faf-cli 8.10.1 → 8.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,176 +1,176 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as oH}from"node:module";var uH=Object.create;var{getPrototypeOf:mH,defineProperty:M7,getOwnPropertyNames:cH}=Object;var pH=Object.prototype.hasOwnProperty;function lH($){return this[$]}var dH,iH,nH=($,Z,z)=>{var Q=$!=null&&typeof $==="object";if(Q){var X=Z?dH??=new WeakMap:iH??=new WeakMap,J=X.get($);if(J)return J}z=$!=null?uH(mH($)):{};let Y=Z||!$||!$.__esModule?M7(z,"default",{value:$,enumerable:!0}):z;for(let U of cH($))if(!pH.call(Y,U))M7(Y,U,{get:lH.bind($,U),enumerable:!0});if(Q)X.set($,Y);return Y};var F=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var rH=($)=>$;function sH($,Z){this[$]=rH.bind(null,Z)}var BX=($,Z)=>{for(var z in Z)M7($,z,{get:Z[z],enumerable:!0,configurable:!0,set:sH.bind(Z,z)})};var h=($,Z)=>()=>($&&(Z=$($=0)),Z);var p0=oH(import.meta.url);var C$=F((aH)=>{class L7 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 MX extends L7{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}aH.CommanderError=L7;aH.InvalidArgumentError=MX});var k8=F((zB)=>{var{InvalidArgumentError:$B}=C$();class LX{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 $B(`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 ZB($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}zB.Argument=LX;zB.humanReadableArgName=ZB});var D7=F((YB)=>{var{humanReadableArgName:JB}=k8();class DX{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)=>JB(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 U=Z.visibleArguments($).map((V)=>{return X(Z.styleArgumentTerm(Z.argumentTerm(V)),Z.styleArgumentDescription(Z.argumentDescription(V)))});if(J=J.concat(this.formatItemList("Arguments:",U,Z)),this.groupItems($.options,Z.visibleOptions($),(V)=>V.helpGroupHeading??"Options:").forEach((V,q)=>{let K=V.map((H)=>{return X(Z.styleOptionTerm(Z.optionTerm(H)),Z.styleOptionDescription(Z.optionDescription(H)))});J=J.concat(this.formatItemList(q,K,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 K=V.map((H)=>{return X(Z.styleSubcommandTerm(Z.subcommandTerm(H)),Z.styleSubcommandDescription(Z.subcommandDescription(H)))});J=J.concat(this.formatItemList(q,K,Z))}),J.join(`
3
- `)}displayWidth($){return OX($).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($)),U=2,G=(this.helpWidth??80)-Z-U-2,V;if(G<this.minWidthToWrap||Q.preformatted(z))V=z;else V=Q.boxWrap(z,G).replace(/\n/g,`
2
+ import{createRequire as YB}from"node:module";var oH=Object.create;var{getPrototypeOf:aH,defineProperty:I7,getOwnPropertyNames:tH}=Object;var eH=Object.prototype.hasOwnProperty;function $B($){return this[$]}var ZB,zB,QB=($,Z,z)=>{var Q=$!=null&&typeof $==="object";if(Q){var X=Z?ZB??=new WeakMap:zB??=new WeakMap,J=X.get($);if(J)return J}z=$!=null?oH(aH($)):{};let Y=Z||!$||!$.__esModule?I7(z,"default",{value:$,enumerable:!0}):z;for(let U of tH($))if(!eH.call(Y,U))I7(Y,U,{get:$B.bind($,U),enumerable:!0});if(Q)X.set($,Y);return Y};var F=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var XB=($)=>$;function JB($,Z){this[$]=XB.bind(null,Z)}var NX=($,Z)=>{for(var z in Z)I7($,z,{get:Z[z],enumerable:!0,configurable:!0,set:JB.bind(Z,z)})};var h=($,Z)=>()=>($&&(Z=$($=0)),Z);var c0=YB(import.meta.url);var j$=F((UB)=>{class T7 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 IX extends T7{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}UB.CommanderError=T7;UB.InvalidArgumentError=IX});var u8=F((KB)=>{var{InvalidArgumentError:VB}=j$();class TX{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 VB(`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 qB($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}KB.Argument=TX;KB.humanReadableArgName=qB});var A7=F((LB)=>{var{humanReadableArgName:MB}=u8();class AX{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)=>MB(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 U=Z.visibleArguments($).map((V)=>{return X(Z.styleArgumentTerm(Z.argumentTerm(V)),Z.styleArgumentDescription(Z.argumentDescription(V)))});if(J=J.concat(this.formatItemList("Arguments:",U,Z)),this.groupItems($.options,Z.visibleOptions($),(V)=>V.helpGroupHeading??"Options:").forEach((V,q)=>{let K=V.map((L)=>{return X(Z.styleOptionTerm(Z.optionTerm(L)),Z.styleOptionDescription(Z.optionDescription(L)))});J=J.concat(this.formatItemList(q,K,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 K=V.map((L)=>{return X(Z.styleSubcommandTerm(Z.subcommandTerm(L)),Z.styleSubcommandDescription(Z.subcommandDescription(L)))});J=J.concat(this.formatItemList(q,K,Z))}),J.join(`
3
+ `)}displayWidth($){return CX($).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($)),U=2,G=(this.helpWidth??80)-Z-U-2,V;if(G<this.minWidthToWrap||Q.preformatted(z))V=z;else V=Q.boxWrap(z,G).replace(/\n/g,`
4
4
  `+" ".repeat(Z+U));return J+Y+" ".repeat(U)+V.replace(/\n/g,`
5
5
  ${J}`)}boxWrap($,Z){if(Z<this.minWidthToWrap)return $;let z=$.split(/\r\n|\n/),Q=/[\s]*[^\s]+/g,X=[];return z.forEach((J)=>{let Y=J.match(Q);if(Y===null){X.push("");return}let U=[Y.shift()],W=this.displayWidth(U[0]);Y.forEach((G)=>{let V=this.displayWidth(G);if(W+V<=Z){U.push(G),W+=V;return}X.push(U.join(""));let q=G.trimStart();U=[q],W=this.displayWidth(q)}),X.push(U.join(""))}),X.join(`
6
- `)}}function OX($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}YB.Help=DX;YB.stripColor=OX});var O7=F((qB)=>{var{InvalidArgumentError:GB}=C$();class IX{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let z=VB($);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 GB(`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 NX(this.name().replace(/^no-/,""));return NX(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class TX{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 NX($){return $.split("-").reduce((Z,z)=>{return Z+z[0].toUpperCase()+z.slice(1)})}function VB($){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],U=`option creation failed due to '${Y}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${U}
6
+ `)}}function CX($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}LB.Help=AX;LB.stripColor=CX});var C7=F((TB)=>{var{InvalidArgumentError:NB}=j$();class PX{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let z=IB($);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 NB(`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 _X(this.name().replace(/^no-/,""));return _X(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class FX{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 _X($){return $.split("-").reduce((Z,z)=>{return Z+z[0].toUpperCase()+z.slice(1)})}function IB($){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],U=`option creation failed due to '${Y}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${U}
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(`${U}
10
10
  - too many short flags`);if(X.test(Y))throw Error(`${U}
11
11
  - too many long flags`);throw Error(`${U}
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}}qB.Option=IX;qB.DualOptions=TX});var AX=F((LB)=>{function BB($,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 MB($,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 U=BB($,Y),W=Math.max($.length,Y.length);if((W-U)/W>J){if(U<X)X=U,Q=[Y];else if(U===X)Q.push(Y)}}),Q.sort((Y,U)=>Y.localeCompare(U)),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}}TB.Option=PX;TB.DualOptions=FX});var RX=F((FB)=>{function _B($,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 PB($,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 U=_B($,Y),W=Math.max($.length,Y.length);if((W-U)/W>J){if(U<X)X=U,Q=[Y];else if(U===X)Q.push(Y)}}),Q.sort((Y,U)=>Y.localeCompare(U)),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""}LB.suggestSimilar=MB});var PX=F((_B)=>{var OB=p0("node:events").EventEmitter,N7=p0("node:child_process"),g2=p0("node:path"),v8=p0("node:fs"),Z0=p0("node:process"),{Argument:NB,humanReadableArgName:IB}=k8(),{CommanderError:I7}=C$(),{Help:TB,stripColor:AB}=D7(),{Option:CX,DualOptions:CB}=O7(),{suggestSimilar:_X}=AX();class A7 extends OB{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)=>Z0.stdout.write(Z),writeErr:(Z)=>Z0.stderr.write(Z),outputError:(Z,z)=>z(Z),getOutHelpWidth:()=>Z0.stdout.isTTY?Z0.stdout.columns:void 0,getErrHelpWidth:()=>Z0.stderr.isTTY?Z0.stderr.columns:void 0,getOutHasColors:()=>T7()??(Z0.stdout.isTTY&&Z0.stdout.hasColors?.()),getErrHasColors:()=>T7()??(Z0.stderr.isTTY&&Z0.stderr.hasColors?.()),stripColor:(Z)=>AB(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(/([^ ]+) *(.*)/),U=this.createCommand(J);if(Q)U.description(Q),U._executableHandler=!0;if(X.isDefault)this._defaultCommandName=U._name;if(U._hidden=!!(X.noHelp||X.hidden),U._executableFile=X.executableFile||null,Y)U.arguments(Y);if(this._registerCommand(U),U.parent=this,U.copyInheritedSettings(this),Q)return this;return U}createCommand($){return new A7($)}createHelp(){return Object.assign(new TB,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 NB($,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 I7($,Z,z));Z0.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 CX($,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 U=this.getOptionValue(z);if(X!==null&&$.parseArg)X=this._callParseArg($,X,U,J);else if(X!==null&&$.variadic)X=$._collectValue(X,U);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 CX)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=(U,W)=>{let G=Y.exec(U);return G?G[0]:W},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(Z0.versions?.electron)Z.from="electron";let Q=Z0.execArgv??[];if(Q.includes("-e")||Q.includes("--eval")||Q.includes("-p")||Q.includes("--print"))Z.from="eval"}if($===void 0)$=Z0.argv;this.rawArgs=$.slice();let z;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],z=$.slice(2);break;case"electron":if(Z0.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(v8.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""}FB.suggestSimilar=PB});var wX=F((bB)=>{var jB=c0("node:events").EventEmitter,_7=c0("node:child_process"),f2=c0("node:path"),m8=c0("node:fs"),Z0=c0("node:process"),{Argument:SB,humanReadableArgName:EB}=u8(),{CommanderError:P7}=j$(),{Help:wB,stripColor:xB}=A7(),{Option:jX,DualOptions:yB}=C7(),{suggestSimilar:SX}=RX();class R7 extends jB{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)=>Z0.stdout.write(Z),writeErr:(Z)=>Z0.stderr.write(Z),outputError:(Z,z)=>z(Z),getOutHelpWidth:()=>Z0.stdout.isTTY?Z0.stdout.columns:void 0,getErrHelpWidth:()=>Z0.stderr.isTTY?Z0.stderr.columns:void 0,getOutHasColors:()=>F7()??(Z0.stdout.isTTY&&Z0.stdout.hasColors?.()),getErrHasColors:()=>F7()??(Z0.stderr.isTTY&&Z0.stderr.hasColors?.()),stripColor:(Z)=>xB(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(/([^ ]+) *(.*)/),U=this.createCommand(J);if(Q)U.description(Q),U._executableHandler=!0;if(X.isDefault)this._defaultCommandName=U._name;if(U._hidden=!!(X.noHelp||X.hidden),U._executableFile=X.executableFile||null,Y)U.arguments(Y);if(this._registerCommand(U),U.parent=this,U.copyInheritedSettings(this),Q)return this;return U}createCommand($){return new R7($)}createHelp(){return Object.assign(new wB,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 SB($,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 P7($,Z,z));Z0.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 jX($,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 U=this.getOptionValue(z);if(X!==null&&$.parseArg)X=this._callParseArg($,X,U,J);else if(X!==null&&$.variadic)X=$._collectValue(X,U);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 jX)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=(U,W)=>{let G=Y.exec(U);return G?G[0]:W},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(Z0.versions?.electron)Z.from="electron";let Q=Z0.execArgv??[];if(Q.includes("-e")||Q.includes("--eval")||Q.includes("-p")||Q.includes("--print"))Z.from="eval"}if($===void 0)$=Z0.argv;this.rawArgs=$.slice();let z;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],z=$.slice(2);break;case"electron":if(Z0.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(m8.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=g2.resolve(G,V);if(v8.existsSync(q))return q;if(Q.includes(g2.extname(V)))return;let K=Q.find((H)=>v8.existsSync(`${q}${H}`));if(K)return`${q}${K}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let G;try{G=v8.realpathSync(this._scriptPath)}catch{G=this._scriptPath}Y=g2.resolve(g2.dirname(G),Y)}if(Y){let G=X(Y,J);if(!G&&!$._executableFile&&this._scriptPath){let V=g2.basename(this._scriptPath,g2.extname(this._scriptPath));if(V!==this._name)G=X(Y,`${V}-${$._name}`)}J=G||J}z=Q.includes(g2.extname(J));let U;if(Z0.platform!=="win32")if(z)Z.unshift(J),Z=RX(Z0.execArgv).concat(Z),U=N7.spawn(Z0.argv[0],Z,{stdio:"inherit"});else U=N7.spawn(J,Z,{stdio:"inherit"});else this._checkForMissingExecutable(J,Y,$._name),Z.unshift(J),Z=RX(Z0.execArgv).concat(Z),U=N7.spawn(Z0.execPath,Z,{stdio:"inherit"});if(!U.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((V)=>{Z0.on(V,()=>{if(U.killed===!1&&U.exitCode===null)U.kill(V)})});let W=this._exitCallback;U.on("close",(G)=>{if(G=G??1,!W)Z0.exit(G);else W(new I7(G,"commander.executeSubCommandAsync","(close)"))}),U.on("error",(G)=>{if(G.code==="ENOENT")this._checkForMissingExecutable(J,Y,$._name);else if(G.code==="EACCES")throw Error(`'${J}' not executable`);if(!W)Z0.exit(1);else{let V=new I7(1,"commander.executeSubCommandAsync","(error)");V.nestedError=G,W(V)}}),this.runningCommand=U}_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,U=null,W=0;while(W<$.length||U){let G=U??$[W++];if(U=null,G==="--"){if(Q===z)Q.push(G);Q.push(...$.slice(W));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=$[W++];if(q===void 0)this.optionMissingArgument(V);this.emit(`option:${V.name()}`,q)}else if(V.optional){let q=null;if(W<$.length&&(!X($[W])||J($[W])))q=$[W++];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()}`),U=`-${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(W));break}else if(this._getHelpCommand()&&G===this._getHelpCommand().name()){Z.push(G,...$.slice(W));break}else if(this._defaultCommandName){z.push(G,...$.slice(W));break}}if(this._passThroughOptions){Q.push(G,...$.slice(W));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 q=f2.resolve(G,V);if(m8.existsSync(q))return q;if(Q.includes(f2.extname(V)))return;let K=Q.find((L)=>m8.existsSync(`${q}${L}`));if(K)return`${q}${K}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let G;try{G=m8.realpathSync(this._scriptPath)}catch{G=this._scriptPath}Y=f2.resolve(f2.dirname(G),Y)}if(Y){let G=X(Y,J);if(!G&&!$._executableFile&&this._scriptPath){let V=f2.basename(this._scriptPath,f2.extname(this._scriptPath));if(V!==this._name)G=X(Y,`${V}-${$._name}`)}J=G||J}z=Q.includes(f2.extname(J));let U;if(Z0.platform!=="win32")if(z)Z.unshift(J),Z=EX(Z0.execArgv).concat(Z),U=_7.spawn(Z0.argv[0],Z,{stdio:"inherit"});else U=_7.spawn(J,Z,{stdio:"inherit"});else this._checkForMissingExecutable(J,Y,$._name),Z.unshift(J),Z=EX(Z0.execArgv).concat(Z),U=_7.spawn(Z0.execPath,Z,{stdio:"inherit"});if(!U.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((V)=>{Z0.on(V,()=>{if(U.killed===!1&&U.exitCode===null)U.kill(V)})});let W=this._exitCallback;U.on("close",(G)=>{if(G=G??1,!W)Z0.exit(G);else W(new P7(G,"commander.executeSubCommandAsync","(close)"))}),U.on("error",(G)=>{if(G.code==="ENOENT")this._checkForMissingExecutable(J,Y,$._name);else if(G.code==="EACCES")throw Error(`'${J}' not executable`);if(!W)Z0.exit(1);else{let V=new P7(1,"commander.executeSubCommandAsync","(error)");V.nestedError=G,W(V)}}),this.runningCommand=U}_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,U=null,W=0;while(W<$.length||U){let G=U??$[W++];if(U=null,G==="--"){if(Q===z)Q.push(G);Q.push(...$.slice(W));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=$[W++];if(q===void 0)this.optionMissingArgument(V);this.emit(`option:${V.name()}`,q)}else if(V.optional){let q=null;if(W<$.length&&(!X($[W])||J($[W])))q=$[W++];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()}`),U=`-${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(W));break}else if(this._getHelpCommand()&&G===this._getHelpCommand().name()){Z.push(G,...$.slice(W));break}else if(this._defaultCommandName){z.push(G,...$.slice(W));break}}if(this._passThroughOptions){Q.push(G,...$.slice(W));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 Z0.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,Z0.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new CB(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(),U=this.getOptionValue(Y),W=this.options.find((V)=>V.negate&&Y===V.attributeName()),G=this.options.find((V)=>!V.negate&&Y===V.attributeName());if(W&&(W.presetArg===void 0&&U===!1||W.presetArg!==void 0&&U===W.presetArg))return W;return G||J},Q=(J)=>{let Y=z(J),U=Y.attributeName();if(this.getOptionValueSource(U)==="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=_X($,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=_X($,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 IB(z)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?Z:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}helpGroup($){if($===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=$,this}commandsGroup($){if($===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=$,this}optionsGroup($){if($===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=$,this}_initOptionGroup($){if(this._defaultOptionGroup&&!$.helpGroupHeading)$.helpGroup(this._defaultOptionGroup)}_initCommandGroup($){if(this._defaultCommandGroup&&!$.helpGroup())$.helpGroup(this._defaultCommandGroup)}nameFromFilename($){return this._name=g2.basename($,g2.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let Z=this.createHelp(),z=this._getOutputContext($);Z.prepareContext({error:z.error,helpWidth:z.helpWidth,outputHasColors:z.hasColors});let Q=Z.formatHelp(this,Z);if(z.hasColors)return Q;return this._outputConfiguration.stripColor(Q)}_getOutputContext($){$=$||{};let Z=!!$.error,z,Q,X;if(Z)z=(Y)=>this._outputConfiguration.writeErr(Y),Q=this._outputConfiguration.getErrHasColors(),X=this._outputConfiguration.getErrHelpWidth();else z=(Y)=>this._outputConfiguration.writeOut(Y),Q=this._outputConfiguration.getOutHasColors(),X=this._outputConfiguration.getOutHelpWidth();return{error:Z,write:(Y)=>{if(!Q)Y=this._outputConfiguration.stripColor(Y);return z(Y)},hasColors:Q,helpWidth:X}}outputHelp($){let Z;if(typeof $==="function")Z=$,$=void 0;let z=this._getOutputContext($),Q={error:z.error,write:z.write,command:this};this._getCommandAndAncestors().reverse().forEach((J)=>J.emit("beforeAllHelp",Q)),this.emit("beforeHelp",Q);let X=this.helpInformation({error:z.error});if(Z){if(X=Z(X),typeof X!=="string"&&!Buffer.isBuffer(X))throw Error("outputHelp callback must return a string or a Buffer")}if(z.write(X),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",Q),this._getCommandAndAncestors().forEach((J)=>J.emit("afterAllHelp",Q))}helpOption($,Z){if(typeof $==="boolean"){if($){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption($??"-h, --help",Z??"display help for command"),$||Z)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let Z=Number(Z0.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 Z0.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,Z0.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new yB(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(),U=this.getOptionValue(Y),W=this.options.find((V)=>V.negate&&Y===V.attributeName()),G=this.options.find((V)=>!V.negate&&Y===V.attributeName());if(W&&(W.presetArg===void 0&&U===!1||W.presetArg!==void 0&&U===W.presetArg))return W;return G||J},Q=(J)=>{let Y=z(J),U=Y.attributeName();if(this.getOptionValueSource(U)==="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=SX($,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=SX($,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 EB(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=f2.basename($,f2.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(Z0.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 RX($){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 T7(){if(Z0.env.NO_COLOR||Z0.env.FORCE_COLOR==="0"||Z0.env.FORCE_COLOR==="false")return!1;if(Z0.env.FORCE_COLOR||Z0.env.CLICOLOR_FORCE!==void 0)return!0;return}_B.Command=A7;_B.useColor=T7});var EX=F((SB)=>{var{Argument:FX}=k8(),{Command:C7}=PX(),{CommanderError:FB,InvalidArgumentError:jX}=C$(),{Help:jB}=D7(),{Option:SX}=O7();SB.program=new C7;SB.createCommand=($)=>new C7($);SB.createOption=($,Z)=>new SX($,Z);SB.createArgument=($,Z)=>new FX($,Z);SB.Command=C7;SB.Option=SX;SB.Argument=FX;SB.Help=jB;SB.CommanderError=FB;SB.InvalidArgumentError=jX;SB.InvalidOptionArgumentError=jX});var e=F((rB)=>{var R7=Symbol.for("yaml.alias"),yX=Symbol.for("yaml.document"),g8=Symbol.for("yaml.map"),bX=Symbol.for("yaml.pair"),P7=Symbol.for("yaml.scalar"),h8=Symbol.for("yaml.seq"),h2=Symbol.for("yaml.node.type"),mB=($)=>!!$&&typeof $==="object"&&$[h2]===R7,cB=($)=>!!$&&typeof $==="object"&&$[h2]===yX,pB=($)=>!!$&&typeof $==="object"&&$[h2]===g8,lB=($)=>!!$&&typeof $==="object"&&$[h2]===bX,kX=($)=>!!$&&typeof $==="object"&&$[h2]===P7,dB=($)=>!!$&&typeof $==="object"&&$[h2]===h8;function vX($){if($&&typeof $==="object")switch($[h2]){case g8:case h8:return!0}return!1}function iB($){if($&&typeof $==="object")switch($[h2]){case R7:case g8:case P7:case h8:return!0}return!1}var nB=($)=>(kX($)||vX($))&&!!$.anchor;rB.ALIAS=R7;rB.DOC=yX;rB.MAP=g8;rB.NODE_TYPE=h2;rB.PAIR=bX;rB.SCALAR=P7;rB.SEQ=h8;rB.hasAnchor=nB;rB.isAlias=mB;rB.isCollection=vX;rB.isDocument=cB;rB.isMap=pB;rB.isNode=iB;rB.isPair=lB;rB.isScalar=kX;rB.isSeq=dB});var _$=F((qM)=>{var T0=e(),l0=Symbol("break visit"),gX=Symbol("skip children"),S2=Symbol("remove node");function f8($,Z){let z=hX(Z);if(T0.isDocument($)){if(D1(null,$.contents,z,Object.freeze([$]))===S2)$.contents=null}else D1(null,$,z,Object.freeze([]))}f8.BREAK=l0;f8.SKIP=gX;f8.REMOVE=S2;function D1($,Z,z,Q){let X=fX($,Z,z,Q);if(T0.isNode(X)||T0.isPair(X))return uX($,Q,X),D1($,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=D1(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===l0)return l0;else if(Y===S2)Z.items.splice(J,1),J-=1}}else if(T0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=D1("key",Z.key,z,Q);if(J===l0)return l0;else if(J===S2)Z.key=null;let Y=D1("value",Z.value,z,Q);if(Y===l0)return l0;else if(Y===S2)Z.value=null}}return X}async function u8($,Z){let z=hX(Z);if(T0.isDocument($)){if(await O1(null,$.contents,z,Object.freeze([$]))===S2)$.contents=null}else await O1(null,$,z,Object.freeze([]))}u8.BREAK=l0;u8.SKIP=gX;u8.REMOVE=S2;async function O1($,Z,z,Q){let X=await fX($,Z,z,Q);if(T0.isNode(X)||T0.isPair(X))return uX($,Q,X),O1($,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 O1(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===l0)return l0;else if(Y===S2)Z.items.splice(J,1),J-=1}}else if(T0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=await O1("key",Z.key,z,Q);if(J===l0)return l0;else if(J===S2)Z.key=null;let Y=await O1("value",Z.value,z,Q);if(Y===l0)return l0;else if(Y===S2)Z.value=null}}return X}function hX($){if(typeof $==="object"&&($.Collection||$.Node||$.Value))return Object.assign({Alias:$.Node,Map:$.Node,Scalar:$.Node,Seq:$.Node},$.Value&&{Map:$.Value,Scalar:$.Value,Seq:$.Value},$.Collection&&{Map:$.Collection,Seq:$.Collection},$);return $}function fX($,Z,z,Q){if(typeof z==="function")return z($,Z,Q);if(T0.isMap(Z))return z.Map?.($,Z,Q);if(T0.isSeq(Z))return z.Seq?.($,Z,Q);if(T0.isPair(Z))return z.Pair?.($,Z,Q);if(T0.isScalar(Z))return z.Scalar?.($,Z,Q);if(T0.isAlias(Z))return z.Alias?.($,Z,Q);return}function uX($,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`)}}qM.visit=f8;qM.visitAsync=u8});var F7=F((DM)=>{var mX=e(),BM=_$(),MM={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},LM=($)=>$.replace(/[!,[\]{}]/g,(Z)=>MM[Z]);class X2{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},X2.defaultYaml,$),this.tags=Object.assign({},X2.defaultTags,Z)}clone(){let $=new X2(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new X2(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:X2.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},X2.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:X2.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},X2.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+LM($.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&&mX.isNode($.contents)){let X={};BM.visit($.contents,(J,Y)=>{if(mX.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
- `)}}X2.defaultYaml={explicit:!1,version:"1.2"};X2.defaultTags={"!!":"tag:yaml.org,2002:"};DM.Directives=X2});var m8=F((AM)=>{var cX=e(),NM=_$();function IM($){if(/[\x00-\x19\s,[\]{}]/.test($)){let z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(z)}return!0}function pX($){let Z=new Set;return NM.visit($,{Value(z,Q){if(Q.anchor)Z.add(Q.anchor)}}),Z}function lX($,Z){for(let z=1;;++z){let Q=`${$}${z}`;if(!Z.has(Q))return Q}}function TM($,Z){let z=[],Q=new Map,X=null;return{onAnchor:(J)=>{z.push(J),X??(X=pX($));let Y=lX(Z,X);return X.add(Y),Y},setAnchors:()=>{for(let J of z){let Y=Q.get(J);if(typeof Y==="object"&&Y.anchor&&(cX.isScalar(Y.node)||cX.isCollection(Y.node)))Y.node.anchor=Y.anchor;else{let U=Error("Failed to resolve repeated object (this should not happen)");throw U.source=J,U}}},sourceObjects:Q}}AM.anchorIsValid=IM;AM.anchorNames=pX;AM.createNodeAnchors=TM;AM.findNewAnchor=lX});var j7=F((FM)=>{function R$($,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],U=R$($,Q,String(X),Y);if(U===void 0)delete Q[X];else if(U!==Y)Q[X]=U}else if(Q instanceof Map)for(let X of Array.from(Q.keys())){let J=Q.get(X),Y=R$($,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=R$($,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=R$($,Q,X,J);if(Y===void 0)delete Q[X];else if(Y!==J)Q[X]=Y}return $.call(Z,z,Q)}FM.applyReviver=R$});var z6=F((EM)=>{var SM=e();function dX($,Z,z){if(Array.isArray($))return $.map((Q,X)=>dX(Q,String(X),z));if($&&typeof $.toJSON==="function"){if(!z||!SM.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 $}EM.toJS=dX});var c8=F((bM)=>{var xM=j7(),iX=e(),yM=z6();class nX{constructor($){Object.defineProperty(this,iX.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(!iX.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=yM.toJS(this,"",J);if(typeof Q==="function")for(let{count:U,res:W}of J.anchors.values())Q(W,U);return typeof X==="function"?xM.applyReviver(X,{"":Y},"",Y):Y}}bM.NodeBase=nX});var P$=F((uM)=>{var vM=m8(),gM=_$(),N1=e(),hM=c8(),fM=z6();class rX extends hM.NodeBase{constructor($){super(N1.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=[],gM.visit($,{Node:(X,J)=>{if(N1.isAlias(J)||N1.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 U=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(U)}let Y=z.get(J);if(!Y)fM.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=p8(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(vM.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 p8($,Z,z){if(N1.isAlias(Z)){let Q=Z.resolve($),X=z&&Q&&z.get(Q);return X?X.count*X.aliasCount:0}else if(N1.isCollection(Z)){let Q=0;for(let X of Z.items){let J=p8($,X,z);if(J>Q)Q=J}return Q}else if(N1.isPair(Z)){let Q=p8($,Z.key,z),X=p8($,Z.value,z);return Math.max(Q,X)}return 1}uM.Alias=rX});var L0=F((iM)=>{var cM=e(),pM=c8(),lM=z6(),dM=($)=>!$||typeof $!=="function"&&typeof $!=="object";class x6 extends pM.NodeBase{constructor($){super(cM.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:lM.toJS(this.value,$,Z)}toString(){return String(this.value)}}x6.BLOCK_FOLDED="BLOCK_FOLDED";x6.BLOCK_LITERAL="BLOCK_LITERAL";x6.PLAIN="PLAIN";x6.QUOTE_DOUBLE="QUOTE_DOUBLE";x6.QUOTE_SINGLE="QUOTE_SINGLE";iM.Scalar=x6;iM.isScalarValue=dM});var F$=F((eM)=>{var sM=P$(),y6=e(),sX=L0(),oM="tag:yaml.org,2002:";function aM($,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 tM($,Z,z){if(y6.isDocument($))$=$.contents;if(y6.isNode($))return $;if(y6.isPair($)){let q=z.schema[y6.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:U}=z,W=void 0;if(Q&&$&&typeof $==="object")if(W=U.get($),W)return W.anchor??(W.anchor=X($)),new sM.Alias(W.anchor);else W={anchor:null,node:null},U.set($,W);if(Z?.startsWith("!!"))Z=oM+Z.slice(2);let G=aM($,Z,Y.tags);if(!G){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let q=new sX.Scalar($);if(W)W.node=q;return q}G=$ instanceof Map?Y[y6.MAP]:(Symbol.iterator in Object($))?Y[y6.SEQ]:Y[y6.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 sX.Scalar($);if(Z)V.tag=Z;else if(!G.default)V.tag=G.tag;if(W)W.node=V;return V}eM.createNode=tM});var l8=F((QL)=>{var ZL=F$(),E2=e(),zL=c8();function S7($,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 ZL.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var oX=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class aX extends zL.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(oX($))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,S7(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,S7(this.schema,Q,Z));else throw Error(`Expected YAML collection at ${z}. Remaining path: ${Q}`)}}}QL.Collection=aX;QL.collectionFromPath=S7;QL.isEmptyPath=oX});var j$=F((GL)=>{var UL=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function E7($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var WL=($,Z,z)=>$.endsWith(`
29
- `)?E7(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 EX($){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 F7(){if(Z0.env.NO_COLOR||Z0.env.FORCE_COLOR==="0"||Z0.env.FORCE_COLOR==="false")return!1;if(Z0.env.FORCE_COLOR||Z0.env.CLICOLOR_FORCE!==void 0)return!0;return}bB.Command=R7;bB.useColor=F7});var kX=F((fB)=>{var{Argument:xX}=u8(),{Command:j7}=wX(),{CommanderError:gB,InvalidArgumentError:yX}=j$(),{Help:hB}=A7(),{Option:bX}=C7();fB.program=new j7;fB.createCommand=($)=>new j7($);fB.createOption=($,Z)=>new bX($,Z);fB.createArgument=($,Z)=>new xX($,Z);fB.Command=j7;fB.Option=bX;fB.Argument=xX;fB.Help=hB;fB.CommanderError=gB;fB.InvalidArgumentError=yX;fB.InvalidOptionArgumentError=yX});var t=F((XM)=>{var E7=Symbol.for("yaml.alias"),hX=Symbol.for("yaml.document"),c8=Symbol.for("yaml.map"),fX=Symbol.for("yaml.pair"),w7=Symbol.for("yaml.scalar"),p8=Symbol.for("yaml.seq"),u2=Symbol.for("yaml.node.type"),aB=($)=>!!$&&typeof $==="object"&&$[u2]===E7,tB=($)=>!!$&&typeof $==="object"&&$[u2]===hX,eB=($)=>!!$&&typeof $==="object"&&$[u2]===c8,$M=($)=>!!$&&typeof $==="object"&&$[u2]===fX,uX=($)=>!!$&&typeof $==="object"&&$[u2]===w7,ZM=($)=>!!$&&typeof $==="object"&&$[u2]===p8;function mX($){if($&&typeof $==="object")switch($[u2]){case c8:case p8:return!0}return!1}function zM($){if($&&typeof $==="object")switch($[u2]){case E7:case c8:case w7:case p8:return!0}return!1}var QM=($)=>(uX($)||mX($))&&!!$.anchor;XM.ALIAS=E7;XM.DOC=hX;XM.MAP=c8;XM.NODE_TYPE=u2;XM.PAIR=fX;XM.SCALAR=w7;XM.SEQ=p8;XM.hasAnchor=QM;XM.isAlias=aB;XM.isCollection=mX;XM.isDocument=tB;XM.isMap=eB;XM.isNode=zM;XM.isPair=$M;XM.isScalar=uX;XM.isSeq=ZM});var S$=F((TM)=>{var O0=t(),p0=Symbol("break visit"),cX=Symbol("skip children"),E2=Symbol("remove node");function l8($,Z){let z=pX(Z);if(O0.isDocument($)){if(I1(null,$.contents,z,Object.freeze([$]))===E2)$.contents=null}else I1(null,$,z,Object.freeze([]))}l8.BREAK=p0;l8.SKIP=cX;l8.REMOVE=E2;function I1($,Z,z,Q){let X=lX($,Z,z,Q);if(O0.isNode(X)||O0.isPair(X))return dX($,Q,X),I1($,X,z,Q);if(typeof X!=="symbol"){if(O0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=I1(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===p0)return p0;else if(Y===E2)Z.items.splice(J,1),J-=1}}else if(O0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=I1("key",Z.key,z,Q);if(J===p0)return p0;else if(J===E2)Z.key=null;let Y=I1("value",Z.value,z,Q);if(Y===p0)return p0;else if(Y===E2)Z.value=null}}return X}async function d8($,Z){let z=pX(Z);if(O0.isDocument($)){if(await T1(null,$.contents,z,Object.freeze([$]))===E2)$.contents=null}else await T1(null,$,z,Object.freeze([]))}d8.BREAK=p0;d8.SKIP=cX;d8.REMOVE=E2;async function T1($,Z,z,Q){let X=await lX($,Z,z,Q);if(O0.isNode(X)||O0.isPair(X))return dX($,Q,X),T1($,X,z,Q);if(typeof X!=="symbol"){if(O0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=await T1(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===p0)return p0;else if(Y===E2)Z.items.splice(J,1),J-=1}}else if(O0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=await T1("key",Z.key,z,Q);if(J===p0)return p0;else if(J===E2)Z.key=null;let Y=await T1("value",Z.value,z,Q);if(Y===p0)return p0;else if(Y===E2)Z.value=null}}return X}function pX($){if(typeof $==="object"&&($.Collection||$.Node||$.Value))return Object.assign({Alias:$.Node,Map:$.Node,Scalar:$.Node,Seq:$.Node},$.Value&&{Map:$.Value,Scalar:$.Value,Seq:$.Value},$.Collection&&{Map:$.Collection,Seq:$.Collection},$);return $}function lX($,Z,z,Q){if(typeof z==="function")return z($,Z,Q);if(O0.isMap(Z))return z.Map?.($,Z,Q);if(O0.isSeq(Z))return z.Seq?.($,Z,Q);if(O0.isPair(Z))return z.Pair?.($,Z,Q);if(O0.isScalar(Z))return z.Scalar?.($,Z,Q);if(O0.isAlias(Z))return z.Alias?.($,Z,Q);return}function dX($,Z,z){let Q=Z[Z.length-1];if(O0.isCollection(Q))Q.items[$]=z;else if(O0.isPair(Q))if($==="key")Q.key=z;else Q.value=z;else if(O0.isDocument(Q))Q.contents=z;else{let X=O0.isAlias(Q)?"alias":"scalar";throw Error(`Cannot replace node with ${X} parent`)}}TM.visit=l8;TM.visitAsync=d8});var x7=F((RM)=>{var iX=t(),_M=S$(),PM={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},FM=($)=>$.replace(/[!,[\]{}]/g,(Z)=>PM[Z]);class X2{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},X2.defaultYaml,$),this.tags=Object.assign({},X2.defaultTags,Z)}clone(){let $=new X2(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new X2(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:X2.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},X2.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:X2.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},X2.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+FM($.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&&iX.isNode($.contents)){let X={};_M.visit($.contents,(J,Y)=>{if(iX.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
+ `)}}X2.defaultYaml={explicit:!1,version:"1.2"};X2.defaultTags={"!!":"tag:yaml.org,2002:"};RM.Directives=X2});var i8=F((xM)=>{var nX=t(),SM=S$();function EM($){if(/[\x00-\x19\s,[\]{}]/.test($)){let z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(z)}return!0}function rX($){let Z=new Set;return SM.visit($,{Value(z,Q){if(Q.anchor)Z.add(Q.anchor)}}),Z}function sX($,Z){for(let z=1;;++z){let Q=`${$}${z}`;if(!Z.has(Q))return Q}}function wM($,Z){let z=[],Q=new Map,X=null;return{onAnchor:(J)=>{z.push(J),X??(X=rX($));let Y=sX(Z,X);return X.add(Y),Y},setAnchors:()=>{for(let J of z){let Y=Q.get(J);if(typeof Y==="object"&&Y.anchor&&(nX.isScalar(Y.node)||nX.isCollection(Y.node)))Y.node.anchor=Y.anchor;else{let U=Error("Failed to resolve repeated object (this should not happen)");throw U.source=J,U}}},sourceObjects:Q}}xM.anchorIsValid=EM;xM.anchorNames=rX;xM.createNodeAnchors=wM;xM.findNewAnchor=sX});var y7=F((gM)=>{function E$($,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],U=E$($,Q,String(X),Y);if(U===void 0)delete Q[X];else if(U!==Y)Q[X]=U}else if(Q instanceof Map)for(let X of Array.from(Q.keys())){let J=Q.get(X),Y=E$($,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=E$($,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=E$($,Q,X,J);if(Y===void 0)delete Q[X];else if(Y!==J)Q[X]=Y}return $.call(Z,z,Q)}gM.applyReviver=E$});var Y6=F((uM)=>{var fM=t();function oX($,Z,z){if(Array.isArray($))return $.map((Q,X)=>oX(Q,String(X),z));if($&&typeof $.toJSON==="function"){if(!z||!fM.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 $}uM.toJS=oX});var n8=F((lM)=>{var cM=y7(),aX=t(),pM=Y6();class tX{constructor($){Object.defineProperty(this,aX.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(!aX.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=pM.toJS(this,"",J);if(typeof Q==="function")for(let{count:U,res:W}of J.anchors.values())Q(W,U);return typeof X==="function"?cM.applyReviver(X,{"":Y},"",Y):Y}}lM.NodeBase=tX});var w$=F((oM)=>{var iM=i8(),nM=S$(),A1=t(),rM=n8(),sM=Y6();class eX extends rM.NodeBase{constructor($){super(A1.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=[],nM.visit($,{Node:(X,J)=>{if(A1.isAlias(J)||A1.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 U=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(U)}let Y=z.get(J);if(!Y)sM.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=r8(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(iM.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 r8($,Z,z){if(A1.isAlias(Z)){let Q=Z.resolve($),X=z&&Q&&z.get(Q);return X?X.count*X.aliasCount:0}else if(A1.isCollection(Z)){let Q=0;for(let X of Z.items){let J=r8($,X,z);if(J>Q)Q=J}return Q}else if(A1.isPair(Z)){let Q=r8($,Z.key,z),X=r8($,Z.value,z);return Math.max(Q,X)}return 1}oM.Alias=eX});var B0=F((zL)=>{var tM=t(),eM=n8(),$L=Y6(),ZL=($)=>!$||typeof $!=="function"&&typeof $!=="object";class v6 extends eM.NodeBase{constructor($){super(tM.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:$L.toJS(this.value,$,Z)}toString(){return String(this.value)}}v6.BLOCK_FOLDED="BLOCK_FOLDED";v6.BLOCK_LITERAL="BLOCK_LITERAL";v6.PLAIN="PLAIN";v6.QUOTE_DOUBLE="QUOTE_DOUBLE";v6.QUOTE_SINGLE="QUOTE_SINGLE";zL.Scalar=v6;zL.isScalarValue=ZL});var x$=F((GL)=>{var JL=w$(),g6=t(),$J=B0(),YL="tag:yaml.org,2002:";function UL($,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 WL($,Z,z){if(g6.isDocument($))$=$.contents;if(g6.isNode($))return $;if(g6.isPair($)){let q=z.schema[g6.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:U}=z,W=void 0;if(Q&&$&&typeof $==="object")if(W=U.get($),W)return W.anchor??(W.anchor=X($)),new JL.Alias(W.anchor);else W={anchor:null,node:null},U.set($,W);if(Z?.startsWith("!!"))Z=YL+Z.slice(2);let G=UL($,Z,Y.tags);if(!G){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let q=new $J.Scalar($);if(W)W.node=q;return q}G=$ instanceof Map?Y[g6.MAP]:(Symbol.iterator in Object($))?Y[g6.SEQ]:Y[g6.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 $J.Scalar($);if(Z)V.tag=Z;else if(!G.default)V.tag=G.tag;if(W)W.node=V;return V}GL.createNode=WL});var s8=F((HL)=>{var qL=x$(),w2=t(),KL=n8();function b7($,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 qL.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var ZJ=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class zJ extends KL.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)=>w2.isNode(z)||w2.isPair(z)?z.clone($):z),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(ZJ($))this.add(Z);else{let[z,...Q]=$,X=this.get(z,!0);if(w2.isCollection(X))X.addIn(Q,Z);else if(X===void 0&&this.schema)this.set(z,b7(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(w2.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&&w2.isScalar(X)?X.value:X;else return w2.isCollection(X)?X.getIn(Q,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!w2.isPair(Z))return!1;let z=Z.value;return z==null||$&&w2.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 w2.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(w2.isCollection(X))X.setIn(Q,Z);else if(X===void 0&&this.schema)this.set(z,b7(this.schema,Q,Z));else throw Error(`Expected YAML collection at ${z}. Remaining path: ${Q}`)}}}HL.Collection=zJ;HL.collectionFromPath=b7;HL.isEmptyPath=ZJ});var y$=F((NL)=>{var DL=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function k7($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var OL=($,Z,z)=>$.endsWith(`
29
+ `)?k7(z,Z):z.includes(`
30
30
  `)?`
31
- `+E7(z,Z):($.endsWith(" ")?"":" ")+z;GL.indentComment=E7;GL.lineComment=WL;GL.stringifyComment=UL});var eX=F((BL)=>{function HL($,Z,z="flow",{indentAtStart:Q,lineWidth:X=80,minContentWidth:J=20,onFold:Y,onOverflow:U}={}){if(!X||X<0)return $;if(X<J)J=0;let W=Math.max(1+J,1+X-Z.length);if($.length<=W)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 K=void 0,H=void 0,L=!1,B=-1,D=-1,N=-1;if(z==="block"){if(B=tX($,B,Z.length),B!==-1)q=B+W}for(let E;E=$[B+=1];){if(z==="quoted"&&E==="\\"){switch(D=B,$[B+1]){case"x":B+=3;break;case"u":B+=5;break;case"U":B+=9;break;default:B+=1}N=B}if(E===`
32
- `){if(z==="block")B=tX($,B,Z.length);q=B+Z.length+W,K=void 0}else{if(E===" "&&H&&H!==" "&&H!==`
33
- `&&H!=="\t"){let P=$[B+1];if(P&&P!==" "&&P!==`
34
- `&&P!=="\t")K=B}if(B>=q)if(K)G.push(K),q=K+W,K=void 0;else if(z==="quoted"){while(H===" "||H==="\t")H=E,E=$[B+=1],L=!0;let P=B>N+1?B-2:D-1;if(V[P])return $;G.push(P),V[P]=!0,q=P+W,K=void 0}else L=!0}H=E}if(L&&U)U();if(G.length===0)return $;if(Y)Y();let _=$.slice(0,G[0]);for(let E=0;E<G.length;++E){let P=G[E],y=G[E+1]||$.length;if(P===0)_=`
35
- ${Z}${$.slice(0,y)}`;else{if(z==="quoted"&&V[P])_+=`${$[P]}\\`;_+=`
36
- ${Z}${$.slice(P+1,y)}`}}return _}function tX($,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}BL.FOLD_BLOCK="block";BL.FOLD_FLOW="flow";BL.FOLD_QUOTED="quoted";BL.foldFlowLines=HL});var E$=F((AL)=>{var D2=L0(),Q6=eX(),i8=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),n8=($)=>/^(%|---|\.\.\.)/m.test($);function NL($,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 S$($,Z){let z=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return z;let{implicitKey:Q}=Z,X=Z.options.doubleQuotedMinMultiLineLength,J=Z.indent||(n8($)?" ":""),Y="",U=0;for(let W=0,G=z[W];G;G=z[++W]){if(G===" "&&z[W+1]==="\\"&&z[W+2]==="n")Y+=z.slice(U,W)+"\\ ",W+=1,U=W,G="\\";if(G==="\\")switch(z[W+1]){case"u":{Y+=z.slice(U,W);let V=z.substr(W+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(W,6)}W+=5,U=W+1}break;case"n":if(Q||z[W+2]==='"'||z.length<X)W+=1;else{Y+=z.slice(U,W)+`
31
+ `+k7(z,Z):($.endsWith(" ")?"":" ")+z;NL.indentComment=k7;NL.lineComment=OL;NL.stringifyComment=DL});var XJ=F((_L)=>{function CL($,Z,z="flow",{indentAtStart:Q,lineWidth:X=80,minContentWidth:J=20,onFold:Y,onOverflow:U}={}){if(!X||X<0)return $;if(X<J)J=0;let W=Math.max(1+J,1+X-Z.length);if($.length<=W)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 K=void 0,L=void 0,B=!1,H=-1,D=-1,N=-1;if(z==="block"){if(H=QJ($,H,Z.length),H!==-1)q=H+W}for(let E;E=$[H+=1];){if(z==="quoted"&&E==="\\"){switch(D=H,$[H+1]){case"x":H+=3;break;case"u":H+=5;break;case"U":H+=9;break;default:H+=1}N=H}if(E===`
32
+ `){if(z==="block")H=QJ($,H,Z.length);q=H+Z.length+W,K=void 0}else{if(E===" "&&L&&L!==" "&&L!==`
33
+ `&&L!=="\t"){let j=$[H+1];if(j&&j!==" "&&j!==`
34
+ `&&j!=="\t")K=H}if(H>=q)if(K)G.push(K),q=K+W,K=void 0;else if(z==="quoted"){while(L===" "||L==="\t")L=E,E=$[H+=1],B=!0;let j=H>N+1?H-2:D-1;if(V[j])return $;G.push(j),V[j]=!0,q=j+W,K=void 0}else B=!0}L=E}if(B&&U)U();if(G.length===0)return $;if(Y)Y();let _=$.slice(0,G[0]);for(let E=0;E<G.length;++E){let j=G[E],x=G[E+1]||$.length;if(j===0)_=`
35
+ ${Z}${$.slice(0,x)}`;else{if(z==="quoted"&&V[j])_+=`${$[j]}\\`;_+=`
36
+ ${Z}${$.slice(j+1,x)}`}}return _}function QJ($,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}_L.FOLD_BLOCK="block";_L.FOLD_FLOW="flow";_L.FOLD_QUOTED="quoted";_L.foldFlowLines=CL});var k$=F((xL)=>{var D2=B0(),U6=XJ(),a8=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),t8=($)=>/^(%|---|\.\.\.)/m.test($);function SL($,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 b$($,Z){let z=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return z;let{implicitKey:Q}=Z,X=Z.options.doubleQuotedMinMultiLineLength,J=Z.indent||(t8($)?" ":""),Y="",U=0;for(let W=0,G=z[W];G;G=z[++W]){if(G===" "&&z[W+1]==="\\"&&z[W+2]==="n")Y+=z.slice(U,W)+"\\ ",W+=1,U=W,G="\\";if(G==="\\")switch(z[W+1]){case"u":{Y+=z.slice(U,W);let V=z.substr(W+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(W,6)}W+=5,U=W+1}break;case"n":if(Q||z[W+2]==='"'||z.length<X)W+=1;else{Y+=z.slice(U,W)+`
39
39
 
40
40
  `;while(z[W+2]==="\\"&&z[W+3]==="n"&&z[W+4]!=='"')Y+=`
41
- `,W+=2;if(Y+=J,z[W+2]===" ")Y+="\\";W+=1,U=W+1}break;default:W+=1}}return Y=U?Y+z.slice(U):z,Q?Y:Q6.foldFlowLines(Y,J,Q6.FOLD_QUOTED,i8(Z,!1))}function w7($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
42
- `)||/[ \t]\n|\n[ \t]/.test($))return S$($,Z);let z=Z.indent||(n8($)?" ":""),Q="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
43
- ${z}`)+"'";return Z.implicitKey?Q:Q6.foldFlowLines(Q,z,Q6.FOLD_FLOW,i8(Z,!1))}function I1($,Z){let{singleQuote:z}=Z.options,Q;if(z===!1)Q=S$;else{let X=$.includes('"'),J=$.includes("'");if(X&&!J)Q=w7;else if(J&&!X)Q=S$;else Q=z?w7:S$}return Q($,Z)}var x7;try{x7=new RegExp(`(^|(?<!
41
+ `,W+=2;if(Y+=J,z[W+2]===" ")Y+="\\";W+=1,U=W+1}break;default:W+=1}}return Y=U?Y+z.slice(U):z,Q?Y:U6.foldFlowLines(Y,J,U6.FOLD_QUOTED,a8(Z,!1))}function v7($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
42
+ `)||/[ \t]\n|\n[ \t]/.test($))return b$($,Z);let z=Z.indent||(t8($)?" ":""),Q="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
43
+ ${z}`)+"'";return Z.implicitKey?Q:U6.foldFlowLines(Q,z,U6.FOLD_FLOW,a8(Z,!1))}function C1($,Z){let{singleQuote:z}=Z.options,Q;if(z===!1)Q=b$;else{let X=$.includes('"'),J=$.includes("'");if(X&&!J)Q=v7;else if(J&&!X)Q=b$;else Q=z?v7:b$}return Q($,Z)}var g7;try{g7=new RegExp(`(^|(?<!
44
44
  ))
45
45
  +(?!
46
- |$)`,"g")}catch{x7=/\n+(?!\n|$)/g}function d8({comment:$,type:Z,value:z},Q,X,J){let{blockQuote:Y,commentString:U,lineWidth:W}=Q.options;if(!Y||/\n[\t ]+$/.test(z))return I1(z,Q);let G=Q.indent||(Q.forceBlockIndent||n8(z)?" ":""),V=Y==="literal"?!0:Y==="folded"||Z===D2.Scalar.BLOCK_FOLDED?!1:Z===D2.Scalar.BLOCK_LITERAL?!0:!NL(z,W,G.length);if(!z)return V?`|
46
+ |$)`,"g")}catch{g7=/\n+(?!\n|$)/g}function o8({comment:$,type:Z,value:z},Q,X,J){let{blockQuote:Y,commentString:U,lineWidth:W}=Q.options;if(!Y||/\n[\t ]+$/.test(z))return C1(z,Q);let G=Q.indent||(Q.forceBlockIndent||t8(z)?" ":""),V=Y==="literal"?!0:Y==="folded"||Z===D2.Scalar.BLOCK_FOLDED?!1:Z===D2.Scalar.BLOCK_LITERAL?!0:!SL(z,W,G.length);if(!z)return V?`|
47
47
  `:`>
48
- `;let q,K;for(K=z.length;K>0;--K){let y=z[K-1];if(y!==`
49
- `&&y!=="\t"&&y!==" ")break}let H=z.substring(K),L=H.indexOf(`
50
- `);if(L===-1)q="-";else if(z===H||L!==H.length-1){if(q="+",J)J()}else q="";if(H){if(z=z.slice(0,-H.length),H[H.length-1]===`
51
- `)H=H.slice(0,-1);H=H.replace(x7,`$&${G}`)}let B=!1,D,N=-1;for(D=0;D<z.length;++D){let y=z[D];if(y===" ")B=!0;else if(y===`
52
- `)N=D;else break}let _=z.substring(0,N<D?N+1:D);if(_)z=z.substring(_.length),_=_.replace(/\n+/g,`$&${G}`);let P=(B?G?"2":"1":"")+q;if($){if(P+=" "+U($.replace(/ ?[\r\n]+/g," ")),X)X()}if(!V){let y=z.replace(/\n+/g,`
53
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${G}`),w=!1,u=i8(Q,!0);if(Y!=="folded"&&Z!==D2.Scalar.BLOCK_FOLDED)u.onOverflow=()=>{w=!0};let S=Q6.foldFlowLines(`${_}${y}${H}`,G,Q6.FOLD_BLOCK,u);if(!w)return`>${P}
54
- ${G}${S}`}return z=z.replace(/\n+/g,`$&${G}`),`|${P}
55
- ${G}${_}${z}${H}`}function IL($,Z,z,Q){let{type:X,value:J}=$,{actualString:Y,implicitKey:U,indent:W,indentStep:G,inFlow:V}=Z;if(U&&J.includes(`
56
- `)||V&&/[[\]{},]/.test(J))return I1(J,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(J))return U||V||!J.includes(`
57
- `)?I1(J,Z):d8($,Z,z,Q);if(!U&&!V&&X!==D2.Scalar.PLAIN&&J.includes(`
58
- `))return d8($,Z,z,Q);if(n8(J)){if(W==="")return Z.forceBlockIndent=!0,d8($,Z,z,Q);else if(U&&W===G)return I1(J,Z)}let q=J.replace(/\n+/g,`$&
59
- ${W}`);if(Y){let K=(B)=>B.default&&B.tag!=="tag:yaml.org,2002:str"&&B.test?.test(q),{compat:H,tags:L}=Z.doc.schema;if(L.some(K)||H?.some(K))return I1(J,Z)}return U?q:Q6.foldFlowLines(q,W,Q6.FOLD_FLOW,i8(Z,!1))}function TL($,Z,z,Q){let{implicitKey:X,inFlow:J}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:U}=$;if(U!==D2.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))U=D2.Scalar.QUOTE_DOUBLE}let W=(V)=>{switch(V){case D2.Scalar.BLOCK_FOLDED:case D2.Scalar.BLOCK_LITERAL:return X||J?I1(Y.value,Z):d8(Y,Z,z,Q);case D2.Scalar.QUOTE_DOUBLE:return S$(Y.value,Z);case D2.Scalar.QUOTE_SINGLE:return w7(Y.value,Z);case D2.Scalar.PLAIN:return IL(Y,Z,z,Q);default:return null}},G=W(U);if(G===null){let{defaultKeyType:V,defaultStringType:q}=Z.options,K=X&&V||q;if(G=W(K),G===null)throw Error(`Unsupported default string type ${K}`)}return G}AL.stringifyString=TL});var w$=F((wL)=>{var _L=m8(),X6=e(),RL=j$(),PL=E$();function FL($,Z){let z=Object.assign({blockQuote:!0,commentString:RL.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 jL($,Z){if(Z.tag){let X=$.filter((J)=>J.tag===Z.tag);if(X.length>0)return X.find((J)=>J.format===Z.format)??X[0]}let z=void 0,Q;if(X6.isScalar(Z)){Q=Z.value;let X=$.filter((J)=>J.identify?.(Q));if(X.length>1){let J=X.filter((Y)=>Y.test);if(J.length>0)X=J}z=X.find((J)=>J.format===Z.format)??X.find((J)=>!J.format)}else Q=Z,z=$.find((X)=>X.nodeClass&&Q instanceof X.nodeClass);if(!z){let X=Q?.constructor?.name??(Q===null?"null":typeof Q);throw Error(`Tag not resolved for ${X} value`)}return z}function SL($,Z,{anchors:z,doc:Q}){if(!Q.directives)return"";let X=[],J=(X6.isScalar($)||X6.isCollection($))&&$.anchor;if(J&&_L.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 EL($,Z,z,Q){if(X6.isPair($))return $.toString(Z,z,Q);if(X6.isAlias($)){if(Z.doc.directives)return $.toString(Z);if(Z.resolvedAliases?.has($))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(Z.resolvedAliases)Z.resolvedAliases.add($);else Z.resolvedAliases=new Set([$]);$=$.resolve(Z.doc)}}let X=void 0,J=X6.isNode($)?$:Z.doc.createNode($,{onTagObj:(W)=>X=W});X??(X=jL(Z.doc.schema.tags,J));let Y=SL(J,X,Z);if(Y.length>0)Z.indentAtStart=(Z.indentAtStart??0)+Y.length+1;let U=typeof X.stringify==="function"?X.stringify(J,Z,z,Q):X6.isScalar(J)?PL.stringifyString(J,Z,z,Q):J.toString(Z,z,Q);if(!Y)return U;return X6.isScalar(J)||U[0]==="{"||U[0]==="["?`${Y} ${U}`:`${Y}
60
- ${Z.indent}${U}`}wL.createStringifyContext=FL;wL.stringify=EL});var zJ=F((kL)=>{var f2=e(),$J=L0(),ZJ=w$(),x$=j$();function bL({key:$,value:Z},z,Q,X){let{allNullValues:J,doc:Y,indent:U,indentStep:W,options:{commentString:G,indentSeq:V,simpleKeys:q}}=z,K=f2.isNode($)&&$.comment||null;if(q){if(K)throw Error("With simple keys, key nodes cannot have comments");if(f2.isCollection($)||!f2.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let H=!q&&(!$||K&&Z==null&&!z.inFlow||f2.isCollection($)||(f2.isScalar($)?$.type===$J.Scalar.BLOCK_FOLDED||$.type===$J.Scalar.BLOCK_LITERAL:typeof $==="object"));z=Object.assign({},z,{allNullValues:!1,implicitKey:!H&&(q||!J),indent:U+W});let L=!1,B=!1,D=ZJ.stringify($,z,()=>L=!0,()=>B=!0);if(!H&&!z.inFlow&&D.length>1024){if(q)throw Error("With simple keys, single line scalar must not span more than 1024 characters");H=!0}if(z.inFlow){if(J||Z==null){if(L&&Q)Q();return D===""?"?":H?`? ${D}`:D}}else if(J&&!q||Z==null&&H){if(D=`? ${D}`,K&&!L)D+=x$.lineComment(D,z.indent,G(K));else if(B&&X)X();return D}if(L)K=null;if(H){if(K)D+=x$.lineComment(D,z.indent,G(K));D=`? ${D}
61
- ${U}:`}else if(D=`${D}:`,K)D+=x$.lineComment(D,z.indent,G(K));let N,_,E;if(f2.isNode(Z))N=!!Z.spaceBefore,_=Z.commentBefore,E=Z.comment;else if(N=!1,_=null,E=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(z.implicitKey=!1,!H&&!K&&f2.isScalar(Z))z.indentAtStart=D.length+1;if(B=!1,!V&&W.length>=2&&!z.inFlow&&!H&&f2.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)z.indent=z.indent.substring(2);let P=!1,y=ZJ.stringify(Z,z,()=>P=!0,()=>B=!0),w=" ";if(K||N||_){if(w=N?`
48
+ `;let q,K;for(K=z.length;K>0;--K){let x=z[K-1];if(x!==`
49
+ `&&x!=="\t"&&x!==" ")break}let L=z.substring(K),B=L.indexOf(`
50
+ `);if(B===-1)q="-";else if(z===L||B!==L.length-1){if(q="+",J)J()}else q="";if(L){if(z=z.slice(0,-L.length),L[L.length-1]===`
51
+ `)L=L.slice(0,-1);L=L.replace(g7,`$&${G}`)}let H=!1,D,N=-1;for(D=0;D<z.length;++D){let x=z[D];if(x===" ")H=!0;else if(x===`
52
+ `)N=D;else break}let _=z.substring(0,N<D?N+1:D);if(_)z=z.substring(_.length),_=_.replace(/\n+/g,`$&${G}`);let j=(H?G?"2":"1":"")+q;if($){if(j+=" "+U($.replace(/ ?[\r\n]+/g," ")),X)X()}if(!V){let x=z.replace(/\n+/g,`
53
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${G}`),w=!1,u=a8(Q,!0);if(Y!=="folded"&&Z!==D2.Scalar.BLOCK_FOLDED)u.onOverflow=()=>{w=!0};let S=U6.foldFlowLines(`${_}${x}${L}`,G,U6.FOLD_BLOCK,u);if(!w)return`>${j}
54
+ ${G}${S}`}return z=z.replace(/\n+/g,`$&${G}`),`|${j}
55
+ ${G}${_}${z}${L}`}function EL($,Z,z,Q){let{type:X,value:J}=$,{actualString:Y,implicitKey:U,indent:W,indentStep:G,inFlow:V}=Z;if(U&&J.includes(`
56
+ `)||V&&/[[\]{},]/.test(J))return C1(J,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(J))return U||V||!J.includes(`
57
+ `)?C1(J,Z):o8($,Z,z,Q);if(!U&&!V&&X!==D2.Scalar.PLAIN&&J.includes(`
58
+ `))return o8($,Z,z,Q);if(t8(J)){if(W==="")return Z.forceBlockIndent=!0,o8($,Z,z,Q);else if(U&&W===G)return C1(J,Z)}let q=J.replace(/\n+/g,`$&
59
+ ${W}`);if(Y){let K=(H)=>H.default&&H.tag!=="tag:yaml.org,2002:str"&&H.test?.test(q),{compat:L,tags:B}=Z.doc.schema;if(B.some(K)||L?.some(K))return C1(J,Z)}return U?q:U6.foldFlowLines(q,W,U6.FOLD_FLOW,a8(Z,!1))}function wL($,Z,z,Q){let{implicitKey:X,inFlow:J}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:U}=$;if(U!==D2.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))U=D2.Scalar.QUOTE_DOUBLE}let W=(V)=>{switch(V){case D2.Scalar.BLOCK_FOLDED:case D2.Scalar.BLOCK_LITERAL:return X||J?C1(Y.value,Z):o8(Y,Z,z,Q);case D2.Scalar.QUOTE_DOUBLE:return b$(Y.value,Z);case D2.Scalar.QUOTE_SINGLE:return v7(Y.value,Z);case D2.Scalar.PLAIN:return EL(Y,Z,z,Q);default:return null}},G=W(U);if(G===null){let{defaultKeyType:V,defaultStringType:q}=Z.options,K=X&&V||q;if(G=W(K),G===null)throw Error(`Unsupported default string type ${K}`)}return G}xL.stringifyString=wL});var v$=F((mL)=>{var bL=i8(),W6=t(),kL=y$(),vL=k$();function gL($,Z){let z=Object.assign({blockQuote:!0,commentString:kL.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 hL($,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(W6.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 fL($,Z,{anchors:z,doc:Q}){if(!Q.directives)return"";let X=[],J=(W6.isScalar($)||W6.isCollection($))&&$.anchor;if(J&&bL.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 uL($,Z,z,Q){if(W6.isPair($))return $.toString(Z,z,Q);if(W6.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=W6.isNode($)?$:Z.doc.createNode($,{onTagObj:(W)=>X=W});X??(X=hL(Z.doc.schema.tags,J));let Y=fL(J,X,Z);if(Y.length>0)Z.indentAtStart=(Z.indentAtStart??0)+Y.length+1;let U=typeof X.stringify==="function"?X.stringify(J,Z,z,Q):W6.isScalar(J)?vL.stringifyString(J,Z,z,Q):J.toString(Z,z,Q);if(!Y)return U;return W6.isScalar(J)||U[0]==="{"||U[0]==="["?`${Y} ${U}`:`${Y}
60
+ ${Z.indent}${U}`}mL.createStringifyContext=gL;mL.stringify=uL});var UJ=F((dL)=>{var m2=t(),JJ=B0(),YJ=v$(),g$=y$();function lL({key:$,value:Z},z,Q,X){let{allNullValues:J,doc:Y,indent:U,indentStep:W,options:{commentString:G,indentSeq:V,simpleKeys:q}}=z,K=m2.isNode($)&&$.comment||null;if(q){if(K)throw Error("With simple keys, key nodes cannot have comments");if(m2.isCollection($)||!m2.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let L=!q&&(!$||K&&Z==null&&!z.inFlow||m2.isCollection($)||(m2.isScalar($)?$.type===JJ.Scalar.BLOCK_FOLDED||$.type===JJ.Scalar.BLOCK_LITERAL:typeof $==="object"));z=Object.assign({},z,{allNullValues:!1,implicitKey:!L&&(q||!J),indent:U+W});let B=!1,H=!1,D=YJ.stringify($,z,()=>B=!0,()=>H=!0);if(!L&&!z.inFlow&&D.length>1024){if(q)throw Error("With simple keys, single line scalar must not span more than 1024 characters");L=!0}if(z.inFlow){if(J||Z==null){if(B&&Q)Q();return D===""?"?":L?`? ${D}`:D}}else if(J&&!q||Z==null&&L){if(D=`? ${D}`,K&&!B)D+=g$.lineComment(D,z.indent,G(K));else if(H&&X)X();return D}if(B)K=null;if(L){if(K)D+=g$.lineComment(D,z.indent,G(K));D=`? ${D}
61
+ ${U}:`}else if(D=`${D}:`,K)D+=g$.lineComment(D,z.indent,G(K));let N,_,E;if(m2.isNode(Z))N=!!Z.spaceBefore,_=Z.commentBefore,E=Z.comment;else if(N=!1,_=null,E=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(z.implicitKey=!1,!L&&!K&&m2.isScalar(Z))z.indentAtStart=D.length+1;if(H=!1,!V&&W.length>=2&&!z.inFlow&&!L&&m2.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)z.indent=z.indent.substring(2);let j=!1,x=YJ.stringify(Z,z,()=>j=!0,()=>H=!0),w=" ";if(K||N||_){if(w=N?`
62
62
  `:"",_){let u=G(_);w+=`
63
- ${x$.indentComment(u,z.indent)}`}if(y===""&&!z.inFlow){if(w===`
63
+ ${g$.indentComment(u,z.indent)}`}if(x===""&&!z.inFlow){if(w===`
64
64
  `&&E)w=`
65
65
 
66
66
  `}else w+=`
67
- ${z.indent}`}else if(!H&&f2.isCollection(Z)){let u=y[0],S=y.indexOf(`
68
- `),d=S!==-1,I0=z.inFlow??Z.flow??Z.items.length===0;if(d||!I0){let S0=!1;if(d&&(u==="&"||u==="!")){let z0=y.indexOf(" ");if(u==="&"&&z0!==-1&&z0<S&&y[z0+1]==="!")z0=y.indexOf(" ",z0+1);if(z0===-1||S<z0)S0=!0}if(!S0)w=`
69
- ${z.indent}`}}else if(y===""||y[0]===`
70
- `)w="";if(D+=w+y,z.inFlow){if(P&&Q)Q()}else if(E&&!P)D+=x$.lineComment(D,z.indent,G(E));else if(B&&X)X();return D}kL.stringifyPair=bL});var y7=F((fL)=>{var QJ=p0("process");function gL($,...Z){if($==="debug")console.log(...Z)}function hL($,Z){if($==="debug"||$==="warn")if(typeof QJ.emitWarning==="function")QJ.emitWarning(Z);else console.warn(Z)}fL.debug=gL;fL.warn=hL});var a8=F((pL)=>{var o8=e(),XJ=L0(),r8="<<",s8={identify:($)=>$===r8||typeof $==="symbol"&&$.description===r8,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new XJ.Scalar(Symbol(r8)),{addToJSMap:JJ}),stringify:()=>r8},cL=($,Z)=>(s8.identify(Z)||o8.isScalar(Z)&&(!Z.type||Z.type===XJ.Scalar.PLAIN)&&s8.identify(Z.value))&&$?.doc.schema.tags.some((z)=>z.tag===s8.tag&&z.default);function JJ($,Z,z){let Q=YJ($,z);if(o8.isSeq(Q))for(let X of Q.items)b7($,Z,X);else if(Array.isArray(Q))for(let X of Q)b7($,Z,X);else b7($,Z,Q)}function b7($,Z,z){let Q=YJ($,z);if(!o8.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 YJ($,Z){return $&&o8.isAlias(Z)?Z.resolve($.doc,$):Z}pL.addMergeToJSMap=JJ;pL.isMergeKey=cL;pL.merge=s8});var v7=F((aL)=>{var nL=y7(),UJ=a8(),rL=w$(),WJ=e(),k7=z6();function sL($,Z,{key:z,value:Q}){if(WJ.isNode(z)&&z.addToJSMap)z.addToJSMap($,Z,Q);else if(UJ.isMergeKey($,z))UJ.addMergeToJSMap($,Z,Q);else{let X=k7.toJS(z,"",$);if(Z instanceof Map)Z.set(X,k7.toJS(Q,X,$));else if(Z instanceof Set)Z.add(X);else{let J=oL(z,X,$),Y=k7.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 oL($,Z,z){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(WJ.isNode($)&&z?.doc){let Q=rL.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)+'..."';nL.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)}aL.addPairToJSMap=sL});var J6=F((zD)=>{var GJ=F$(),eL=zJ(),$D=v7(),t8=e();function ZD($,Z,z){let Q=GJ.createNode($,void 0,z),X=GJ.createNode(Z,void 0,z);return new e8(Q,X)}class e8{constructor($,Z=null){Object.defineProperty(this,t8.NODE_TYPE,{value:t8.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:z}=this;if(t8.isNode(Z))Z=Z.clone($);if(t8.isNode(z))z=z.clone($);return new e8(Z,z)}toJSON($,Z){let z=Z?.mapAsMap?new Map:{};return $D.addPairToJSMap(Z,z,this)}toString($,Z,z){return $?.doc?eL.stringifyPair(this,$,Z,z):JSON.stringify(this)}}zD.Pair=e8;zD.createPair=ZD});var g7=F((WD)=>{var b6=e(),VJ=w$(),$5=j$();function JD($,Z,z){return(Z.inFlow??$.flow?UD:YD)($,Z,z)}function YD({comment:$,items:Z},z,{blockItemPrefix:Q,flowChars:X,itemIndent:J,onChompKeep:Y,onComment:U}){let{indent:W,options:{commentString:G}}=z,V=Object.assign({},z,{indent:J,type:null}),q=!1,K=[];for(let L=0;L<Z.length;++L){let B=Z[L],D=null;if(b6.isNode(B)){if(!q&&B.spaceBefore)K.push("");if(Z5(z,K,B.commentBefore,q),B.comment)D=B.comment}else if(b6.isPair(B)){let _=b6.isNode(B.key)?B.key:null;if(_){if(!q&&_.spaceBefore)K.push("");Z5(z,K,_.commentBefore,q)}}q=!1;let N=VJ.stringify(B,V,()=>D=null,()=>q=!0);if(D)N+=$5.lineComment(N,J,G(D));if(q&&D)q=!1;K.push(Q+N)}let H;if(K.length===0)H=X.start+X.end;else{H=K[0];for(let L=1;L<K.length;++L){let B=K[L];H+=B?`
71
- ${W}${B}`:`
72
- `}}if($){if(H+=`
73
- `+$5.indentComment(G($),W),U)U()}else if(q&&Y)Y();return H}function UD({items:$},Z,{flowChars:z,itemIndent:Q}){let{indent:X,indentStep:J,flowCollectionPadding:Y,options:{commentString:U}}=Z;Q+=J;let W=Object.assign({},Z,{indent:Q,inFlow:!0,type:null}),G=!1,V=0,q=[];for(let L=0;L<$.length;++L){let B=$[L],D=null;if(b6.isNode(B)){if(B.spaceBefore)q.push("");if(Z5(Z,q,B.commentBefore,!1),B.comment)D=B.comment}else if(b6.isPair(B)){let _=b6.isNode(B.key)?B.key:null;if(_){if(_.spaceBefore)q.push("");if(Z5(Z,q,_.commentBefore,!1),_.comment)G=!0}let E=b6.isNode(B.value)?B.value:null;if(E){if(E.comment)D=E.comment;if(E.commentBefore)G=!0}else if(B.value==null&&_?.comment)D=_.comment}if(D)G=!0;let N=VJ.stringify(B,W,()=>D=null);if(G||(G=q.length>V||N.includes(`
74
- `)),L<$.length-1)N+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)G||(G=q.reduce((_,E)=>_+E.length+2,2)+(N.length+2)>Z.options.lineWidth);if(G)N+=","}if(D)N+=$5.lineComment(N,Q,U(D));q.push(N),V=q.length}let{start:K,end:H}=z;if(q.length===0)return K+H;else{if(!G){let L=q.reduce((B,D)=>B+D.length+2,2);G=Z.options.lineWidth>0&&L>Z.options.lineWidth}if(G){let L=K;for(let B of q)L+=B?`
75
- ${J}${X}${B}`:`
76
- `;return`${L}
77
- ${X}${H}`}else return`${K}${Y}${q.join(" ")}${Y}${H}`}}function Z5({indent:$,options:{commentString:Z}},z,Q,X){if(Q&&X)Q=Q.replace(/^\n+/,"");if(Q){let J=$5.indentComment(Z(Q),$);z.push(J.trimStart())}}WD.stringifyCollection=JD});var U6=F((BD)=>{var VD=g7(),qD=v7(),KD=l8(),Y6=e(),z5=J6(),HD=L0();function y$($,Z){let z=Y6.isScalar(Z)?Z.value:Z;for(let Q of $)if(Y6.isPair(Q)){if(Q.key===Z||Q.key===z)return Q;if(Y6.isScalar(Q.key)&&Q.key.value===z)return Q}return}class qJ extends KD.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(Y6.MAP,$);this.items=[]}static from($,Z,z){let{keepUndefined:Q,replacer:X}=z,J=new this($),Y=(U,W)=>{if(typeof X==="function")W=X.call(Z,U,W);else if(Array.isArray(X)&&!X.includes(U))return;if(W!==void 0||Q)J.items.push(z5.createPair(U,W,z))};if(Z instanceof Map)for(let[U,W]of Z)Y(U,W);else if(Z&&typeof Z==="object")for(let U of Object.keys(Z))Y(U,Z[U]);if(typeof $.sortMapEntries==="function")J.items.sort($.sortMapEntries);return J}add($,Z){let z;if(Y6.isPair($))z=$;else if(!$||typeof $!=="object"||!("key"in $))z=new z5.Pair($,$?.value);else z=new z5.Pair($.key,$.value);let Q=y$(this.items,z.key),X=this.schema?.sortMapEntries;if(Q){if(!Z)throw Error(`Key ${z.key} already set`);if(Y6.isScalar(Q.value)&&HD.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=y$(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let Q=y$(this.items,$)?.value;return(!Z&&Y6.isScalar(Q)?Q.value:Q)??void 0}has($){return!!y$(this.items,$)}set($,Z){this.add(new z5.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)qD.addPairToJSMap(Z,Q,X);return Q}toString($,Z,z){if(!$)return JSON.stringify(this);for(let Q of this.items)if(!Y6.isPair(Q))throw Error(`Map items must all be pairs; found ${JSON.stringify(Q)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return VD.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:z,onComment:Z})}}BD.YAMLMap=qJ;BD.findPair=y$});var T1=F((ND)=>{var DD=e(),KJ=U6(),OD={collection:"map",default:!0,nodeClass:KJ.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!DD.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,z)=>KJ.YAMLMap.from($,Z,z)};ND.map=OD});var W6=F((PD)=>{var TD=F$(),AD=g7(),CD=l8(),X5=e(),_D=L0(),RD=z6();class HJ extends CD.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(X5.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=Q5($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let z=Q5($);if(typeof z!=="number")return;let Q=this.items[z];return!Z&&X5.isScalar(Q)?Q.value:Q}has($){let Z=Q5($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let z=Q5($);if(typeof z!=="number")throw Error(`Expected a valid index, not ${$}.`);let Q=this.items[z];if(X5.isScalar(Q)&&_D.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(RD.toJS(X,String(Q++),Z));return z}toString($,Z,z){if(!$)return JSON.stringify(this);return AD.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 U=Z instanceof Set?Y:String(J++);Y=Q.call(Z,U,Y)}X.items.push(TD.createNode(Y,void 0,z))}}return X}}function Q5($){let Z=X5.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}PD.YAMLSeq=HJ});var A1=F((ED)=>{var jD=e(),BJ=W6(),SD={collection:"seq",default:!0,nodeClass:BJ.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!jD.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,z)=>BJ.YAMLSeq.from($,Z,z)};ED.seq=SD});var b$=F((bD)=>{var xD=E$(),yD={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,z,Q){return Z=Object.assign({actualString:!0},Z),xD.stringifyString($,Z,z,Q)}};bD.string=yD});var J5=F((vD)=>{var MJ=L0(),LJ={identify:($)=>$==null,createNode:()=>new MJ.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new MJ.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&LJ.test.test($)?$:Z.options.nullStr};vD.nullTag=LJ});var h7=F((fD)=>{var hD=L0(),DJ={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new hD.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},z){if($&&DJ.test.test($)){let Q=$[0]==="t"||$[0]==="T";if(Z===Q)return $}return Z?z.options.trueStr:z.options.falseStr}};fD.boolTag=DJ});var C1=F((cD)=>{function mD({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 U=Z-(J.length-Y-1);while(U-- >0)J+="0"}return J}cD.stringifyNumber=mD});var u7=F((rD)=>{var lD=L0(),f7=C1(),dD={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},iD={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($),stringify($){let Z=Number($.value);return isFinite(Z)?Z.toExponential():f7.stringifyNumber($)}},nD={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new lD.Scalar(parseFloat($)),z=$.indexOf(".");if(z!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-z-1;return Z},stringify:f7.stringifyNumber};rD.float=nD;rD.floatExp=iD;rD.floatNaN=dD});var c7=F((ZO)=>{var OJ=C1(),Y5=($)=>typeof $==="bigint"||Number.isInteger($),m7=($,Z,z,{intAsBigInt:Q})=>Q?BigInt($):parseInt($.substring(Z),z);function NJ($,Z,z){let{value:Q}=$;if(Y5(Q)&&Q>=0)return z+Q.toString(Z);return OJ.stringifyNumber($)}var tD={identify:($)=>Y5($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,z)=>m7($,2,8,z),stringify:($)=>NJ($,8,"0o")},eD={identify:Y5,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,z)=>m7($,0,10,z),stringify:OJ.stringifyNumber},$O={identify:($)=>Y5($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,z)=>m7($,2,16,z),stringify:($)=>NJ($,16,"0x")};ZO.int=eD;ZO.intHex=$O;ZO.intOct=tD});var IJ=F((qO)=>{var JO=T1(),YO=J5(),UO=A1(),WO=b$(),GO=h7(),p7=u7(),l7=c7(),VO=[JO.map,UO.seq,WO.string,YO.nullTag,GO.boolTag,l7.intOct,l7.int,l7.intHex,p7.floatNaN,p7.floatExp,p7.float];qO.schema=VO});var AJ=F((NO)=>{var HO=L0(),BO=T1(),MO=A1();function TJ($){return typeof $==="bigint"||Number.isInteger($)}var U5=({value:$})=>JSON.stringify($),LO=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:U5},{identify:($)=>$==null,createNode:()=>new HO.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:U5},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:U5},{identify:TJ,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:z})=>z?BigInt($):parseInt($,10),stringify:({value:$})=>TJ($)?$.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:U5}],DO={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},OO=[BO.map,MO.seq].concat(LO,DO);NO.schema=OO});var i7=F((CO)=>{var k$=p0("buffer"),d7=L0(),TO=E$(),AO={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof k$.Buffer==="function")return k$.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,U;if(typeof k$.Buffer==="function")U=Y instanceof k$.Buffer?Y.toString("base64"):k$.Buffer.from(Y.buffer).toString("base64");else if(typeof btoa==="function"){let W="";for(let G=0;G<Y.length;++G)W+=String.fromCharCode(Y[G]);U=btoa(W)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(Z??(Z=d7.Scalar.BLOCK_LITERAL),Z!==d7.Scalar.QUOTE_DOUBLE){let W=Math.max(Q.options.lineWidth-Q.indent.length,Q.options.minContentWidth),G=Math.ceil(U.length/W),V=Array(G);for(let q=0,K=0;q<G;++q,K+=W)V[q]=U.substr(K,W);U=V.join(Z===d7.Scalar.BLOCK_LITERAL?`
78
- `:" ")}return TO.stringifyString({comment:$,type:Z,value:U},Q,X,J)}};CO.binary=AO});var G5=F((jO)=>{var W5=e(),n7=J6(),RO=L0(),PO=W6();function CJ($,Z){if(W5.isSeq($))for(let z=0;z<$.items.length;++z){let Q=$.items[z];if(W5.isPair(Q))continue;else if(W5.isMap(Q)){if(Q.items.length>1)Z("Each pair must have its own sequence indicator");let X=Q.items[0]||new n7.Pair(new RO.Scalar(null));if(Q.commentBefore)X.key.commentBefore=X.key.commentBefore?`${Q.commentBefore}
67
+ ${z.indent}`}else if(!L&&m2.isCollection(Z)){let u=x[0],S=x.indexOf(`
68
+ `),d=S!==-1,y0=z.inFlow??Z.flow??Z.items.length===0;if(d||!y0){let j0=!1;if(d&&(u==="&"||u==="!")){let $0=x.indexOf(" ");if(u==="&"&&$0!==-1&&$0<S&&x[$0+1]==="!")$0=x.indexOf(" ",$0+1);if($0===-1||S<$0)j0=!0}if(!j0)w=`
69
+ ${z.indent}`}}else if(x===""||x[0]===`
70
+ `)w="";if(D+=w+x,z.inFlow){if(j&&Q)Q()}else if(E&&!j)D+=g$.lineComment(D,z.indent,G(E));else if(H&&X)X();return D}dL.stringifyPair=lL});var h7=F((sL)=>{var WJ=c0("process");function nL($,...Z){if($==="debug")console.log(...Z)}function rL($,Z){if($==="debug"||$==="warn")if(typeof WJ.emitWarning==="function")WJ.emitWarning(Z);else console.warn(Z)}sL.debug=nL;sL.warn=rL});var z5=F((eL)=>{var Z5=t(),GJ=B0(),e8="<<",$5={identify:($)=>$===e8||typeof $==="symbol"&&$.description===e8,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new GJ.Scalar(Symbol(e8)),{addToJSMap:VJ}),stringify:()=>e8},tL=($,Z)=>($5.identify(Z)||Z5.isScalar(Z)&&(!Z.type||Z.type===GJ.Scalar.PLAIN)&&$5.identify(Z.value))&&$?.doc.schema.tags.some((z)=>z.tag===$5.tag&&z.default);function VJ($,Z,z){let Q=qJ($,z);if(Z5.isSeq(Q))for(let X of Q.items)f7($,Z,X);else if(Array.isArray(Q))for(let X of Q)f7($,Z,X);else f7($,Z,Q)}function f7($,Z,z){let Q=qJ($,z);if(!Z5.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 qJ($,Z){return $&&Z5.isAlias(Z)?Z.resolve($.doc,$):Z}eL.addMergeToJSMap=VJ;eL.isMergeKey=tL;eL.merge=$5});var m7=F((UD)=>{var QD=h7(),KJ=z5(),XD=v$(),HJ=t(),u7=Y6();function JD($,Z,{key:z,value:Q}){if(HJ.isNode(z)&&z.addToJSMap)z.addToJSMap($,Z,Q);else if(KJ.isMergeKey($,z))KJ.addMergeToJSMap($,Z,Q);else{let X=u7.toJS(z,"",$);if(Z instanceof Map)Z.set(X,u7.toJS(Q,X,$));else if(Z instanceof Set)Z.add(X);else{let J=YD(z,X,$),Y=u7.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 YD($,Z,z){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(HJ.isNode($)&&z?.doc){let Q=XD.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)+'..."';QD.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)}UD.addPairToJSMap=JD});var G6=F((KD)=>{var BJ=x$(),GD=UJ(),VD=m7(),Q5=t();function qD($,Z,z){let Q=BJ.createNode($,void 0,z),X=BJ.createNode(Z,void 0,z);return new X5(Q,X)}class X5{constructor($,Z=null){Object.defineProperty(this,Q5.NODE_TYPE,{value:Q5.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:z}=this;if(Q5.isNode(Z))Z=Z.clone($);if(Q5.isNode(z))z=z.clone($);return new X5(Z,z)}toJSON($,Z){let z=Z?.mapAsMap?new Map:{};return VD.addPairToJSMap(Z,z,this)}toString($,Z,z){return $?.doc?GD.stringifyPair(this,$,Z,z):JSON.stringify(this)}}KD.Pair=X5;KD.createPair=qD});var c7=F((OD)=>{var h6=t(),MJ=v$(),J5=y$();function MD($,Z,z){return(Z.inFlow??$.flow?DD:LD)($,Z,z)}function LD({comment:$,items:Z},z,{blockItemPrefix:Q,flowChars:X,itemIndent:J,onChompKeep:Y,onComment:U}){let{indent:W,options:{commentString:G}}=z,V=Object.assign({},z,{indent:J,type:null}),q=!1,K=[];for(let B=0;B<Z.length;++B){let H=Z[B],D=null;if(h6.isNode(H)){if(!q&&H.spaceBefore)K.push("");if(Y5(z,K,H.commentBefore,q),H.comment)D=H.comment}else if(h6.isPair(H)){let _=h6.isNode(H.key)?H.key:null;if(_){if(!q&&_.spaceBefore)K.push("");Y5(z,K,_.commentBefore,q)}}q=!1;let N=MJ.stringify(H,V,()=>D=null,()=>q=!0);if(D)N+=J5.lineComment(N,J,G(D));if(q&&D)q=!1;K.push(Q+N)}let L;if(K.length===0)L=X.start+X.end;else{L=K[0];for(let B=1;B<K.length;++B){let H=K[B];L+=H?`
71
+ ${W}${H}`:`
72
+ `}}if($){if(L+=`
73
+ `+J5.indentComment(G($),W),U)U()}else if(q&&Y)Y();return L}function DD({items:$},Z,{flowChars:z,itemIndent:Q}){let{indent:X,indentStep:J,flowCollectionPadding:Y,options:{commentString:U}}=Z;Q+=J;let W=Object.assign({},Z,{indent:Q,inFlow:!0,type:null}),G=!1,V=0,q=[];for(let B=0;B<$.length;++B){let H=$[B],D=null;if(h6.isNode(H)){if(H.spaceBefore)q.push("");if(Y5(Z,q,H.commentBefore,!1),H.comment)D=H.comment}else if(h6.isPair(H)){let _=h6.isNode(H.key)?H.key:null;if(_){if(_.spaceBefore)q.push("");if(Y5(Z,q,_.commentBefore,!1),_.comment)G=!0}let E=h6.isNode(H.value)?H.value:null;if(E){if(E.comment)D=E.comment;if(E.commentBefore)G=!0}else if(H.value==null&&_?.comment)D=_.comment}if(D)G=!0;let N=MJ.stringify(H,W,()=>D=null);if(G||(G=q.length>V||N.includes(`
74
+ `)),B<$.length-1)N+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)G||(G=q.reduce((_,E)=>_+E.length+2,2)+(N.length+2)>Z.options.lineWidth);if(G)N+=","}if(D)N+=J5.lineComment(N,Q,U(D));q.push(N),V=q.length}let{start:K,end:L}=z;if(q.length===0)return K+L;else{if(!G){let B=q.reduce((H,D)=>H+D.length+2,2);G=Z.options.lineWidth>0&&B>Z.options.lineWidth}if(G){let B=K;for(let H of q)B+=H?`
75
+ ${J}${X}${H}`:`
76
+ `;return`${B}
77
+ ${X}${L}`}else return`${K}${Y}${q.join(" ")}${Y}${L}`}}function Y5({indent:$,options:{commentString:Z}},z,Q,X){if(Q&&X)Q=Q.replace(/^\n+/,"");if(Q){let J=J5.indentComment(Z(Q),$);z.push(J.trimStart())}}OD.stringifyCollection=MD});var q6=F((_D)=>{var ID=c7(),TD=m7(),AD=s8(),V6=t(),U5=G6(),CD=B0();function h$($,Z){let z=V6.isScalar(Z)?Z.value:Z;for(let Q of $)if(V6.isPair(Q)){if(Q.key===Z||Q.key===z)return Q;if(V6.isScalar(Q.key)&&Q.key.value===z)return Q}return}class LJ extends AD.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(V6.MAP,$);this.items=[]}static from($,Z,z){let{keepUndefined:Q,replacer:X}=z,J=new this($),Y=(U,W)=>{if(typeof X==="function")W=X.call(Z,U,W);else if(Array.isArray(X)&&!X.includes(U))return;if(W!==void 0||Q)J.items.push(U5.createPair(U,W,z))};if(Z instanceof Map)for(let[U,W]of Z)Y(U,W);else if(Z&&typeof Z==="object")for(let U of Object.keys(Z))Y(U,Z[U]);if(typeof $.sortMapEntries==="function")J.items.sort($.sortMapEntries);return J}add($,Z){let z;if(V6.isPair($))z=$;else if(!$||typeof $!=="object"||!("key"in $))z=new U5.Pair($,$?.value);else z=new U5.Pair($.key,$.value);let Q=h$(this.items,z.key),X=this.schema?.sortMapEntries;if(Q){if(!Z)throw Error(`Key ${z.key} already set`);if(V6.isScalar(Q.value)&&CD.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=h$(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let Q=h$(this.items,$)?.value;return(!Z&&V6.isScalar(Q)?Q.value:Q)??void 0}has($){return!!h$(this.items,$)}set($,Z){this.add(new U5.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)TD.addPairToJSMap(Z,Q,X);return Q}toString($,Z,z){if(!$)return JSON.stringify(this);for(let Q of this.items)if(!V6.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 ID.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:z,onComment:Z})}}_D.YAMLMap=LJ;_D.findPair=h$});var _1=F((SD)=>{var RD=t(),DJ=q6(),jD={collection:"map",default:!0,nodeClass:DJ.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!RD.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,z)=>DJ.YAMLMap.from($,Z,z)};SD.map=jD});var K6=F((vD)=>{var wD=x$(),xD=c7(),yD=s8(),G5=t(),bD=B0(),kD=Y6();class OJ extends yD.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(G5.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=W5($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let z=W5($);if(typeof z!=="number")return;let Q=this.items[z];return!Z&&G5.isScalar(Q)?Q.value:Q}has($){let Z=W5($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let z=W5($);if(typeof z!=="number")throw Error(`Expected a valid index, not ${$}.`);let Q=this.items[z];if(G5.isScalar(Q)&&bD.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(kD.toJS(X,String(Q++),Z));return z}toString($,Z,z){if(!$)return JSON.stringify(this);return xD.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 U=Z instanceof Set?Y:String(J++);Y=Q.call(Z,U,Y)}X.items.push(wD.createNode(Y,void 0,z))}}return X}}function W5($){let Z=G5.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}vD.YAMLSeq=OJ});var P1=F((uD)=>{var hD=t(),NJ=K6(),fD={collection:"seq",default:!0,nodeClass:NJ.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!hD.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,z)=>NJ.YAMLSeq.from($,Z,z)};uD.seq=fD});var f$=F((lD)=>{var cD=k$(),pD={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,z,Q){return Z=Object.assign({actualString:!0},Z),cD.stringifyString($,Z,z,Q)}};lD.string=pD});var V5=F((iD)=>{var IJ=B0(),TJ={identify:($)=>$==null,createNode:()=>new IJ.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new IJ.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&TJ.test.test($)?$:Z.options.nullStr};iD.nullTag=TJ});var p7=F((sD)=>{var rD=B0(),AJ={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new rD.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},z){if($&&AJ.test.test($)){let Q=$[0]==="t"||$[0]==="T";if(Z===Q)return $}return Z?z.options.trueStr:z.options.falseStr}};sD.boolTag=AJ});var F1=F((tD)=>{function aD({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 U=Z-(J.length-Y-1);while(U-- >0)J+="0"}return J}tD.stringifyNumber=aD});var d7=F((XO)=>{var $O=B0(),l7=F1(),ZO={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:l7.stringifyNumber},zO={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():l7.stringifyNumber($)}},QO={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new $O.Scalar(parseFloat($)),z=$.indexOf(".");if(z!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-z-1;return Z},stringify:l7.stringifyNumber};XO.float=QO;XO.floatExp=zO;XO.floatNaN=ZO});var n7=F((qO)=>{var CJ=F1(),q5=($)=>typeof $==="bigint"||Number.isInteger($),i7=($,Z,z,{intAsBigInt:Q})=>Q?BigInt($):parseInt($.substring(Z),z);function _J($,Z,z){let{value:Q}=$;if(q5(Q)&&Q>=0)return z+Q.toString(Z);return CJ.stringifyNumber($)}var WO={identify:($)=>q5($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,z)=>i7($,2,8,z),stringify:($)=>_J($,8,"0o")},GO={identify:q5,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,z)=>i7($,0,10,z),stringify:CJ.stringifyNumber},VO={identify:($)=>q5($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,z)=>i7($,2,16,z),stringify:($)=>_J($,16,"0x")};qO.int=GO;qO.intHex=VO;qO.intOct=WO});var PJ=F((TO)=>{var MO=_1(),LO=V5(),DO=P1(),OO=f$(),NO=p7(),r7=d7(),s7=n7(),IO=[MO.map,DO.seq,OO.string,LO.nullTag,NO.boolTag,s7.intOct,s7.int,s7.intHex,r7.floatNaN,r7.floatExp,r7.float];TO.schema=IO});var RJ=F((SO)=>{var CO=B0(),_O=_1(),PO=P1();function FJ($){return typeof $==="bigint"||Number.isInteger($)}var K5=({value:$})=>JSON.stringify($),FO=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:K5},{identify:($)=>$==null,createNode:()=>new CO.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:K5},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:K5},{identify:FJ,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:z})=>z?BigInt($):parseInt($,10),stringify:({value:$})=>FJ($)?$.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:K5}],RO={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},jO=[_O.map,PO.seq].concat(FO,RO);SO.schema=jO});var a7=F((yO)=>{var u$=c0("buffer"),o7=B0(),wO=k$(),xO={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof u$.Buffer==="function")return u$.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,U;if(typeof u$.Buffer==="function")U=Y instanceof u$.Buffer?Y.toString("base64"):u$.Buffer.from(Y.buffer).toString("base64");else if(typeof btoa==="function"){let W="";for(let G=0;G<Y.length;++G)W+=String.fromCharCode(Y[G]);U=btoa(W)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(Z??(Z=o7.Scalar.BLOCK_LITERAL),Z!==o7.Scalar.QUOTE_DOUBLE){let W=Math.max(Q.options.lineWidth-Q.indent.length,Q.options.minContentWidth),G=Math.ceil(U.length/W),V=Array(G);for(let q=0,K=0;q<G;++q,K+=W)V[q]=U.substr(K,W);U=V.join(Z===o7.Scalar.BLOCK_LITERAL?`
78
+ `:" ")}return wO.stringifyString({comment:$,type:Z,value:U},Q,X,J)}};yO.binary=xO});var B5=F((hO)=>{var H5=t(),t7=G6(),kO=B0(),vO=K6();function jJ($,Z){if(H5.isSeq($))for(let z=0;z<$.items.length;++z){let Q=$.items[z];if(H5.isPair(Q))continue;else if(H5.isMap(Q)){if(Q.items.length>1)Z("Each pair must have its own sequence indicator");let X=Q.items[0]||new t7.Pair(new kO.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]=W5.isPair(Q)?Q:new n7.Pair(Q)}else Z("Expected a sequence for this tag");return $}function _J($,Z,z){let{replacer:Q}=z,X=new PO.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 U,W;if(Array.isArray(Y))if(Y.length===2)U=Y[0],W=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)U=G[0],W=Y[U];else throw TypeError(`Expected tuple with one key, not ${G.length} keys`)}else U=Y;X.items.push(n7.createPair(U,W,z))}return X}var FO={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:CJ,createNode:_J};jO.createPairs=_J;jO.pairs=FO;jO.resolvePairs=CJ});var s7=F((bO)=>{var RJ=e(),r7=z6(),v$=U6(),xO=W6(),PJ=G5();class k6 extends xO.YAMLSeq{constructor(){super();this.add=v$.YAMLMap.prototype.add.bind(this),this.delete=v$.YAMLMap.prototype.delete.bind(this),this.get=v$.YAMLMap.prototype.get.bind(this),this.has=v$.YAMLMap.prototype.has.bind(this),this.set=v$.YAMLMap.prototype.set.bind(this),this.tag=k6.tag}toJSON($,Z){if(!Z)return super.toJSON($);let z=new Map;if(Z?.onCreate)Z.onCreate(z);for(let Q of this.items){let X,J;if(RJ.isPair(Q))X=r7.toJS(Q.key,"",Z),J=r7.toJS(Q.value,X,Z);else X=r7.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=PJ.createPairs($,Z,z),X=new this;return X.items=Q.items,X}}k6.tag="tag:yaml.org,2002:omap";var yO={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:k6,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let z=PJ.resolvePairs($,Z),Q=[];for(let{key:X}of z.items)if(RJ.isScalar(X))if(Q.includes(X.value))Z(`Ordered maps must not include duplicate keys: ${X.value}`);else Q.push(X.value);return Object.assign(new k6,z)},createNode:($,Z,z)=>k6.from($,Z,z)};bO.YAMLOMap=k6;bO.omap=yO});var wJ=F((gO)=>{var FJ=L0();function jJ({value:$,source:Z},z){if(Z&&($?SJ:EJ).test.test(Z))return Z;return $?z.options.trueStr:z.options.falseStr}var SJ={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new FJ.Scalar(!0),stringify:jJ},EJ={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new FJ.Scalar(!1),stringify:jJ};gO.falseTag=EJ;gO.trueTag=SJ});var xJ=F((lO)=>{var uO=L0(),o7=C1(),mO={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:o7.stringifyNumber},cO={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():o7.stringifyNumber($)}},pO={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new uO.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:o7.stringifyNumber};lO.float=pO;lO.floatExp=cO;lO.floatNaN=mO});var bJ=F((tO)=>{var yJ=C1(),g$=($)=>typeof $==="bigint"||Number.isInteger($);function V5($,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(g$(Q)){let X=Q.toString(Z);return Q<0?"-"+z+X.substr(1):z+X}return yJ.stringifyNumber($)}var rO={identify:g$,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,z)=>V5($,2,2,z),stringify:($)=>a7($,2,"0b")},sO={identify:g$,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,z)=>V5($,1,8,z),stringify:($)=>a7($,8,"0")},oO={identify:g$,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,z)=>V5($,0,10,z),stringify:yJ.stringifyNumber},aO={identify:g$,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,z)=>V5($,2,16,z),stringify:($)=>a7($,16,"0x")};tO.int=oO;tO.intBin=rO;tO.intHex=aO;tO.intOct=sO});var t7=F((XN)=>{var H5=e(),q5=J6(),K5=U6();class v6 extends K5.YAMLMap{constructor($){super($);this.tag=v6.tag}add($){let Z;if(H5.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new q5.Pair($.key,null);else Z=new q5.Pair($,null);if(!K5.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let z=K5.findPair(this.items,$);return!Z&&H5.isPair(z)?H5.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=K5.findPair(this.items,$);if(z&&!Z)this.items.splice(this.items.indexOf(z),1);else if(!z&&Z)this.items.push(new q5.Pair($))}toJSON($,Z){return super.toJSON($,Z,Set)}toString($,Z,z){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),Z,z);else throw Error("Set items must all have null values")}static from($,Z,z){let{replacer:Q}=z,X=new this($);if(Z&&Symbol.iterator in Object(Z))for(let J of Z){if(typeof Q==="function")J=Q.call(Z,J,J);X.items.push(q5.createPair(J,null,z))}return X}}v6.tag="tag:yaml.org,2002:set";var QN={collection:"map",identify:($)=>$ instanceof Set,nodeClass:v6,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,z)=>v6.from($,Z,z),resolve($,Z){if(H5.isMap($))if($.hasAllNullValues(!0))return Object.assign(new v6,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};XN.YAMLSet=v6;XN.set=QN});var $9=F((VN)=>{var UN=C1();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,U)=>Y*X(60)+X(U),X(0));return z==="-"?X(-1)*J:J}function kJ($){let{value:Z}=$,z=(Y)=>Y;if(typeof Z==="bigint")z=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return UN.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 WN={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:kJ},GN={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:kJ},vJ={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(vJ.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,z,Q,X,J,Y,U]=Z.map(Number),W=Z[7]?Number((Z[7]+"00").substr(1,3)):0,G=Date.UTC(z,Q-1,X,J||0,Y||0,U||0,W),V=Z[8];if(V&&V!=="Z"){let q=e7(V,!1);if(Math.abs(q)<30)q*=60;G-=60000*q}return new Date(G)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};VN.floatTime=GN;VN.intTime=WN;VN.timestamp=vJ});var hJ=F((_N)=>{var BN=T1(),MN=J5(),LN=A1(),DN=b$(),ON=i7(),gJ=wJ(),Z9=xJ(),B5=bJ(),NN=a8(),IN=s7(),TN=G5(),AN=t7(),z9=$9(),CN=[BN.map,LN.seq,DN.string,MN.nullTag,gJ.trueTag,gJ.falseTag,B5.intBin,B5.intOct,B5.int,B5.intHex,Z9.floatNaN,Z9.floatExp,Z9.float,ON.binary,NN.merge,IN.omap,TN.pairs,AN.set,z9.intTime,z9.floatTime,z9.timestamp];_N.schema=CN});var rJ=F((yN)=>{var cJ=T1(),PN=J5(),pJ=A1(),FN=b$(),jN=h7(),Q9=u7(),X9=c7(),SN=IJ(),EN=AJ(),lJ=i7(),h$=a8(),dJ=s7(),iJ=G5(),fJ=hJ(),nJ=t7(),M5=$9(),uJ=new Map([["core",SN.schema],["failsafe",[cJ.map,pJ.seq,FN.string]],["json",EN.schema],["yaml11",fJ.schema],["yaml-1.1",fJ.schema]]),mJ={binary:lJ.binary,bool:jN.boolTag,float:Q9.float,floatExp:Q9.floatExp,floatNaN:Q9.floatNaN,floatTime:M5.floatTime,int:X9.int,intHex:X9.intHex,intOct:X9.intOct,intTime:M5.intTime,map:cJ.map,merge:h$.merge,null:PN.nullTag,omap:dJ.omap,pairs:iJ.pairs,seq:pJ.seq,set:nJ.set,timestamp:M5.timestamp},wN={"tag:yaml.org,2002:binary":lJ.binary,"tag:yaml.org,2002:merge":h$.merge,"tag:yaml.org,2002:omap":dJ.omap,"tag:yaml.org,2002:pairs":iJ.pairs,"tag:yaml.org,2002:set":nJ.set,"tag:yaml.org,2002:timestamp":M5.timestamp};function xN($,Z,z){let Q=uJ.get(Z);if(Q&&!$)return z&&!Q.includes(h$.merge)?Q.concat(h$.merge):Q.slice();let X=Q;if(!X)if(Array.isArray($))X=[];else{let J=Array.from(uJ.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(h$.merge);return X.reduce((J,Y)=>{let U=typeof Y==="string"?mJ[Y]:Y;if(!U){let W=JSON.stringify(Y),G=Object.keys(mJ).map((V)=>JSON.stringify(V)).join(", ");throw Error(`Unknown custom tag ${W}; use one of ${G}`)}if(!J.includes(U))J.push(U);return J},[])}yN.coreKnownTags=wN;yN.getTags=xN});var U9=F((uN)=>{var J9=e(),vN=T1(),gN=A1(),hN=b$(),L5=rJ(),fN=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class Y9{constructor({compat:$,customTags:Z,merge:z,resolveKnownTags:Q,schema:X,sortMapEntries:J,toStringDefaults:Y}){this.compat=Array.isArray($)?L5.getTags($,"compat"):$?L5.getTags(null,$):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?L5.coreKnownTags:{},this.tags=L5.getTags(Z,this.name,z),this.toStringOptions=Y??null,Object.defineProperty(this,J9.MAP,{value:vN.map}),Object.defineProperty(this,J9.SCALAR,{value:hN.string}),Object.defineProperty(this,J9.SEQ,{value:gN.seq}),this.sortMapEntries=typeof J==="function"?J:J===!0?fN:null}clone(){let $=Object.create(Y9.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}uN.Schema=Y9});var sJ=F((lN)=>{var cN=e(),W9=w$(),f$=j$();function pN($,Z){let z=[],Q=Z.directives===!0;if(Z.directives!==!1&&$.directives){let W=$.directives.toString($);if(W)z.push(W),Q=!0;else if($.directives.docStart)Q=!0}if(Q)z.push("---");let X=W9.createStringifyContext($,Z),{commentString:J}=X.options;if($.commentBefore){if(z.length!==1)z.unshift("");let W=J($.commentBefore);z.unshift(f$.indentComment(W,""))}let Y=!1,U=null;if($.contents){if(cN.isNode($.contents)){if($.contents.spaceBefore&&Q)z.push("");if($.contents.commentBefore){let V=J($.contents.commentBefore);z.push(f$.indentComment(V,""))}X.forceBlockIndent=!!$.comment,U=$.contents.comment}let W=U?void 0:()=>Y=!0,G=W9.stringify($.contents,X,()=>U=null,W);if(U)G+=f$.lineComment(G,"",J(U));if((G[0]==="|"||G[0]===">")&&z[z.length-1]==="---")z[z.length-1]=`--- ${G}`;else z.push(G)}else z.push(W9.stringify($.contents,X));if($.directives?.docEnd)if($.comment){let W=J($.comment);if(W.includes(`
81
- `))z.push("..."),z.push(f$.indentComment(W,""));else z.push(`... ${W}`)}else z.push("...");else{let W=$.comment;if(W&&Y)W=W.replace(/^\n+/,"");if(W){if((!Y||U)&&z[z.length-1]!=="")z.push("");z.push(f$.indentComment(J(W),""))}}return z.join(`
80
+ ${J.comment}`:Q.comment}Q=X}$.items[z]=H5.isPair(Q)?Q:new t7.Pair(Q)}else Z("Expected a sequence for this tag");return $}function SJ($,Z,z){let{replacer:Q}=z,X=new vO.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 U,W;if(Array.isArray(Y))if(Y.length===2)U=Y[0],W=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)U=G[0],W=Y[U];else throw TypeError(`Expected tuple with one key, not ${G.length} keys`)}else U=Y;X.items.push(t7.createPair(U,W,z))}return X}var gO={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:jJ,createNode:SJ};hO.createPairs=SJ;hO.pairs=gO;hO.resolvePairs=jJ});var $9=F((lO)=>{var EJ=t(),e7=Y6(),m$=q6(),cO=K6(),wJ=B5();class f6 extends cO.YAMLSeq{constructor(){super();this.add=m$.YAMLMap.prototype.add.bind(this),this.delete=m$.YAMLMap.prototype.delete.bind(this),this.get=m$.YAMLMap.prototype.get.bind(this),this.has=m$.YAMLMap.prototype.has.bind(this),this.set=m$.YAMLMap.prototype.set.bind(this),this.tag=f6.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(EJ.isPair(Q))X=e7.toJS(Q.key,"",Z),J=e7.toJS(Q.value,X,Z);else X=e7.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=wJ.createPairs($,Z,z),X=new this;return X.items=Q.items,X}}f6.tag="tag:yaml.org,2002:omap";var pO={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:f6,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let z=wJ.resolvePairs($,Z),Q=[];for(let{key:X}of z.items)if(EJ.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 f6,z)},createNode:($,Z,z)=>f6.from($,Z,z)};lO.YAMLOMap=f6;lO.omap=pO});var vJ=F((nO)=>{var xJ=B0();function yJ({value:$,source:Z},z){if(Z&&($?bJ:kJ).test.test(Z))return Z;return $?z.options.trueStr:z.options.falseStr}var bJ={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new xJ.Scalar(!0),stringify:yJ},kJ={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new xJ.Scalar(!1),stringify:yJ};nO.falseTag=kJ;nO.trueTag=bJ});var gJ=F(($N)=>{var oO=B0(),Z9=F1(),aO={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:Z9.stringifyNumber},tO={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():Z9.stringifyNumber($)}},eO={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new oO.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:Z9.stringifyNumber};$N.float=eO;$N.floatExp=tO;$N.floatNaN=aO});var fJ=F((WN)=>{var hJ=F1(),c$=($)=>typeof $==="bigint"||Number.isInteger($);function M5($,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 z9($,Z,z){let{value:Q}=$;if(c$(Q)){let X=Q.toString(Z);return Q<0?"-"+z+X.substr(1):z+X}return hJ.stringifyNumber($)}var XN={identify:c$,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,z)=>M5($,2,2,z),stringify:($)=>z9($,2,"0b")},JN={identify:c$,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,z)=>M5($,1,8,z),stringify:($)=>z9($,8,"0")},YN={identify:c$,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,z)=>M5($,0,10,z),stringify:hJ.stringifyNumber},UN={identify:c$,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,z)=>M5($,2,16,z),stringify:($)=>z9($,16,"0x")};WN.int=YN;WN.intBin=XN;WN.intHex=UN;WN.intOct=JN});var Q9=F((BN)=>{var O5=t(),L5=G6(),D5=q6();class u6 extends D5.YAMLMap{constructor($){super($);this.tag=u6.tag}add($){let Z;if(O5.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new L5.Pair($.key,null);else Z=new L5.Pair($,null);if(!D5.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let z=D5.findPair(this.items,$);return!Z&&O5.isPair(z)?O5.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=D5.findPair(this.items,$);if(z&&!Z)this.items.splice(this.items.indexOf(z),1);else if(!z&&Z)this.items.push(new L5.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(L5.createPair(J,null,z))}return X}}u6.tag="tag:yaml.org,2002:set";var HN={collection:"map",identify:($)=>$ instanceof Set,nodeClass:u6,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,z)=>u6.from($,Z,z),resolve($,Z){if(O5.isMap($))if($.hasAllNullValues(!0))return Object.assign(new u6,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};BN.YAMLSet=u6;BN.set=HN});var J9=F((IN)=>{var DN=F1();function X9($,Z){let z=$[0],Q=z==="-"||z==="+"?$.substring(1):$,X=(Y)=>Z?BigInt(Y):Number(Y),J=Q.replace(/_/g,"").split(":").reduce((Y,U)=>Y*X(60)+X(U),X(0));return z==="-"?X(-1)*J:J}function uJ($){let{value:Z}=$,z=(Y)=>Y;if(typeof Z==="bigint")z=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return DN.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 ON={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})=>X9($,z),stringify:uJ},NN={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:($)=>X9($,!1),stringify:uJ},mJ={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(mJ.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,z,Q,X,J,Y,U]=Z.map(Number),W=Z[7]?Number((Z[7]+"00").substr(1,3)):0,G=Date.UTC(z,Q-1,X,J||0,Y||0,U||0,W),V=Z[8];if(V&&V!=="Z"){let q=X9(V,!1);if(Math.abs(q)<30)q*=60;G-=60000*q}return new Date(G)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};IN.floatTime=NN;IN.intTime=ON;IN.timestamp=mJ});var pJ=F((bN)=>{var _N=_1(),PN=V5(),FN=P1(),RN=f$(),jN=a7(),cJ=vJ(),Y9=gJ(),N5=fJ(),SN=z5(),EN=$9(),wN=B5(),xN=Q9(),U9=J9(),yN=[_N.map,FN.seq,RN.string,PN.nullTag,cJ.trueTag,cJ.falseTag,N5.intBin,N5.intOct,N5.int,N5.intHex,Y9.floatNaN,Y9.floatExp,Y9.float,jN.binary,SN.merge,EN.omap,wN.pairs,xN.set,U9.intTime,U9.floatTime,U9.timestamp];bN.schema=yN});var eJ=F((pN)=>{var nJ=_1(),vN=V5(),rJ=P1(),gN=f$(),hN=p7(),W9=d7(),G9=n7(),fN=PJ(),uN=RJ(),sJ=a7(),p$=z5(),oJ=$9(),aJ=B5(),lJ=pJ(),tJ=Q9(),I5=J9(),dJ=new Map([["core",fN.schema],["failsafe",[nJ.map,rJ.seq,gN.string]],["json",uN.schema],["yaml11",lJ.schema],["yaml-1.1",lJ.schema]]),iJ={binary:sJ.binary,bool:hN.boolTag,float:W9.float,floatExp:W9.floatExp,floatNaN:W9.floatNaN,floatTime:I5.floatTime,int:G9.int,intHex:G9.intHex,intOct:G9.intOct,intTime:I5.intTime,map:nJ.map,merge:p$.merge,null:vN.nullTag,omap:oJ.omap,pairs:aJ.pairs,seq:rJ.seq,set:tJ.set,timestamp:I5.timestamp},mN={"tag:yaml.org,2002:binary":sJ.binary,"tag:yaml.org,2002:merge":p$.merge,"tag:yaml.org,2002:omap":oJ.omap,"tag:yaml.org,2002:pairs":aJ.pairs,"tag:yaml.org,2002:set":tJ.set,"tag:yaml.org,2002:timestamp":I5.timestamp};function cN($,Z,z){let Q=dJ.get(Z);if(Q&&!$)return z&&!Q.includes(p$.merge)?Q.concat(p$.merge):Q.slice();let X=Q;if(!X)if(Array.isArray($))X=[];else{let J=Array.from(dJ.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(p$.merge);return X.reduce((J,Y)=>{let U=typeof Y==="string"?iJ[Y]:Y;if(!U){let W=JSON.stringify(Y),G=Object.keys(iJ).map((V)=>JSON.stringify(V)).join(", ");throw Error(`Unknown custom tag ${W}; use one of ${G}`)}if(!J.includes(U))J.push(U);return J},[])}pN.coreKnownTags=mN;pN.getTags=cN});var K9=F((oN)=>{var V9=t(),iN=_1(),nN=P1(),rN=f$(),T5=eJ(),sN=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class q9{constructor({compat:$,customTags:Z,merge:z,resolveKnownTags:Q,schema:X,sortMapEntries:J,toStringDefaults:Y}){this.compat=Array.isArray($)?T5.getTags($,"compat"):$?T5.getTags(null,$):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?T5.coreKnownTags:{},this.tags=T5.getTags(Z,this.name,z),this.toStringOptions=Y??null,Object.defineProperty(this,V9.MAP,{value:iN.map}),Object.defineProperty(this,V9.SCALAR,{value:rN.string}),Object.defineProperty(this,V9.SEQ,{value:nN.seq}),this.sortMapEntries=typeof J==="function"?J:J===!0?sN:null}clone(){let $=Object.create(q9.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}oN.Schema=q9});var $Y=F(($I)=>{var tN=t(),H9=v$(),l$=y$();function eN($,Z){let z=[],Q=Z.directives===!0;if(Z.directives!==!1&&$.directives){let W=$.directives.toString($);if(W)z.push(W),Q=!0;else if($.directives.docStart)Q=!0}if(Q)z.push("---");let X=H9.createStringifyContext($,Z),{commentString:J}=X.options;if($.commentBefore){if(z.length!==1)z.unshift("");let W=J($.commentBefore);z.unshift(l$.indentComment(W,""))}let Y=!1,U=null;if($.contents){if(tN.isNode($.contents)){if($.contents.spaceBefore&&Q)z.push("");if($.contents.commentBefore){let V=J($.contents.commentBefore);z.push(l$.indentComment(V,""))}X.forceBlockIndent=!!$.comment,U=$.contents.comment}let W=U?void 0:()=>Y=!0,G=H9.stringify($.contents,X,()=>U=null,W);if(U)G+=l$.lineComment(G,"",J(U));if((G[0]==="|"||G[0]===">")&&z[z.length-1]==="---")z[z.length-1]=`--- ${G}`;else z.push(G)}else z.push(H9.stringify($.contents,X));if($.directives?.docEnd)if($.comment){let W=J($.comment);if(W.includes(`
81
+ `))z.push("..."),z.push(l$.indentComment(W,""));else z.push(`... ${W}`)}else z.push("...");else{let W=$.comment;if(W&&Y)W=W.replace(/^\n+/,"");if(W){if((!Y||U)&&z[z.length-1]!=="")z.push("");z.push(l$.indentComment(J(W),""))}}return z.join(`
82
82
  `)+`
83
- `}lN.stringifyDocument=pN});var u$=F((eN)=>{var iN=P$(),_1=l8(),J2=e(),nN=J6(),rN=z6(),sN=U9(),oN=sJ(),G9=m8(),aN=j7(),tN=F$(),V9=F7();class q9{constructor($,Z,z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,J2.NODE_TYPE,{value:J2.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 V9.Directives({version:J});this.setSchema(J,z),this.contents=$===void 0?null:this.createNode($,Q,z)}clone(){let $=Object.create(q9.prototype,{[J2.NODE_TYPE]:{value:J2.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=J2.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(R1(this.contents))this.contents.add($)}addIn($,Z){if(R1(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let z=G9.anchorNames(this);$.anchor=!Z||z.has(Z)?G9.findNewAnchor(Z||"a",z):Z}return new iN.Alias($.anchor)}createNode($,Z,z){let Q=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),Q=Z;else if(Array.isArray(Z)){let B=(N)=>typeof N==="number"||N instanceof String||N instanceof Number,D=Z.filter(B).map(String);if(D.length>0)Z=Z.concat(D);Q=Z}else if(z===void 0&&Z)z=Z,Z=void 0;let{aliasDuplicateObjects:X,anchorPrefix:J,flow:Y,keepUndefined:U,onTagObj:W,tag:G}=z??{},{onAnchor:V,setAnchors:q,sourceObjects:K}=G9.createNodeAnchors(this,J||"a"),H={aliasDuplicateObjects:X??!0,keepUndefined:U??!1,onAnchor:V,onTagObj:W,replacer:Q,schema:this.schema,sourceObjects:K},L=tN.createNode($,G,H);if(Y&&J2.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 nN.Pair(Q,X)}delete($){return R1(this.contents)?this.contents.delete($):!1}deleteIn($){if(_1.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return R1(this.contents)?this.contents.deleteIn($):!1}get($,Z){return J2.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(_1.isEmptyPath($))return!Z&&J2.isScalar(this.contents)?this.contents.value:this.contents;return J2.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return J2.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(_1.isEmptyPath($))return this.contents!==void 0;return J2.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=_1.collectionFromPath(this.schema,[$],Z);else if(R1(this.contents))this.contents.set($,Z)}setIn($,Z){if(_1.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=_1.collectionFromPath(this.schema,Array.from($),Z);else if(R1(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 V9.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 V9.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 sN.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},U=rN.toJS(this.contents,Z??"",Y);if(typeof X==="function")for(let{count:W,res:G}of Y.anchors.values())X(G,W);return typeof J==="function"?aN.applyReviver(J,{"":U},"",U):U}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 oN.stringifyDocument(this,$)}}function R1($){if(J2.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}eN.Document=q9});var m$=F((zI)=>{class D5 extends Error{constructor($,Z,z,Q){super();this.name=$,this.code=z,this.message=Q,this.pos=Z}}class oJ extends D5{constructor($,Z,z){super("YAMLParseError",$,Z,z)}}class aJ extends D5{constructor($,Z,z){super("YAMLWarning",$,Z,z)}}var ZI=($,Z)=>(z)=>{if(z.pos[0]===-1)return;z.linePos=z.pos.map((U)=>Z.linePos(U));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 U=Math.min(J-39,Y.length-79);Y="…"+Y.substring(U),J-=U-1}if(Y.length>80)Y=Y.substring(0,79)+"…";if(Q>1&&/^ *$/.test(Y.substring(0,J))){let U=$.substring(Z.lineStarts[Q-2],Z.lineStarts[Q-1]);if(U.length>80)U=U.substring(0,79)+`…
83
+ `}$I.stringifyDocument=eN});var d$=F((GI)=>{var zI=w$(),R1=s8(),J2=t(),QI=G6(),XI=Y6(),JI=K9(),YI=$Y(),B9=i8(),UI=y7(),WI=x$(),M9=x7();class L9{constructor($,Z,z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,J2.NODE_TYPE,{value:J2.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 M9.Directives({version:J});this.setSchema(J,z),this.contents=$===void 0?null:this.createNode($,Q,z)}clone(){let $=Object.create(L9.prototype,{[J2.NODE_TYPE]:{value:J2.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=J2.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(j1(this.contents))this.contents.add($)}addIn($,Z){if(j1(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let z=B9.anchorNames(this);$.anchor=!Z||z.has(Z)?B9.findNewAnchor(Z||"a",z):Z}return new zI.Alias($.anchor)}createNode($,Z,z){let Q=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),Q=Z;else if(Array.isArray(Z)){let H=(N)=>typeof N==="number"||N instanceof String||N instanceof Number,D=Z.filter(H).map(String);if(D.length>0)Z=Z.concat(D);Q=Z}else if(z===void 0&&Z)z=Z,Z=void 0;let{aliasDuplicateObjects:X,anchorPrefix:J,flow:Y,keepUndefined:U,onTagObj:W,tag:G}=z??{},{onAnchor:V,setAnchors:q,sourceObjects:K}=B9.createNodeAnchors(this,J||"a"),L={aliasDuplicateObjects:X??!0,keepUndefined:U??!1,onAnchor:V,onTagObj:W,replacer:Q,schema:this.schema,sourceObjects:K},B=WI.createNode($,G,L);if(Y&&J2.isCollection(B))B.flow=!0;return q(),B}createPair($,Z,z={}){let Q=this.createNode($,null,z),X=this.createNode(Z,null,z);return new QI.Pair(Q,X)}delete($){return j1(this.contents)?this.contents.delete($):!1}deleteIn($){if(R1.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return j1(this.contents)?this.contents.deleteIn($):!1}get($,Z){return J2.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(R1.isEmptyPath($))return!Z&&J2.isScalar(this.contents)?this.contents.value:this.contents;return J2.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return J2.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(R1.isEmptyPath($))return this.contents!==void 0;return J2.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=R1.collectionFromPath(this.schema,[$],Z);else if(j1(this.contents))this.contents.set($,Z)}setIn($,Z){if(R1.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=R1.collectionFromPath(this.schema,Array.from($),Z);else if(j1(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 M9.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 M9.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 JI.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},U=XI.toJS(this.contents,Z??"",Y);if(typeof X==="function")for(let{count:W,res:G}of Y.anchors.values())X(G,W);return typeof J==="function"?UI.applyReviver(J,{"":U},"",U):U}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 YI.stringifyDocument(this,$)}}function j1($){if(J2.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}GI.Document=L9});var i$=F((KI)=>{class A5 extends Error{constructor($,Z,z,Q){super();this.name=$,this.code=z,this.message=Q,this.pos=Z}}class ZY extends A5{constructor($,Z,z){super("YAMLParseError",$,Z,z)}}class zY extends A5{constructor($,Z,z){super("YAMLWarning",$,Z,z)}}var qI=($,Z)=>(z)=>{if(z.pos[0]===-1)return;z.linePos=z.pos.map((U)=>Z.linePos(U));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 U=Math.min(J-39,Y.length-79);Y="…"+Y.substring(U),J-=U-1}if(Y.length>80)Y=Y.substring(0,79)+"…";if(Q>1&&/^ *$/.test(Y.substring(0,J))){let U=$.substring(Z.lineStarts[Q-2],Z.lineStarts[Q-1]);if(U.length>80)U=U.substring(0,79)+`…
84
84
  `;Y=U+Y}if(/[^ ]/.test(Y)){let U=1,W=z.linePos[1];if(W?.line===Q&&W.col>X)U=Math.max(1,Math.min(W.col-X,80-J));let G=" ".repeat(J)+"^".repeat(U);z.message+=`:
85
85
 
86
86
  ${Y}
87
87
  ${G}
88
- `}};zI.YAMLError=D5;zI.YAMLParseError=oJ;zI.YAMLWarning=aJ;zI.prettifyError=ZI});var c$=F((WI)=>{function UI($,{flow:Z,indicator:z,next:Q,offset:X,onError:J,parentIndent:Y,startOnNewline:U}){let W=!1,G=U,V=U,q="",K="",H=!1,L=!1,B=null,D=null,N=null,_=null,E=null,P=null,y=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+=K+d;K="",G=!1;break}case"newline":if(G){if(q)q+=S.source;else if(!P||z!=="seq-item-ind")W=!0}else K+=S.source;if(G=!0,H=!0,D||N)_=S;V=!0;break;case"anchor":if(D)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);D=S,y??(y=S.offset),G=!1,V=!1,L=!0;break;case"tag":{if(N)J(S,"MULTIPLE_TAGS","A node can have at most one tag");N=S,y??(y=S.offset),G=!1,V=!1,L=!0;break}case z:if(D||N)J(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`);if(P)J(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${Z??"collection"}`);P=S,G=z==="seq-item-ind"||z==="explicit-key-ind",V=!1;break;case"comma":if(Z){if(E)J(S,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);E=S,G=!1,V=!1;break}default:J(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),G=!1,V=!1}}let w=$[$.length-1],u=w?w.offset+w.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:E,found:P,spaceBefore:W,comment:q,hasNewline:H,anchor:D,tag:N,newlineAfterProp:_,end:u,start:y??u}}WI.resolveProps=UI});var O5=F((VI)=>{function K9($){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(K9(Z.key)||K9(Z.value))return!0}return!1;default:return!0}}VI.containsNewline=K9});var H9=F((BI)=>{var KI=O5();function HI($,Z,z){if(Z?.type==="flow-collection"){let Q=Z.end[0];if(Q.indent===$&&(Q.source==="]"||Q.source==="}")&&KI.containsNewline(Z))z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}BI.flowIndentCheck=HI});var B9=F((DI)=>{var tJ=e();function LI($,Z,z){let{uniqueKeys:Q}=$.options;if(Q===!1)return!1;let X=typeof Q==="function"?Q:(J,Y)=>J===Y||tJ.isScalar(J)&&tJ.isScalar(Y)&&J.value===Y.value;return Z.some((J)=>X(J.key,z))}DI.mapIncludes=LI});var QY=F((CI)=>{var eJ=J6(),NI=U6(),$Y=c$(),II=O5(),ZY=H9(),TI=B9(),zY="All mapping items must start at the same column";function AI({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let U=new(J?.nodeClass??NI.YAMLMap)(z.schema);if(z.atRoot)z.atRoot=!1;let W=Q.offset,G=null;for(let V of Q.items){let{start:q,key:K,sep:H,value:L}=V,B=$Y.resolveProps(q,{indicator:"explicit-key-ind",next:K??H?.[0],offset:W,onError:X,parentIndent:Q.indent,startOnNewline:!0}),D=!B.found;if(D){if(K){if(K.type==="block-seq")X(W,"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(W,"BAD_INDENT",zY)}if(!B.anchor&&!B.tag&&!H){if(G=B.end,B.comment)if(U.comment)U.comment+=`
90
- `+B.comment;else U.comment=B.comment;continue}if(B.newlineAfterProp||II.containsNewline(K))X(K??q[q.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(B.found?.indent!==Q.indent)X(W,"BAD_INDENT",zY);z.atKey=!0;let N=B.end,_=K?$(z,K,B,X):Z(z,N,q,null,B,X);if(z.schema.compat)ZY.flowIndentCheck(Q.indent,K,X);if(z.atKey=!1,TI.mapIncludes(z,U.items,_))X(N,"DUPLICATE_KEY","Map keys must be unique");let E=$Y.resolveProps(H??[],{indicator:"map-value-ind",next:L,offset:_.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!K||K.type==="block-scalar"});if(W=E.end,E.found){if(D){if(L?.type==="block-map"&&!E.hasNewline)X(W,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(z.options.strict&&B.start<E.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 P=L?$(z,L,E,X):Z(z,W,H,null,E,X);if(z.schema.compat)ZY.flowIndentCheck(Q.indent,L,X);W=P.range[2];let y=new eJ.Pair(_,P);if(z.options.keepSourceTokens)y.srcToken=V;U.items.push(y)}else{if(D)X(_.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(E.comment)if(_.comment)_.comment+=`
91
- `+E.comment;else _.comment=E.comment;let P=new eJ.Pair(_);if(z.options.keepSourceTokens)P.srcToken=V;U.items.push(P)}}if(G&&G<W)X(G,"IMPOSSIBLE","Map comment with trailing content");return U.range=[Q.offset,W,G??W],U}CI.resolveBlockMap=AI});var XY=F((SI)=>{var RI=W6(),PI=c$(),FI=H9();function jI({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let U=new(J?.nodeClass??RI.YAMLSeq)(z.schema);if(z.atRoot)z.atRoot=!1;if(z.atKey)z.atKey=!1;let W=Q.offset,G=null;for(let{start:V,value:q}of Q.items){let K=PI.resolveProps(V,{indicator:"seq-item-ind",next:q,offset:W,onError:X,parentIndent:Q.indent,startOnNewline:!0});if(!K.found)if(K.anchor||K.tag||q)if(q?.type==="block-seq")X(K.end,"BAD_INDENT","All sequence items must start at the same column");else X(W,"MISSING_CHAR","Sequence item without - indicator");else{if(G=K.end,K.comment)U.comment=K.comment;continue}let H=q?$(z,q,K,X):Z(z,K.end,V,null,K,X);if(z.schema.compat)FI.flowIndentCheck(Q.indent,q,X);W=H.range[2],U.items.push(H)}return U.range=[Q.offset,W,G??W],U}SI.resolveBlockSeq=jI});var P1=F((xI)=>{function wI($,Z,z,Q){let X="";if($){let J=!1,Y="";for(let U of $){let{source:W,type:G}=U;switch(G){case"space":J=!0;break;case"comment":{if(z&&!J)Q(U,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let V=W.substring(1)||" ";if(!X)X=V;else X+=Y+V;Y="";break}case"newline":if(X)Y+=W;J=!0;break;default:Q(U,"UNEXPECTED_TOKEN",`Unexpected ${G} at node end`)}Z+=W.length}}return{comment:X,offset:Z}}xI.resolveEnd=wI});var UY=F((mI)=>{var bI=e(),kI=J6(),JY=U6(),vI=W6(),gI=P1(),YY=c$(),hI=O5(),fI=B9(),M9="Block collections are not allowed within flow collections",L9=($)=>$&&($.type==="block-map"||$.type==="block-seq");function uI({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let Y=Q.start.source==="{",U=Y?"flow map":"flow sequence",G=new(J?.nodeClass??(Y?JY.YAMLMap:vI.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 D=0;D<Q.items.length;++D){let N=Q.items[D],{start:_,key:E,sep:P,value:y}=N,w=YY.resolveProps(_,{flow:U,indicator:"explicit-key-ind",next:E??P?.[0],offset:q,onError:X,parentIndent:Q.indent,startOnNewline:!1});if(!w.found){if(!w.anchor&&!w.tag&&!P&&!y){if(D===0&&w.comma)X(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${U}`);else if(D<Q.items.length-1)X(w.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${U}`);if(w.comment)if(G.comment)G.comment+=`
92
- `+w.comment;else G.comment=w.comment;q=w.end;continue}if(!Y&&z.options.strict&&hI.containsNewline(E))X(E,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(D===0){if(w.comma)X(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${U}`)}else{if(!w.comma)X(w.start,"MISSING_CHAR",`Missing , between ${U} items`);if(w.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(bI.isPair(S))S=S.value??S.key;if(S.comment)S.comment+=`
93
- `+u;else S.comment=u;w.comment=w.comment.substring(u.length+1)}}}if(!Y&&!P&&!w.found){let u=y?$(z,y,w,X):Z(z,w.end,P,null,w,X);if(G.items.push(u),q=u.range[2],L9(y))X(u.range,"BLOCK_IN_FLOW",M9)}else{z.atKey=!0;let u=w.end,S=E?$(z,E,w,X):Z(z,u,_,null,w,X);if(L9(E))X(S.range,"BLOCK_IN_FLOW",M9);z.atKey=!1;let d=YY.resolveProps(P??[],{flow:U,indicator:"map-value-ind",next:y,offset:S.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!1});if(d.found){if(!Y&&!w.found&&z.options.strict){if(P)for(let z0 of P){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(w.start<d.found.offset-1024)X(d.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(y)if("source"in y&&y.source?.[0]===":")X(y,"MISSING_CHAR",`Missing space after : in ${U}`);else X(d.start,"MISSING_CHAR",`Missing , or : between ${U} items`);let I0=y?$(z,y,d,X):d.found?Z(z,d.end,P,null,d,X):null;if(I0){if(L9(y))X(I0.range,"BLOCK_IN_FLOW",M9)}else if(d.comment)if(S.comment)S.comment+=`
94
- `+d.comment;else S.comment=d.comment;let S0=new kI.Pair(S,I0);if(z.options.keepSourceTokens)S0.srcToken=N;if(Y){let z0=G;if(fI.mapIncludes(z,z0.items,S))X(u,"DUPLICATE_KEY","Map keys must be unique");z0.items.push(S0)}else{let z0=new JY.YAMLMap(z.schema);z0.flow=!0,z0.items.push(S0);let k=(I0??S).range;z0.range=[S.range[0],k[1],k[2]],G.items.push(z0)}q=I0?I0.range[2]:d.end}}let K=Y?"}":"]",[H,...L]=Q.end,B=q;if(H?.source===K)B=H.offset+H.source.length;else{let D=U[0].toUpperCase()+U.substring(1),N=V?`${D} must end with a ${K}`:`${D} in block collection must be sufficiently indented and end with a ${K}`;if(X(q,V?"MISSING_CHAR":"BAD_INDENT",N),H&&H.source.length!==1)L.unshift(H)}if(L.length>0){let D=gI.resolveEnd(L,B,z.options.strict,X);if(D.comment)if(G.comment)G.comment+=`
95
- `+D.comment;else G.comment=D.comment;G.range=[Q.offset,B,D.offset]}else G.range=[Q.offset,B,B];return G}mI.resolveFlowCollection=uI});var WY=F((aI)=>{var pI=e(),lI=L0(),dI=U6(),iI=W6(),nI=QY(),rI=XY(),sI=UY();function D9($,Z,z,Q,X,J){let Y=z.type==="block-map"?nI.resolveBlockMap($,Z,z,Q,J):z.type==="block-seq"?rI.resolveBlockSeq($,Z,z,Q,J):sI.resolveFlowCollection($,Z,z,Q,J),U=Y.constructor;if(X==="!"||X===U.tagName)return Y.tag=U.tagName,Y;if(X)Y.tag=X;return Y}function oI($,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:H}=Q,L=K&&J?K.offset>J.offset?K:J:K??J;if(L&&(!H||H.offset<L.offset))X(L,"MISSING_CHAR","Missing newline after block sequence props")}let U=z.type==="block-map"?"map":z.type==="block-seq"?"seq":z.start.source==="{"?"map":"seq";if(!J||!Y||Y==="!"||Y===dI.YAMLMap.tagName&&U==="map"||Y===iI.YAMLSeq.tagName&&U==="seq")return D9($,Z,z,X,Y);let W=Z.schema.tags.find((K)=>K.tag===Y&&K.collection===U);if(!W){let K=Z.schema.knownTags[Y];if(K?.collection===U)Z.schema.tags.push(Object.assign({},K,{default:!1})),W=K;else{if(K)X(J,"BAD_COLLECTION_TYPE",`${K.tag} used for ${U} collection, but expects ${K.collection??"scalar"}`,!0);else X(J,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return D9($,Z,z,X,Y)}}let G=D9($,Z,z,X,Y,W),V=W.resolve?.(G,(K)=>X(J,"TAG_RESOLVE_FAILED",K),Z.options)??G,q=pI.isNode(V)?V:new lI.Scalar(V);if(q.range=G.range,q.tag=Y,W?.format)q.format=W.format;return q}aI.composeCollection=oI});var N9=F((zT)=>{var O9=L0();function eI($,Z,z){let Q=Z.offset,X=$T(Z,$.options.strict,z);if(!X)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let J=X.mode===">"?O9.Scalar.BLOCK_FOLDED:O9.Scalar.BLOCK_LITERAL,Y=Z.source?ZT(Z.source):[],U=Y.length;for(let B=Y.length-1;B>=0;--B){let D=Y[B][1];if(D===""||D==="\r")U=B;else break}if(U===0){let B=X.chomp==="+"&&Y.length>0?`
96
- `.repeat(Math.max(1,Y.length-1)):"",D=Q+X.length;if(Z.source)D+=Z.source.length;return{value:B,type:J,comment:X.comment,range:[Q,D,D]}}let W=Z.indent+X.indent,G=Z.offset+X.length,V=0;for(let B=0;B<U;++B){let[D,N]=Y[B];if(N===""||N==="\r"){if(X.indent===0&&D.length>W)W=D.length}else{if(D.length<W)z(G+D.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(X.indent===0)W=D.length;if(V=B,W===0&&!$.atRoot)z(G,"BAD_INDENT","Block scalar values in collections must be indented");break}G+=D.length+N.length+1}for(let B=Y.length-1;B>=U;--B)if(Y[B][0].length>W)U=B+1;let q="",K="",H=!1;for(let B=0;B<V;++B)q+=Y[B][0].slice(W)+`
97
- `;for(let B=V;B<U;++B){let[D,N]=Y[B];G+=D.length+N.length+1;let _=N[N.length-1]==="\r";if(_)N=N.slice(0,-1);if(N&&D.length<W){let P=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;z(G-N.length-(_?2:1),"BAD_INDENT",P),D=""}if(J===O9.Scalar.BLOCK_LITERAL)q+=K+D.slice(W)+N,K=`
88
+ `}};KI.YAMLError=A5;KI.YAMLParseError=ZY;KI.YAMLWarning=zY;KI.prettifyError=qI});var n$=F((OI)=>{function DI($,{flow:Z,indicator:z,next:Q,offset:X,onError:J,parentIndent:Y,startOnNewline:U}){let W=!1,G=U,V=U,q="",K="",L=!1,B=!1,H=null,D=null,N=null,_=null,E=null,j=null,x=null;for(let S of $){if(B){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");B=!1}if(H){if(G&&S.type!=="comment"&&S.type!=="newline")J(H,"TAB_AS_INDENT","Tabs are not allowed as indentation");H=null}switch(S.type){case"space":if(!Z&&(z!=="doc-start"||Q?.type!=="flow-collection")&&S.source.includes("\t"))H=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+=K+d;K="",G=!1;break}case"newline":if(G){if(q)q+=S.source;else if(!j||z!=="seq-item-ind")W=!0}else K+=S.source;if(G=!0,L=!0,D||N)_=S;V=!0;break;case"anchor":if(D)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);D=S,x??(x=S.offset),G=!1,V=!1,B=!0;break;case"tag":{if(N)J(S,"MULTIPLE_TAGS","A node can have at most one tag");N=S,x??(x=S.offset),G=!1,V=!1,B=!0;break}case z:if(D||N)J(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`);if(j)J(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${Z??"collection"}`);j=S,G=z==="seq-item-ind"||z==="explicit-key-ind",V=!1;break;case"comma":if(Z){if(E)J(S,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);E=S,G=!1,V=!1;break}default:J(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),G=!1,V=!1}}let w=$[$.length-1],u=w?w.offset+w.source.length:X;if(B&&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(H&&(G&&H.indent<=Y||Q?.type==="block-map"||Q?.type==="block-seq"))J(H,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:E,found:j,spaceBefore:W,comment:q,hasNewline:L,anchor:D,tag:N,newlineAfterProp:_,end:u,start:x??u}}OI.resolveProps=DI});var C5=F((II)=>{function D9($){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(D9(Z.key)||D9(Z.value))return!0}return!1;default:return!0}}II.containsNewline=D9});var O9=F((_I)=>{var AI=C5();function CI($,Z,z){if(Z?.type==="flow-collection"){let Q=Z.end[0];if(Q.indent===$&&(Q.source==="]"||Q.source==="}")&&AI.containsNewline(Z))z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}_I.flowIndentCheck=CI});var N9=F((RI)=>{var QY=t();function FI($,Z,z){let{uniqueKeys:Q}=$.options;if(Q===!1)return!1;let X=typeof Q==="function"?Q:(J,Y)=>J===Y||QY.isScalar(J)&&QY.isScalar(Y)&&J.value===Y.value;return Z.some((J)=>X(J.key,z))}RI.mapIncludes=FI});var WY=F((yI)=>{var XY=G6(),SI=q6(),JY=n$(),EI=C5(),YY=O9(),wI=N9(),UY="All mapping items must start at the same column";function xI({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let U=new(J?.nodeClass??SI.YAMLMap)(z.schema);if(z.atRoot)z.atRoot=!1;let W=Q.offset,G=null;for(let V of Q.items){let{start:q,key:K,sep:L,value:B}=V,H=JY.resolveProps(q,{indicator:"explicit-key-ind",next:K??L?.[0],offset:W,onError:X,parentIndent:Q.indent,startOnNewline:!0}),D=!H.found;if(D){if(K){if(K.type==="block-seq")X(W,"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(W,"BAD_INDENT",UY)}if(!H.anchor&&!H.tag&&!L){if(G=H.end,H.comment)if(U.comment)U.comment+=`
90
+ `+H.comment;else U.comment=H.comment;continue}if(H.newlineAfterProp||EI.containsNewline(K))X(K??q[q.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(H.found?.indent!==Q.indent)X(W,"BAD_INDENT",UY);z.atKey=!0;let N=H.end,_=K?$(z,K,H,X):Z(z,N,q,null,H,X);if(z.schema.compat)YY.flowIndentCheck(Q.indent,K,X);if(z.atKey=!1,wI.mapIncludes(z,U.items,_))X(N,"DUPLICATE_KEY","Map keys must be unique");let E=JY.resolveProps(L??[],{indicator:"map-value-ind",next:B,offset:_.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!K||K.type==="block-scalar"});if(W=E.end,E.found){if(D){if(B?.type==="block-map"&&!E.hasNewline)X(W,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(z.options.strict&&H.start<E.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 j=B?$(z,B,E,X):Z(z,W,L,null,E,X);if(z.schema.compat)YY.flowIndentCheck(Q.indent,B,X);W=j.range[2];let x=new XY.Pair(_,j);if(z.options.keepSourceTokens)x.srcToken=V;U.items.push(x)}else{if(D)X(_.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(E.comment)if(_.comment)_.comment+=`
91
+ `+E.comment;else _.comment=E.comment;let j=new XY.Pair(_);if(z.options.keepSourceTokens)j.srcToken=V;U.items.push(j)}}if(G&&G<W)X(G,"IMPOSSIBLE","Map comment with trailing content");return U.range=[Q.offset,W,G??W],U}yI.resolveBlockMap=xI});var GY=F((fI)=>{var kI=K6(),vI=n$(),gI=O9();function hI({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let U=new(J?.nodeClass??kI.YAMLSeq)(z.schema);if(z.atRoot)z.atRoot=!1;if(z.atKey)z.atKey=!1;let W=Q.offset,G=null;for(let{start:V,value:q}of Q.items){let K=vI.resolveProps(V,{indicator:"seq-item-ind",next:q,offset:W,onError:X,parentIndent:Q.indent,startOnNewline:!0});if(!K.found)if(K.anchor||K.tag||q)if(q?.type==="block-seq")X(K.end,"BAD_INDENT","All sequence items must start at the same column");else X(W,"MISSING_CHAR","Sequence item without - indicator");else{if(G=K.end,K.comment)U.comment=K.comment;continue}let L=q?$(z,q,K,X):Z(z,K.end,V,null,K,X);if(z.schema.compat)gI.flowIndentCheck(Q.indent,q,X);W=L.range[2],U.items.push(L)}return U.range=[Q.offset,W,G??W],U}fI.resolveBlockSeq=hI});var S1=F((cI)=>{function mI($,Z,z,Q){let X="";if($){let J=!1,Y="";for(let U of $){let{source:W,type:G}=U;switch(G){case"space":J=!0;break;case"comment":{if(z&&!J)Q(U,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let V=W.substring(1)||" ";if(!X)X=V;else X+=Y+V;Y="";break}case"newline":if(X)Y+=W;J=!0;break;default:Q(U,"UNEXPECTED_TOKEN",`Unexpected ${G} at node end`)}Z+=W.length}}return{comment:X,offset:Z}}cI.resolveEnd=mI});var KY=F((aI)=>{var lI=t(),dI=G6(),VY=q6(),iI=K6(),nI=S1(),qY=n$(),rI=C5(),sI=N9(),I9="Block collections are not allowed within flow collections",T9=($)=>$&&($.type==="block-map"||$.type==="block-seq");function oI({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let Y=Q.start.source==="{",U=Y?"flow map":"flow sequence",G=new(J?.nodeClass??(Y?VY.YAMLMap:iI.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 D=0;D<Q.items.length;++D){let N=Q.items[D],{start:_,key:E,sep:j,value:x}=N,w=qY.resolveProps(_,{flow:U,indicator:"explicit-key-ind",next:E??j?.[0],offset:q,onError:X,parentIndent:Q.indent,startOnNewline:!1});if(!w.found){if(!w.anchor&&!w.tag&&!j&&!x){if(D===0&&w.comma)X(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${U}`);else if(D<Q.items.length-1)X(w.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${U}`);if(w.comment)if(G.comment)G.comment+=`
92
+ `+w.comment;else G.comment=w.comment;q=w.end;continue}if(!Y&&z.options.strict&&rI.containsNewline(E))X(E,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(D===0){if(w.comma)X(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${U}`)}else{if(!w.comma)X(w.start,"MISSING_CHAR",`Missing , between ${U} items`);if(w.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(lI.isPair(S))S=S.value??S.key;if(S.comment)S.comment+=`
93
+ `+u;else S.comment=u;w.comment=w.comment.substring(u.length+1)}}}if(!Y&&!j&&!w.found){let u=x?$(z,x,w,X):Z(z,w.end,j,null,w,X);if(G.items.push(u),q=u.range[2],T9(x))X(u.range,"BLOCK_IN_FLOW",I9)}else{z.atKey=!0;let u=w.end,S=E?$(z,E,w,X):Z(z,u,_,null,w,X);if(T9(E))X(S.range,"BLOCK_IN_FLOW",I9);z.atKey=!1;let d=qY.resolveProps(j??[],{flow:U,indicator:"map-value-ind",next:x,offset:S.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!1});if(d.found){if(!Y&&!w.found&&z.options.strict){if(j)for(let $0 of j){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(w.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(x)if("source"in x&&x.source?.[0]===":")X(x,"MISSING_CHAR",`Missing space after : in ${U}`);else X(d.start,"MISSING_CHAR",`Missing , or : between ${U} items`);let y0=x?$(z,x,d,X):d.found?Z(z,d.end,j,null,d,X):null;if(y0){if(T9(x))X(y0.range,"BLOCK_IN_FLOW",I9)}else if(d.comment)if(S.comment)S.comment+=`
94
+ `+d.comment;else S.comment=d.comment;let j0=new dI.Pair(S,y0);if(z.options.keepSourceTokens)j0.srcToken=N;if(Y){let $0=G;if(sI.mapIncludes(z,$0.items,S))X(u,"DUPLICATE_KEY","Map keys must be unique");$0.items.push(j0)}else{let $0=new VY.YAMLMap(z.schema);$0.flow=!0,$0.items.push(j0);let S2=(y0??S).range;$0.range=[S.range[0],S2[1],S2[2]],G.items.push($0)}q=y0?y0.range[2]:d.end}}let K=Y?"}":"]",[L,...B]=Q.end,H=q;if(L?.source===K)H=L.offset+L.source.length;else{let D=U[0].toUpperCase()+U.substring(1),N=V?`${D} must end with a ${K}`:`${D} in block collection must be sufficiently indented and end with a ${K}`;if(X(q,V?"MISSING_CHAR":"BAD_INDENT",N),L&&L.source.length!==1)B.unshift(L)}if(B.length>0){let D=nI.resolveEnd(B,H,z.options.strict,X);if(D.comment)if(G.comment)G.comment+=`
95
+ `+D.comment;else G.comment=D.comment;G.range=[Q.offset,H,D.offset]}else G.range=[Q.offset,H,H];return G}aI.resolveFlowCollection=oI});var HY=F((UT)=>{var eI=t(),$T=B0(),ZT=q6(),zT=K6(),QT=WY(),XT=GY(),JT=KY();function A9($,Z,z,Q,X,J){let Y=z.type==="block-map"?QT.resolveBlockMap($,Z,z,Q,J):z.type==="block-seq"?XT.resolveBlockSeq($,Z,z,Q,J):JT.resolveFlowCollection($,Z,z,Q,J),U=Y.constructor;if(X==="!"||X===U.tagName)return Y.tag=U.tagName,Y;if(X)Y.tag=X;return Y}function YT($,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:L}=Q,B=K&&J?K.offset>J.offset?K:J:K??J;if(B&&(!L||L.offset<B.offset))X(B,"MISSING_CHAR","Missing newline after block sequence props")}let U=z.type==="block-map"?"map":z.type==="block-seq"?"seq":z.start.source==="{"?"map":"seq";if(!J||!Y||Y==="!"||Y===ZT.YAMLMap.tagName&&U==="map"||Y===zT.YAMLSeq.tagName&&U==="seq")return A9($,Z,z,X,Y);let W=Z.schema.tags.find((K)=>K.tag===Y&&K.collection===U);if(!W){let K=Z.schema.knownTags[Y];if(K?.collection===U)Z.schema.tags.push(Object.assign({},K,{default:!1})),W=K;else{if(K)X(J,"BAD_COLLECTION_TYPE",`${K.tag} used for ${U} collection, but expects ${K.collection??"scalar"}`,!0);else X(J,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return A9($,Z,z,X,Y)}}let G=A9($,Z,z,X,Y,W),V=W.resolve?.(G,(K)=>X(J,"TAG_RESOLVE_FAILED",K),Z.options)??G,q=eI.isNode(V)?V:new $T.Scalar(V);if(q.range=G.range,q.tag=Y,W?.format)q.format=W.format;return q}UT.composeCollection=YT});var _9=F((KT)=>{var C9=B0();function GT($,Z,z){let Q=Z.offset,X=VT(Z,$.options.strict,z);if(!X)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let J=X.mode===">"?C9.Scalar.BLOCK_FOLDED:C9.Scalar.BLOCK_LITERAL,Y=Z.source?qT(Z.source):[],U=Y.length;for(let H=Y.length-1;H>=0;--H){let D=Y[H][1];if(D===""||D==="\r")U=H;else break}if(U===0){let H=X.chomp==="+"&&Y.length>0?`
96
+ `.repeat(Math.max(1,Y.length-1)):"",D=Q+X.length;if(Z.source)D+=Z.source.length;return{value:H,type:J,comment:X.comment,range:[Q,D,D]}}let W=Z.indent+X.indent,G=Z.offset+X.length,V=0;for(let H=0;H<U;++H){let[D,N]=Y[H];if(N===""||N==="\r"){if(X.indent===0&&D.length>W)W=D.length}else{if(D.length<W)z(G+D.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(X.indent===0)W=D.length;if(V=H,W===0&&!$.atRoot)z(G,"BAD_INDENT","Block scalar values in collections must be indented");break}G+=D.length+N.length+1}for(let H=Y.length-1;H>=U;--H)if(Y[H][0].length>W)U=H+1;let q="",K="",L=!1;for(let H=0;H<V;++H)q+=Y[H][0].slice(W)+`
97
+ `;for(let H=V;H<U;++H){let[D,N]=Y[H];G+=D.length+N.length+1;let _=N[N.length-1]==="\r";if(_)N=N.slice(0,-1);if(N&&D.length<W){let j=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;z(G-N.length-(_?2:1),"BAD_INDENT",j),D=""}if(J===C9.Scalar.BLOCK_LITERAL)q+=K+D.slice(W)+N,K=`
98
98
  `;else if(D.length>W||N[0]==="\t"){if(K===" ")K=`
99
- `;else if(!H&&K===`
99
+ `;else if(!L&&K===`
100
100
  `)K=`
101
101
 
102
102
  `;q+=K+D.slice(W)+N,K=`
103
- `,H=!0}else if(N==="")if(K===`
103
+ `,L=!0}else if(N==="")if(K===`
104
104
  `)q+=`
105
105
  `;else K=`
106
- `;else q+=K+N,K=" ",H=!1}switch(X.chomp){case"-":break;case"+":for(let B=U;B<Y.length;++B)q+=`
107
- `+Y[B][0].slice(W);if(q[q.length-1]!==`
106
+ `;else q+=K+N,K=" ",L=!1}switch(X.chomp){case"-":break;case"+":for(let H=U;H<Y.length;++H)q+=`
107
+ `+Y[H][0].slice(W);if(q[q.length-1]!==`
108
108
  `)q+=`
109
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 $T({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,U="",W=-1;for(let K=1;K<X.length;++K){let H=X[K];if(!U&&(H==="-"||H==="+"))U=H;else{let L=Number(H);if(!Y&&L)Y=L;else if(W===-1)W=$+K}}if(W!==-1)Q(W,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${X}`);let G=!1,V="",q=X.length;for(let K=1;K<Z.length;++K){let H=Z[K];switch(H.type){case"space":G=!0;case"newline":q+=H.source.length;break;case"comment":if(z&&!G)Q(H,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");q+=H.source.length,V=H.source.substring(1);break;case"error":Q(H,"UNEXPECTED_TOKEN",H.message),q+=H.source.length;break;default:{let L=`Unexpected token in block scalar header: ${H.type}`;Q(H,"UNEXPECTED_TOKEN",L);let B=H.source;if(B&&typeof B==="string")q+=B.length}}}return{mode:J,indent:Y,chomp:U,comment:V,length:q}}function ZT($){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}zT.resolveBlockScalar=eI});var T9=F((KT)=>{var I9=L0(),XT=P1();function JT($,Z,z){let{offset:Q,type:X,source:J,end:Y}=$,U,W,G=(K,H,L)=>z(Q+K,H,L);switch(X){case"scalar":U=I9.Scalar.PLAIN,W=YT(J,G);break;case"single-quoted-scalar":U=I9.Scalar.QUOTE_SINGLE,W=UT(J,G);break;case"double-quoted-scalar":U=I9.Scalar.QUOTE_DOUBLE,W=WT(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=XT.resolveEnd(Y,V,Z,z);return{value:W,type:U,comment:q.comment,range:[Q,V,q.offset]}}function YT($,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 GY($)}function UT($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return GY($.slice(1,-1)).replace(/''/g,"'")}function GY($){let Z,z;try{Z=new RegExp(`(.*?)(?<![ ])[ ]*\r?
110
+ `}let B=Q+X.length+Z.source.length;return{value:q,type:J,comment:X.comment,range:[Q,B,B]}}function VT({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,U="",W=-1;for(let K=1;K<X.length;++K){let L=X[K];if(!U&&(L==="-"||L==="+"))U=L;else{let B=Number(L);if(!Y&&B)Y=B;else if(W===-1)W=$+K}}if(W!==-1)Q(W,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${X}`);let G=!1,V="",q=X.length;for(let K=1;K<Z.length;++K){let L=Z[K];switch(L.type){case"space":G=!0;case"newline":q+=L.source.length;break;case"comment":if(z&&!G)Q(L,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");q+=L.source.length,V=L.source.substring(1);break;case"error":Q(L,"UNEXPECTED_TOKEN",L.message),q+=L.source.length;break;default:{let B=`Unexpected token in block scalar header: ${L.type}`;Q(L,"UNEXPECTED_TOKEN",B);let H=L.source;if(H&&typeof H==="string")q+=H.length}}}return{mode:J,indent:Y,chomp:U,comment:V,length:q}}function qT($){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}KT.resolveBlockScalar=GT});var F9=F((AT)=>{var P9=B0(),BT=S1();function MT($,Z,z){let{offset:Q,type:X,source:J,end:Y}=$,U,W,G=(K,L,B)=>z(Q+K,L,B);switch(X){case"scalar":U=P9.Scalar.PLAIN,W=LT(J,G);break;case"single-quoted-scalar":U=P9.Scalar.QUOTE_SINGLE,W=DT(J,G);break;case"double-quoted-scalar":U=P9.Scalar.QUOTE_DOUBLE,W=OT(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=BT.resolveEnd(Y,V,Z,z);return{value:W,type:U,comment:q.comment,range:[Q,V,q.offset]}}function LT($,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 BY($)}function DT($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return BY($.slice(1,-1)).replace(/''/g,"'")}function BY($){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 U=/[ \t]*(.*)/sy;return U.lastIndex=Y,Q=U.exec($),X+J+(Q?.[1]??"")}function WT($,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 U=/[ \t]*(.*)/sy;return U.lastIndex=Y,Q=U.exec($),X+J+(Q?.[1]??"")}function OT($,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}=GT($,Q);z+=J,Q=Y}else if(X==="\\"){let J=$[++Q],Y=VT[J];if(Y)z+=Y;else if(J===`
116
+ `){let{fold:J,offset:Y}=NT($,Q);z+=J,Q=Y}else if(X==="\\"){let J=$[++Q],Y=IT[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 U=J==="x"?2:J==="u"?4:8;z+=qT($,Q+1,U,Z),Q+=U}else{let U=$.substr(Q-1,2);Z(Q-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${U}`),z+=U}}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 U=J==="x"?2:J==="u"?4:8;z+=TT($,Q+1,U,Z),Q+=U}else{let U=$.substr(Q-1,2);Z(Q-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${U}`),z+=U}}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 GT($,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 NT($,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 VT={"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 qT($,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 U=$.substr(Z-2,z+2);return Q(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${U}`),U}}KT.resolveFlowScalar=JT});var qY=F((NT)=>{var g6=e(),VY=L0(),BT=N9(),MT=T9();function LT($,Z,z,Q){let{value:X,type:J,comment:Y,range:U}=Z.type==="block-scalar"?BT.resolveBlockScalar($,Z,Q):MT.resolveFlowScalar(Z,$.options.strict,Q),W=z?$.directives.tagName(z.source,(q)=>Q(z,"TAG_RESOLVE_FAILED",q)):null,G;if($.options.stringKeys&&$.atKey)G=$.schema[g6.SCALAR];else if(W)G=DT($.schema,X,W,z,Q);else if(Z.type==="scalar")G=OT($,X,Z,Q);else G=$.schema[g6.SCALAR];let V;try{let q=G.resolve(X,(K)=>Q(z??Z,"TAG_RESOLVE_FAILED",K),$.options);V=g6.isScalar(q)?q:new VY.Scalar(q)}catch(q){let K=q instanceof Error?q.message:String(q);Q(z??Z,"TAG_RESOLVE_FAILED",K),V=new VY.Scalar(X)}if(V.range=U,V.source=X,J)V.type=J;if(W)V.tag=W;if(G.format)V.format=G.format;if(Y)V.comment=Y;return V}function DT($,Z,z,Q,X){if(z==="!")return $[g6.SCALAR];let J=[];for(let U of $.tags)if(!U.collection&&U.tag===z)if(U.default&&U.test)J.push(U);else return U;for(let U of J)if(U.test?.test(Z))return U;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"),$[g6.SCALAR]}function OT({atKey:$,directives:Z,schema:z},Q,X,J){let Y=z.tags.find((U)=>(U.default===!0||$&&U.default==="key")&&U.test?.test(Q))||z[g6.SCALAR];if(z.compat){let U=z.compat.find((W)=>W.default&&W.test?.test(Q))??z[g6.SCALAR];if(Y.tag!==U.tag){let W=Z.tagString(Y.tag),G=Z.tagString(U.tag),V=`Value may be parsed as either ${W} or ${G}`;J(X,"TAG_RESOLVE_FAILED",V,!0)}}return Y}NT.composeScalar=LT});var KY=F((AT)=>{function TT($,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 $}AT.emptyScalarPosition=TT});var MY=F((wT)=>{var _T=P$(),RT=e(),PT=WY(),HY=qY(),FT=P1(),jT=KY(),ST={composeNode:BY,composeEmptyNode:A9};function BY($,Z,z,Q){let X=$.atKey,{spaceBefore:J,comment:Y,anchor:U,tag:W}=z,G,V=!0;switch(Z.type){case"alias":if(G=ET($,Z,Q),U||W)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=HY.composeScalar($,Z,W,Q),U)G.anchor=U.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(G=PT.composeCollection(ST,$,Z,z,Q),U)G.anchor=U.source.substring(1)}catch(q){let K=q instanceof Error?q.message:String(q);Q(Z,"RESOURCE_EXHAUSTION",K)}break;default:{let q=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;Q(Z,"UNEXPECTED_TOKEN",q),V=!1}}if(G??(G=A9($,Z.offset,void 0,null,z,Q)),U&&G.anchor==="")Q(U,"BAD_ALIAS","Anchor cannot be an empty string");if(X&&$.options.stringKeys&&(!RT.isScalar(G)||typeof G.value!=="string"||G.tag&&G.tag!=="tag:yaml.org,2002:str"))Q(W??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 A9($,Z,z,Q,{spaceBefore:X,comment:J,anchor:Y,tag:U,end:W},G){let V={type:"scalar",offset:jT.emptyScalarPosition(Z,z,Q),indent:-1,source:""},q=HY.composeScalar($,V,U,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]=W;return q}function ET({options:$},{offset:Z,source:z,end:Q},X){let J=new _T.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,U=FT.resolveEnd(Q,Y,$.strict,X);if(J.range=[Z,Y,U.offset],U.comment)J.comment=U.comment;return J}wT.composeEmptyNode=A9;wT.composeNode=BY});var DY=F((hT)=>{var bT=u$(),LY=MY(),kT=P1(),vT=c$();function gT($,Z,{offset:z,start:Q,value:X,end:J},Y){let U=Object.assign({_directives:Z},$),W=new bT.Document(void 0,U),G={atKey:!1,atRoot:!0,directives:W.directives,options:W.options,schema:W.schema},V=vT.resolveProps(Q,{indicator:"doc-start",next:X??J?.[0],offset:z,onError:Y,parentIndent:0,startOnNewline:!0});if(V.found){if(W.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")}W.contents=X?LY.composeNode(G,X,V,Y):LY.composeEmptyNode(G,V.end,Q,null,V,Y);let q=W.contents.range[2],K=kT.resolveEnd(J,q,!1,Y);if(K.comment)W.comment=K.comment;return W.range=[z,q,K.offset],W}hT.composeDoc=gT});var C9=F((dT)=>{var uT=p0("process"),mT=F7(),cT=u$(),p$=m$(),OY=e(),pT=DY(),lT=P1();function l$($){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 NY($){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 IT={"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 TT($,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 U=$.substr(Z-2,z+2);return Q(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${U}`),U}}AT.resolveFlowScalar=MT});var LY=F((ST)=>{var m6=t(),MY=B0(),_T=_9(),PT=F9();function FT($,Z,z,Q){let{value:X,type:J,comment:Y,range:U}=Z.type==="block-scalar"?_T.resolveBlockScalar($,Z,Q):PT.resolveFlowScalar(Z,$.options.strict,Q),W=z?$.directives.tagName(z.source,(q)=>Q(z,"TAG_RESOLVE_FAILED",q)):null,G;if($.options.stringKeys&&$.atKey)G=$.schema[m6.SCALAR];else if(W)G=RT($.schema,X,W,z,Q);else if(Z.type==="scalar")G=jT($,X,Z,Q);else G=$.schema[m6.SCALAR];let V;try{let q=G.resolve(X,(K)=>Q(z??Z,"TAG_RESOLVE_FAILED",K),$.options);V=m6.isScalar(q)?q:new MY.Scalar(q)}catch(q){let K=q instanceof Error?q.message:String(q);Q(z??Z,"TAG_RESOLVE_FAILED",K),V=new MY.Scalar(X)}if(V.range=U,V.source=X,J)V.type=J;if(W)V.tag=W;if(G.format)V.format=G.format;if(Y)V.comment=Y;return V}function RT($,Z,z,Q,X){if(z==="!")return $[m6.SCALAR];let J=[];for(let U of $.tags)if(!U.collection&&U.tag===z)if(U.default&&U.test)J.push(U);else return U;for(let U of J)if(U.test?.test(Z))return U;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"),$[m6.SCALAR]}function jT({atKey:$,directives:Z,schema:z},Q,X,J){let Y=z.tags.find((U)=>(U.default===!0||$&&U.default==="key")&&U.test?.test(Q))||z[m6.SCALAR];if(z.compat){let U=z.compat.find((W)=>W.default&&W.test?.test(Q))??z[m6.SCALAR];if(Y.tag!==U.tag){let W=Z.tagString(Y.tag),G=Z.tagString(U.tag),V=`Value may be parsed as either ${W} or ${G}`;J(X,"TAG_RESOLVE_FAILED",V,!0)}}return Y}ST.composeScalar=FT});var DY=F((xT)=>{function wT($,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 $}xT.emptyScalarPosition=wT});var IY=F((mT)=>{var bT=w$(),kT=t(),vT=HY(),OY=LY(),gT=S1(),hT=DY(),fT={composeNode:NY,composeEmptyNode:R9};function NY($,Z,z,Q){let X=$.atKey,{spaceBefore:J,comment:Y,anchor:U,tag:W}=z,G,V=!0;switch(Z.type){case"alias":if(G=uT($,Z,Q),U||W)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=OY.composeScalar($,Z,W,Q),U)G.anchor=U.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(G=vT.composeCollection(fT,$,Z,z,Q),U)G.anchor=U.source.substring(1)}catch(q){let K=q instanceof Error?q.message:String(q);Q(Z,"RESOURCE_EXHAUSTION",K)}break;default:{let q=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;Q(Z,"UNEXPECTED_TOKEN",q),V=!1}}if(G??(G=R9($,Z.offset,void 0,null,z,Q)),U&&G.anchor==="")Q(U,"BAD_ALIAS","Anchor cannot be an empty string");if(X&&$.options.stringKeys&&(!kT.isScalar(G)||typeof G.value!=="string"||G.tag&&G.tag!=="tag:yaml.org,2002:str"))Q(W??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 R9($,Z,z,Q,{spaceBefore:X,comment:J,anchor:Y,tag:U,end:W},G){let V={type:"scalar",offset:hT.emptyScalarPosition(Z,z,Q),indent:-1,source:""},q=OY.composeScalar($,V,U,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]=W;return q}function uT({options:$},{offset:Z,source:z,end:Q},X){let J=new bT.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,U=gT.resolveEnd(Q,Y,$.strict,X);if(J.range=[Z,Y,U.offset],U.comment)J.comment=U.comment;return J}mT.composeEmptyNode=R9;mT.composeNode=NY});var AY=F((rT)=>{var lT=d$(),TY=IY(),dT=S1(),iT=n$();function nT($,Z,{offset:z,start:Q,value:X,end:J},Y){let U=Object.assign({_directives:Z},$),W=new lT.Document(void 0,U),G={atKey:!1,atRoot:!0,directives:W.directives,options:W.options,schema:W.schema},V=iT.resolveProps(Q,{indicator:"doc-start",next:X??J?.[0],offset:z,onError:Y,parentIndent:0,startOnNewline:!0});if(V.found){if(W.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")}W.contents=X?TY.composeNode(G,X,V,Y):TY.composeEmptyNode(G,V.end,Q,null,V,Y);let q=W.contents.range[2],K=dT.resolveEnd(J,q,!1,Y);if(K.comment)W.comment=K.comment;return W.range=[z,q,K.offset],W}rT.composeDoc=nT});var j9=F((ZA)=>{var oT=c0("process"),aT=x7(),tT=d$(),r$=i$(),CY=t(),eT=AY(),$A=S1();function s$($){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 _Y($){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 IY{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,z,Q,X)=>{let J=l$(Z);if(X)this.warnings.push(new p$.YAMLWarning(J,z,Q));else this.errors.push(new p$.YAMLParseError(J,z,Q))},this.directives=new mT.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:z,afterEmptyLine:Q}=NY(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(OY.isCollection(X)&&!X.flow&&X.items.length>0){let J=X.items[0];if(OY.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 PY{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,z,Q,X)=>{let J=s$(Z);if(X)this.warnings.push(new r$.YAMLWarning(J,z,Q));else this.errors.push(new r$.YAMLParseError(J,z,Q))},this.directives=new aT.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:z,afterEmptyLine:Q}=_Y(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(CY.isCollection(X)&&!X.flow&&X.items.length>0){let J=X.items[0];if(CY.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:NY(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(uT.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,z,Q)=>{let X=l$($);X[0]+=Z,this.onError(X,"BAD_DIRECTIVE",z,Q)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=pT.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 p$.YAMLParseError(l$($),"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 p$.YAMLParseError(l$($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=lT.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 p$.YAMLParseError(l$($),"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 cT.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}}}dT.Composer=IY});var CY=F(($A)=>{var nT=N9(),rT=T9(),sT=m$(),TY=E$();function oT($,Z=!0,z){if($){let Q=(X,J,Y)=>{let U=typeof X==="number"?X:Array.isArray(X)?X[0]:X.offset;if(z)z(U,J,Y);else throw new sT.YAMLParseError([U,U+1],J,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return rT.resolveFlowScalar($,Z,Q);case"block-scalar":return nT.resolveBlockScalar({options:{strict:Z}},$,Q)}}return null}function aT($,Z){let{implicitKey:z=!1,indent:Q,inFlow:X=!1,offset:J=-1,type:Y="PLAIN"}=Z,U=TY.stringifyString({type:Y,value:$},{implicitKey:z,indent:Q>0?" ".repeat(Q):"",inFlow:X,options:{blockQuote:!0,lineWidth:-1}}),W=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:_Y(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(oT.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,z,Q)=>{let X=s$($);X[0]+=Z,this.onError(X,"BAD_DIRECTIVE",z,Q)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=eT.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 r$.YAMLParseError(s$($),"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 r$.YAMLParseError(s$($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=$A.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 r$.YAMLParseError(s$($),"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 tT.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}}}ZA.Composer=PY});var jY=F((VA)=>{var QA=_9(),XA=F9(),JA=i$(),FY=k$();function YA($,Z=!0,z){if($){let Q=(X,J,Y)=>{let U=typeof X==="number"?X:Array.isArray(X)?X[0]:X.offset;if(z)z(U,J,Y);else throw new JA.YAMLParseError([U,U+1],J,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return XA.resolveFlowScalar($,Z,Q);case"block-scalar":return QA.resolveBlockScalar({options:{strict:Z}},$,Q)}}return null}function UA($,Z){let{implicitKey:z=!1,indent:Q,inFlow:X=!1,offset:J=-1,type:Y="PLAIN"}=Z,U=FY.stringifyString({type:Y,value:$},{implicitKey:z,indent:Q>0?" ".repeat(Q):"",inFlow:X,options:{blockQuote:!0,lineWidth:-1}}),W=Z.end??[{type:"newline",offset:-1,indent:Q,source:`
133
133
  `}];switch(U[0]){case"|":case">":{let G=U.indexOf(`
134
134
  `),V=U.substring(0,G),q=U.substring(G+1)+`
135
- `,K=[{type:"block-scalar-header",offset:J,indent:Q,source:V}];if(!AY(K,W))K.push({type:"newline",offset:-1,indent:Q,source:`
136
- `});return{type:"block-scalar",offset:J,indent:Q,props:K,source:q}}case'"':return{type:"double-quoted-scalar",offset:J,indent:Q,source:U,end:W};case"'":return{type:"single-quoted-scalar",offset:J,indent:Q,source:U,end:W};default:return{type:"scalar",offset:J,indent:Q,source:U,end:W}}}function tT($,Z,z={}){let{afterKey:Q=!1,implicitKey:X=!1,inFlow:J=!1,type:Y}=z,U="indent"in $?$.indent:null;if(Q&&typeof U==="number")U+=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 W=TY.stringifyString({type:Y,value:Z},{implicitKey:X||U===null,indent:U!==null&&U>0?" ".repeat(U):"",inFlow:J,options:{blockQuote:!0,lineWidth:-1}});switch(W[0]){case"|":case">":eT($,W);break;case'"':_9($,W,"double-quoted-scalar");break;case"'":_9($,W,"single-quoted-scalar");break;default:_9($,W,"scalar")}}function eT($,Z){let z=Z.indexOf(`
135
+ `,K=[{type:"block-scalar-header",offset:J,indent:Q,source:V}];if(!RY(K,W))K.push({type:"newline",offset:-1,indent:Q,source:`
136
+ `});return{type:"block-scalar",offset:J,indent:Q,props:K,source:q}}case'"':return{type:"double-quoted-scalar",offset:J,indent:Q,source:U,end:W};case"'":return{type:"single-quoted-scalar",offset:J,indent:Q,source:U,end:W};default:return{type:"scalar",offset:J,indent:Q,source:U,end:W}}}function WA($,Z,z={}){let{afterKey:Q=!1,implicitKey:X=!1,inFlow:J=!1,type:Y}=z,U="indent"in $?$.indent:null;if(Q&&typeof U==="number")U+=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 W=FY.stringifyString({type:Y,value:Z},{implicitKey:X||U===null,indent:U!==null&&U>0?" ".repeat(U):"",inFlow:J,options:{blockQuote:!0,lineWidth:-1}});switch(W[0]){case"|":case">":GA($,W);break;case'"':S9($,W,"double-quoted-scalar");break;case"'":S9($,W,"single-quoted-scalar");break;default:S9($,W,"scalar")}}function GA($,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,U=[{type:"block-scalar-header",offset:J,indent:Y,source:Q}];if(!AY(U,"end"in $?$.end:void 0))U.push({type:"newline",offset:-1,indent:Y,source:`
139
- `});for(let W of Object.keys($))if(W!=="type"&&W!=="offset")delete $[W];Object.assign($,{type:"block-scalar",indent:Y,props:U,source:X})}}function AY($,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 _9($,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})}}}$A.createScalarToken=aT;$A.resolveAsScalar=oT;$A.setScalarValue=tT});var _Y=F((JA)=>{var XA=($)=>("type"in $)?I5($):N5($);function I5($){switch($.type){case"block-scalar":{let Z="";for(let z of $.props)Z+=I5(z);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let z of $.items)Z+=N5(z);return Z}case"flow-collection":{let Z=$.start.source;for(let z of $.items)Z+=N5(z);for(let z of $.end)Z+=z.source;return Z}case"document":{let Z=N5($);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 N5({start:$,key:Z,sep:z,value:Q}){let X="";for(let J of $)X+=J.source;if(Z)X+=I5(Z);if(z)for(let J of z)X+=J.source;if(Q)X+=I5(Q);return X}JA.stringify=XA});var FY=F((WA)=>{var R9=Symbol("break visit"),UA=Symbol("skip children"),RY=Symbol("remove item");function h6($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};PY(Object.freeze([]),$,Z)}h6.BREAK=R9;h6.SKIP=UA;h6.REMOVE=RY;h6.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};h6.parentCollection=($,Z)=>{let z=h6.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 PY($,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 U=PY(Object.freeze($.concat([[X,Y]])),J.items[Y],z);if(typeof U==="number")Y=U-1;else if(U===R9)return R9;else if(U===RY)J.items.splice(Y,1),Y-=1}if(typeof Q==="function"&&X==="key")Q=Q(Z,$)}}return typeof Q==="function"?Q(Z,$):Q}WA.visit=h6});var T5=F((LA)=>{var P9=CY(),VA=_Y(),qA=FY(),F9="\uFEFF",j9="\x02",S9="\x18",E9="\x1F",KA=($)=>!!$&&("items"in $),HA=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function BA($){switch($){case F9:return"<BOM>";case j9:return"<DOC>";case S9:return"<FLOW_END>";case E9:return"<SCALAR>";default:return JSON.stringify($)}}function MA($){switch($){case F9:return"byte-order-mark";case j9:return"doc-mode";case S9:return"flow-error-end";case E9: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,U=[{type:"block-scalar-header",offset:J,indent:Y,source:Q}];if(!RY(U,"end"in $?$.end:void 0))U.push({type:"newline",offset:-1,indent:Y,source:`
139
+ `});for(let W of Object.keys($))if(W!=="type"&&W!=="offset")delete $[W];Object.assign($,{type:"block-scalar",indent:Y,props:U,source:X})}}function RY($,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 S9($,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})}}}VA.createScalarToken=UA;VA.resolveAsScalar=YA;VA.setScalarValue=WA});var SY=F((MA)=>{var BA=($)=>("type"in $)?P5($):_5($);function P5($){switch($.type){case"block-scalar":{let Z="";for(let z of $.props)Z+=P5(z);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let z of $.items)Z+=_5(z);return Z}case"flow-collection":{let Z=$.start.source;for(let z of $.items)Z+=_5(z);for(let z of $.end)Z+=z.source;return Z}case"document":{let Z=_5($);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 _5({start:$,key:Z,sep:z,value:Q}){let X="";for(let J of $)X+=J.source;if(Z)X+=P5(Z);if(z)for(let J of z)X+=J.source;if(Q)X+=P5(Q);return X}MA.stringify=BA});var xY=F((OA)=>{var E9=Symbol("break visit"),DA=Symbol("skip children"),EY=Symbol("remove item");function c6($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};wY(Object.freeze([]),$,Z)}c6.BREAK=E9;c6.SKIP=DA;c6.REMOVE=EY;c6.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};c6.parentCollection=($,Z)=>{let z=c6.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 wY($,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 U=wY(Object.freeze($.concat([[X,Y]])),J.items[Y],z);if(typeof U==="number")Y=U-1;else if(U===E9)return E9;else if(U===EY)J.items.splice(Y,1),Y-=1}if(typeof Q==="function"&&X==="key")Q=Q(Z,$)}}return typeof Q==="function"?Q(Z,$):Q}OA.visit=c6});var F5=F((FA)=>{var w9=jY(),IA=SY(),TA=xY(),x9="\uFEFF",y9="\x02",b9="\x18",k9="\x1F",AA=($)=>!!$&&("items"in $),CA=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function _A($){switch($){case x9:return"<BOM>";case y9:return"<DOC>";case b9:return"<FLOW_END>";case k9:return"<SCALAR>";default:return JSON.stringify($)}}function PA($){switch($){case x9:return"byte-order-mark";case y9:return"doc-mode";case b9:return"flow-error-end";case k9: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}LA.createScalarToken=P9.createScalarToken;LA.resolveAsScalar=P9.resolveAsScalar;LA.setScalarValue=P9.setScalarValue;LA.stringify=VA.stringify;LA.visit=qA.visit;LA.BOM=F9;LA.DOCUMENT=j9;LA.FLOW_END=S9;LA.SCALAR=E9;LA.isCollection=KA;LA.isScalar=HA;LA.prettyToken=BA;LA.tokenType=MA});var x9=F((xA)=>{var d$=T5();function O2($){switch($){case void 0:case" ":case`
143
- `:case"\r":case"\t":return!0;default:return!1}}var jY=new Set("0123456789ABCDEFabcdef"),EA=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),A5=new Set(",[]{}"),wA=new Set(` ,[]{}
144
- \r `),w9=($)=>!$||wA.has($);class SY{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}FA.createScalarToken=w9.createScalarToken;FA.resolveAsScalar=w9.resolveAsScalar;FA.setScalarValue=w9.setScalarValue;FA.stringify=IA.stringify;FA.visit=TA.visit;FA.BOM=x9;FA.DOCUMENT=y9;FA.FLOW_END=b9;FA.SCALAR=k9;FA.isCollection=AA;FA.isScalar=CA;FA.prettyToken=_A;FA.tokenType=PA});var g9=F((cA)=>{var o$=F5();function O2($){switch($){case void 0:case" ":case`
143
+ `:case"\r":case"\t":return!0;default:return!1}}var yY=new Set("0123456789ABCDEFabcdef"),uA=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),R5=new Set(",[]{}"),mA=new Set(` ,[]{}
144
+ \r `),v9=($)=>!$||mA.has($);class bY{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex($,Z=!1){if($){if(typeof $!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+$:$,this.lineEndPos=null}this.atEnd=!Z;let z=this.next??"stream";while(z&&(Z||this.hasChars(1)))z=yield*this.parseNext(z)}atLineEnd(){let $=this.pos,Z=this.buffer[$];while(Z===" "||Z==="\t")Z=this.buffer[++$];if(!Z||Z==="#"||Z===`
145
145
  `)return!0;if(Z==="\r")return this.buffer[$+1]===`
146
146
  `;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let Z=this.buffer[$];if(this.indentNext>0){let z=0;while(Z===" ")Z=this.buffer[++z+$];if(Z==="\r"){let Q=this.buffer[z+$+1];if(Q===`
147
147
  `||!Q&&!this.atEnd)return $+z+1}return Z===`
148
148
  `||z>=this.indentNext||!Z&&!this.atEnd?$+z:-1}if(Z==="-"||Z==="."){let z=this.buffer.substr($,3);if((z==="---"||z==="...")&&O2(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]===d$.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 d$.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==="...")&&O2(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&&!O2(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(($==="-"||$==="?"||$===":")&&O2(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(w9),"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("..."))&&O2(Q[3])){if(!(z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield d$.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(w9),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let J=this.charAt(1);if(this.flowKey||O2(J)||J===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=this.charAt(0),Z=this.buffer.indexOf($,this.pos+1);if($==="'")while(Z!==-1&&this.buffer[Z+1]==="'")Z=this.buffer.indexOf("'",Z+2);else while(Z!==-1){let X=0;while(this.buffer[Z-1-X]==="\\")X+=1;if(X%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let z=this.buffer.substring(0,Z),Q=z.indexOf(`
149
+ `,this.pos),this.lineEndPos=$;if($===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[$-1]==="\r")$-=1;return this.buffer.substring(this.pos,$)}hasChars($){return this.pos+$<=this.buffer.length}setNext($){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=$,null}peek($){return this.buffer.substr(this.pos,$)}*parseNext($){switch($){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let $=this.getLine();if($===null)return this.setNext("stream");if($[0]===o$.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 o$.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==="...")&&O2(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&&!O2(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(($==="-"||$==="?"||$===":")&&O2(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(v9),"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("..."))&&O2(Q[3])){if(!(z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield o$.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(v9),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let J=this.charAt(1);if(this.flowKey||O2(J)||J===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=this.charAt(0),Z=this.buffer.indexOf($,this.pos+1);if($==="'")while(Z!==-1&&this.buffer[Z+1]==="'")Z=this.buffer.indexOf("'",Z+2);else while(Z!==-1){let X=0;while(this.buffer[Z-1-X]==="\\")X+=1;if(X%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let z=this.buffer.substring(0,Z),Q=z.indexOf(`
150
150
  `,this.pos);if(Q!==-1){while(Q!==-1){let X=this.continueScalar(Q+1);if(X===-1)break;Q=z.indexOf(`
151
151
  `,X)}if(Q!==-1)Z=Q-(z[Q-1]==="\r"?2:1)}if(Z===-1){if(!this.atEnd)return this.setNext("quoted-scalar");Z=this.buffer.length}return yield*this.pushToIndex(Z+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let $=this.pos;while(!0){let Z=this.buffer[++$];if(Z==="+")this.blockScalarKeep=!0;else if(Z>"0"&&Z<="9")this.blockScalarIndent=Number(Z)-1;else if(Z!=="-")break}return yield*this.pushUntil((Z)=>O2(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 d$.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(O2(X)||$&&A5.has(X))break;Z=z}else if(O2(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 o$.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(O2(X)||$&&R5.has(X))break;Z=z}else if(O2(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==="#"||$&&A5.has(X))break;if(Q===`
159
- `){let J=this.continueScalar(z+1);if(J===-1)break;z=Math.max(z,J-2)}}else{if($&&A5.has(Q))break;Z=z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield d$.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(w9),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let Z=this.flowLevel>0,z=this.charAt(1);if(O2(z)||Z&&A5.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(!O2(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(EA.has(Z))Z=this.buffer[++$];else if(Z==="%"&&jY.has(this.buffer[$+1])&&jY.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==="#"||$&&R5.has(X))break;if(Q===`
159
+ `){let J=this.continueScalar(z+1);if(J===-1)break;z=Math.max(z,J-2)}}else{if($&&R5.has(Q))break;Z=z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield o$.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(v9),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let Z=this.flowLevel>0,z=this.charAt(1);if(O2(z)||Z&&R5.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(!O2(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(uA.has(Z))Z=this.buffer[++$];else if(Z==="%"&&yY.has(this.buffer[$+1])&&yY.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)}}xA.Lexer=SY});var y9=F((bA)=>{class EY{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}}}}bA.LineCounter=EY});var b9=F((hA)=>{var vA=p0("process"),wY=T5(),gA=x9();function G6($,Z){for(let z=0;z<$.length;++z)if($[z].type===Z)return!0;return!1}function xY($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function bY($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function C5($){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 F1($){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 _5($,Z){if(Z.length<1e5)Array.prototype.push.apply($,Z);else for(let z=0;z<Z.length;++z)$.push(Z[z])}function yY($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!G6(Z.start,"explicit-key-ind")&&!G6(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,bY(Z.value))if(Z.value.end)_5(Z.value.end,Z.sep);else Z.value.end=Z.sep;else _5(Z.start,Z.sep);delete Z.sep}}}class kY{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 gA.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=$,vA.env.LOG_TOKENS)console.log("|",wY.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=wY.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")yY(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&&xY(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(xY($.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=C5(this.peek(2)),z=F1(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)}}cA.Lexer=bY});var h9=F((lA)=>{class kY{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}}}}lA.LineCounter=kY});var f9=F((rA)=>{var iA=c0("process"),vY=F5(),nA=g9();function H6($,Z){for(let z=0;z<$.length;++z)if($[z].type===Z)return!0;return!1}function gY($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function fY($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function j5($){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 E1($){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 S5($,Z){if(Z.length<1e5)Array.prototype.push.apply($,Z);else for(let z=0;z<Z.length;++z)$.push(Z[z])}function hY($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!H6(Z.start,"explicit-key-ind")&&!H6(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,fY(Z.value))if(Z.value.end)S5(Z.value.end,Z.sep);else Z.value.end=Z.sep;else S5(Z.start,Z.sep);delete Z.sep}}}class uY{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 nA.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=$,iA.env.LOG_TOKENS)console.log("|",vY.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=vY.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")hY(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&&gY(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(gY($.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=j5(this.peek(2)),z=E1(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)){_5(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 U=Z.sep[Y];switch(U.type){case"newline":J.push(Y);break;case"space":break;case"comment":if(U.indent>$.indent)J.length=0;break;default:J.length=0}}if(J.length>=2)X=Z.sep.splice(J[1])}switch(this.type){case"anchor":case"tag":if(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X}),this.onKeyLine=!0;else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"explicit-key-ind":if(!Z.sep&&!Z.explicitKey)Z.start.push(this.sourceToken),Z.explicitKey=!0;else if(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(Z.explicitKey)if(!Z.sep)if(G6(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let J=F1(Z.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]})}else if(Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(G6(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]});else if(bY(Z.key)&&!G6(Z.sep,"newline")){let J=F1(Z.start),Y=Z.key,U=Z.sep;U.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:U}]})}else if(X.length>0)Z.sep=Z.sep.concat(X,this.sourceToken);else Z.sep.push(this.sourceToken);else if(!Z.sep)Object.assign(Z,{key:null,sep:[this.sourceToken]});else if(Z.value||Q)$.items.push({start:X,key:null,sep:[this.sourceToken]});else if(G6(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else Z.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let J=this.flowScalar(this.type);if(Q||Z.value)$.items.push({start:X,key:J,sep:[]}),this.onKeyLine=!0;else if(Z.sep)this.stack.push(J);else Object.assign(Z,{key:J,sep:[]}),this.onKeyLine=!0;return}default:{let J=this.startBlockValue($);if(J){if(J.type==="block-seq"){if(!Z.explicitKey&&Z.sep&&!G6(Z.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(z)$.items.push({start:X});this.stack.push(J);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(Z.value){let z="end"in Z.value?Z.value.end:void 0;if((Array.isArray(z)?z[z.length-1]:void 0)?.type==="comment")z?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(Z.start,$.indent)){let Q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(Q)){_5(Q,Z.start),Q.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return;case"anchor":case"tag":if(Z.value||this.indent<=$.indent)break;Z.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(Z.value||G6(Z.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return}if(this.indent>$.indent){let z=this.startBlockValue($);if(z){this.stack.push(z);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let Z=$.items[$.items.length-1];if(this.type==="flow-error-end"){let z;do yield*this.pop(),z=this.peek(1);while(z?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!Z||Z.sep)$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return;case"map-value-ind":if(!Z||Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Object.assign(Z,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!Z||Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let Q=this.flowScalar(this.type);if(!Z||Z.value)$.items.push({start:[],key:Q,sep:[]});else if(Z.sep)this.stack.push(Q);else Object.assign(Z,{key:Q,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let z=this.startBlockValue($);if(z)this.stack.push(z);else yield*this.pop(),yield*this.step()}else{let z=this.peek(2);if(z.type==="block-map"&&(this.type==="map-value-ind"&&z.indent===$.indent||this.type==="newline"&&!z.items[z.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&z.type!=="flow-collection"){let Q=C5(z),X=F1(Q);yY($);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)){S5(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 U=Z.sep[Y];switch(U.type){case"newline":J.push(Y);break;case"space":break;case"comment":if(U.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(H6(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let J=E1(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(H6(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(fY(Z.key)&&!H6(Z.sep,"newline")){let J=E1(Z.start),Y=Z.key,U=Z.sep;U.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:U}]})}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(H6(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&&!H6(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)){S5(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||H6(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=j5(z),X=E1(Q);hY($);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=C5($),z=F1(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=C5($),z=F1(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()}}}hA.Parser=kY});var uY=F((nA)=>{var vY=C9(),uA=u$(),i$=m$(),mA=y7(),cA=e(),pA=y9(),gY=b9();function hY($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new pA.LineCounter||null,prettyErrors:Z}}function lA($,Z={}){let{lineCounter:z,prettyErrors:Q}=hY(Z),X=new gY.Parser(z?.addNewLine),J=new vY.Composer(Z),Y=Array.from(J.compose(X.parse($)));if(Q&&z)for(let U of Y)U.errors.forEach(i$.prettifyError($,z)),U.warnings.forEach(i$.prettifyError($,z));if(Y.length>0)return Y;return Object.assign([],{empty:!0},J.streamInfo())}function fY($,Z={}){let{lineCounter:z,prettyErrors:Q}=hY(Z),X=new gY.Parser(z?.addNewLine),J=new vY.Composer(Z),Y=null;for(let U of J.compose(X.parse($),!0,$.length))if(!Y)Y=U;else if(Y.options.logLevel!=="silent"){Y.errors.push(new i$.YAMLParseError(U.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&z)Y.errors.forEach(i$.prettifyError($,z)),Y.warnings.forEach(i$.prettifyError($,z));return Y}function dA($,Z,z){let Q=void 0;if(typeof Z==="function")Q=Z;else if(z===void 0&&Z&&typeof Z==="object")z=Z;let X=fY($,z);if(!X)return null;if(X.warnings.forEach((J)=>mA.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 iA($,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(cA.isDocument($)&&!Q)return $.toString(z);return new uA.Document($,Q,z).toString(z)}nA.parse=dA;nA.parseAllDocuments=lA;nA.parseDocument=fY;nA.stringify=iA});var gU={};BX(gU,{plainOnStderr:()=>Y3,orange:()=>P0,italic:()=>l_,fafCyanDeep:()=>p5,fafCyan:()=>A,dim:()=>M,colorOn:()=>J3,bold:()=>C,FAF_HEX:()=>U4});function J3($=process.stdout){let Z=process.env.FORCE_COLOR;if(Z!==void 0)return Z!=="0"&&Z!=="false";if(process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!=="")return!1;return Boolean($.isTTY)}function Y3($){return J3(process.stderr)?$:$.replace(p_,"")}var p_,c5=($,Z)=>J3()?`\x1B[${$}m${Z}\x1B[0m`:Z,U3=($)=>(Z)=>c5($,Z),C,M,l_,U4,A=($)=>c5("38;2;0;212;212",$),p5=($)=>c5("38;2;14;140;140",$),P0=($)=>c5("38;5;208",$);var l=h(()=>{p_=new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`,"g");C=U3("1"),M=U3("2"),l_=U3("3"),U4={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var wz=F((Cn,_y)=>{_y.exports={name:"faf-cli",version:"8.10.1",description:"Persistent AI context + memory — .faf and .fafm, IANA-registered. AI suggests your goal and six W's; you confirm. Anthropic-merged.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",types:"./dist/index.d.ts",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"},"./pack":{types:"./dist/interop/pack.d.ts",default:"./dist/pack.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",clean:"rm -rf dist",build:"bun run clean && bun build src/cli.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/index.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/interop/pack.ts --outdir dist --target=browser --minify --sourcemap=linked && tsc -p tsconfig.build.json && node scripts/strip-sources-content.mjs",compile:"bun build src/cli.ts --compile --bytecode --minify --outfile faf","compile:all":"bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-arm64 --outfile faf-darwin-arm64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-x64 --outfile faf-darwin-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-linux-x64 --outfile faf-linux-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-windows-x64 --outfile faf-windows-x64.exe",test:"bun test --timeout=120000","test:watch":"bun test --watch --timeout=120000",lint:"eslint 'src/**/*.ts'",format:"prettier --write 'src/**/*.ts'","check:no-hardcode":"! grep -rEln '/(Users|home/runner|private/var)/' dist/ || (echo '❌ Hardcoded build-machine path leaked into dist — see grep output above. Externalize the offending dep in the build script.'; exit 1)","check:engines":"node scripts/check-engines.mjs",prepublishOnly:"bun run check:engines && bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational","agents-md","context-engineering","codex","windsurf","fafm","ai-memory","agents"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.3","faf-scoring-kernel":"^3.0.0",open:"^11.0.0",yaml:"^2.9.0"},devDependencies:{"@anthropic-ai/sdk":"^0.91.1","@faf/specification":"github:Wolfe-Jam/faf","@types/bun":"^1.3.14","@types/node":"^22.20.1","@typescript-eslint/eslint-plugin":"^8.66.0","@typescript-eslint/parser":"^8.66.0",ajv:"^8.20.0",eslint:"^9.39.5",prettier:"^3.9.6",typescript:"^5.9.3","typescript-eslint":"^8.66.0"},overrides:{"brace-expansion":"^1.1.18","fast-uri":"^3.1.9",picomatch:"^4.0.5","@typescript-eslint/typescript-estree":{minimatch:"^11.0.1"}},engines:{node:">=22.0.0"},publishConfig:{access:"public"}}});function j($,Z,z,Q,X){if(Q==="m")throw TypeError("Private method is not writable");if(Q==="a"&&!X)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!X:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return Q==="a"?X.call($,z):X?X.value=z:Z.set($,z),z}function O($,Z,z,Q){if(z==="a"&&!Q)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!Q:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return z==="m"?Q:z==="a"?Q.call($):Q?Q.value:Z.get($)}var o2=()=>{};var uz=function(){let{crypto:$}=globalThis;if($?.randomUUID)return uz=$.randomUUID.bind($),$.randomUUID();let Z=new Uint8Array(1),z=$?()=>$.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(Q)=>(+Q^z()&15>>+Q/4).toString(16))};function a2($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var p4=($)=>{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 b,O0,x0,C6,a1,t1,e1,$$,Z$,z$,Q$,X$,J$;var n0=h(()=>{b=class b extends Error{};O0=class O0 extends b{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 C6({message:z,cause:p4(Z)});let X=Z,J=X?.error?.type;if($===400)return new t1($,X,z,Q,J);if($===401)return new e1($,X,z,Q,J);if($===403)return new $$($,X,z,Q,J);if($===404)return new Z$($,X,z,Q,J);if($===409)return new z$($,X,z,Q,J);if($===422)return new Q$($,X,z,Q,J);if($===429)return new X$($,X,z,Q,J);if($>=500)return new J$($,X,z,Q,J);return new O0($,X,z,Q,J)}};x0=class x0 extends O0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};C6=class C6 extends O0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};a1=class a1 extends C6{constructor({message:$}={}){super({message:$??"Request timed out."})}};t1=class t1 extends O0{};e1=class e1 extends O0{};$$=class $$ extends O0{};Z$=class Z$ extends O0{};z$=class z$ extends O0{};Q$=class Q$ extends O0{};X$=class X$ extends O0{};J$=class J$ extends O0{}});function uZ($){if(typeof $!=="object")return{};return $??{}}function pz($){if(!$)return!0;for(let Z in $)return!1;return!0}function BK($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var Yk,HK=($)=>{return Yk.test($)},mz=($)=>(mz=Array.isArray,mz($)),cz,MK=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new b(`${$} must be an integer`);if(Z<0)throw new b(`${$} must be a positive integer`);return Z},mZ=($)=>{try{return JSON.parse($)}catch(Z){return}};var W1=h(()=>{n0();Yk=/^[a-z][a-z0-9+.-]*:/i,cz=mz});var LK=($)=>new Promise((Z)=>setTimeout(Z,$));var _6="0.91.1";function Uk(){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 Gk(){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 IK=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},Wk=()=>{let $=Uk();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_6,"X-Stainless-OS":OK(Deno.build.os),"X-Stainless-Arch":DK(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":_6,"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":_6,"X-Stainless-OS":OK(globalThis.process.platform??"unknown"),"X-Stainless-Arch":DK(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=Gk();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_6,"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":_6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},DK=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},OK=($)=>{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"},NK,TK=()=>{return NK??(NK=Wk())};var lz=()=>{};function AK(){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 dz(...$){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 cZ($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return dz({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 l4($){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 CK($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),z=Z.cancel();Z.releaseLock(),await z}var _K=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function RK($){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 b(`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 PK=h(()=>{n0()});function SK($){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 d4($){let Z;return(FK??(Z=new globalThis.TextEncoder,FK=Z.encode.bind(Z)))($)}function iz($){let Z;return(jK??(Z=new globalThis.TextDecoder,jK=Z.decode.bind(Z)))($)}var FK,jK;class R6{constructor(){$2.set(this,void 0),Z2.set(this,void 0),j(this,$2,new Uint8Array,"f"),j(this,Z2,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?d4($):$;j(this,$2,SK([O(this,$2,"f"),Z]),"f");let z=[],Q;while((Q=Kk(O(this,$2,"f"),O(this,Z2,"f")))!=null){if(Q.carriage&&O(this,Z2,"f")==null){j(this,Z2,Q.index,"f");continue}if(O(this,Z2,"f")!=null&&(Q.index!==O(this,Z2,"f")+1||Q.carriage)){z.push(iz(O(this,$2,"f").subarray(0,O(this,Z2,"f")-1))),j(this,$2,O(this,$2,"f").subarray(O(this,Z2,"f")),"f"),j(this,Z2,null,"f");continue}let X=O(this,Z2,"f")!==null?Q.preceding-1:Q.preceding,J=iz(O(this,$2,"f").subarray(0,X));z.push(J),j(this,$2,O(this,$2,"f").subarray(Q.index),"f"),j(this,Z2,null,"f")}return z}flush(){if(!O(this,$2,"f").length)return[];return this.decode(`
166
- `)}}function Kk($,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 EK($){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 $2,Z2;var nz=h(()=>{o2();$2=new WeakMap,Z2=new WeakMap;R6.NEWLINE_CHARS=new Set([`
167
- `,"\r"]);R6.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function i4(){}function pZ($,Z,z){if(!Z||lZ[$]>lZ[z])return i4;else return Z[$].bind(Z)}function j0($){let Z=$.logger,z=$.logLevel??"off";if(!Z)return Hk;let Q=wK.get(Z);if(Q&&Q[0]===z)return Q[1];let X={error:pZ("error",Z,z),warn:pZ("warn",Z,z),info:pZ("info",Z,z),debug:pZ("debug",Z,z)};return wK.set(Z,[z,X]),X}var lZ,rz=($,Z,z)=>{if(!$)return;if(BK(lZ,$))return $;j0(z).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(lZ))}`);return},Hk,wK,t2=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([Z,z])=>[Z,Z.toLowerCase()==="x-api-key"||Z.toLowerCase()==="authorization"||Z.toLowerCase()==="cookie"||Z.toLowerCase()==="set-cookie"?"***":z]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var dZ=h(()=>{W1();lZ={off:0,error:200,warn:300,info:400,debug:500};Hk={error:i4,warn:i4,info:i4,debug:i4},wK=new WeakMap});async function*Bk($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new b("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 b("Attempted to iterate over a response with no body")}let z=new xK,Q=new R6,X=l4($.body);for await(let J of Mk(X))for(let Y of Q.decode(J)){let U=z.decode(Y);if(U)yield U}for(let J of Q.flush()){let Y=z.decode(J);if(Y)yield Y}}async function*Mk($){let Z=new Uint8Array;for await(let z of $){if(z==null)continue;let Q=z instanceof ArrayBuffer?new Uint8Array(z):typeof z==="string"?d4(z):z,X=new Uint8Array(Z.length+Q.length);X.set(Z),X.set(Q,Z.length),Z=X;let J;while((J=EK(Z))!==-1)yield Z.slice(0,J),Z=Z.slice(J)}if(Z.length>0)yield Z}class xK{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]=Lk($,":");if(Q.startsWith(" "))Q=Q.substring(1);if(Z==="event")this.event=Q;else if(Z==="data")this.data.push(Q);return null}}function Lk($,Z){let z=$.indexOf(Z);if(z!==-1)return[$.substring(0,z),Z,$.substring(z+Z.length)];return[$,"",""]}var n4,z2;var sz=h(()=>{o2();n0();nz();W1();dZ();n0();z2=class z2{constructor($,Z,z){this.iterator=$,n4.set(this,void 0),this.controller=Z,j(this,n4,z,"f")}static fromSSEResponse($,Z,z){let Q=!1,X=z?j0(z):console;async function*J(){if(Q)throw new b("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let U of Bk($,Z)){if(U.event==="completion")try{yield JSON.parse(U.data)}catch(W){throw X.error("Could not parse message into JSON:",U.data),X.error("From chunk:",U.raw),W}if(U.event==="message_start"||U.event==="message_delta"||U.event==="message_stop"||U.event==="content_block_start"||U.event==="content_block_delta"||U.event==="content_block_stop"||U.event==="message"||U.event==="user.message"||U.event==="user.interrupt"||U.event==="user.tool_confirmation"||U.event==="user.custom_tool_result"||U.event==="agent.message"||U.event==="agent.thinking"||U.event==="agent.tool_use"||U.event==="agent.tool_result"||U.event==="agent.mcp_tool_use"||U.event==="agent.mcp_tool_result"||U.event==="agent.custom_tool_use"||U.event==="agent.thread_context_compacted"||U.event==="session.status_running"||U.event==="session.status_idle"||U.event==="session.status_rescheduled"||U.event==="session.status_terminated"||U.event==="session.error"||U.event==="session.deleted"||U.event==="span.model_request_start"||U.event==="span.model_request_end")try{yield JSON.parse(U.data)}catch(W){throw X.error("Could not parse message into JSON:",U.data),X.error("From chunk:",U.raw),W}if(U.event==="ping")continue;if(U.event==="error"){let W=mZ(U.data)??U.data,G=W?.error?.type;throw new O0(void 0,W,void 0,$.headers,G)}}Y=!0}catch(U){if(a2(U))return;throw U}finally{if(!Y)Z.abort()}}return new z2(J,Z,z)}static fromReadableStream($,Z,z){let Q=!1;async function*X(){let Y=new R6,U=l4($);for await(let W of U)for(let G of Y.decode(W))yield G;for(let W of Y.flush())yield W}async function*J(){if(Q)throw new b("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let U of X()){if(Y)continue;if(U)yield JSON.parse(U)}Y=!0}catch(U){if(a2(U))return;throw U}finally{if(!Y)Z.abort()}}return new z2(J,Z,z)}[(n4=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],Z=[],z=this.iterator(),Q=(X)=>{return{next:()=>{if(X.length===0){let J=z.next();$.push(J),Z.push(J)}return X.shift()}}};return[new z2(()=>Q($),this.controller,O(this,n4,"f")),new z2(()=>Q(Z),this.controller,O(this,n4,"f"))]}toReadableStream(){let $=this,Z;return dz({async start(){Z=$[Symbol.asyncIterator]()},async pull(z){try{let{value:Q,done:X}=await Z.next();if(X)return z.close();let J=d4(JSON.stringify(Q)+`
169
- `);z.enqueue(J)}catch(Q){z.error(Q)}},async cancel(){await Z.return?.()}})}}});async function iZ($,Z){let{response:z,requestLogID:Q,retryOfRequestLogID:X,startTime:J}=Z,Y=await(async()=>{if(Z.options.stream){if(j0($).debug("response",z.status,z.url,z.headers,z.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(z,Z.controller);return z2.fromSSEResponse(z,Z.controller)}if(z.status===204)return null;if(Z.options.__binaryResponse)return z;let W=z.headers.get("content-type")?.split(";")[0]?.trim();if(W?.includes("application/json")||W?.endsWith("+json")){if(z.headers.get("content-length")==="0")return;let K=await z.json();return oz(K,z)}return await z.text()})();return j0($).debug(`[${Q}] response parsed`,t2({retryOfRequestLogID:X,url:z.url,status:z.status,body:Y,durationMs:Date.now()-J})),Y}function oz($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var az=h(()=>{sz();dZ()});var r4,P6;var nZ=h(()=>{o2();az();P6=class P6 extends Promise{constructor($,Z,z=iZ){super((Q)=>{Q(null)});this.responsePromise=Z,this.parseResponse=z,r4.set(this,void 0),j(this,r4,$,"f")}_thenUnwrap($){return new P6(O(this,r4,"f"),this.responsePromise,async(Z,z)=>oz($(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,r4,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};r4=new WeakMap});var rZ,tz,s4,j2,Q0;var K0=h(()=>{o2();n0();az();nZ();W1();tz=class tz{constructor($,Z,z,Q){rZ.set(this,void 0),j(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 b("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}};s4=class s4 extends P6{constructor($,Z,z){super($,Z,async(Q,X)=>new z(Q,X.response,await iZ(Q,X),X.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};j2=class j2 extends tz{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:{...uZ(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...uZ(this.options.query),after_id:$}}}};Q0=class Q0 extends tz{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:{...uZ(this.options.query),page:$}}}}});function G1($,Z,z){return $Q(),new File($,Z??"unknown_file",z)}function o4($,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 Ok($){let Z=typeof $==="function"?$:$.fetch,z=yK.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 yK.set(Z,Q),Q}var $Q=()=>{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`.":""))}},ZQ=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",Y$=async($,Z,z=!0)=>{return{...$,body:await Nk($.body,Z,z)}},yK,Nk=async($,Z,z=!0)=>{if(!await Ok(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])=>ez(Q,X,J,z))),Q},Ik=($)=>$ instanceof Blob&&("name"in $),ez=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,G1([await z.blob()],o4(z,Q),X))}else if(ZQ(z))$.append(Z,G1([await new Response(cZ(z)).blob()],o4(z,Q)));else if(Ik(z))$.append(Z,G1([z],o4(z,Q),{type:z.type}));else if(Array.isArray(z))await Promise.all(z.map((X)=>ez($,Z+"[]",X,Q)));else if(typeof z==="object")await Promise.all(Object.entries(z).map(([X,J])=>ez($,`${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 U$=h(()=>{yK=new WeakMap});async function a4($,Z,z){if($Q(),$=await $,Z||(Z=o4($,!0)),Tk($)){if($ instanceof File&&Z==null&&z==null)return $;return G1([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...z})}if(Ak($)){let X=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),G1(await zQ(X),Z,z)}let Q=await zQ($);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 G1(Q,Z,z)}async function zQ($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(bK($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(ZQ($))for await(let z of $)Z.push(...await zQ(z));else{let z=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${z?`; constructor: ${z}`:""}${Ck($)}`)}return Z}function Ck($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((z)=>`"${z}"`).join(", ")}]`}var bK=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",Tk=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&bK($),Ak=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var kK=h(()=>{U$();U$()});var QQ=h(()=>{kK()});var vK=()=>{};class c{constructor($){this._client=$}}function*Rk($){if(!$)return;if(gK 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(cz($))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=cz(Q[1])?Q[1]:[Q[1]],Y=!1;for(let U of J){if(U===void 0)continue;if(Z&&!Y)Y=!0,yield[X,null];yield[X,U]}}}var gK,T=($)=>{let Z=new Headers,z=new Set;for(let Q of $){let X=new Set;for(let[J,Y]of Rk(Q)){let U=J.toLowerCase();if(!X.has(U))Z.delete(J),X.add(U);if(Y===null)Z.delete(J),z.add(U);else Z.append(J,Y),z.delete(U)}}return{[gK]:!0,values:Z,nulls:z}};var W0=h(()=>{W1();gK=Symbol.for("brand.privateNullableHeaders")});function fK($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var hK,Pk=($=fK)=>function(z,...Q){if(z.length===1)return z[0];let X=!1,J=[],Y=z.reduce((V,q,K)=>{if(/[?#]/.test(q))X=!0;let H=Q[K],L=(X?encodeURIComponent:$)(""+H);if(K!==Q.length&&(H==null||typeof H==="object"&&H.toString===Object.getPrototypeOf(Object.getPrototypeOf(H.hasOwnProperty??hK)??hK)?.toString))L=H+"",J.push({start:V.length+q.length,length:L.length,error:`Value of type ${Object.prototype.toString.call(H).slice(8,-1)} is not a valid path parameter`});return V+q+(K===Q.length?"":L)},""),U=Y.split(/[?#]/,1)[0],W=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,G;while((G=W.exec(U))!==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((K,H)=>{let L=" ".repeat(H.start-V),B="^".repeat(H.length);return V=H.start+H.length,K+L+B},"");throw new b(`Path parameters result in path with invalid segments:
165
+ `,Z)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Z=j5($),z=E1(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=j5($),z=E1(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()}}}rA.Parser=uY});var dY=F((QC)=>{var mY=j9(),oA=d$(),a$=i$(),aA=h7(),tA=t(),eA=h9(),cY=f9();function pY($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new eA.LineCounter||null,prettyErrors:Z}}function $C($,Z={}){let{lineCounter:z,prettyErrors:Q}=pY(Z),X=new cY.Parser(z?.addNewLine),J=new mY.Composer(Z),Y=Array.from(J.compose(X.parse($)));if(Q&&z)for(let U of Y)U.errors.forEach(a$.prettifyError($,z)),U.warnings.forEach(a$.prettifyError($,z));if(Y.length>0)return Y;return Object.assign([],{empty:!0},J.streamInfo())}function lY($,Z={}){let{lineCounter:z,prettyErrors:Q}=pY(Z),X=new cY.Parser(z?.addNewLine),J=new mY.Composer(Z),Y=null;for(let U of J.compose(X.parse($),!0,$.length))if(!Y)Y=U;else if(Y.options.logLevel!=="silent"){Y.errors.push(new a$.YAMLParseError(U.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&z)Y.errors.forEach(a$.prettifyError($,z)),Y.warnings.forEach(a$.prettifyError($,z));return Y}function ZC($,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=lY($,z);if(!X)return null;if(X.warnings.forEach((J)=>aA.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 zC($,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(tA.isDocument($)&&!Q)return $.toString(z);return new oA.Document($,Q,z).toString(z)}QC.parse=ZC;QC.parseAllDocuments=$C;QC.parseDocument=lY;QC.stringify=zC});var lU={};NX(lU,{plainOnStderr:()=>K3,orange:()=>_0,italic:()=>ZP,fafCyanDeep:()=>r5,fafCyan:()=>A,dim:()=>M,colorOn:()=>q3,bold:()=>C,FAF_HEX:()=>V4});function q3($=process.stdout){let Z=process.env.FORCE_COLOR;if(Z!==void 0)return Z!=="0"&&Z!=="false";if(process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!=="")return!1;return Boolean($.isTTY)}function K3($){return q3(process.stderr)?$:$.replace($P,"")}var $P,n5=($,Z)=>q3()?`\x1B[${$}m${Z}\x1B[0m`:Z,H3=($)=>(Z)=>n5($,Z),C,M,ZP,V4,A=($)=>n5("38;2;0;212;212",$),r5=($)=>n5("38;2;14;140;140",$),_0=($)=>n5("38;5;208",$);var i=h(()=>{$P=new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`,"g");C=H3("1"),M=H3("2"),ZP=H3("3"),V4={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var gz=F((cn,gy)=>{gy.exports={name:"faf-cli",version:"8.11.0",description:"Persistent AI context + memory — .faf and .fafm, IANA-registered. AI suggests your goal and six W's, you confirm, and every agent file faf writes carries them. Anthropic-merged.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",types:"./dist/index.d.ts",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"},"./pack":{types:"./dist/interop/pack.d.ts",default:"./dist/pack.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",clean:"rm -rf dist",build:"bun run clean && bun build src/cli.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/index.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/interop/pack.ts --outdir dist --target=browser --minify --sourcemap=linked && tsc -p tsconfig.build.json && node scripts/strip-sources-content.mjs",compile:"bun build src/cli.ts --compile --bytecode --minify --outfile faf","compile:all":"bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-arm64 --outfile faf-darwin-arm64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-x64 --outfile faf-darwin-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-linux-x64 --outfile faf-linux-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-windows-x64 --outfile faf-windows-x64.exe",test:"bun test --timeout=120000","test:watch":"bun test --watch --timeout=120000",lint:"eslint 'src/**/*.ts'",format:"prettier --write 'src/**/*.ts'","check:no-hardcode":"! grep -rEln '/(Users|home/runner|private/var)/' dist/ || (echo '❌ Hardcoded build-machine path leaked into dist — see grep output above. Externalize the offending dep in the build script.'; exit 1)","check:engines":"node scripts/check-engines.mjs",prepublishOnly:"bun run check:engines && bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational","agents-md","context-engineering","codex","windsurf","fafm","ai-memory","agents"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.3","faf-scoring-kernel":"^3.0.0",open:"^11.0.0",yaml:"^2.9.0"},devDependencies:{"@anthropic-ai/sdk":"^0.91.1","@faf/specification":"github:Wolfe-Jam/faf","@types/bun":"^1.3.14","@types/node":"^22.20.1","@typescript-eslint/eslint-plugin":"^8.66.0","@typescript-eslint/parser":"^8.66.0",ajv:"^8.20.0",eslint:"^9.39.5",prettier:"^3.9.6",typescript:"^5.9.3","typescript-eslint":"^8.66.0"},overrides:{"brace-expansion":"^1.1.18","fast-uri":"^3.1.9",picomatch:"^4.0.5","@typescript-eslint/typescript-estree":{minimatch:"^11.0.1"}},engines:{node:">=22.0.0"},publishConfig:{access:"public"}}});function R($,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 $6=()=>{};var iz=function(){let{crypto:$}=globalThis;if($?.randomUUID)return iz=$.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 Z6($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var r4=($)=>{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 b,L0,x0,R6,z$,Q$,X$,J$,Y$,U$,W$,G$,V$;var i0=h(()=>{b=class b extends Error{};L0=class L0 extends b{constructor($,Z,z,Q,X){super(`${L0.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 R6({message:z,cause:r4(Z)});let X=Z,J=X?.error?.type;if($===400)return new Q$($,X,z,Q,J);if($===401)return new X$($,X,z,Q,J);if($===403)return new J$($,X,z,Q,J);if($===404)return new Y$($,X,z,Q,J);if($===409)return new U$($,X,z,Q,J);if($===422)return new W$($,X,z,Q,J);if($===429)return new G$($,X,z,Q,J);if($>=500)return new V$($,X,z,Q,J);return new L0($,X,z,Q,J)}};x0=class x0 extends L0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};R6=class R6 extends L0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};z$=class z$ extends R6{constructor({message:$}={}){super({message:$??"Request timed out."})}};Q$=class Q$ extends L0{};X$=class X$ extends L0{};J$=class J$ extends L0{};Y$=class Y$ extends L0{};U$=class U$ extends L0{};W$=class W$ extends L0{};G$=class G$ extends L0{};V$=class V$ extends L0{}});function dZ($){if(typeof $!=="object")return{};return $??{}}function sz($){if(!$)return!0;for(let Z in $)return!1;return!0}function _K($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var Ak,CK=($)=>{return Ak.test($)},nz=($)=>(nz=Array.isArray,nz($)),rz,PK=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new b(`${$} must be an integer`);if(Z<0)throw new b(`${$} must be a positive integer`);return Z},iZ=($)=>{try{return JSON.parse($)}catch(Z){return}};var q1=h(()=>{i0();Ak=/^[a-z][a-z0-9+.-]*:/i,rz=nz});var FK=($)=>new Promise((Z)=>setTimeout(Z,$));var j6="0.91.1";function Ck(){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 Pk(){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 EK=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},_k=()=>{let $=Ck();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":j6,"X-Stainless-OS":jK(Deno.build.os),"X-Stainless-Arch":RK(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":j6,"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":j6,"X-Stainless-OS":jK(globalThis.process.platform??"unknown"),"X-Stainless-Arch":RK(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=Pk();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":j6,"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":j6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},RK=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},jK=($)=>{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"},SK,wK=()=>{return SK??(SK=_k())};var oz=()=>{};function xK(){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 az(...$){let Z=globalThis.ReadableStream;if(typeof Z>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new Z(...$)}function nZ($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return az({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 s4($){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 yK($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),z=Z.cancel();Z.releaseLock(),await z}var bK=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function kK($){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 b(`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 vK=h(()=>{i0()});function fK($){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 o4($){let Z;return(gK??(Z=new globalThis.TextEncoder,gK=Z.encode.bind(Z)))($)}function tz($){let Z;return(hK??(Z=new globalThis.TextDecoder,hK=Z.decode.bind(Z)))($)}var gK,hK;class S6{constructor(){$2.set(this,void 0),Z2.set(this,void 0),R(this,$2,new Uint8Array,"f"),R(this,Z2,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?o4($):$;R(this,$2,fK([O(this,$2,"f"),Z]),"f");let z=[],Q;while((Q=jk(O(this,$2,"f"),O(this,Z2,"f")))!=null){if(Q.carriage&&O(this,Z2,"f")==null){R(this,Z2,Q.index,"f");continue}if(O(this,Z2,"f")!=null&&(Q.index!==O(this,Z2,"f")+1||Q.carriage)){z.push(tz(O(this,$2,"f").subarray(0,O(this,Z2,"f")-1))),R(this,$2,O(this,$2,"f").subarray(O(this,Z2,"f")),"f"),R(this,Z2,null,"f");continue}let X=O(this,Z2,"f")!==null?Q.preceding-1:Q.preceding,J=tz(O(this,$2,"f").subarray(0,X));z.push(J),R(this,$2,O(this,$2,"f").subarray(Q.index),"f"),R(this,Z2,null,"f")}return z}flush(){if(!O(this,$2,"f").length)return[];return this.decode(`
166
+ `)}}function jk($,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 uK($){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 $2,Z2;var ez=h(()=>{$6();$2=new WeakMap,Z2=new WeakMap;S6.NEWLINE_CHARS=new Set([`
167
+ `,"\r"]);S6.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function a4(){}function rZ($,Z,z){if(!Z||sZ[$]>sZ[z])return a4;else return Z[$].bind(Z)}function R0($){let Z=$.logger,z=$.logLevel??"off";if(!Z)return Sk;let Q=mK.get(Z);if(Q&&Q[0]===z)return Q[1];let X={error:rZ("error",Z,z),warn:rZ("warn",Z,z),info:rZ("info",Z,z),debug:rZ("debug",Z,z)};return mK.set(Z,[z,X]),X}var sZ,$Q=($,Z,z)=>{if(!$)return;if(_K(sZ,$))return $;R0(z).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(sZ))}`);return},Sk,mK,z6=($)=>{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 oZ=h(()=>{q1();sZ={off:0,error:200,warn:300,info:400,debug:500};Sk={error:a4,warn:a4,info:a4,debug:a4},mK=new WeakMap});async function*Ek($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new b("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 b("Attempted to iterate over a response with no body")}let z=new cK,Q=new S6,X=s4($.body);for await(let J of wk(X))for(let Y of Q.decode(J)){let U=z.decode(Y);if(U)yield U}for(let J of Q.flush()){let Y=z.decode(J);if(Y)yield Y}}async function*wk($){let Z=new Uint8Array;for await(let z of $){if(z==null)continue;let Q=z instanceof ArrayBuffer?new Uint8Array(z):typeof z==="string"?o4(z):z,X=new Uint8Array(Z.length+Q.length);X.set(Z),X.set(Q,Z.length),Z=X;let J;while((J=uK(Z))!==-1)yield Z.slice(0,J),Z=Z.slice(J)}if(Z.length>0)yield Z}class cK{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]=xk($,":");if(Q.startsWith(" "))Q=Q.substring(1);if(Z==="event")this.event=Q;else if(Z==="data")this.data.push(Q);return null}}function xk($,Z){let z=$.indexOf(Z);if(z!==-1)return[$.substring(0,z),Z,$.substring(z+Z.length)];return[$,"",""]}var t4,z2;var ZQ=h(()=>{$6();i0();ez();q1();oZ();i0();z2=class z2{constructor($,Z,z){this.iterator=$,t4.set(this,void 0),this.controller=Z,R(this,t4,z,"f")}static fromSSEResponse($,Z,z){let Q=!1,X=z?R0(z):console;async function*J(){if(Q)throw new b("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let U of Ek($,Z)){if(U.event==="completion")try{yield JSON.parse(U.data)}catch(W){throw X.error("Could not parse message into JSON:",U.data),X.error("From chunk:",U.raw),W}if(U.event==="message_start"||U.event==="message_delta"||U.event==="message_stop"||U.event==="content_block_start"||U.event==="content_block_delta"||U.event==="content_block_stop"||U.event==="message"||U.event==="user.message"||U.event==="user.interrupt"||U.event==="user.tool_confirmation"||U.event==="user.custom_tool_result"||U.event==="agent.message"||U.event==="agent.thinking"||U.event==="agent.tool_use"||U.event==="agent.tool_result"||U.event==="agent.mcp_tool_use"||U.event==="agent.mcp_tool_result"||U.event==="agent.custom_tool_use"||U.event==="agent.thread_context_compacted"||U.event==="session.status_running"||U.event==="session.status_idle"||U.event==="session.status_rescheduled"||U.event==="session.status_terminated"||U.event==="session.error"||U.event==="session.deleted"||U.event==="span.model_request_start"||U.event==="span.model_request_end")try{yield JSON.parse(U.data)}catch(W){throw X.error("Could not parse message into JSON:",U.data),X.error("From chunk:",U.raw),W}if(U.event==="ping")continue;if(U.event==="error"){let W=iZ(U.data)??U.data,G=W?.error?.type;throw new L0(void 0,W,void 0,$.headers,G)}}Y=!0}catch(U){if(Z6(U))return;throw U}finally{if(!Y)Z.abort()}}return new z2(J,Z,z)}static fromReadableStream($,Z,z){let Q=!1;async function*X(){let Y=new S6,U=s4($);for await(let W of U)for(let G of Y.decode(W))yield G;for(let W of Y.flush())yield W}async function*J(){if(Q)throw new b("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let U of X()){if(Y)continue;if(U)yield JSON.parse(U)}Y=!0}catch(U){if(Z6(U))return;throw U}finally{if(!Y)Z.abort()}}return new z2(J,Z,z)}[(t4=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],Z=[],z=this.iterator(),Q=(X)=>{return{next:()=>{if(X.length===0){let J=z.next();$.push(J),Z.push(J)}return X.shift()}}};return[new z2(()=>Q($),this.controller,O(this,t4,"f")),new z2(()=>Q(Z),this.controller,O(this,t4,"f"))]}toReadableStream(){let $=this,Z;return az({async start(){Z=$[Symbol.asyncIterator]()},async pull(z){try{let{value:Q,done:X}=await Z.next();if(X)return z.close();let J=o4(JSON.stringify(Q)+`
169
+ `);z.enqueue(J)}catch(Q){z.error(Q)}},async cancel(){await Z.return?.()}})}}});async function aZ($,Z){let{response:z,requestLogID:Q,retryOfRequestLogID:X,startTime:J}=Z,Y=await(async()=>{if(Z.options.stream){if(R0($).debug("response",z.status,z.url,z.headers,z.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(z,Z.controller);return z2.fromSSEResponse(z,Z.controller)}if(z.status===204)return null;if(Z.options.__binaryResponse)return z;let W=z.headers.get("content-type")?.split(";")[0]?.trim();if(W?.includes("application/json")||W?.endsWith("+json")){if(z.headers.get("content-length")==="0")return;let K=await z.json();return zQ(K,z)}return await z.text()})();return R0($).debug(`[${Q}] response parsed`,z6({retryOfRequestLogID:X,url:z.url,status:z.status,body:Y,durationMs:Date.now()-J})),Y}function zQ($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var QQ=h(()=>{ZQ();oZ()});var e4,E6;var tZ=h(()=>{$6();QQ();E6=class E6 extends Promise{constructor($,Z,z=aZ){super((Q)=>{Q(null)});this.responsePromise=Z,this.parseResponse=z,e4.set(this,void 0),R(this,e4,$,"f")}_thenUnwrap($){return new E6(O(this,e4,"f"),this.responsePromise,async(Z,z)=>zQ($(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,e4,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};e4=new WeakMap});var eZ,XQ,$8,j2,z0;var V0=h(()=>{$6();i0();QQ();tZ();q1();XQ=class XQ{constructor($,Z,z,Q){eZ.set(this,void 0),R(this,eZ,$,"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 b("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await O(this,eZ,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(eZ=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};$8=class $8 extends E6{constructor($,Z,z){super($,Z,async(Q,X)=>new z(Q,X.response,await aZ(Q,X),X.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};j2=class j2 extends XQ{constructor($,Z,z,Q){super($,Z,z,Q);this.data=z.data||[],this.has_more=z.has_more||!1,this.first_id=z.first_id||null,this.last_id=z.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let Z=this.first_id;if(!Z)return null;return{...this.options,query:{...dZ(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...dZ(this.options.query),after_id:$}}}};z0=class z0 extends XQ{constructor($,Z,z,Q){super($,Z,z,Q);this.data=z.data||[],this.next_page=z.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let $=this.next_page;if(!$)return null;return{...this.options,query:{...dZ(this.options.query),page:$}}}}});function K1($,Z,z){return YQ(),new File($,Z??"unknown_file",z)}function Z8($,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 bk($){let Z=typeof $==="function"?$:$.fetch,z=pK.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 pK.set(Z,Q),Q}var YQ=()=>{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`.":""))}},UQ=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",q$=async($,Z,z=!0)=>{return{...$,body:await kk($.body,Z,z)}},pK,kk=async($,Z,z=!0)=>{if(!await bk(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])=>JQ(Q,X,J,z))),Q},vk=($)=>$ instanceof Blob&&("name"in $),JQ=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,K1([await z.blob()],Z8(z,Q),X))}else if(UQ(z))$.append(Z,K1([await new Response(nZ(z)).blob()],Z8(z,Q)));else if(vk(z))$.append(Z,K1([z],Z8(z,Q),{type:z.type}));else if(Array.isArray(z))await Promise.all(z.map((X)=>JQ($,Z+"[]",X,Q)));else if(typeof z==="object")await Promise.all(Object.entries(z).map(([X,J])=>JQ($,`${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 K$=h(()=>{pK=new WeakMap});async function z8($,Z,z){if(YQ(),$=await $,Z||(Z=Z8($,!0)),gk($)){if($ instanceof File&&Z==null&&z==null)return $;return K1([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...z})}if(hk($)){let X=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),K1(await WQ(X),Z,z)}let Q=await WQ($);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 K1(Q,Z,z)}async function WQ($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(lK($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(UQ($))for await(let z of $)Z.push(...await WQ(z));else{let z=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${z?`; constructor: ${z}`:""}${fk($)}`)}return Z}function fk($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((z)=>`"${z}"`).join(", ")}]`}var lK=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",gk=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&lK($),hk=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var dK=h(()=>{K$();K$()});var GQ=h(()=>{dK()});var iK=()=>{};class p{constructor($){this._client=$}}function*mk($){if(!$)return;if(nK 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(rz($))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=rz(Q[1])?Q[1]:[Q[1]],Y=!1;for(let U of J){if(U===void 0)continue;if(Z&&!Y)Y=!0,yield[X,null];yield[X,U]}}}var nK,T=($)=>{let Z=new Headers,z=new Set;for(let Q of $){let X=new Set;for(let[J,Y]of mk(Q)){let U=J.toLowerCase();if(!X.has(U))Z.delete(J),X.add(U);if(Y===null)Z.delete(J),z.add(U);else Z.append(J,Y),z.delete(U)}}return{[nK]:!0,values:Z,nulls:z}};var U0=h(()=>{q1();nK=Symbol.for("brand.privateNullableHeaders")});function sK($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var rK,ck=($=sK)=>function(z,...Q){if(z.length===1)return z[0];let X=!1,J=[],Y=z.reduce((V,q,K)=>{if(/[?#]/.test(q))X=!0;let L=Q[K],B=(X?encodeURIComponent:$)(""+L);if(K!==Q.length&&(L==null||typeof L==="object"&&L.toString===Object.getPrototypeOf(Object.getPrototypeOf(L.hasOwnProperty??rK)??rK)?.toString))B=L+"",J.push({start:V.length+q.length,length:B.length,error:`Value of type ${Object.prototype.toString.call(L).slice(8,-1)} is not a valid path parameter`});return V+q+(K===Q.length?"":B)},""),U=Y.split(/[?#]/,1)[0],W=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,G;while((G=W.exec(U))!==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((K,L)=>{let B=" ".repeat(L.start-V),H="^".repeat(L.length);return V=L.start+L.length,K+B+H},"");throw new b(`Path parameters result in path with invalid segments:
170
170
  ${J.map((K)=>K.error).join(`
171
171
  `)}
172
172
  ${Y}
173
- ${q}`)}return Y},R;var N0=h(()=>{n0();hK=Object.freeze(Object.create(null)),R=Pk(fK)});var t4;var XQ=h(()=>{K0();W0();N0();t4=class t4 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/environments?beta=true",{body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/environments/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/environments/${$}?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/environments?beta=true",Q0,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/environments/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/environments/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});function sZ($){return typeof $==="object"&&$!==null&&e4 in $}function JQ($,Z){let z=new Set;if($){for(let Q of $)if(sZ(Q))z.add(Q[e4])}if(Z)for(let Q of Z){if(sZ(Q))z.add(Q[e4]);if(Array.isArray(Q.content)){for(let X of Q.content)if(sZ(X))z.add(X[e4])}}return Array.from(z)}function oZ($,Z){let z=JQ($,Z);if(z.length===0)return{};return{"x-stainless-helper":z.join(", ")}}function uK($){if(sZ($))return{"x-stainless-helper":$[e4]};return{}}var e4;var $8=h(()=>{e4=Symbol("anthropic.sdk.stainlessHelper")});var Z8;var YQ=h(()=>{K0();W0();$8();U$();N0();Z8=class Z8 extends c{list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/files?beta=true",j2,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/files/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}download($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/files/${$}/content?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},z?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/files/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}upload($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/files?beta=true",Y$({body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},uK(Q.file),Z?.headers])},this._client))}}});var z8;var UQ=h(()=>{K0();W0();N0();z8=class z8 extends c{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/models/${$}?beta=true`,{...z,headers:T([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models?beta=true",j2,{query:Q,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var Q8;var WQ=h(()=>{K0();W0();N0();Q8=class Q8 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/user_profiles?beta=true",{body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/user_profiles/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/user_profiles/${$}?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/user_profiles?beta=true",Q0,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}}});var X8;var GQ=h(()=>{K0();W0();N0();X8=class X8 extends c{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/agents/${$}/versions?beta=true`,Q0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var W$;var VQ=h(()=>{GQ();GQ();K0();W0();N0();W$=class W$ extends c{constructor(){super(...arguments);this.versions=new X8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/agents?beta=true",{body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.get(R`/v1/agents/${$}?beta=true`,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/agents/${$}?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/agents?beta=true",Q0,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/agents/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};W$.Versions=X8});var J8;var qQ=h(()=>{K0();W0();N0();J8=class J8 extends c{create($,Z,z){let{view:Q,betas:X,...J}=Z;return this._client.post(R`/v1/memory_stores/${$}/memories?beta=true`,{query:{view:Q},body:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(R`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{memory_store_id:Q,view:X,betas:J,...Y}=Z;return this._client.post(R`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{view:X},body:Y,...z,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/memory_stores/${$}/memories?beta=true`,Q0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{memory_store_id:Q,expected_content_sha256:X,betas:J}=Z;return this._client.delete(R`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{expected_content_sha256:X},...z,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var Y8;var KQ=h(()=>{K0();W0();N0();Y8=class Y8 extends c{retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(R`/v1/memory_stores/${Q}/memory_versions/${$}?beta=true`,{query:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/memory_stores/${$}/memory_versions?beta=true`,Q0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}redact($,Z,z){let{memory_store_id:Q,betas:X}=Z;return this._client.post(R`/v1/memory_stores/${Q}/memory_versions/${$}/redact?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var V1;var HQ=h(()=>{qQ();qQ();KQ();KQ();K0();W0();N0();V1=class V1 extends c{constructor(){super(...arguments);this.memories=new J8(this._client),this.memoryVersions=new Y8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/memory_stores?beta=true",{body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/memory_stores/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/memory_stores/${$}?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/memory_stores?beta=true",Q0,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/memory_stores/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/memory_stores/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};V1.Memories=J8;V1.MemoryVersions=Y8});var G$=h(()=>{n0()});var aZ;var BQ=h(()=>{aZ={"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 mK($){return $?.output_format??$?.output_config?.format}function MQ($,Z,z){let Q=mK(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 LQ($,Z,z)}function LQ($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=vk(Z,J.text);if(Q===null)Q=Y;let U=Object.defineProperty({...J},"parsed_output",{value:Y,enumerable:!1});return Object.defineProperty(U,"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 vk($,Z){let z=mK($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new b(`Failed to parse structured output: ${Q}`)}}var DQ=h(()=>{n0()});var gk=($)=>{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 U="",W=!1;Q=$[++Z];while(Q!=='"'){if(Z===$.length){W=!0;break}if(Q==="\\"){if(Z++,Z===$.length){W=!0;break}U+=Q+$[Z],Q=$[++Z]}else U+=Q,Q=$[++Z]}if(Q=$[++Z],!W)z.push({type:"string",value:U});continue}if(Q&&/\s/.test(Q)){Z++;continue}let J=/[0-9]/;if(Q&&J.test(Q)||Q==="-"||Q==="."){let U="";if(Q==="-")U+=Q,Q=$[++Z];while(Q&&J.test(Q)||Q===".")U+=Q,Q=$[++Z];z.push({type:"number",value:U});continue}let Y=/[a-z]/i;if(Q&&Y.test(Q)){let U="";while(Q&&Y.test(Q)){if(Z===$.length)break;U+=Q,Q=$[++Z]}if(U=="true"||U=="false"||U==="null")z.push({type:"name",value:U});else{Z++;continue}continue}Z++}return z},V$=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),V$($);break;case"number":let z=Z.value[Z.value.length-1];if(z==="."||z==="-")return $=$.slice(0,$.length-1),V$($);case"string":let Q=$[$.length-2];if(Q?.type==="delimiter")return $=$.slice(0,$.length-1),V$($);else if(Q?.type==="brace"&&Q.value==="{")return $=$.slice(0,$.length-1),V$($);break;case"delimiter":return $=$.slice(0,$.length-1),V$($);break}return $},hk=($)=>{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 $},fk=($)=>{let Z="";return $.map((z)=>{switch(z.type){case"string":Z+='"'+z.value+'"';break;default:Z+=z.value;break}}),Z},tZ=($)=>JSON.parse(fk(hk(V$(gk($)))));var OQ=()=>{};var NQ=h(()=>{sz()});function dK($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function iK($){}var B2,F6,q$,U8,eZ,W8,G8,$7,V8,e2,q8,Z7,z7,q1,Q7,X7,K8,IQ,cK,J7,TQ,AQ,CQ,pK,lK="__json_buf",H8;var nK=h(()=>{o2();OQ();G$();NQ();DQ();H8=class H8{constructor($,Z){B2.add(this),this.messages=[],this.receivedMessages=[],F6.set(this,void 0),q$.set(this,null),this.controller=new AbortController,U8.set(this,void 0),eZ.set(this,()=>{}),W8.set(this,()=>{}),G8.set(this,void 0),$7.set(this,()=>{}),V8.set(this,()=>{}),e2.set(this,{}),q8.set(this,!1),Z7.set(this,!1),z7.set(this,!1),q1.set(this,!1),Q7.set(this,void 0),X7.set(this,void 0),K8.set(this,void 0),J7.set(this,(z)=>{if(j(this,Z7,!0,"f"),a2(z))z=new x0;if(z instanceof x0)return j(this,z7,!0,"f"),this._emit("abort",z);if(z instanceof b)return this._emit("error",z);if(z instanceof Error){let Q=new b(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new b(String(z)))}),j(this,U8,new Promise((z,Q)=>{j(this,eZ,z,"f"),j(this,W8,Q,"f")}),"f"),j(this,G8,new Promise((z,Q)=>{j(this,$7,z,"f"),j(this,V8,Q,"f")}),"f"),O(this,U8,"f").catch(()=>{}),O(this,G8,"f").catch(()=>{}),j(this,q$,$,"f"),j(this,K8,Z?.logger??console,"f")}get response(){return O(this,Q7,"f")}get request_id(){return O(this,X7,"f")}async withResponse(){j(this,q1,!0,"f");let $=await O(this,U8,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new H8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new H8(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return j(X,q$,{...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,J7,"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,B2,"m",TQ).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let U of Y)O(this,B2,"m",AQ).call(this,U);if(Y.controller.signal?.aborted)throw new x0;O(this,B2,"m",CQ).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;j(this,Q7,$,"f"),j(this,X7,$?.headers.get("request-id"),"f"),O(this,eZ,"f").call(this,$),this._emit("connect")}get ended(){return O(this,q8,"f")}get errored(){return O(this,Z7,"f")}get aborted(){return O(this,z7,"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(j(this,q1,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){j(this,q1,!0,"f"),await O(this,G8,"f")}get currentMessage(){return O(this,F6,"f")}async finalMessage(){return await this.done(),O(this,B2,"m",IQ).call(this)}async finalText(){return await this.done(),O(this,B2,"m",cK).call(this)}_emit($,...Z){if(O(this,q8,"f"))return;if($==="end")j(this,q8,!0,"f"),O(this,$7,"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,q1,"f")&&!z?.length)Promise.reject(Q);O(this,W8,"f").call(this,Q),O(this,V8,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!O(this,q1,"f")&&!z?.length)Promise.reject(Q);O(this,W8,"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,B2,"m",IQ).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,B2,"m",TQ).call(this),this._connected(null);let X=z2.fromReadableStream($,this.controller);for await(let J of X)O(this,B2,"m",AQ).call(this,J);if(X.controller.signal?.aborted)throw new x0;O(this,B2,"m",CQ).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(F6=new WeakMap,q$=new WeakMap,U8=new WeakMap,eZ=new WeakMap,W8=new WeakMap,G8=new WeakMap,$7=new WeakMap,V8=new WeakMap,e2=new WeakMap,q8=new WeakMap,Z7=new WeakMap,z7=new WeakMap,q1=new WeakMap,Q7=new WeakMap,X7=new WeakMap,K8=new WeakMap,J7=new WeakMap,B2=new WeakSet,IQ=function(){if(this.receivedMessages.length===0)throw new b("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},cK=function(){if(this.receivedMessages.length===0)throw new b("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 b("stream ended without producing a content block with type=text");return Z.join(" ")},TQ=function(){if(this.ended)return;j(this,F6,void 0,"f")},AQ=function(Z){if(this.ended)return;let z=O(this,B2,"m",pK).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(dK(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:iK(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(MQ(z,O(this,q$,"f"),{logger:O(this,K8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{j(this,F6,z,"f");break}case"content_block_start":case"message_delta":break}},CQ=function(){if(this.ended)throw new b("stream has ended, this shouldn't happen");let Z=O(this,F6,"f");if(!Z)throw new b("request ended without sending any chunks");return j(this,F6,void 0,"f"),MQ(Z,O(this,q$,"f"),{logger:O(this,K8,"f")})},pK=function(Z){let z=O(this,F6,"f");if(Z.type==="message_start"){if(z)throw new b(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new b(`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&&dK(Q)){let X=Q[lK]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,lK,{value:X,enumerable:!1,writable:!0}),X)try{J.input=tZ(X)}catch(Y){let U=new b(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${X}`);O(this,J7,"f").call(this,U)}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:iK(Z.delta)}return z}case"content_block_stop":return z}},Symbol.asyncIterator)](){let $=[],Z=[],z=!1;return this.on("streamEvent",(Q)=>{let X=Z.shift();if(X)X.resolve(Q);else $.push(Q)}),this.on("end",()=>{z=!0;for(let Q of Z)Q.resolve(void 0);Z.length=0}),this.on("abort",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),this.on("error",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),{next:async()=>{if(!$.length){if(z)return{value:void 0,done:!0};return new Promise((X,J)=>Z.push({resolve:X,reject:J})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new z2(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var K$;var Y7=h(()=>{K$=class K$ 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 rK=1e5,sK=`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
+ ${q}`)}return Y},P;var D0=h(()=>{i0();rK=Object.freeze(Object.create(null)),P=ck(sK)});var Q8;var VQ=h(()=>{V0();U0();D0();Q8=class Q8 extends p{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/environments?beta=true",{body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(P`/v1/environments/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(P`/v1/environments/${$}?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/environments?beta=true",z0,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(P`/v1/environments/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(P`/v1/environments/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});function $7($){return typeof $==="object"&&$!==null&&X8 in $}function qQ($,Z){let z=new Set;if($){for(let Q of $)if($7(Q))z.add(Q[X8])}if(Z)for(let Q of Z){if($7(Q))z.add(Q[X8]);if(Array.isArray(Q.content)){for(let X of Q.content)if($7(X))z.add(X[X8])}}return Array.from(z)}function Z7($,Z){let z=qQ($,Z);if(z.length===0)return{};return{"x-stainless-helper":z.join(", ")}}function oK($){if($7($))return{"x-stainless-helper":$[X8]};return{}}var X8;var J8=h(()=>{X8=Symbol("anthropic.sdk.stainlessHelper")});var Y8;var KQ=h(()=>{V0();U0();J8();K$();D0();Y8=class Y8 extends p{list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/files?beta=true",j2,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(P`/v1/files/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}download($,Z={},z){let{betas:Q}=Z??{};return this._client.get(P`/v1/files/${$}/content?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},z?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},z){let{betas:Q}=Z??{};return this._client.get(P`/v1/files/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}upload($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/files?beta=true",q$({body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},oK(Q.file),Z?.headers])},this._client))}}});var U8;var HQ=h(()=>{V0();U0();D0();U8=class U8 extends p{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(P`/v1/models/${$}?beta=true`,{...z,headers:T([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models?beta=true",j2,{query:Q,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var W8;var BQ=h(()=>{V0();U0();D0();W8=class W8 extends p{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/user_profiles?beta=true",{body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(P`/v1/user_profiles/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(P`/v1/user_profiles/${$}?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/user_profiles?beta=true",z0,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},z){let{betas:Q}=Z??{};return this._client.post(P`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}}});var G8;var MQ=h(()=>{V0();U0();D0();G8=class G8 extends p{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(P`/v1/agents/${$}/versions?beta=true`,z0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var H$;var LQ=h(()=>{MQ();MQ();V0();U0();D0();H$=class H$ extends p{constructor(){super(...arguments);this.versions=new G8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/agents?beta=true",{body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.get(P`/v1/agents/${$}?beta=true`,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(P`/v1/agents/${$}?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/agents?beta=true",z0,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(P`/v1/agents/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};H$.Versions=G8});var V8;var DQ=h(()=>{V0();U0();D0();V8=class V8 extends p{create($,Z,z){let{view:Q,betas:X,...J}=Z;return this._client.post(P`/v1/memory_stores/${$}/memories?beta=true`,{query:{view:Q},body:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(P`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{memory_store_id:Q,view:X,betas:J,...Y}=Z;return this._client.post(P`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{view:X},body:Y,...z,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(P`/v1/memory_stores/${$}/memories?beta=true`,z0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{memory_store_id:Q,expected_content_sha256:X,betas:J}=Z;return this._client.delete(P`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{expected_content_sha256:X},...z,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var q8;var OQ=h(()=>{V0();U0();D0();q8=class q8 extends p{retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(P`/v1/memory_stores/${Q}/memory_versions/${$}?beta=true`,{query:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(P`/v1/memory_stores/${$}/memory_versions?beta=true`,z0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}redact($,Z,z){let{memory_store_id:Q,betas:X}=Z;return this._client.post(P`/v1/memory_stores/${Q}/memory_versions/${$}/redact?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var H1;var NQ=h(()=>{DQ();DQ();OQ();OQ();V0();U0();D0();H1=class H1 extends p{constructor(){super(...arguments);this.memories=new V8(this._client),this.memoryVersions=new q8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/memory_stores?beta=true",{body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(P`/v1/memory_stores/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(P`/v1/memory_stores/${$}?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/memory_stores?beta=true",z0,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(P`/v1/memory_stores/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(P`/v1/memory_stores/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};H1.Memories=V8;H1.MemoryVersions=q8});var B$=h(()=>{i0()});var z7;var IQ=h(()=>{z7={"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 aK($){return $?.output_format??$?.output_config?.format}function TQ($,Z,z){let Q=aK(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 AQ($,Z,z)}function AQ($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=tk(Z,J.text);if(Q===null)Q=Y;let U=Object.defineProperty({...J},"parsed_output",{value:Y,enumerable:!1});return Object.defineProperty(U,"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 tk($,Z){let z=aK($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new b(`Failed to parse structured output: ${Q}`)}}var CQ=h(()=>{i0()});var ek=($)=>{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 U="",W=!1;Q=$[++Z];while(Q!=='"'){if(Z===$.length){W=!0;break}if(Q==="\\"){if(Z++,Z===$.length){W=!0;break}U+=Q+$[Z],Q=$[++Z]}else U+=Q,Q=$[++Z]}if(Q=$[++Z],!W)z.push({type:"string",value:U});continue}if(Q&&/\s/.test(Q)){Z++;continue}let J=/[0-9]/;if(Q&&J.test(Q)||Q==="-"||Q==="."){let U="";if(Q==="-")U+=Q,Q=$[++Z];while(Q&&J.test(Q)||Q===".")U+=Q,Q=$[++Z];z.push({type:"number",value:U});continue}let Y=/[a-z]/i;if(Q&&Y.test(Q)){let U="";while(Q&&Y.test(Q)){if(Z===$.length)break;U+=Q,Q=$[++Z]}if(U=="true"||U=="false"||U==="null")z.push({type:"name",value:U});else{Z++;continue}continue}Z++}return z},M$=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),M$($);break;case"number":let z=Z.value[Z.value.length-1];if(z==="."||z==="-")return $=$.slice(0,$.length-1),M$($);case"string":let Q=$[$.length-2];if(Q?.type==="delimiter")return $=$.slice(0,$.length-1),M$($);else if(Q?.type==="brace"&&Q.value==="{")return $=$.slice(0,$.length-1),M$($);break;case"delimiter":return $=$.slice(0,$.length-1),M$($);break}return $},$v=($)=>{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 $},Zv=($)=>{let Z="";return $.map((z)=>{switch(z.type){case"string":Z+='"'+z.value+'"';break;default:Z+=z.value;break}}),Z},Q7=($)=>JSON.parse(Zv($v(M$(ek($)))));var _Q=()=>{};var PQ=h(()=>{ZQ()});function ZH($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function zH($){}var B2,w6,L$,K8,X7,H8,B8,J7,M8,Q6,L8,Y7,U7,B1,W7,G7,D8,FQ,tK,V7,RQ,jQ,SQ,eK,$H="__json_buf",O8;var QH=h(()=>{$6();_Q();B$();PQ();CQ();O8=class O8{constructor($,Z){B2.add(this),this.messages=[],this.receivedMessages=[],w6.set(this,void 0),L$.set(this,null),this.controller=new AbortController,K8.set(this,void 0),X7.set(this,()=>{}),H8.set(this,()=>{}),B8.set(this,void 0),J7.set(this,()=>{}),M8.set(this,()=>{}),Q6.set(this,{}),L8.set(this,!1),Y7.set(this,!1),U7.set(this,!1),B1.set(this,!1),W7.set(this,void 0),G7.set(this,void 0),D8.set(this,void 0),V7.set(this,(z)=>{if(R(this,Y7,!0,"f"),Z6(z))z=new x0;if(z instanceof x0)return R(this,U7,!0,"f"),this._emit("abort",z);if(z instanceof b)return this._emit("error",z);if(z instanceof Error){let Q=new b(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new b(String(z)))}),R(this,K8,new Promise((z,Q)=>{R(this,X7,z,"f"),R(this,H8,Q,"f")}),"f"),R(this,B8,new Promise((z,Q)=>{R(this,J7,z,"f"),R(this,M8,Q,"f")}),"f"),O(this,K8,"f").catch(()=>{}),O(this,B8,"f").catch(()=>{}),R(this,L$,$,"f"),R(this,D8,Z?.logger??console,"f")}get response(){return O(this,W7,"f")}get request_id(){return O(this,G7,"f")}async withResponse(){R(this,B1,!0,"f");let $=await O(this,K8,"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 O8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new O8(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return R(X,L$,{...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,V7,"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,B2,"m",RQ).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let U of Y)O(this,B2,"m",jQ).call(this,U);if(Y.controller.signal?.aborted)throw new x0;O(this,B2,"m",SQ).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;R(this,W7,$,"f"),R(this,G7,$?.headers.get("request-id"),"f"),O(this,X7,"f").call(this,$),this._emit("connect")}get ended(){return O(this,L8,"f")}get errored(){return O(this,Y7,"f")}get aborted(){return O(this,U7,"f")}abort(){this.controller.abort()}on($,Z){return(O(this,Q6,"f")[$]||(O(this,Q6,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=O(this,Q6,"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,Q6,"f")[$]||(O(this,Q6,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(R(this,B1,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){R(this,B1,!0,"f"),await O(this,B8,"f")}get currentMessage(){return O(this,w6,"f")}async finalMessage(){return await this.done(),O(this,B2,"m",FQ).call(this)}async finalText(){return await this.done(),O(this,B2,"m",tK).call(this)}_emit($,...Z){if(O(this,L8,"f"))return;if($==="end")R(this,L8,!0,"f"),O(this,J7,"f").call(this);let z=O(this,Q6,"f")[$];if(z)O(this,Q6,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!O(this,B1,"f")&&!z?.length)Promise.reject(Q);O(this,H8,"f").call(this,Q),O(this,M8,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!O(this,B1,"f")&&!z?.length)Promise.reject(Q);O(this,H8,"f").call(this,Q),O(this,M8,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",O(this,B2,"m",FQ).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,B2,"m",RQ).call(this),this._connected(null);let X=z2.fromReadableStream($,this.controller);for await(let J of X)O(this,B2,"m",jQ).call(this,J);if(X.controller.signal?.aborted)throw new x0;O(this,B2,"m",SQ).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(w6=new WeakMap,L$=new WeakMap,K8=new WeakMap,X7=new WeakMap,H8=new WeakMap,B8=new WeakMap,J7=new WeakMap,M8=new WeakMap,Q6=new WeakMap,L8=new WeakMap,Y7=new WeakMap,U7=new WeakMap,B1=new WeakMap,W7=new WeakMap,G7=new WeakMap,D8=new WeakMap,V7=new WeakMap,B2=new WeakSet,FQ=function(){if(this.receivedMessages.length===0)throw new b("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},tK=function(){if(this.receivedMessages.length===0)throw new b("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 b("stream ended without producing a content block with type=text");return Z.join(" ")},RQ=function(){if(this.ended)return;R(this,w6,void 0,"f")},jQ=function(Z){if(this.ended)return;let z=O(this,B2,"m",eK).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(ZH(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:zH(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(TQ(z,O(this,L$,"f"),{logger:O(this,D8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{R(this,w6,z,"f");break}case"content_block_start":case"message_delta":break}},SQ=function(){if(this.ended)throw new b("stream has ended, this shouldn't happen");let Z=O(this,w6,"f");if(!Z)throw new b("request ended without sending any chunks");return R(this,w6,void 0,"f"),TQ(Z,O(this,L$,"f"),{logger:O(this,D8,"f")})},eK=function(Z){let z=O(this,w6,"f");if(Z.type==="message_start"){if(z)throw new b(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new b(`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&&ZH(Q)){let X=Q[$H]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,$H,{value:X,enumerable:!1,writable:!0}),X)try{J.input=Q7(X)}catch(Y){let U=new b(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${X}`);O(this,V7,"f").call(this,U)}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:zH(Z.delta)}return z}case"content_block_stop":return z}},Symbol.asyncIterator)](){let $=[],Z=[],z=!1;return this.on("streamEvent",(Q)=>{let X=Z.shift();if(X)X.resolve(Q);else $.push(Q)}),this.on("end",()=>{z=!0;for(let Q of Z)Q.resolve(void 0);Z.length=0}),this.on("abort",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),this.on("error",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),{next:async()=>{if(!$.length){if(z)return{value:void 0,done:!0};return new Promise((X,J)=>Z.push({resolve:X,reject:J})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new z2(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var D$;var q7=h(()=>{D$=class D$ 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 XH=1e5,JH=`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,120 +192,120 @@ 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 aK(){let $,Z;return{promise:new Promise((Q,X)=>{$=Q,Z=X}),resolve:$,reject:Z}}async function uk($,Z=$.messages.at(-1),z){if(!Z||Z.role!=="assistant"||!Z.content||typeof Z.content==="string")return null;let Q=Z.content.filter((J)=>J.type==="tool_use");if(Q.length===0)return null;return{role:"user",content:await Promise.all(Q.map(async(J)=>{let Y=$.tools.find((U)=>("name"in U?U.name:U.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 U=J.input;if("parse"in Y&&Y.parse)U=Y.parse(U);let W=await Y.run(U,{toolUseBlock:J,signal:z?.signal});return{type:"tool_result",tool_use_id:J.id,content:W}}catch(U){return{type:"tool_result",tool_use_id:J.id,content:U instanceof K$?U.content:`Error: ${U instanceof Error?U.message:String(U)}`,is_error:!0}}}))}}var B8,H$,K1,R0,r0,Q2,$6,j6,M8,oK,_Q,L8;var RQ=h(()=>{o2();Y7();n0();W0();$8();L8=class L8{constructor($,Z,z){B8.add(this),this.client=$,H$.set(this,!1),K1.set(this,!1),R0.set(this,void 0),r0.set(this,void 0),Q2.set(this,void 0),$6.set(this,void 0),j6.set(this,void 0),M8.set(this,0),j(this,R0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let X=["BetaToolRunner",...JQ(Z.tools,Z.messages)].join(", ");if(j(this,r0,{...z,headers:T([{"x-stainless-helper":X},z?.headers])},"f"),j(this,j6,aK(),"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*[(H$=new WeakMap,K1=new WeakMap,R0=new WeakMap,r0=new WeakMap,Q2=new WeakMap,$6=new WeakMap,j6=new WeakMap,M8=new WeakMap,B8=new WeakSet,oK=async function(){let Z=O(this,R0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let z=0;if(O(this,Q2,"f")!==void 0)try{let W=await O(this,Q2,"f");z=W.usage.input_tokens+(W.usage.cache_creation_input_tokens??0)+(W.usage.cache_read_input_tokens??0)+W.usage.output_tokens}catch{return!1}let Q=Z.contextTokenThreshold??rK;if(z<Q)return!1;let X=Z.model??O(this,R0,"f").params.model,J=Z.summaryPrompt??sK,Y=O(this,R0,"f").params.messages;if(Y[Y.length-1].role==="assistant"){let W=Y[Y.length-1];if(Array.isArray(W.content)){let G=W.content.filter((V)=>V.type!=="tool_use");if(G.length===0)Y.pop();else W.content=G}}let U=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,r0,"f").signal,headers:T([O(this,r0,"f").headers,{"x-stainless-helper":"compaction"}])});if(U.content[0]?.type!=="text")throw new b("Expected text response for compaction");return O(this,R0,"f").params.messages=[{role:"user",content:U.content}],!0},Symbol.asyncIterator)](){var $;if(O(this,H$,"f"))throw new b("Cannot iterate over a consumed stream");j(this,H$,!0,"f"),j(this,K1,!0,"f"),j(this,$6,void 0,"f");try{while(!0){let Z;try{if(O(this,R0,"f").params.max_iterations&&O(this,M8,"f")>=O(this,R0,"f").params.max_iterations)break;j(this,K1,!1,"f"),j(this,$6,void 0,"f"),j(this,M8,($=O(this,M8,"f"),$++,$),"f"),j(this,Q2,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,r0,"f")),j(this,Q2,Z.finalMessage(),"f"),O(this,Q2,"f").catch(()=>{}),yield Z;else j(this,Q2,this.client.beta.messages.create({...X,stream:!1},O(this,r0,"f")),"f"),yield O(this,Q2,"f");if(!await O(this,B8,"m",oK).call(this)){if(!O(this,K1,"f")){let{role:U,content:W}=await O(this,Q2,"f");O(this,R0,"f").params.messages.push({role:U,content:W})}let Y=await O(this,B8,"m",_Q).call(this,O(this,R0,"f").params.messages.at(-1));if(Y)O(this,R0,"f").params.messages.push(Y);else if(!O(this,K1,"f"))break}}finally{if(Z)Z.abort()}}if(!O(this,Q2,"f"))throw new b("ToolRunner concluded without a message from the server");O(this,j6,"f").resolve(await O(this,Q2,"f"))}catch(Z){throw j(this,H$,!1,"f"),O(this,j6,"f").promise.catch(()=>{}),O(this,j6,"f").reject(Z),j(this,j6,aK(),"f"),Z}}setMessagesParams($){if(typeof $==="function")O(this,R0,"f").params=$(O(this,R0,"f").params);else O(this,R0,"f").params=$;j(this,K1,!0,"f"),j(this,$6,void 0,"f")}setRequestOptions($){if(typeof $==="function")j(this,r0,$(O(this,r0,"f")),"f");else j(this,r0,{...O(this,r0,"f"),...$},"f")}async generateToolResponse($=O(this,r0,"f").signal){let Z=await O(this,Q2,"f")??this.params.messages.at(-1);if(!Z)return null;return O(this,B8,"m",_Q).call(this,Z,$)}done(){return O(this,j6,"f").promise}async runUntilDone(){if(!O(this,H$,"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)}};_Q=async function(Z,z=O(this,r0,"f").signal){if(O(this,$6,"f")!==void 0)return O(this,$6,"f");return j(this,$6,uk(O(this,R0,"f").params,Z,{...O(this,r0,"f"),signal:z}),"f"),O(this,$6,"f")}});var B$;var PQ=h(()=>{n0();nz();B$=class B${constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new R6;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 b("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 b("Attempted to iterate over a response with no body")}return new B$(l4($.body),Z)}}});var D8;var FQ=h(()=>{K0();W0();PQ();G$();N0();D8=class D8 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/messages/batches?beta=true",{body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/messages/batches/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",j2,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/messages/batches/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}cancel($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/messages/batches/${$}/cancel?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}async results($,Z={},z){let Q=await this.retrieve($);if(!Q.results_url)throw new b(`No batch \`results_url\`; Has it finished processing? ${Q.processing_status} - ${Q.id}`);let{betas:X}=Z??{};return this._client.get(Q.results_url,{...z,headers:T([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((J,Y)=>B$.fromResponse(Y.response,Y.controller))}}});function eK($){if(!$.output_format)return $;if($.output_config?.format)throw new b("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 tK,ck,S6;var jQ=h(()=>{G$();BQ();W0();$8();DQ();nK();RQ();Y7();FQ();FQ();RQ();Y7();tK={"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"},ck=["claude-mythos-preview","claude-opus-4-6"];S6=class S6 extends c{constructor(){super(...arguments);this.batches=new D8(this._client)}create($,Z){let z=eK($),{betas:Q,...X}=z;if(X.model in tK)console.warn(`The model '${X.model}' is deprecated and will reach end-of-life on ${tK[X.model]}
196
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(ck.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 U=aZ[X.model]??void 0;J=this._client.calculateNonstreamingTimeout(X.max_tokens,U)}let Y=oZ(X.tools,X.messages);return this._client.post("/v1/messages?beta=true",{body:X,timeout:J??600000,...Z,headers:T([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},Y,Z?.headers]),stream:z.stream??!1})}parse($,Z){return Z={...Z,headers:T([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((z)=>LQ(z,$,{logger:this._client.logger??console}))}stream($,Z){return H8.createMessage(this,$,Z)}countTokens($,Z){let z=eK($),{betas:Q,...X}=z;return this._client.post("/v1/messages/count_tokens?beta=true",{body:X,...Z,headers:T([{"anthropic-beta":[...Q??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new L8(this._client,$,Z)}};S6.Batches=D8;S6.BetaToolRunner=L8;S6.ToolError=K$});var O8;var SQ=h(()=>{K0();W0();N0();O8=class O8 extends c{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/sessions/${$}/events?beta=true`,Q0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}send($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/sessions/${$}/events?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}stream($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/sessions/${$}/events/stream?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers]),stream:!0})}}});var N8;var EQ=h(()=>{K0();W0();N0();N8=class N8 extends c{retrieve($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.get(R`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{session_id:Q,betas:X,...J}=Z;return this._client.post(R`/v1/sessions/${Q}/resources/${$}?beta=true`,{body:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/sessions/${$}/resources?beta=true`,Q0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.delete(R`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}add($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/sessions/${$}/resources?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var H1;var wQ=h(()=>{SQ();SQ();EQ();EQ();K0();W0();N0();H1=class H1 extends c{constructor(){super(...arguments);this.events=new O8(this._client),this.resources=new N8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/sessions?beta=true",{body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/sessions/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/sessions/${$}?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/sessions?beta=true",Q0,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/sessions/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/sessions/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};H1.Events=O8;H1.Resources=N8});var I8;var xQ=h(()=>{K0();W0();U$();N0();I8=class I8 extends c{create($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.post(R`/v1/skills/${$}/versions?beta=true`,Y$({body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])},this._client))}retrieve($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.get(R`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/skills/${$}/versions?beta=true`,Q0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}delete($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.delete(R`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}}});var M$;var yQ=h(()=>{xQ();xQ();K0();W0();U$();N0();M$=class M$ extends c{constructor(){super(...arguments);this.versions=new I8(this._client)}create($={},Z){let{betas:z,...Q}=$??{};return this._client.post("/v1/skills?beta=true",Y$({body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/skills/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/skills?beta=true",Q0,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/skills/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}};M$.Versions=I8});var T8;var bQ=h(()=>{K0();W0();N0();T8=class T8 extends c{create($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/vaults/${$}/credentials?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.get(R`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{vault_id:Q,betas:X,...J}=Z;return this._client.post(R`/v1/vaults/${Q}/credentials/${$}?beta=true`,{body:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/vaults/${$}/credentials?beta=true`,Q0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.delete(R`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.post(R`/v1/vaults/${Q}/credentials/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var L$;var kQ=h(()=>{bQ();bQ();K0();W0();N0();L$=class L$ extends c{constructor(){super(...arguments);this.credentials=new T8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/vaults?beta=true",{body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/vaults/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/vaults/${$}?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/vaults?beta=true",Q0,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/vaults/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/vaults/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};L$.Credentials=T8});var g0;var vQ=h(()=>{XQ();XQ();YQ();YQ();UQ();UQ();WQ();WQ();VQ();VQ();HQ();HQ();jQ();jQ();wQ();wQ();yQ();yQ();kQ();kQ();g0=class g0 extends c{constructor(){super(...arguments);this.models=new z8(this._client),this.messages=new S6(this._client),this.agents=new W$(this._client),this.environments=new t4(this._client),this.sessions=new H1(this._client),this.vaults=new L$(this._client),this.memoryStores=new V1(this._client),this.files=new Z8(this._client),this.skills=new M$(this._client),this.userProfiles=new Q8(this._client)}};g0.Models=z8;g0.Messages=S6;g0.Agents=W$;g0.Environments=t4;g0.Sessions=H1;g0.Vaults=L$;g0.MemoryStores=V1;g0.Files=Z8;g0.Skills=M$;g0.UserProfiles=Q8});var D$;var gQ=h(()=>{W0();D$=class D$ extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/complete",{body:Q,timeout:this._client._options.timeout??600000,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function $H($){return $?.output_config?.format}function hQ($,Z,z){let Q=$H(Z);if(!Z||!("parse"in(Q??{})))return{...$,content:$.content.map((X)=>{if(X.type==="text")return Object.defineProperty({...X},"parsed_output",{value:null,enumerable:!1});return X}),parsed_output:null};return fQ($,Z,z)}function fQ($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=ak(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 ak($,Z){let z=$H($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new b(`Failed to parse structured output: ${Q}`)}}var uQ=h(()=>{n0()});function XH($){return $.type==="tool_use"||$.type==="server_tool_use"}function JH($){}var M2,E6,O$,A8,U7,C8,_8,W7,R8,Z6,P8,G7,V7,B1,q7,K7,F8,mQ,ZH,cQ,pQ,lQ,dQ,zH,QH="__json_buf",j8;var YH=h(()=>{o2();G$();NQ();OQ();uQ();j8=class j8{constructor($,Z){M2.add(this),this.messages=[],this.receivedMessages=[],E6.set(this,void 0),O$.set(this,null),this.controller=new AbortController,A8.set(this,void 0),U7.set(this,()=>{}),C8.set(this,()=>{}),_8.set(this,void 0),W7.set(this,()=>{}),R8.set(this,()=>{}),Z6.set(this,{}),P8.set(this,!1),G7.set(this,!1),V7.set(this,!1),B1.set(this,!1),q7.set(this,void 0),K7.set(this,void 0),F8.set(this,void 0),cQ.set(this,(z)=>{if(j(this,G7,!0,"f"),a2(z))z=new x0;if(z instanceof x0)return j(this,V7,!0,"f"),this._emit("abort",z);if(z instanceof b)return this._emit("error",z);if(z instanceof Error){let Q=new b(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new b(String(z)))}),j(this,A8,new Promise((z,Q)=>{j(this,U7,z,"f"),j(this,C8,Q,"f")}),"f"),j(this,_8,new Promise((z,Q)=>{j(this,W7,z,"f"),j(this,R8,Q,"f")}),"f"),O(this,A8,"f").catch(()=>{}),O(this,_8,"f").catch(()=>{}),j(this,O$,$,"f"),j(this,F8,Z?.logger??console,"f")}get response(){return O(this,q7,"f")}get request_id(){return O(this,K7,"f")}async withResponse(){j(this,B1,!0,"f");let $=await O(this,A8,"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 j8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new j8(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return j(X,O$,{...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,cQ,"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,M2,"m",pQ).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let U of Y)O(this,M2,"m",lQ).call(this,U);if(Y.controller.signal?.aborted)throw new x0;O(this,M2,"m",dQ).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;j(this,q7,$,"f"),j(this,K7,$?.headers.get("request-id"),"f"),O(this,U7,"f").call(this,$),this._emit("connect")}get ended(){return O(this,P8,"f")}get errored(){return O(this,G7,"f")}get aborted(){return O(this,V7,"f")}abort(){this.controller.abort()}on($,Z){return(O(this,Z6,"f")[$]||(O(this,Z6,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=O(this,Z6,"f")[$];if(!z)return this;let Q=z.findIndex((X)=>X.listener===Z);if(Q>=0)z.splice(Q,1);return this}once($,Z){return(O(this,Z6,"f")[$]||(O(this,Z6,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(j(this,B1,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){j(this,B1,!0,"f"),await O(this,_8,"f")}get currentMessage(){return O(this,E6,"f")}async finalMessage(){return await this.done(),O(this,M2,"m",mQ).call(this)}async finalText(){return await this.done(),O(this,M2,"m",ZH).call(this)}_emit($,...Z){if(O(this,P8,"f"))return;if($==="end")j(this,P8,!0,"f"),O(this,W7,"f").call(this);let z=O(this,Z6,"f")[$];if(z)O(this,Z6,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!O(this,B1,"f")&&!z?.length)Promise.reject(Q);O(this,C8,"f").call(this,Q),O(this,R8,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!O(this,B1,"f")&&!z?.length)Promise.reject(Q);O(this,C8,"f").call(this,Q),O(this,R8,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",O(this,M2,"m",mQ).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,M2,"m",pQ).call(this),this._connected(null);let X=z2.fromReadableStream($,this.controller);for await(let J of X)O(this,M2,"m",lQ).call(this,J);if(X.controller.signal?.aborted)throw new x0;O(this,M2,"m",dQ).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(E6=new WeakMap,O$=new WeakMap,A8=new WeakMap,U7=new WeakMap,C8=new WeakMap,_8=new WeakMap,W7=new WeakMap,R8=new WeakMap,Z6=new WeakMap,P8=new WeakMap,G7=new WeakMap,V7=new WeakMap,B1=new WeakMap,q7=new WeakMap,K7=new WeakMap,F8=new WeakMap,cQ=new WeakMap,M2=new WeakSet,mQ=function(){if(this.receivedMessages.length===0)throw new b("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},ZH=function(){if(this.receivedMessages.length===0)throw new b("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 b("stream ended without producing a content block with type=text");return Z.join(" ")},pQ=function(){if(this.ended)return;j(this,E6,void 0,"f")},lQ=function(Z){if(this.ended)return;let z=O(this,M2,"m",zH).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(XH(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:JH(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(hQ(z,O(this,O$,"f"),{logger:O(this,F8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{j(this,E6,z,"f");break}case"content_block_start":case"message_delta":break}},dQ=function(){if(this.ended)throw new b("stream has ended, this shouldn't happen");let Z=O(this,E6,"f");if(!Z)throw new b("request ended without sending any chunks");return j(this,E6,void 0,"f"),hQ(Z,O(this,O$,"f"),{logger:O(this,F8,"f")})},zH=function(Z){let z=O(this,E6,"f");if(Z.type==="message_start"){if(z)throw new b(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new b(`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&&XH(Q)){let X=Q[QH]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,QH,{value:X,enumerable:!1,writable:!0}),X)J.input=tZ(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:JH(Z.delta)}return z}case"content_block_stop":return z}},Symbol.asyncIterator)](){let $=[],Z=[],z=!1;return this.on("streamEvent",(Q)=>{let X=Z.shift();if(X)X.resolve(Q);else $.push(Q)}),this.on("end",()=>{z=!0;for(let Q of Z)Q.resolve(void 0);Z.length=0}),this.on("abort",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),this.on("error",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),{next:async()=>{if(!$.length){if(z)return{value:void 0,done:!0};return new Promise((X,J)=>Z.push({resolve:X,reject:J})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new z2(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var S8;var iQ=h(()=>{K0();W0();PQ();G$();N0();S8=class S8 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",j2,{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 b(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);return this._client.get(z.results_url,{...Z,headers:T([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,X)=>B$.fromResponse(X.response,X.controller))}}});var M1,UH,ek;var nQ=h(()=>{W0();$8();YH();uQ();iQ();iQ();BQ();M1=class M1 extends c{constructor(){super(...arguments);this.batches=new S8(this._client)}create($,Z){if($.model in UH)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${UH[$.model]}
197
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(ek.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=aZ[$.model]??void 0;z=this._client.calculateNonstreamingTimeout($.max_tokens,X)}let Q=oZ($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:z??600000,...Z,headers:T([Q,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((z)=>fQ(z,$,{logger:this._client.logger??console}))}stream($,Z){return j8.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};UH={"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"},ek=["claude-mythos-preview","claude-opus-4-6"];M1.Batches=S8});var N$;var rQ=h(()=>{K0();W0();N0();N$=class N$ extends c{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/models/${$}`,{...z,headers:T([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models",j2,{query:Q,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var WH=h(()=>{vQ();gQ();nQ();rQ();vK()});var E8=($)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[$]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.($)?.trim()||void 0;return};class V0{constructor({baseURL:$=E8("ANTHROPIC_BASE_URL"),apiKey:Z=E8("ANTHROPIC_API_KEY")??null,authToken:z=E8("ANTHROPIC_AUTH_TOKEN")??null,...Q}={}){sQ.add(this),H7.set(this,void 0);let X={apiKey:Z,authToken:z,...Q,baseURL:$||"https://api.anthropic.com"};if(!X.dangerouslyAllowBrowser&&IK())throw new b(`It looks like you're running in a browser-like environment.
195
+ Wrap your summary in <summary></summary> tags.`;function UH(){let $,Z;return{promise:new Promise((Q,X)=>{$=Q,Z=X}),resolve:$,reject:Z}}async function zv($,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((U)=>("name"in U?U.name:U.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 U=J.input;if("parse"in Y&&Y.parse)U=Y.parse(U);let W=await Y.run(U,{toolUseBlock:J,signal:z?.signal});return{type:"tool_result",tool_use_id:J.id,content:W}}catch(U){return{type:"tool_result",tool_use_id:J.id,content:U instanceof D$?U.content:`Error: ${U instanceof Error?U.message:String(U)}`,is_error:!0}}}))}}var N8,O$,M1,A0,n0,Q2,X6,x6,I8,YH,EQ,T8;var wQ=h(()=>{$6();q7();i0();U0();J8();T8=class T8{constructor($,Z,z){N8.add(this),this.client=$,O$.set(this,!1),M1.set(this,!1),A0.set(this,void 0),n0.set(this,void 0),Q2.set(this,void 0),X6.set(this,void 0),x6.set(this,void 0),I8.set(this,0),R(this,A0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let X=["BetaToolRunner",...qQ(Z.tools,Z.messages)].join(", ");if(R(this,n0,{...z,headers:T([{"x-stainless-helper":X},z?.headers])},"f"),R(this,x6,UH(),"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*[(O$=new WeakMap,M1=new WeakMap,A0=new WeakMap,n0=new WeakMap,Q2=new WeakMap,X6=new WeakMap,x6=new WeakMap,I8=new WeakMap,N8=new WeakSet,YH=async function(){let Z=O(this,A0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let z=0;if(O(this,Q2,"f")!==void 0)try{let W=await O(this,Q2,"f");z=W.usage.input_tokens+(W.usage.cache_creation_input_tokens??0)+(W.usage.cache_read_input_tokens??0)+W.usage.output_tokens}catch{return!1}let Q=Z.contextTokenThreshold??XH;if(z<Q)return!1;let X=Z.model??O(this,A0,"f").params.model,J=Z.summaryPrompt??JH,Y=O(this,A0,"f").params.messages;if(Y[Y.length-1].role==="assistant"){let W=Y[Y.length-1];if(Array.isArray(W.content)){let G=W.content.filter((V)=>V.type!=="tool_use");if(G.length===0)Y.pop();else W.content=G}}let U=await this.client.beta.messages.create({model:X,messages:[...Y,{role:"user",content:[{type:"text",text:J}]}],max_tokens:O(this,A0,"f").params.max_tokens},{signal:O(this,n0,"f").signal,headers:T([O(this,n0,"f").headers,{"x-stainless-helper":"compaction"}])});if(U.content[0]?.type!=="text")throw new b("Expected text response for compaction");return O(this,A0,"f").params.messages=[{role:"user",content:U.content}],!0},Symbol.asyncIterator)](){var $;if(O(this,O$,"f"))throw new b("Cannot iterate over a consumed stream");R(this,O$,!0,"f"),R(this,M1,!0,"f"),R(this,X6,void 0,"f");try{while(!0){let Z;try{if(O(this,A0,"f").params.max_iterations&&O(this,I8,"f")>=O(this,A0,"f").params.max_iterations)break;R(this,M1,!1,"f"),R(this,X6,void 0,"f"),R(this,I8,($=O(this,I8,"f"),$++,$),"f"),R(this,Q2,void 0,"f");let{max_iterations:z,compactionControl:Q,...X}=O(this,A0,"f").params;if(X.stream)Z=this.client.beta.messages.stream({...X},O(this,n0,"f")),R(this,Q2,Z.finalMessage(),"f"),O(this,Q2,"f").catch(()=>{}),yield Z;else R(this,Q2,this.client.beta.messages.create({...X,stream:!1},O(this,n0,"f")),"f"),yield O(this,Q2,"f");if(!await O(this,N8,"m",YH).call(this)){if(!O(this,M1,"f")){let{role:U,content:W}=await O(this,Q2,"f");O(this,A0,"f").params.messages.push({role:U,content:W})}let Y=await O(this,N8,"m",EQ).call(this,O(this,A0,"f").params.messages.at(-1));if(Y)O(this,A0,"f").params.messages.push(Y);else if(!O(this,M1,"f"))break}}finally{if(Z)Z.abort()}}if(!O(this,Q2,"f"))throw new b("ToolRunner concluded without a message from the server");O(this,x6,"f").resolve(await O(this,Q2,"f"))}catch(Z){throw R(this,O$,!1,"f"),O(this,x6,"f").promise.catch(()=>{}),O(this,x6,"f").reject(Z),R(this,x6,UH(),"f"),Z}}setMessagesParams($){if(typeof $==="function")O(this,A0,"f").params=$(O(this,A0,"f").params);else O(this,A0,"f").params=$;R(this,M1,!0,"f"),R(this,X6,void 0,"f")}setRequestOptions($){if(typeof $==="function")R(this,n0,$(O(this,n0,"f")),"f");else R(this,n0,{...O(this,n0,"f"),...$},"f")}async generateToolResponse($=O(this,n0,"f").signal){let Z=await O(this,Q2,"f")??this.params.messages.at(-1);if(!Z)return null;return O(this,N8,"m",EQ).call(this,Z,$)}done(){return O(this,x6,"f").promise}async runUntilDone(){if(!O(this,O$,"f"))for await(let $ of this);return this.done()}get params(){return O(this,A0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};EQ=async function(Z,z=O(this,n0,"f").signal){if(O(this,X6,"f")!==void 0)return O(this,X6,"f");return R(this,X6,zv(O(this,A0,"f").params,Z,{...O(this,n0,"f"),signal:z}),"f"),O(this,X6,"f")}});var N$;var xQ=h(()=>{i0();ez();N$=class N${constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new S6;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 b("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 b("Attempted to iterate over a response with no body")}return new N$(s4($.body),Z)}}});var A8;var yQ=h(()=>{V0();U0();xQ();B$();D0();A8=class A8 extends p{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/messages/batches?beta=true",{body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(P`/v1/messages/batches/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",j2,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(P`/v1/messages/batches/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}cancel($,Z={},z){let{betas:Q}=Z??{};return this._client.post(P`/v1/messages/batches/${$}/cancel?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}async results($,Z={},z){let Q=await this.retrieve($);if(!Q.results_url)throw new b(`No batch \`results_url\`; Has it finished processing? ${Q.processing_status} - ${Q.id}`);let{betas:X}=Z??{};return this._client.get(Q.results_url,{...z,headers:T([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((J,Y)=>N$.fromResponse(Y.response,Y.controller))}}});function GH($){if(!$.output_format)return $;if($.output_config?.format)throw new b("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 WH,Xv,y6;var bQ=h(()=>{B$();IQ();U0();J8();CQ();QH();wQ();q7();yQ();yQ();wQ();q7();WH={"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"},Xv=["claude-mythos-preview","claude-opus-4-6"];y6=class y6 extends p{constructor(){super(...arguments);this.batches=new A8(this._client)}create($,Z){let z=GH($),{betas:Q,...X}=z;if(X.model in WH)console.warn(`The model '${X.model}' is deprecated and will reach end-of-life on ${WH[X.model]}
196
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Xv.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 U=z7[X.model]??void 0;J=this._client.calculateNonstreamingTimeout(X.max_tokens,U)}let Y=Z7(X.tools,X.messages);return this._client.post("/v1/messages?beta=true",{body:X,timeout:J??600000,...Z,headers:T([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},Y,Z?.headers]),stream:z.stream??!1})}parse($,Z){return Z={...Z,headers:T([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((z)=>AQ(z,$,{logger:this._client.logger??console}))}stream($,Z){return O8.createMessage(this,$,Z)}countTokens($,Z){let z=GH($),{betas:Q,...X}=z;return this._client.post("/v1/messages/count_tokens?beta=true",{body:X,...Z,headers:T([{"anthropic-beta":[...Q??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new T8(this._client,$,Z)}};y6.Batches=A8;y6.BetaToolRunner=T8;y6.ToolError=D$});var C8;var kQ=h(()=>{V0();U0();D0();C8=class C8 extends p{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(P`/v1/sessions/${$}/events?beta=true`,z0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}send($,Z,z){let{betas:Q,...X}=Z;return this._client.post(P`/v1/sessions/${$}/events?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}stream($,Z={},z){let{betas:Q}=Z??{};return this._client.get(P`/v1/sessions/${$}/events/stream?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers]),stream:!0})}}});var _8;var vQ=h(()=>{V0();U0();D0();_8=class _8 extends p{retrieve($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.get(P`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{session_id:Q,betas:X,...J}=Z;return this._client.post(P`/v1/sessions/${Q}/resources/${$}?beta=true`,{body:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(P`/v1/sessions/${$}/resources?beta=true`,z0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.delete(P`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}add($,Z,z){let{betas:Q,...X}=Z;return this._client.post(P`/v1/sessions/${$}/resources?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var L1;var gQ=h(()=>{kQ();kQ();vQ();vQ();V0();U0();D0();L1=class L1 extends p{constructor(){super(...arguments);this.events=new C8(this._client),this.resources=new _8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/sessions?beta=true",{body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(P`/v1/sessions/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(P`/v1/sessions/${$}?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/sessions?beta=true",z0,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(P`/v1/sessions/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(P`/v1/sessions/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};L1.Events=C8;L1.Resources=_8});var P8;var hQ=h(()=>{V0();U0();K$();D0();P8=class P8 extends p{create($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.post(P`/v1/skills/${$}/versions?beta=true`,q$({body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])},this._client))}retrieve($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.get(P`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(P`/v1/skills/${$}/versions?beta=true`,z0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}delete($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.delete(P`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}}});var I$;var fQ=h(()=>{hQ();hQ();V0();U0();K$();D0();I$=class I$ extends p{constructor(){super(...arguments);this.versions=new P8(this._client)}create($={},Z){let{betas:z,...Q}=$??{};return this._client.post("/v1/skills?beta=true",q$({body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(P`/v1/skills/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/skills?beta=true",z0,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(P`/v1/skills/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}};I$.Versions=P8});var F8;var uQ=h(()=>{V0();U0();D0();F8=class F8 extends p{create($,Z,z){let{betas:Q,...X}=Z;return this._client.post(P`/v1/vaults/${$}/credentials?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.get(P`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{vault_id:Q,betas:X,...J}=Z;return this._client.post(P`/v1/vaults/${Q}/credentials/${$}?beta=true`,{body:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(P`/v1/vaults/${$}/credentials?beta=true`,z0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.delete(P`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.post(P`/v1/vaults/${Q}/credentials/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var T$;var mQ=h(()=>{uQ();uQ();V0();U0();D0();T$=class T$ extends p{constructor(){super(...arguments);this.credentials=new F8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/vaults?beta=true",{body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(P`/v1/vaults/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(P`/v1/vaults/${$}?beta=true`,{body:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/vaults?beta=true",z0,{query:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(P`/v1/vaults/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(P`/v1/vaults/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};T$.Credentials=F8});var h0;var cQ=h(()=>{VQ();VQ();KQ();KQ();HQ();HQ();BQ();BQ();LQ();LQ();NQ();NQ();bQ();bQ();gQ();gQ();fQ();fQ();mQ();mQ();h0=class h0 extends p{constructor(){super(...arguments);this.models=new U8(this._client),this.messages=new y6(this._client),this.agents=new H$(this._client),this.environments=new Q8(this._client),this.sessions=new L1(this._client),this.vaults=new T$(this._client),this.memoryStores=new H1(this._client),this.files=new Y8(this._client),this.skills=new I$(this._client),this.userProfiles=new W8(this._client)}};h0.Models=U8;h0.Messages=y6;h0.Agents=H$;h0.Environments=Q8;h0.Sessions=L1;h0.Vaults=T$;h0.MemoryStores=H1;h0.Files=Y8;h0.Skills=I$;h0.UserProfiles=W8});var A$;var pQ=h(()=>{U0();A$=class A$ extends p{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/complete",{body:Q,timeout:this._client._options.timeout??600000,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function VH($){return $?.output_config?.format}function lQ($,Z,z){let Q=VH(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 dQ($,Z,z)}function dQ($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=Hv(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 Hv($,Z){let z=VH($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new b(`Failed to parse structured output: ${Q}`)}}var iQ=h(()=>{i0()});function BH($){return $.type==="tool_use"||$.type==="server_tool_use"}function MH($){}var M2,b6,C$,R8,K7,j8,S8,H7,E8,J6,w8,B7,M7,D1,L7,D7,x8,nQ,qH,rQ,sQ,oQ,aQ,KH,HH="__json_buf",y8;var LH=h(()=>{$6();B$();PQ();_Q();iQ();y8=class y8{constructor($,Z){M2.add(this),this.messages=[],this.receivedMessages=[],b6.set(this,void 0),C$.set(this,null),this.controller=new AbortController,R8.set(this,void 0),K7.set(this,()=>{}),j8.set(this,()=>{}),S8.set(this,void 0),H7.set(this,()=>{}),E8.set(this,()=>{}),J6.set(this,{}),w8.set(this,!1),B7.set(this,!1),M7.set(this,!1),D1.set(this,!1),L7.set(this,void 0),D7.set(this,void 0),x8.set(this,void 0),rQ.set(this,(z)=>{if(R(this,B7,!0,"f"),Z6(z))z=new x0;if(z instanceof x0)return R(this,M7,!0,"f"),this._emit("abort",z);if(z instanceof b)return this._emit("error",z);if(z instanceof Error){let Q=new b(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new b(String(z)))}),R(this,R8,new Promise((z,Q)=>{R(this,K7,z,"f"),R(this,j8,Q,"f")}),"f"),R(this,S8,new Promise((z,Q)=>{R(this,H7,z,"f"),R(this,E8,Q,"f")}),"f"),O(this,R8,"f").catch(()=>{}),O(this,S8,"f").catch(()=>{}),R(this,C$,$,"f"),R(this,x8,Z?.logger??console,"f")}get response(){return O(this,L7,"f")}get request_id(){return O(this,D7,"f")}async withResponse(){R(this,D1,!0,"f");let $=await O(this,R8,"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 y8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new y8(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return R(X,C$,{...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,rQ,"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,M2,"m",sQ).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let U of Y)O(this,M2,"m",oQ).call(this,U);if(Y.controller.signal?.aborted)throw new x0;O(this,M2,"m",aQ).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;R(this,L7,$,"f"),R(this,D7,$?.headers.get("request-id"),"f"),O(this,K7,"f").call(this,$),this._emit("connect")}get ended(){return O(this,w8,"f")}get errored(){return O(this,B7,"f")}get aborted(){return O(this,M7,"f")}abort(){this.controller.abort()}on($,Z){return(O(this,J6,"f")[$]||(O(this,J6,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=O(this,J6,"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,J6,"f")[$]||(O(this,J6,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(R(this,D1,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){R(this,D1,!0,"f"),await O(this,S8,"f")}get currentMessage(){return O(this,b6,"f")}async finalMessage(){return await this.done(),O(this,M2,"m",nQ).call(this)}async finalText(){return await this.done(),O(this,M2,"m",qH).call(this)}_emit($,...Z){if(O(this,w8,"f"))return;if($==="end")R(this,w8,!0,"f"),O(this,H7,"f").call(this);let z=O(this,J6,"f")[$];if(z)O(this,J6,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!O(this,D1,"f")&&!z?.length)Promise.reject(Q);O(this,j8,"f").call(this,Q),O(this,E8,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!O(this,D1,"f")&&!z?.length)Promise.reject(Q);O(this,j8,"f").call(this,Q),O(this,E8,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",O(this,M2,"m",nQ).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,M2,"m",sQ).call(this),this._connected(null);let X=z2.fromReadableStream($,this.controller);for await(let J of X)O(this,M2,"m",oQ).call(this,J);if(X.controller.signal?.aborted)throw new x0;O(this,M2,"m",aQ).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(b6=new WeakMap,C$=new WeakMap,R8=new WeakMap,K7=new WeakMap,j8=new WeakMap,S8=new WeakMap,H7=new WeakMap,E8=new WeakMap,J6=new WeakMap,w8=new WeakMap,B7=new WeakMap,M7=new WeakMap,D1=new WeakMap,L7=new WeakMap,D7=new WeakMap,x8=new WeakMap,rQ=new WeakMap,M2=new WeakSet,nQ=function(){if(this.receivedMessages.length===0)throw new b("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},qH=function(){if(this.receivedMessages.length===0)throw new b("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 b("stream ended without producing a content block with type=text");return Z.join(" ")},sQ=function(){if(this.ended)return;R(this,b6,void 0,"f")},oQ=function(Z){if(this.ended)return;let z=O(this,M2,"m",KH).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(BH(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:MH(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(lQ(z,O(this,C$,"f"),{logger:O(this,x8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{R(this,b6,z,"f");break}case"content_block_start":case"message_delta":break}},aQ=function(){if(this.ended)throw new b("stream has ended, this shouldn't happen");let Z=O(this,b6,"f");if(!Z)throw new b("request ended without sending any chunks");return R(this,b6,void 0,"f"),lQ(Z,O(this,C$,"f"),{logger:O(this,x8,"f")})},KH=function(Z){let z=O(this,b6,"f");if(Z.type==="message_start"){if(z)throw new b(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new b(`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&&BH(Q)){let X=Q[HH]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,HH,{value:X,enumerable:!1,writable:!0}),X)J.input=Q7(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:MH(Z.delta)}return z}case"content_block_stop":return z}},Symbol.asyncIterator)](){let $=[],Z=[],z=!1;return this.on("streamEvent",(Q)=>{let X=Z.shift();if(X)X.resolve(Q);else $.push(Q)}),this.on("end",()=>{z=!0;for(let Q of Z)Q.resolve(void 0);Z.length=0}),this.on("abort",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),this.on("error",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),{next:async()=>{if(!$.length){if(z)return{value:void 0,done:!0};return new Promise((X,J)=>Z.push({resolve:X,reject:J})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new z2(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var b8;var tQ=h(()=>{V0();U0();xQ();B$();D0();b8=class b8 extends p{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(P`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",j2,{query:$,...Z})}delete($,Z){return this._client.delete(P`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(P`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let z=await this.retrieve($);if(!z.results_url)throw new b(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);return this._client.get(z.results_url,{...Z,headers:T([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,X)=>N$.fromResponse(X.response,X.controller))}}});var O1,DH,Mv;var eQ=h(()=>{U0();J8();LH();iQ();tQ();tQ();IQ();O1=class O1 extends p{constructor(){super(...arguments);this.batches=new b8(this._client)}create($,Z){if($.model in DH)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${DH[$.model]}
197
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Mv.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=z7[$.model]??void 0;z=this._client.calculateNonstreamingTimeout($.max_tokens,X)}let Q=Z7($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:z??600000,...Z,headers:T([Q,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((z)=>dQ(z,$,{logger:this._client.logger??console}))}stream($,Z){return y8.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};DH={"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"},Mv=["claude-mythos-preview","claude-opus-4-6"];O1.Batches=b8});var _$;var $X=h(()=>{V0();U0();D0();_$=class _$ extends p{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(P`/v1/models/${$}`,{...z,headers:T([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models",j2,{query:Q,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var OH=h(()=>{cQ();pQ();eQ();$X();iK()});var k8=($)=>{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 G0{constructor({baseURL:$=k8("ANTHROPIC_BASE_URL"),apiKey:Z=k8("ANTHROPIC_API_KEY")??null,authToken:z=k8("ANTHROPIC_AUTH_TOKEN")??null,...Q}={}){ZX.add(this),O7.set(this,void 0);let X={apiKey:Z,authToken:z,...Q,baseURL:$||"https://api.anthropic.com"};if(!X.dangerouslyAllowBrowser&&EK())throw new b(`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??oQ.DEFAULT_TIMEOUT,this.logger=X.logger??console;let J="warn";this.logLevel=J,this.logLevel=rz(X.logLevel,"ClientOptions.logLevel",this)??rz(E8("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=X.fetchOptions,this.maxRetries=X.maxRetries??2,this.fetch=X.fetch??AK(),j(this,H7,_K,"f"),this._options=X,this.apiKey=typeof Z==="string"?Z:null,this.authToken=z}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders($){return T([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return T([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return T([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return RK($)}getUserAgent(){return`${this.constructor.name}/JS ${_6}`}defaultIdempotencyKey(){return`stainless-node-retry-${uz()}`}makeStatusError($,Z,z,Q){return O0.generate($,Z,z,Q)}buildURL($,Z,z){let Q=!O(this,sQ,"m",GH).call(this)&&z||this.baseURL,X=HK($)?new URL($):new URL(Q+(Q.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),J=this.defaultQuery(),Y=Object.fromEntries(X.searchParams);if(!pz(J)||!pz(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 b("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 P6(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:U}=await this.buildRequest(Q,{retryCount:X-Z});await this.prepareRequest(J,{url:Y,options:Q});let W="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),G=z===void 0?"":`, retryOf: ${z}`,V=Date.now();if(j0(this).debug(`[${W}] sending request`,t2({retryOfRequestLogID:z,method:Q.method,url:Y,options:Q,headers:J.headers})),Q.signal?.aborted)throw new x0;let q=new AbortController,K=await this.fetchWithTimeout(Y,J,U,q).catch(p4),H=Date.now();if(K instanceof globalThis.Error){let D=`retrying, ${Z} attempts remaining`;if(Q.signal?.aborted)throw new x0;let N=a2(K)||/timed? ?out/i.test(String(K)+("cause"in K?String(K.cause):""));if(Z)return j0(this).info(`[${W}] connection ${N?"timed out":"failed"} - ${D}`),j0(this).debug(`[${W}] connection ${N?"timed out":"failed"} (${D})`,t2({retryOfRequestLogID:z,url:Y,durationMs:H-V,message:K.message})),this.retryRequest(Q,Z,z??W);if(j0(this).info(`[${W}] connection ${N?"timed out":"failed"} - error; no more retries left`),j0(this).debug(`[${W}] connection ${N?"timed out":"failed"} (error; no more retries left)`,t2({retryOfRequestLogID:z,url:Y,durationMs:H-V,message:K.message})),N)throw new a1;throw new C6({cause:K})}let L=[...K.headers.entries()].filter(([D])=>D==="request-id").map(([D,N])=>", "+D+": "+JSON.stringify(N)).join(""),B=`[${W}${G}${L}] ${J.method} ${Y} ${K.ok?"succeeded":"failed"} with status ${K.status} in ${H-V}ms`;if(!K.ok){let D=await this.shouldRetry(K);if(Z&&D){let w=`retrying, ${Z} attempts remaining`;return await CK(K.body),j0(this).info(`${B} - ${w}`),j0(this).debug(`[${W}] response error (${w})`,t2({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,durationMs:H-V})),this.retryRequest(Q,Z,z??W,K.headers)}let N=D?"error; no more retries left":"error; not retryable";j0(this).info(`${B} - ${N}`);let _=await K.text().catch((w)=>p4(w).message),E=mZ(_),P=E?void 0:_;throw j0(this).debug(`[${W}] response error (${N})`,t2({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,message:P,durationMs:Date.now()-V})),this.makeStatusError(K.status,E,P,K.headers)}return j0(this).info(B),j0(this).debug(`[${W}] response start`,t2({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,durationMs:H-V})),{response:K,options:Q,controller:q,requestLogID:W,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 s4(this,z,$)}async fetchWithTimeout($,Z,z,Q){let{signal:X,method:J,...Y}=Z||{},U=this._makeAbort(Q);if(X)X.addEventListener("abort",U,{once:!0});let W=setTimeout(U,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(W)}}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 U=parseFloat(J);if(!Number.isNaN(U))X=U}let Y=Q?.get("retry-after");if(Y&&!X){let U=parseFloat(Y);if(!Number.isNaN(U))X=U*1000;else X=Date.parse(Y)-Date.now()}if(X===void 0){let U=$.maxRetries??this.maxRetries;X=this.calculateDefaultRetryTimeoutMillis(Z,U)}return await LK(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 b("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,U=this.buildURL(X,J,Y);if("timeout"in z)MK("timeout",z.timeout);z.timeout=z.timeout??this.timeout;let{bodyHeaders:W,body:G}=this.buildBody({options:z}),V=await this.buildHeaders({options:$,method:Q,bodyHeaders:W,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:U,timeout:z.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:z,retryCount:Q}){let X={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();X[this.idempotencyHeader]=$.idempotencyKey}let J=T([X,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(Q),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...TK(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,z,$.headers]);return this.validateHeaders(J),J.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let z=T([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&z.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:cZ($)};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,H7,"f").call(this,{body:$,headers:z})}}var sQ,oQ,H7,GH,aQ="\\n\\nHuman:",tQ="\\n\\nAssistant:",w6;var eQ=h(()=>{o2();W1();lz();PK();n0();K0();QQ();WH();nZ();gQ();rQ();vQ();nQ();lz();W0();dZ();W1();oQ=V0,H7=new WeakMap,sQ=new WeakSet,GH=function(){return this.baseURL!=="https://api.anthropic.com"};V0.Anthropic=oQ;V0.HUMAN_PROMPT=aQ;V0.AI_PROMPT=tQ;V0.DEFAULT_TIMEOUT=600000;V0.AnthropicError=b;V0.APIError=O0;V0.APIConnectionError=C6;V0.APIConnectionTimeoutError=a1;V0.APIUserAbortError=x0;V0.NotFoundError=Z$;V0.ConflictError=z$;V0.RateLimitError=X$;V0.BadRequestError=t1;V0.AuthenticationError=e1;V0.InternalServerError=J$;V0.PermissionDeniedError=$$;V0.UnprocessableEntityError=Q$;V0.toFile=a4;w6=class w6 extends V0{constructor(){super(...arguments);this.completions=new D$(this),this.messages=new M1(this),this.models=new N$(this),this.beta=new g0(this)}};w6.Completions=D$;w6.Messages=M1;w6.Models=N$;w6.Beta=g0});var VH={};BX(VH,{toFile:()=>a4,default:()=>w6,UnprocessableEntityError:()=>Q$,RateLimitError:()=>X$,PermissionDeniedError:()=>$$,PagePromise:()=>s4,NotFoundError:()=>Z$,InternalServerError:()=>J$,HUMAN_PROMPT:()=>aQ,ConflictError:()=>z$,BaseAnthropic:()=>V0,BadRequestError:()=>t1,AuthenticationError:()=>e1,AnthropicError:()=>b,Anthropic:()=>w6,APIUserAbortError:()=>x0,APIPromise:()=>P6,APIError:()=>O0,APIConnectionTimeoutError:()=>a1,APIConnectionError:()=>C6,AI_PROMPT:()=>tQ});var qH=h(()=>{eQ();QQ();nZ();eQ();K0();n0()});var wX=nH(EX(),1),{program:Pg,createCommand:Fg,createArgument:jg,createOption:Sg,CommanderError:Eg,InvalidArgumentError:wg,InvalidOptionArgumentError:xg,Command:xX,Argument:yg,Option:_7,Help:bg}=wX.default;import{lstatSync as kU}from"fs";import{join as yU,dirname as Y4,basename as b_,resolve as n6}from"path";import{execFileSync as k_}from"child_process";var tA=C9(),eA=u$(),$C=U9(),k9=m$(),ZC=P$(),V6=e(),zC=J6(),QC=L0(),XC=U6(),JC=W6(),eh=T5(),YC=x9(),UC=y9(),WC=b9(),R5=uY(),mY=_$();var GC=tA.Composer,P5=eA.Document,VC=$C.Schema,qC=k9.YAMLError,F5=k9.YAMLParseError,KC=k9.YAMLWarning,HC=ZC.Alias,u2=V6.isAlias,f6=V6.isCollection,BC=V6.isDocument,B0=V6.isMap,N2=V6.isNode,MC=V6.isPair,A0=V6.isScalar,m2=V6.isSeq,LC=zC.Pair,DC=QC.Scalar,j1=XC.YAMLMap,n$=JC.YAMLSeq;var OC=YC.Lexer,NC=UC.LineCounter,IC=WC.Parser,h0=R5.parse,TC=R5.parseAllDocuments,u6=R5.parseDocument,m6=R5.stringify,AC=mY.visit,CC=mY.visitAsync;import{accessSync as cY,closeSync as S5,constants as pY,existsSync as _C,fchmodSync as lY,fchownSync as RC,fsyncSync as dY,lstatSync as s$,mkdirSync as iY,mkdtempSync as PC,openSync as u9,readdirSync as nY,readFileSync as E5,readlinkSync as FC,realpathSync as jC,renameSync as SC,rmSync as rY,statSync as S1,unlinkSync as sY,writeFileSync as oY}from"fs";import{randomBytes as EC}from"crypto";import{tmpdir as aY}from"os";import{basename as q6,dirname as c6,isAbsolute as tY,join as w2,relative as m9,resolve as Y2,sep as j5}from"path";class v extends Error{reason;path;onWrite;constructor($,Z,z,Q={}){super(z,Q.cause===void 0?void 0:{cause:Q.cause});this.name="SafePathError",this.reason=$,this.path=Z,this.onWrite=Q.onWrite===!0}}var y0=Object.freeze({claude:"CLAUDE.md",agents:"AGENTS.md",gemini:"GEMINI.md",cursorrules:".cursorrules",copilot:"copilot-instructions.md",memory:"MEMORY.md",llms:"llms.txt"}),wC=new Set(Object.values(y0).map(($)=>$.toLowerCase())),xC=($,Z)=>$.toLowerCase()===Z.toLowerCase(),v9=($)=>wC.has($.toLowerCase());function E1($){return $.split(/[\\/]/).some((Z)=>Z.toLowerCase()===".git")}var yC=/\.fafm?$/i,bC=/^[a-z][a-z0-9-]*$/,I2=($)=>jC.native($),K6=($)=>$?.code;function o$($,Z){let z=m9($,Z);return z===""||z!==".."&&!z.startsWith(`..${j5}`)&&!tY(z)}function eY($){try{return FC($)}catch{return"?"}}function kC($,Z,z,Q){let X;try{X=I2(z)}catch(J){let Y=K6(J);if(Y==="ENOENT"||Y==="ELOOP"||Y==="ENOTDIR")throw new v("dangling",Z,`${Z} is a link to ${eY(z)}, which does not exist. faf does not create files through a link — refused.`);throw J}if(!o$($,X))throw new v("outside",Z,`${Z} is a link to ${X}, outside ${$} — refused.`);if(E1(X)&&!(Q.inGit&&c6(X)===$))throw new v("git",Z,`${Z} is a link to ${X}, inside .git/ — refused.`);if(!S1(X).isFile())throw new v("not-a-file",Z,`${Z} is a link to ${X}, which is not a regular file — refused.`);return vC(Z,X,Q.read),X}function vC($,Z,z){let Q=q6($),X=q6(Z),J=v9(Q)&&v9(X);if(z&&!yC.test(X)&&!J){let Y=v9(Q)?"a .faf or .fafm file, nor another AI context file":"a .faf or .fafm file";throw new v("not-faf",$,`${$} is a link to ${Z}, which is not ${Y} — refused.`)}if(!z&&!xC(Q,X)&&!J)throw new v("other-file",$,`${$} is a link to ${Z}, a file with another name — refused (faf follows a link only to a file of the same name, or from one AI context file to another).`)}function gC($,Z,z,Q){if(q6(Y2($))!=="hooks"||!bC.test(q6(Z)))throw new v("git",Z,`${Z} is not a git hook in a hooks folder — refused.`);if(Q!==z)throw new v("git",Z,`${Z} is not directly in the hooks folder ${z} — refused.`)}function hC($,Z,z){if(q6($)!=="config"||z!==Z)throw new v("git",$,`${$} is not the git config file directly in ${Z} — refused.`)}function i($,Z,z={}){let Q=I2(Y2($)),X=Y2($,Z),J=I2(c6(X));if(!o$(Q,J))throw new v("outside",X,`${X} is in ${J}, outside ${Q} — refused.`);let Y=z.allowGitHooks===!0,U=z.allowGitConfig===!0;if(Y)gC($,X,Q,J);if(U)hC(X,Q,J);let W=w2(J,q6(X));if(E1(W)&&!Y&&!U)throw new v("git",X,W===X?`${X} is inside .git/ — refused.`:`${X} resolves to ${W}, inside .git/ — refused.`);let G;try{G=s$(W)}catch(V){if(K6(V)==="ENOENT")return W;throw V}if(G.isSymbolicLink())return kC(Q,X,W,{read:z.read===!0,inGit:Y||U});if(!G.isFile())throw new v("not-a-file",X,`${X} is not a regular file — refused.`);return I2(W)}var fC=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function uC($,Z){if(!($.length>=2&&($[0]===255&&$[1]===254||$[0]===254&&$[1]===255)))try{return fC.decode($)}catch{}throw new v("not-utf8",Z,`${Z} is not UTF-8 — faf left it unchanged`)}function G0($){return uC(E5($),$)}function f0($){try{return E5($)}catch(Z){if(K6(Z)==="ENOENT")return null;throw Z}}function r$($,Z){let z=Y2(w2($,Z));if(!_C(z))return null;let Q,X;try{Q=I2(mC($)),X=I2(z)}catch{return null}if(!o$(Q,X)||E1(m9(Q,X)))return null;return X}var h9=[];function mC($){let Z=Y2($);return h9.find((z)=>Z===z||Z.startsWith(z.endsWith(j5)?z:z+j5))??Z}function w1($,Z){h9.push(Y2($));try{return Z()}finally{h9.pop()}}function I($,Z){return r$($,Z)!==null}function g($,Z){let z=r$($,Z);if(z===null)return null;try{return S1(z).isFile()?E5(z,"utf-8"):null}catch{return null}}function T2($,Z){let z=r$($,Z);if(z===null)return null;try{return S1(z)}catch{return null}}function X0($,Z="."){let z=r$($,Z);if(z===null)return null;let Q;try{Q=nY(z,{withFileTypes:!0})}catch{return null}return Q.filter((X)=>!X.isSymbolicLink()||r$($,w2(Z,X.name))!==null)}function cC($){try{let Z=S1($);return{mode:Z.mode&511,perm:Z.mode&4095,uid:Z.uid,gid:Z.gid}}catch(Z){if(K6(Z)==="ENOENT")return;throw Z}}class c2 extends Error{path;constructor($,Z,z={}){super(Z,{cause:z.cause});this.path=$}}var g9=($)=>new v("changed",$,`${$} changed on disk while faf was writing — not written; original kept`,{onWrite:!0});function c9($,Z,z){if(Z!==void 0){let X=f0($),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 g9($)}if(!z)return;let Q;try{Q=S1($)}catch(X){if(K6(X)==="ENOENT")return;throw X}if((Q.mode&4095)!==z.perm)throw g9($);try{cY($,pY.W_OK)}catch{throw g9($)}}function pC($,Z){if(process.platform!=="win32")try{RC($,Z.uid,Z.gid)}catch{}lY($,Z.mode)}function lC($){if(process.platform==="win32")return;try{let Z=u9($,"r");try{dY(Z)}finally{S5(Z)}}catch{}}function dC($,Z,z,Q){if($.fd=u9($.path,"wx",Q??z?.mode??438),$.created=!0,oY($.fd,Z),z)pC($.fd,z);if(Q!==void 0)lY($.fd,Q);dY($.fd),S5($.fd),$.fd=void 0}function iC($){if($.fd!==void 0)try{S5($.fd)}catch{}if($.created)try{sY($.path)}catch{}}function nC($,Z,z){let Q=c6($),X={path:w2(Q,`.${q6($).slice(0,100)}.${process.pid}.${EC(6).toString("hex")}.faf-tmp`),created:!1},J=cC($);try{if(J)cY($,pY.W_OK);dC(X,Z,J,z.mode),c9($,z.expect,J),SC(X.path,$)}catch(Y){if(iC(X),Y instanceof v)throw Y;let U=K6(Y)??(Y instanceof Error?Y.message:String(Y));throw new c2($,`${$}: not written${J?"; original kept":""} (${U})`,{cause:Y})}lC(Q)}function rC($){return $ instanceof v&&!$.onWrite?new v($.reason,$.path,$.message,{onWrite:!0}):$}function o($,Z,z={}){let Q=Y2($),X;try{X=i(z.root??c6(Q),Q,{allowGitHooks:z.allowGitHooks,allowGitConfig:z.allowGitConfig})}catch(J){throw rC(J)}return nC(X,Z,z),X}function x2($,Z,z){let Q=Y2($),X=z.root??c6(Q),J=i(X,Q),Y=f0(J);if(z.expect!==void 0)c9(J,z.expect,void 0);if(Y!==null&&z.force!==!0&&!z.owns(Y))throw new v("not-owned",Q,`${Q} has no ${z.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});return o(J,Z,{root:X,expect:Y})}function E0($,Z=$){let z=Y2($);iY(z,{recursive:!0});let Q=I2(z),X=Y2(z,Z),J=m9(z,X);if(J===".."||J.startsWith(`..${j5}`)||tY(J))throw new v("outside",X,`${X} is outside ${Q} — refused.`,{onWrite:!0});let Y=Q;for(let U of J.split(/[\\/]/).filter(Boolean)){let W=w2(Y,U);if(E1(W))throw new v("git",X,`${X} runs through ${W}, inside .git/ — refused.`,{onWrite:!0});Y=sC(Q,X,W)}return Y}function sC($,Z,z){let Q;try{Q=s$(z)}catch(J){if(K6(J)!=="ENOENT")throw J;return iY(z),z}let X=z;if(Q.isSymbolicLink()){try{X=I2(z)}catch{throw new v("dangling",Z,`${z} is a link to ${eY(z)}, which does not exist. faf does not create folders through a link — refused.`,{onWrite:!0})}if(!o$($,X))throw new v("outside",Z,`${z} is a link to ${X}, outside ${$} — refused.`,{onWrite:!0});if(E1(X))throw new v("git",Z,`${z} is a link to ${X}, inside .git/ — refused.`,{onWrite:!0})}if(!S1(X).isDirectory())throw new v("not-a-file",Z,`${z} is not a folder — refused.`,{onWrite:!0});return X}function w5($,Z){let z=Y2($),Q=I2(Y2(Z.root??c6(z))),X=I2(c6(z));if(!o$(Q,X))throw new v("outside",z,`${z} is in ${X}, outside ${Q} — refused.`,{onWrite:!0});let J=w2(X,q6(z));if(E1(J))throw new v("git",z,`${z} is inside .git/ — refused.`,{onWrite:!0});let Y;try{Y=s$(J)}catch(U){if(K6(U)==="ENOENT")return!1;throw U}if(!Y.isFile())throw new v("not-a-file",z,`${z} is not a regular file faf wrote — left as it is.`,{onWrite:!0});return c9(J,Z.expect,void 0),sY(J),!0}var f9=new Set,$U=".faf-temp",ZU="faf made this temp folder; `faf clear` removes it.\n";function x5($){let Z=I2(PC(w2(aY(),$)));f9.add(Z);let z=u9(w2(Z,$U),"wx",420);try{oY(z,ZU)}finally{S5(z)}return Z}function y5($){if(!f9.has($))throw Error(`${$} is not a temp folder faf made — not removed`);rY($,{recursive:!0,force:!0}),f9.delete($)}function oC($){let Z=w2($,$U);try{if(!s$(Z).isFile())return!1;return E5(Z,"utf-8")===ZU}catch{return!1}}var aC=($)=>$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function zU($){let Z=aY(),z=typeof process.getuid==="function"?process.getuid():void 0,Q=new RegExp(`^${aC($)}[A-Za-z0-9]{6}$`),X=0;for(let J of nY(Z)){if(!Q.test(J))continue;let Y=w2(Z,J);try{let U=s$(Y);if(!U.isDirectory()||z!==void 0&&U.uid!==z||!oC(Y))continue;rY(Y,{recursive:!0,force:!0}),X++}catch{}}return X}function $0($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function p6($){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 a$($,Z){if($===null||$===void 0)return{};if(!$0($))throw new v("not-yaml",Z,`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${p6($)}. `+"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:"The stage it is at, and since when",category:"human"},{index:9,path:"human_context.how",label:"How",description:"How it works",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,$]])),QU=new Map(J0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),Wf=new Map(J0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function t$($,Z){let z=(X)=>{let J=X.split("."),Y=$;for(let U of J)if(Y&&typeof Y==="object"&&U in Y)Y=Y[U];else return;return Y},Q=z(Z.path);if(Q!==void 0)return Q;if(Z.canonical)return z(Z.canonical);return}var Gf=J0.filter(($)=>$.index<=21);var p9=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","tbd","todo","n/a","not applicable"]);var e$="slotignored";function p2($){return typeof $==="string"&&$.trim()!==""&&U0($)}function U0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return p9.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var x1="no classifying signals — fallback",tC=new Set(["stack.css_framework","stack.ui_library","stack.database","stack.connection","stack.hosting"]),b5={skills:new Set(["stack.frontend"]),"skills-plugin":new Set(["stack.frontend","stack.runtime"])};function d6($,Z){if(typeof $!=="string"||!Object.prototype.hasOwnProperty.call(l6,$))return null;if(b5[$]?.has(Z.path))return!0;if(!l6[$].includes(Z.category))return!1;return!($==="framework"&&tC.has(Z.path))}var l6={documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],skills:["project","human"],cli:["project","human","universal"],"skills-plugin":["project","human","universal"],library:["project","human","universal"],sdk:["project","human","universal"],wasm:["project","human","universal"],html:["project","human","universal"],"server-card":["project","human","universal"],frontend:["project","frontend","human","universal"],website:["project","frontend","human","universal"],mobile:["project","frontend","human","universal"],app:["project","frontend","human","universal"],extension:["project","frontend","human","universal"],mcp:["project","backend","human","universal"],backend:["project","backend","universal","human"],"data-science":["project","backend","human","universal"],fullstack:["project","frontend","backend","universal","human"],svelte:["project","frontend","backend","universal","human"],framework:["project","frontend","backend","universal","human"],"monorepo-root":["project","human","enterprise_infra","enterprise_app","enterprise_ops"],mcpaas:["project","backend","universal","human","enterprise_app","enterprise_ops"],saas:["project","frontend","backend","universal","human","enterprise_app"],enterprise:["project","frontend","backend","universal","human","enterprise_infra","enterprise_app","enterprise_ops"]};var GU=new Set(["tag:yaml.org,2002:int","tag:yaml.org,2002:float"]);function XU($){return typeof $==="object"&&$.collection===void 0}function eC($,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||!GU.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 $_($){let Z=$.filter(XU);return $.map((z)=>{if(!XU(z)||!GU.has(z.tag)||!z.stringify)return z;let Q=z.stringify;return{...z,stringify:(X,J,Y,U)=>eC(X,Z)??Q(X,J,Y,U)}})}var k5={keepSourceTokens:!0,customTags:$_};function Z_($,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 z_($){let Z=$.split(/\r?\n/),z,Q;for(let X=0;X+1<Z.length;X++){let J=Z_(Z[X],Z[X+1]);z??=J.indent,Q??=J.indentSeq}return{indent:z??2,indentSeq:Q??!0}}function r9($,Z){let z=u6($,k5);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 i6($,Z,z,Q){$.edits.push({start:Z,end:z,text:Q,seq:$.edits.length})}function $4($,Z){return $.lastIndexOf(`
207
- `,Z-1)+1}function VU($,Z){if(Z>0&&$[Z-1]===`
204
+ `);this.baseURL=X.baseURL,this.timeout=X.timeout??zX.DEFAULT_TIMEOUT,this.logger=X.logger??console;let J="warn";this.logLevel=J,this.logLevel=$Q(X.logLevel,"ClientOptions.logLevel",this)??$Q(k8("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=X.fetchOptions,this.maxRetries=X.maxRetries??2,this.fetch=X.fetch??xK(),R(this,O7,bK,"f"),this._options=X,this.apiKey=typeof Z==="string"?Z:null,this.authToken=z}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders($){return T([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return T([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return T([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return kK($)}getUserAgent(){return`${this.constructor.name}/JS ${j6}`}defaultIdempotencyKey(){return`stainless-node-retry-${iz()}`}makeStatusError($,Z,z,Q){return L0.generate($,Z,z,Q)}buildURL($,Z,z){let Q=!O(this,ZX,"m",NH).call(this)&&z||this.baseURL,X=CK($)?new URL($):new URL(Q+(Q.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),J=this.defaultQuery(),Y=Object.fromEntries(X.searchParams);if(!sz(J)||!sz(Y))Z={...Y,...J,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))X.search=this.stringifyQuery(Z);return X.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new b("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 E6(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:U}=await this.buildRequest(Q,{retryCount:X-Z});await this.prepareRequest(J,{url:Y,options:Q});let W="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),G=z===void 0?"":`, retryOf: ${z}`,V=Date.now();if(R0(this).debug(`[${W}] sending request`,z6({retryOfRequestLogID:z,method:Q.method,url:Y,options:Q,headers:J.headers})),Q.signal?.aborted)throw new x0;let q=new AbortController,K=await this.fetchWithTimeout(Y,J,U,q).catch(r4),L=Date.now();if(K instanceof globalThis.Error){let D=`retrying, ${Z} attempts remaining`;if(Q.signal?.aborted)throw new x0;let N=Z6(K)||/timed? ?out/i.test(String(K)+("cause"in K?String(K.cause):""));if(Z)return R0(this).info(`[${W}] connection ${N?"timed out":"failed"} - ${D}`),R0(this).debug(`[${W}] connection ${N?"timed out":"failed"} (${D})`,z6({retryOfRequestLogID:z,url:Y,durationMs:L-V,message:K.message})),this.retryRequest(Q,Z,z??W);if(R0(this).info(`[${W}] connection ${N?"timed out":"failed"} - error; no more retries left`),R0(this).debug(`[${W}] connection ${N?"timed out":"failed"} (error; no more retries left)`,z6({retryOfRequestLogID:z,url:Y,durationMs:L-V,message:K.message})),N)throw new z$;throw new R6({cause:K})}let B=[...K.headers.entries()].filter(([D])=>D==="request-id").map(([D,N])=>", "+D+": "+JSON.stringify(N)).join(""),H=`[${W}${G}${B}] ${J.method} ${Y} ${K.ok?"succeeded":"failed"} with status ${K.status} in ${L-V}ms`;if(!K.ok){let D=await this.shouldRetry(K);if(Z&&D){let w=`retrying, ${Z} attempts remaining`;return await yK(K.body),R0(this).info(`${H} - ${w}`),R0(this).debug(`[${W}] response error (${w})`,z6({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,durationMs:L-V})),this.retryRequest(Q,Z,z??W,K.headers)}let N=D?"error; no more retries left":"error; not retryable";R0(this).info(`${H} - ${N}`);let _=await K.text().catch((w)=>r4(w).message),E=iZ(_),j=E?void 0:_;throw R0(this).debug(`[${W}] response error (${N})`,z6({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,message:j,durationMs:Date.now()-V})),this.makeStatusError(K.status,E,j,K.headers)}return R0(this).info(H),R0(this).debug(`[${W}] response start`,z6({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,durationMs:L-V})),{response:K,options:Q,controller:q,requestLogID:W,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 $8(this,z,$)}async fetchWithTimeout($,Z,z,Q){let{signal:X,method:J,...Y}=Z||{},U=this._makeAbort(Q);if(X)X.addEventListener("abort",U,{once:!0});let W=setTimeout(U,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(W)}}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 U=parseFloat(J);if(!Number.isNaN(U))X=U}let Y=Q?.get("retry-after");if(Y&&!X){let U=parseFloat(Y);if(!Number.isNaN(U))X=U*1000;else X=Date.parse(Y)-Date.now()}if(X===void 0){let U=$.maxRetries??this.maxRetries;X=this.calculateDefaultRetryTimeoutMillis(Z,U)}return await FK(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 b("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,U=this.buildURL(X,J,Y);if("timeout"in z)PK("timeout",z.timeout);z.timeout=z.timeout??this.timeout;let{bodyHeaders:W,body:G}=this.buildBody({options:z}),V=await this.buildHeaders({options:$,method:Q,bodyHeaders:W,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:U,timeout:z.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:z,retryCount:Q}){let X={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();X[this.idempotencyHeader]=$.idempotencyKey}let J=T([X,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(Q),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...wK(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,z,$.headers]);return this.validateHeaders(J),J.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let z=T([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&z.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:nZ($)};else if(typeof $==="object"&&z.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery($)};else return O(this,O7,"f").call(this,{body:$,headers:z})}}var ZX,zX,O7,NH,QX="\\n\\nHuman:",XX="\\n\\nAssistant:",k6;var JX=h(()=>{$6();q1();oz();vK();i0();V0();GQ();OH();tZ();pQ();$X();cQ();eQ();oz();U0();oZ();q1();zX=G0,O7=new WeakMap,ZX=new WeakSet,NH=function(){return this.baseURL!=="https://api.anthropic.com"};G0.Anthropic=zX;G0.HUMAN_PROMPT=QX;G0.AI_PROMPT=XX;G0.DEFAULT_TIMEOUT=600000;G0.AnthropicError=b;G0.APIError=L0;G0.APIConnectionError=R6;G0.APIConnectionTimeoutError=z$;G0.APIUserAbortError=x0;G0.NotFoundError=Y$;G0.ConflictError=U$;G0.RateLimitError=G$;G0.BadRequestError=Q$;G0.AuthenticationError=X$;G0.InternalServerError=V$;G0.PermissionDeniedError=J$;G0.UnprocessableEntityError=W$;G0.toFile=z8;k6=class k6 extends G0{constructor(){super(...arguments);this.completions=new A$(this),this.messages=new O1(this),this.models=new _$(this),this.beta=new h0(this)}};k6.Completions=A$;k6.Messages=O1;k6.Models=_$;k6.Beta=h0});var IH={};NX(IH,{toFile:()=>z8,default:()=>k6,UnprocessableEntityError:()=>W$,RateLimitError:()=>G$,PermissionDeniedError:()=>J$,PagePromise:()=>$8,NotFoundError:()=>Y$,InternalServerError:()=>V$,HUMAN_PROMPT:()=>QX,ConflictError:()=>U$,BaseAnthropic:()=>G0,BadRequestError:()=>Q$,AuthenticationError:()=>X$,AnthropicError:()=>b,Anthropic:()=>k6,APIUserAbortError:()=>x0,APIPromise:()=>E6,APIError:()=>L0,APIConnectionTimeoutError:()=>z$,APIConnectionError:()=>R6,AI_PROMPT:()=>XX});var TH=h(()=>{JX();GQ();tZ();JX();V0();i0()});var vX=QB(kX(),1),{program:cg,createCommand:pg,createArgument:lg,createOption:dg,CommanderError:ig,InvalidArgumentError:ng,InvalidOptionArgumentError:rg,Command:gX,Argument:sg,Option:S7,Help:og}=vX.default;import{lstatSync as cU,realpathSync as hU}from"fs";import{join as fU,dirname as g1,basename as J3,resolve as o6,relative as uU,isAbsolute as l_,sep as d_}from"path";import{execFileSync as i_}from"child_process";var WC=j9(),GC=d$(),VC=K9(),u9=i$(),qC=w$(),B6=t(),KC=G6(),HC=B0(),BC=q6(),MC=K6(),Mf=F5(),LC=g9(),DC=h9(),OC=f9(),E5=dY(),iY=S$();var NC=WC.Composer,w5=GC.Document,IC=VC.Schema,TC=u9.YAMLError,x5=u9.YAMLParseError,AC=u9.YAMLWarning,CC=qC.Alias,c2=B6.isAlias,p6=B6.isCollection,_C=B6.isDocument,K0=B6.isMap,N2=B6.isNode,PC=B6.isPair,N0=B6.isScalar,p2=B6.isSeq,FC=KC.Pair,RC=HC.Scalar,w1=BC.YAMLMap,t$=MC.YAMLSeq;var jC=LC.Lexer,SC=DC.LineCounter,EC=OC.Parser,S0=E5.parse,wC=E5.parseAllDocuments,l2=E5.parseDocument,l6=E5.stringify,xC=iY.visit,yC=iY.visitAsync;import{accessSync as nY,closeSync as b5,constants as rY,existsSync as bC,fchmodSync as sY,fchownSync as kC,fsyncSync as oY,lstatSync as $4,mkdirSync as aY,mkdtempSync as vC,openSync as d9,readdirSync as tY,readFileSync as k5,readlinkSync as gC,realpathSync as hC,renameSync as fC,rmSync as eY,statSync as x1,unlinkSync as $U,writeFileSync as ZU}from"fs";import{randomBytes as uC}from"crypto";import{tmpdir as zU}from"os";import{basename as M6,dirname as d6,isAbsolute as QU,join as x2,relative as i9,resolve as Y2,sep as y5}from"path";class k 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 b0=Object.freeze({claude:"CLAUDE.md",agents:"AGENTS.md",gemini:"GEMINI.md",cursorrules:".cursorrules",copilot:"copilot-instructions.md",memory:"MEMORY.md",llms:"llms.txt"}),mC=new Set(Object.values(b0).map(($)=>$.toLowerCase())),cC=($,Z)=>$.toLowerCase()===Z.toLowerCase(),m9=($)=>mC.has($.toLowerCase());function y1($){return $.split(/[\\/]/).some((Z)=>Z.toLowerCase()===".git")}var pC=/\.fafm?$/i,lC=/^[a-z][a-z0-9-]*$/,I2=($)=>hC.native($),L6=($)=>$?.code;function Z4($,Z){let z=i9($,Z);return z===""||z!==".."&&!z.startsWith(`..${y5}`)&&!QU(z)}function XU($){try{return gC($)}catch{return"?"}}function dC($,Z,z,Q){let X;try{X=I2(z)}catch(J){let Y=L6(J);if(Y==="ENOENT"||Y==="ELOOP"||Y==="ENOTDIR")throw new k("dangling",Z,`${Z} is a link to ${XU(z)}, which does not exist. faf does not create files through a link — refused.`);throw J}if(!Z4($,X))throw new k("outside",Z,`${Z} is a link to ${X}, outside ${$} — refused.`);if(y1(X)&&!(Q.inGit&&d6(X)===$))throw new k("git",Z,`${Z} is a link to ${X}, inside .git/ — refused.`);if(!x1(X).isFile())throw new k("not-a-file",Z,`${Z} is a link to ${X}, which is not a regular file — refused.`);return iC(Z,X,Q.read),X}function iC($,Z,z){let Q=M6($),X=M6(Z),J=m9(Q)&&m9(X);if(z&&!pC.test(X)&&!J){let Y=m9(Q)?"a .faf or .fafm file, nor another AI context file":"a .faf or .fafm file";throw new k("not-faf",$,`${$} is a link to ${Z}, which is not ${Y} — refused.`)}if(!z&&!cC(Q,X)&&!J)throw new k("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 nC($,Z,z,Q){if(M6(Y2($))!=="hooks"||!lC.test(M6(Z)))throw new k("git",Z,`${Z} is not a git hook in a hooks folder — refused.`);if(Q!==z)throw new k("git",Z,`${Z} is not directly in the hooks folder ${z} — refused.`)}function rC($,Z,z){if(M6($)!=="config"||z!==Z)throw new k("git",$,`${$} is not the git config file directly in ${Z} — refused.`)}function n($,Z,z={}){let Q=I2(Y2($)),X=Y2($,Z),J=I2(d6(X));if(!Z4(Q,J))throw new k("outside",X,`${X} is in ${J}, outside ${Q} — refused.`);let Y=z.allowGitHooks===!0,U=z.allowGitConfig===!0;if(Y)nC($,X,Q,J);if(U)rC(X,Q,J);let W=x2(J,M6(X));if(y1(W)&&!Y&&!U)throw new k("git",X,W===X?`${X} is inside .git/ — refused.`:`${X} resolves to ${W}, inside .git/ — refused.`);let G;try{G=$4(W)}catch(V){if(L6(V)==="ENOENT")return W;throw V}if(G.isSymbolicLink())return dC(Q,X,W,{read:z.read===!0,inGit:Y||U});if(!G.isFile())throw new k("not-a-file",X,`${X} is not a regular file — refused.`);return I2(W)}var sC=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function oC($,Z){if(!($.length>=2&&($[0]===255&&$[1]===254||$[0]===254&&$[1]===255)))try{return sC.decode($)}catch{}throw new k("not-utf8",Z,`${Z} is not UTF-8 — faf left it unchanged`)}function W0($){return oC(k5($),$)}function f0($){try{return k5($)}catch(Z){if(L6(Z)==="ENOENT")return null;throw Z}}function e$($,Z){let z=Y2(x2($,Z));if(!bC(z))return null;let Q,X;try{Q=I2(aC($)),X=I2(z)}catch{return null}if(!Z4(Q,X)||y1(i9(Q,X)))return null;return X}var p9=[];function aC($){let Z=Y2($);return p9.find((z)=>Z===z||Z.startsWith(z.endsWith(y5)?z:z+y5))??Z}function b1($,Z){p9.push(Y2($));try{return Z()}finally{p9.pop()}}function I($,Z){return e$($,Z)!==null}function g($,Z){let z=e$($,Z);if(z===null)return null;try{return x1(z).isFile()?k5(z,"utf-8"):null}catch{return null}}function T2($,Z){let z=e$($,Z);if(z===null)return null;try{return x1(z)}catch{return null}}function Q0($,Z="."){let z=e$($,Z);if(z===null)return null;let Q;try{Q=tY(z,{withFileTypes:!0})}catch{return null}return Q.filter((X)=>!X.isSymbolicLink()||e$($,x2(Z,X.name))!==null)}function tC($){try{let Z=x1($);return{mode:Z.mode&511,perm:Z.mode&4095,uid:Z.uid,gid:Z.gid}}catch(Z){if(L6(Z)==="ENOENT")return;throw Z}}class d2 extends Error{path;constructor($,Z,z={}){super(Z,{cause:z.cause});this.path=$}}var c9=($)=>new k("changed",$,`${$} changed on disk while faf was writing — not written; original kept`,{onWrite:!0});function n9($,Z,z){if(Z!==void 0){let X=f0($),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 c9($)}if(!z)return;let Q;try{Q=x1($)}catch(X){if(L6(X)==="ENOENT")return;throw X}if((Q.mode&4095)!==z.perm)throw c9($);try{nY($,rY.W_OK)}catch{throw c9($)}}function eC($,Z){if(process.platform!=="win32")try{kC($,Z.uid,Z.gid)}catch{}sY($,Z.mode)}function $_($){if(process.platform==="win32")return;try{let Z=d9($,"r");try{oY(Z)}finally{b5(Z)}}catch{}}function Z_($,Z,z,Q){if($.fd=d9($.path,"wx",Q??z?.mode??438),$.created=!0,ZU($.fd,Z),z)eC($.fd,z);if(Q!==void 0)sY($.fd,Q);oY($.fd),b5($.fd),$.fd=void 0}function z_($){if($.fd!==void 0)try{b5($.fd)}catch{}if($.created)try{$U($.path)}catch{}}function Q_($,Z,z){let Q=d6($),X={path:x2(Q,`.${M6($).slice(0,100)}.${process.pid}.${uC(6).toString("hex")}.faf-tmp`),created:!1},J=tC($);try{if(J)nY($,rY.W_OK);Z_(X,Z,J,z.mode),n9($,z.expect,J),fC(X.path,$)}catch(Y){if(z_(X),Y instanceof k)throw Y;let U=L6(Y)??(Y instanceof Error?Y.message:String(Y));throw new d2($,`${$}: not written${J?"; original kept":""} (${U})`,{cause:Y})}$_(Q)}function X_($){return $ instanceof k&&!$.onWrite?new k($.reason,$.path,$.message,{onWrite:!0}):$}function s($,Z,z={}){let Q=Y2($),X;try{X=n(z.root??d6(Q),Q,{allowGitHooks:z.allowGitHooks,allowGitConfig:z.allowGitConfig})}catch(J){throw X_(J)}return Q_(X,Z,z),X}function y2($,Z,z){let Q=Y2($),X=z.root??d6(Q),J=n(X,Q),Y=f0(J);if(z.expect!==void 0)n9(J,z.expect,void 0);if(Y!==null&&z.force!==!0&&!z.owns(Y))throw new k("not-owned",Q,`${Q} has no ${z.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});return s(J,Z,{root:X,expect:Y})}function E0($,Z=$){let z=Y2($);aY(z,{recursive:!0});let Q=I2(z),X=Y2(z,Z),J=i9(z,X);if(J===".."||J.startsWith(`..${y5}`)||QU(J))throw new k("outside",X,`${X} is outside ${Q} — refused.`,{onWrite:!0});let Y=Q;for(let U of J.split(/[\\/]/).filter(Boolean)){let W=x2(Y,U);if(y1(W))throw new k("git",X,`${X} runs through ${W}, inside .git/ — refused.`,{onWrite:!0});Y=J_(Q,X,W)}return Y}function J_($,Z,z){let Q;try{Q=$4(z)}catch(J){if(L6(J)!=="ENOENT")throw J;return aY(z),z}let X=z;if(Q.isSymbolicLink()){try{X=I2(z)}catch{throw new k("dangling",Z,`${z} is a link to ${XU(z)}, which does not exist. faf does not create folders through a link — refused.`,{onWrite:!0})}if(!Z4($,X))throw new k("outside",Z,`${z} is a link to ${X}, outside ${$} — refused.`,{onWrite:!0});if(y1(X))throw new k("git",Z,`${z} is a link to ${X}, inside .git/ — refused.`,{onWrite:!0})}if(!x1(X).isDirectory())throw new k("not-a-file",Z,`${z} is not a folder — refused.`,{onWrite:!0});return X}function v5($,Z){let z=Y2($),Q=I2(Y2(Z.root??d6(z))),X=I2(d6(z));if(!Z4(Q,X))throw new k("outside",z,`${z} is in ${X}, outside ${Q} — refused.`,{onWrite:!0});let J=x2(X,M6(z));if(y1(J))throw new k("git",z,`${z} is inside .git/ — refused.`,{onWrite:!0});let Y;try{Y=$4(J)}catch(U){if(L6(U)==="ENOENT")return!1;throw U}if(!Y.isFile())throw new k("not-a-file",z,`${z} is not a regular file faf wrote — left as it is.`,{onWrite:!0});return n9(J,Z.expect,void 0),$U(J),!0}var l9=new Set,JU=".faf-temp",YU="faf made this temp folder; `faf clear` removes it.\n";function g5($){let Z=I2(vC(x2(zU(),$)));l9.add(Z);let z=d9(x2(Z,JU),"wx",420);try{ZU(z,YU)}finally{b5(z)}return Z}function h5($){if(!l9.has($))throw Error(`${$} is not a temp folder faf made — not removed`);eY($,{recursive:!0,force:!0}),l9.delete($)}function Y_($){let Z=x2($,JU);try{if(!$4(Z).isFile())return!1;return k5(Z,"utf-8")===YU}catch{return!1}}var U_=($)=>$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function UU($){let Z=zU(),z=typeof process.getuid==="function"?process.getuid():void 0,Q=new RegExp(`^${U_($)}[A-Za-z0-9]{6}$`),X=0;for(let J of tY(Z)){if(!Q.test(J))continue;let Y=x2(Z,J);try{let U=$4(Y);if(!U.isDirectory()||z!==void 0&&U.uid!==z||!Y_(Y))continue;eY(Y,{recursive:!0,force:!0}),X++}catch{}}return X}function e($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function i6($){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 z4($,Z){if($===null||$===void 0)return{};if(!e($))throw new k("not-yaml",Z,`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${i6($)}. `+"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:"The stage it is at, and since when",category:"human"},{index:9,path:"human_context.how",label:"How",description:"How it works",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"}],D6=new Map(X0.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),WU=new Map(X0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),_f=new Map(X0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function Q4($,Z){let z=(X)=>{let J=X.split("."),Y=$;for(let U of J)if(Y&&typeof Y==="object"&&U in Y)Y=Y[U];else return;return Y},Q=z(Z.path);if(Q!==void 0)return Q;if(Z.canonical)return z(Z.canonical);return}var Pf=X0.filter(($)=>$.index<=21);var r9=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","tbd","todo","n/a","not applicable"]);var X4="slotignored";function i2($){return typeof $==="string"&&$.trim()!==""&&J0($)}function J0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return r9.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var k1="no classifying signals — fallback",W_=new Set(["stack.css_framework","stack.ui_library","stack.database","stack.connection","stack.hosting"]),f5={skills:new Set(["stack.frontend"]),"skills-plugin":new Set(["stack.frontend","stack.runtime"])};function r6($,Z){if(typeof $!=="string"||!Object.prototype.hasOwnProperty.call(n6,$))return null;if(f5[$]?.has(Z.path))return!0;if(!n6[$].includes(Z.category))return!1;return!($==="framework"&&W_.has(Z.path))}var n6={documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],skills:["project","human"],cli:["project","human","universal"],"skills-plugin":["project","human","universal"],library:["project","human","universal"],sdk:["project","human","universal"],wasm:["project","human","universal"],html:["project","human","universal"],"server-card":["project","human","universal"],frontend:["project","frontend","human","universal"],website:["project","frontend","human","universal"],mobile:["project","frontend","human","universal"],app:["project","frontend","human","universal"],extension:["project","frontend","human","universal"],mcp:["project","backend","human","universal"],backend:["project","backend","universal","human"],"data-science":["project","backend","human","universal"],fullstack:["project","frontend","backend","universal","human"],svelte:["project","frontend","backend","universal","human"],framework:["project","frontend","backend","universal","human"],"monorepo-root":["project","human","enterprise_infra","enterprise_app","enterprise_ops"],mcpaas:["project","backend","universal","human","enterprise_app","enterprise_ops"],saas:["project","frontend","backend","universal","human","enterprise_app"],enterprise:["project","frontend","backend","universal","human","enterprise_infra","enterprise_app","enterprise_ops"]};var BU=new Set(["tag:yaml.org,2002:int","tag:yaml.org,2002:float"]);function GU($){return typeof $==="object"&&$.collection===void 0}function G_($,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||!BU.has(Q.tag))return;let X;try{X=Q.resolve(z,()=>{return},{})}catch{return}return Object.is(N0(X)?X.value:X,$.value)?z:void 0}function V_($){let Z=$.filter(GU);return $.map((z)=>{if(!GU(z)||!BU.has(z.tag)||!z.stringify)return z;let Q=z.stringify;return{...z,stringify:(X,J,Y,U)=>G_(X,Z)??Q(X,J,Y,U)}})}var u5={keepSourceTokens:!0,customTags:V_};function q_($,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 K_($){let Z=$.split(/\r?\n/),z,Q;for(let X=0;X+1<Z.length;X++){let J=q_(Z[X],Z[X+1]);z??=J.indent,Q??=J.indentSeq}return{indent:z??2,indentSeq:Q??!0}}function e9($,Z){let z=l2($,u5);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 s6($,Z,z,Q){$.edits.push({start:Z,end:z,text:Q,seq:$.edits.length})}function J4($,Z){return $.lastIndexOf(`
207
+ `,Z-1)+1}function MU($,Z){if(Z>0&&$[Z-1]===`
208
208
  `)return Z;let z=$.indexOf(`
209
- `,Z);return z<0?$.length:z+1}function JU($,Z){let z=Z;if($[z-1]===`
210
- `){if(z--,$[z-1]==="\r")z--}return z}function A2($){return $!==null&&$!==void 0}function d0($){let Z=N2($)?$.range:void 0;return Z?[Z[0],Z[1],Z[2]]:void 0}function qU($,Z){let z=d0($),Q=d0(Z);return!!z&&!!Q&&z[0]===Q[0]&&z[1]===Q[1]&&z[2]===Q[2]&&$.constructor===Z.constructor}function KU($){if(A0($))return $.type==="BLOCK_LITERAL"||$.type==="BLOCK_FOLDED";return f6($)&&!$.flow}function v5($,Z){return $.anchor===Z.anchor&&$.tag===Z.tag&&$.comment===Z.comment&&$.commentBefore===Z.commentBefore&&!!$.spaceBefore===!!Z.spaceBefore}function HU($,Z){return Object.is($.value,Z.value)&&$.type===Z.type&&$.format===Z.format&&$.minFractionDigits===Z.minFractionDigits&&v5($,Z)}function BU($,Z,z,Q){let X=new P5(void 0,k5);X.contents=Z(X);let Y=X.toString($.piece).replace(/\n+$/,"").slice(z),U=Y.startsWith(" ")&&!Y.includes(`
209
+ `,Z);return z<0?$.length:z+1}function VU($,Z){let z=Z;if($[z-1]===`
210
+ `){if(z--,$[z-1]==="\r")z--}return z}function A2($){return $!==null&&$!==void 0}function l0($){let Z=N2($)?$.range:void 0;return Z?[Z[0],Z[1],Z[2]]:void 0}function LU($,Z){let z=l0($),Q=l0(Z);return!!z&&!!Q&&z[0]===Q[0]&&z[1]===Q[1]&&z[2]===Q[2]&&$.constructor===Z.constructor}function DU($){if(N0($))return $.type==="BLOCK_LITERAL"||$.type==="BLOCK_FOLDED";return p6($)&&!$.flow}function m5($,Z){return $.anchor===Z.anchor&&$.tag===Z.tag&&$.comment===Z.comment&&$.commentBefore===Z.commentBefore&&!!$.spaceBefore===!!Z.spaceBefore}function OU($,Z){return Object.is($.value,Z.value)&&$.type===Z.type&&$.format===Z.format&&$.minFractionDigits===Z.minFractionDigits&&m5($,Z)}function NU($,Z,z,Q){let X=new w5(void 0,u5);X.contents=Z(X);let Y=X.toString($.piece).replace(/\n+$/,"").slice(z),U=Y.startsWith(" ")&&!Y.includes(`
211
211
  `),W=" ".repeat(Q),G=Y.replace(/\n(?=.)/g,`
212
- ${W}`).replace(/\n/g,$.eol);return{inline:U,text:U?Y.slice(1):G}}function d9($,Z,z){return BU($,(Q)=>{let X=new j1;return X.items.push(Q.createPair("k",Z)),X},2,z)}function Q_($,Z,z){let Q=BU($,()=>{let X=new n$;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 X_($){if(!N2($)||!A2($.comment))return $;let Z=$.clone();return Z.comment=void 0,Z}function J_($,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 Y_($,Z){let z=d0(Z);if(!z)return-1;let Q=z[2];while($[Q]===" "||$[Q]==="\t")Q++;return $[Q]===":"?Q+1:-1}function U_($,Z,z){let Q=$[Z-1]===" "||$[Z-1]==="\t"?"":" ",X=$[Z]==="#"?" ":"";return`${Q}${z}${X}`}function YU($,Z,z,Q,X=!1){let J=d0(Z);if(!J||Q.kind==="root")return null;let Y=Z.comment,U=N2(z)?z.comment:void 0,W=!A2(Y)||Y===U,G=W?X_(z):z,V=X?G:J_(Z,G),q=Q.kind==="value"?d9($,V,Q.col):Q_($,V,Q.col);return q?{range:J,keepTail:W,newComment:U,piece:q}:null}function W_($,Z,z,Q){if(!Q)return JU($,VU($,z[2]));return KU(Z)?JU($,z[1]):z[1]}function Z4($,Z,z,Q,X){let J=YU($,Z,z,Q);if(!J)return!1;let Y=W_($.src,Z,J.range,J.keepTail);if(J.piece.inline&&(!KU(Z)||Q.kind==="item"))return G_($,J,Y,Q,X),!0;let U=J.keepTail?Z.comment:J.newComment;if(X!==void 0||A2(U))return!1;let W=Q.kind==="value"?YU($,Z,z,Q,!0):J;return W!==null&&V_($,W.range[0],Y,W.piece,Q)}function G_($,Z,z,Q,X){let[J,Y]=Z.range,W=J===Y&&Q.kind==="value"?U_($.src,J,Z.piece.text):Z.piece.text;i6($,J,z,W+(X===void 0?"":` #${X}`))}function V_($,Z,z,Q,X){if(X.kind==="item")return i6($,Z,z,Q.text),!0;if(X.kind!=="value")return!1;let J=Y_($.src,X.key);if(J<0)return!1;return i6($,J,z,Q.inline?` ${Q.text}`:Q.text),!0}function q_($,Z){return v5({...$,comment:void 0},{...Z,comment:void 0})}function K_($,Z){if(A2($.comment)||typeof Z.comment!=="string")return;return Z.comment.includes(`
213
- `)?void 0:Z.comment}function H_($,Z,z,Q){if(HU(Z,z))return!0;if(!q_(Z,z))return!1;let X=K_(Z,z);if(Z.comment!==z.comment&&X===void 0)return!1;return Z4($,Z,z,Q,X)}function B_($,Z,z,Q){if(!v5(Z,z)||!!Z.flow!==!!z.flow)return!1;if(Z.flow)return d9($,Z,0).text===d9($,z,0).text||Z4($,Z,z,Q);if(z.items.length===0)return Z4($,Z,z,Q);return B0(Z)?O_($,Z,z):I_($,Z,z)}function s9($,Z,z,Q){if(!qU(Z,z))return Z4($,Z,z,Q);if(A0(Z))return H_($,Z,z,Q);if(u2(Z))return u2(z)&&Z.source===z.source&&v5(Z,z)||Z4($,Z,z,Q);if(!f6(Z)||!f6(z))return!1;return B_($,Z,z,Q)}function MU($,Z){return Z-$4($,Z)}function o9($,Z,z){let Q=$.slice($4($,Z),Z);return z?/^ *- +$/.test(Q)||/^ *$/.test(Q):/^ *$/.test(Q)}function i9($){return N2($)&&(A2($.commentBefore)||!!$.spaceBefore)}function a9($,Z,z){let Q=d0(Z)??d0(z);return Q?VU($.src,Q[2]):-1}function LU($,Z,z){let Q=new P5(void 0,k5);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 M_($,Z,z){let Q=Z===$.src.length&&Z>0&&!$.src.endsWith(`
215
- `);i6($,Z,Z,Q?$.eol+z.slice(0,-$.eol.length):z)}function DU($,Z,z,Q,X,J){let Y=z;if(Y<0){let U=d0(Z);if(!U||i9(Z)||!o9($.src,U[0],J))return!1;Y=$4($.src,U[0])}return M_($,Y,LU($,Q,X)),!0}function L_($,Z,z){let Q=$4($,z),X=Z,J=A2(X.commentBefore),Y=!!X.spaceBefore;while(Q>0){let U=$4($,Q-1),W=$.slice(U,Q).trim();if(J&&W.startsWith("#"))Q=U;else if(Y&&W==="")Q=U,Y=!1;else break}return Q}function OU($,Z,z,Q){let X=d0(Z);if(!X||!o9($.src,X[0],Q))return!1;let J=a9($,z,Z);if(J<0)return!1;return i6($,L_($.src,Z,X[0]),J,""),!0}function NU($,Z){let z=new Map,Q=(X)=>{let J=d0(X);return J?J.join(":"):void 0};return $.forEach((X,J)=>{let Y=Q(Z(X));if(Y!==void 0&&!z.has(Y))z.set(Y,J)}),(X)=>{let J=Q(Z(X)),Y=J===void 0?void 0:z.get(J);return Y!==void 0&&qU(Z($[Y]),Z(X))?Y:-1}}function D_($,Z){return A0($)&&A0(Z)?HU($,Z):$===Z}function O_($,Z,z){let Q=Z.items[0]?.key,X=d0(Q);if(!X)return!1;let J=MU($.src,X[0]),Y=new Set,U=(q,K)=>{if(q.length===0)return!0;let H=new j1;H.items.push(...q);let L=K<0?-1:a9($,Z.items[K].value,Z.items[K].key);return DU($,Q,L,H,J,!1)},W=NU(Z.items,(q)=>q.key),G=-1,V=[];for(let q of z.items){let K=W(q);if(K<0){V.push(q);continue}if(K<=G||!U(V,G)||!D_(Z.items[K].key,q.key))return!1;if(V=[],!s9($,Z.items[K].value,q.value,{kind:"value",key:Z.items[K].key,col:J}))return!1;Y.add(K),G=K}if(!U(V,G))return!1;return Z.items.every((q,K)=>Y.has(K)||N_($,Z,K))}function N_($,Z,z){let Q=Z.items[z],X=d0(Q.key);if(!X)return!1;if(o9($.src,X[0],!1))return OU($,Q.key,Q.value,!1);let J=Z.items[z+1],Y=d0(J?.key);if(z!==0||!Y||i9(Q.key)||i9(J.key))return!1;return i6($,X[0],Y[0],""),!0}function I_($,Z,z){let Q=d0(Z);if(!Q||Z.items.length===0)return!1;let X=MU($.src,Q[0]),J=new Set,Y=(V,q)=>{if(V.length===0)return!0;let K=new n$;K.items.push(...V);let H=q<0?-1:a9($,Z.items[q]);return DU($,Z.items[0],H,K,X,!0)},U=NU(Z.items,(V)=>V),W=-1,G=[];for(let V of z.items){let q=U(V);if(q<0){G.push(V);continue}if(q<=W||!Y(G,W))return!1;if(G=[],!s9($,Z.items[q],V,{kind:"item",col:X}))return!1;J.add(q),W=q}if(!Y(G,W))return!1;return Z.items.every((V,q)=>J.has(q)||OU($,V,V,!0))}function T_($,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 A_($,Z,z){if(!B0(z)&&!m2(z))return!1;let Q=$.src.length>0&&!$.src.endsWith(`
216
- `)?$.eol:"",X=Z.commentBefore?$.eol:"";return i6($,$.src.length,$.src.length,Q+X+LU($,z,0)),!0}function C_($,Z,z){if(Z.commentBefore!==z.commentBefore||Z.comment!==z.comment)return!1;let Q=Z.contents,X=z.contents;if(!A2(Q))return!A2(X)||A_($,Z,X);return A2(X)&&s9($,Q,X,{kind:"root"})}function __($,Z,z,Q,X){let J={src:$,eol:Q,edits:[],piece:X};if(!C_(J,Z,z))return null;return T_($,J.edits)}var UU=($)=>$.replace(/^[ \t]*\n/gm,"");function R_($,Z,z,Q){let X=u6($,k5);if(X.errors.length>0||!M0(X.toJS(),Z.toJS()))return!1;let J=X.toString(Q);return J===z||UU(J)===UU(z)}function g5($,Z,z="YAML"){let{text:Q,changed:X}=P_($,Z,z);return{text:Q,changed:X}}function P_($,Z,z="YAML"){let Q=$.startsWith("\uFEFF")?"\uFEFF":"",X=$.slice(Q.length),J=r9(X,z),Y=F_(J);Z(Y);let U={text:$,changed:!1,spliced:!1};if(M0(Y.toJS(),J.toJS()))return U;let W={lineWidth:0,...z_(X)},G=Y.toString(W);if(G===J.toString(W))return U;let V=X.includes(`\r
212
+ ${W}`).replace(/\n/g,$.eol);return{inline:U,text:U?Y.slice(1):G}}function o9($,Z,z){return NU($,(Q)=>{let X=new w1;return X.items.push(Q.createPair("k",Z)),X},2,z)}function H_($,Z,z){let Q=NU($,()=>{let X=new t$;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 B_($){if(!N2($)||!A2($.comment))return $;let Z=$.clone();return Z.comment=void 0,Z}function M_($,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 L_($,Z){let z=l0(Z);if(!z)return-1;let Q=z[2];while($[Q]===" "||$[Q]==="\t")Q++;return $[Q]===":"?Q+1:-1}function D_($,Z,z){let Q=$[Z-1]===" "||$[Z-1]==="\t"?"":" ",X=$[Z]==="#"?" ":"";return`${Q}${z}${X}`}function qU($,Z,z,Q,X=!1){let J=l0(Z);if(!J||Q.kind==="root")return null;let Y=Z.comment,U=N2(z)?z.comment:void 0,W=!A2(Y)||Y===U,G=W?B_(z):z,V=X?G:M_(Z,G),q=Q.kind==="value"?o9($,V,Q.col):H_($,V,Q.col);return q?{range:J,keepTail:W,newComment:U,piece:q}:null}function O_($,Z,z,Q){if(!Q)return VU($,MU($,z[2]));return DU(Z)?VU($,z[1]):z[1]}function Y4($,Z,z,Q,X){let J=qU($,Z,z,Q);if(!J)return!1;let Y=O_($.src,Z,J.range,J.keepTail);if(J.piece.inline&&(!DU(Z)||Q.kind==="item"))return N_($,J,Y,Q,X),!0;let U=J.keepTail?Z.comment:J.newComment;if(X!==void 0||A2(U))return!1;let W=Q.kind==="value"?qU($,Z,z,Q,!0):J;return W!==null&&I_($,W.range[0],Y,W.piece,Q)}function N_($,Z,z,Q,X){let[J,Y]=Z.range,W=J===Y&&Q.kind==="value"?D_($.src,J,Z.piece.text):Z.piece.text;s6($,J,z,W+(X===void 0?"":` #${X}`))}function I_($,Z,z,Q,X){if(X.kind==="item")return s6($,Z,z,Q.text),!0;if(X.kind!=="value")return!1;let J=L_($.src,X.key);if(J<0)return!1;return s6($,J,z,Q.inline?` ${Q.text}`:Q.text),!0}function T_($,Z){return m5({...$,comment:void 0},{...Z,comment:void 0})}function A_($,Z){if(A2($.comment)||typeof Z.comment!=="string")return;return Z.comment.includes(`
213
+ `)?void 0:Z.comment}function C_($,Z,z,Q){if(OU(Z,z))return!0;if(!T_(Z,z))return!1;let X=A_(Z,z);if(Z.comment!==z.comment&&X===void 0)return!1;return Y4($,Z,z,Q,X)}function __($,Z,z,Q){if(!m5(Z,z)||!!Z.flow!==!!z.flow)return!1;if(Z.flow)return o9($,Z,0).text===o9($,z,0).text||Y4($,Z,z,Q);if(z.items.length===0)return Y4($,Z,z,Q);return K0(Z)?j_($,Z,z):E_($,Z,z)}function $3($,Z,z,Q){if(!LU(Z,z))return Y4($,Z,z,Q);if(N0(Z))return C_($,Z,z,Q);if(c2(Z))return c2(z)&&Z.source===z.source&&m5(Z,z)||Y4($,Z,z,Q);if(!p6(Z)||!p6(z))return!1;return __($,Z,z,Q)}function IU($,Z){return Z-J4($,Z)}function Z3($,Z,z){let Q=$.slice(J4($,Z),Z);return z?/^ *- +$/.test(Q)||/^ *$/.test(Q):/^ *$/.test(Q)}function a9($){return N2($)&&(A2($.commentBefore)||!!$.spaceBefore)}function z3($,Z,z){let Q=l0(Z)??l0(z);return Q?MU($.src,Q[2]):-1}function TU($,Z,z){let Q=new w5(void 0,u5);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 P_($,Z,z){let Q=Z===$.src.length&&Z>0&&!$.src.endsWith(`
215
+ `);s6($,Z,Z,Q?$.eol+z.slice(0,-$.eol.length):z)}function AU($,Z,z,Q,X,J){let Y=z;if(Y<0){let U=l0(Z);if(!U||a9(Z)||!Z3($.src,U[0],J))return!1;Y=J4($.src,U[0])}return P_($,Y,TU($,Q,X)),!0}function F_($,Z,z){let Q=J4($,z),X=Z,J=A2(X.commentBefore),Y=!!X.spaceBefore;while(Q>0){let U=J4($,Q-1),W=$.slice(U,Q).trim();if(J&&W.startsWith("#"))Q=U;else if(Y&&W==="")Q=U,Y=!1;else break}return Q}function CU($,Z,z,Q){let X=l0(Z);if(!X||!Z3($.src,X[0],Q))return!1;let J=z3($,z,Z);if(J<0)return!1;return s6($,F_($.src,Z,X[0]),J,""),!0}function _U($,Z){let z=new Map,Q=(X)=>{let J=l0(X);return J?J.join(":"):void 0};return $.forEach((X,J)=>{let Y=Q(Z(X));if(Y!==void 0&&!z.has(Y))z.set(Y,J)}),(X)=>{let J=Q(Z(X)),Y=J===void 0?void 0:z.get(J);return Y!==void 0&&LU(Z($[Y]),Z(X))?Y:-1}}function R_($,Z){return N0($)&&N0(Z)?OU($,Z):$===Z}function j_($,Z,z){let Q=Z.items[0]?.key,X=l0(Q);if(!X)return!1;let J=IU($.src,X[0]),Y=new Set,U=(q,K)=>{if(q.length===0)return!0;let L=new w1;L.items.push(...q);let B=K<0?-1:z3($,Z.items[K].value,Z.items[K].key);return AU($,Q,B,L,J,!1)},W=_U(Z.items,(q)=>q.key),G=-1,V=[];for(let q of z.items){let K=W(q);if(K<0){V.push(q);continue}if(K<=G||!U(V,G)||!R_(Z.items[K].key,q.key))return!1;if(V=[],!$3($,Z.items[K].value,q.value,{kind:"value",key:Z.items[K].key,col:J}))return!1;Y.add(K),G=K}if(!U(V,G))return!1;return Z.items.every((q,K)=>Y.has(K)||S_($,Z,K))}function S_($,Z,z){let Q=Z.items[z],X=l0(Q.key);if(!X)return!1;if(Z3($.src,X[0],!1))return CU($,Q.key,Q.value,!1);let J=Z.items[z+1],Y=l0(J?.key);if(z!==0||!Y||a9(Q.key)||a9(J.key))return!1;return s6($,X[0],Y[0],""),!0}function E_($,Z,z){let Q=l0(Z);if(!Q||Z.items.length===0)return!1;let X=IU($.src,Q[0]),J=new Set,Y=(V,q)=>{if(V.length===0)return!0;let K=new t$;K.items.push(...V);let L=q<0?-1:z3($,Z.items[q]);return AU($,Z.items[0],L,K,X,!0)},U=_U(Z.items,(V)=>V),W=-1,G=[];for(let V of z.items){let q=U(V);if(q<0){G.push(V);continue}if(q<=W||!Y(G,W))return!1;if(G=[],!$3($,Z.items[q],V,{kind:"item",col:X}))return!1;J.add(q),W=q}if(!Y(G,W))return!1;return Z.items.every((V,q)=>J.has(q)||CU($,V,V,!0))}function w_($,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 x_($,Z,z){if(!K0(z)&&!p2(z))return!1;let Q=$.src.length>0&&!$.src.endsWith(`
216
+ `)?$.eol:"",X=Z.commentBefore?$.eol:"";return s6($,$.src.length,$.src.length,Q+X+TU($,z,0)),!0}function y_($,Z,z){if(Z.commentBefore!==z.commentBefore||Z.comment!==z.comment)return!1;let Q=Z.contents,X=z.contents;if(!A2(Q))return!A2(X)||x_($,Z,X);return A2(X)&&$3($,Q,X,{kind:"root"})}function b_($,Z,z,Q,X){let J={src:$,eol:Q,edits:[],piece:X};if(!y_(J,Z,z))return null;return w_($,J.edits)}var KU=($)=>$.replace(/^[ \t]*\n/gm,"");function k_($,Z,z,Q){let X=l2($,u5);if(X.errors.length>0||!H0(X.toJS(),Z.toJS()))return!1;let J=X.toString(Q);return J===z||KU(J)===KU(z)}function c5($,Z,z="YAML"){let{text:Q,changed:X}=v_($,Z,z);return{text:Q,changed:X}}function v_($,Z,z="YAML"){let Q=$.startsWith("\uFEFF")?"\uFEFF":"",X=$.slice(Q.length),J=e9(X,z),Y=g_(J);Z(Y);let U={text:$,changed:!1,spliced:!1};if(H0(Y.toJS(),J.toJS()))return U;let W={lineWidth:0,...K_(X)},G=Y.toString(W);if(G===J.toString(W))return U;let V=X.includes(`\r
217
217
  `)?`\r
218
218
  `:`
219
- `,q=__(X,J,Y,V,{...W,verifyAliasOrder:!1}),K=q!==null&&R_(q,Y,G,W),H=K&&q!==null?q:G.replace(/\r?\n/g,V);return{text:Q+H,changed:Q+H!==$,spliced:K}}function F_($){let Z=$.clone();if($.directives&&Z.directives)Z.directives.docEnd=$.directives.docEnd;return Z}function M0($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>M0(z,Z[Q]));if($0($)&&$0(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&M0($[Q],Z[Q]))}return!1}function Q4($){let Z=A0($.key)?$.key.value:$.key;return typeof Z==="string"||typeof Z==="number"||typeof Z==="boolean"?String(Z):void 0}function B6($,Z){return $.items.find((z)=>Q4(z)===Z)}function IU($,Z){return N2(Z)?Z.toJS($):Z}function j_($,Z,z,Q){return Q.keepAliases===!0&&u2(Z)||M0(IU($,Z),z)}function h5($,Z,z,Q={}){if(j_($,Z,z,Q))return Z;if($0(z)&&B0(Z))return E_($,Z,z,Q),Z;if(Array.isArray(z)&&m2(Z))return y_($,Z,z,Q),Z;if(!$0(z)&&!Array.isArray(z)&&A0(Z))return Z.value=z,Z;return S_(Z,$.createNode(z))}function S_($,Z){if(!A0($)&&!u2($))return Z;let z=$,Q=Z;if(f6(Z)&&Z.items.length>0&&!Z.flow)return Q.commentBefore=l9(Q.commentBefore,z.commentBefore,z.comment),Z;if(f6(Z))Z.flow=!0;return Q.comment=l9(Q.comment??z.comment),Q.commentBefore=l9(Q.commentBefore??z.commentBefore),Z}function l9(...$){let Z=$.filter(A2);return Z.length>0?Z.join(`
220
- `):void 0}function E_($,Z,z,Q={}){for(let[X,J]of Object.entries(z)){if(J===void 0)continue;let Y=B6(Z,X);if(Y)Y.value=h5($,Y.value,J,Q);else Z.items.push($.createPair(X,J))}if(!Q.prune)return;Z.items=Z.items.filter((X)=>{let J=Q4(X);return J===void 0||z[J]!==void 0})}function t9($,Z,z,Q){let X=$0(z)?z:{};for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let U=B6(Z,J);if(!U)Z.items.push($.createPair(J,Y));else if(Object.prototype.hasOwnProperty.call(X,J)&&M0(X[J],Y))continue;else if($0(Y)&&$0(X[J])&&B0(U.value))t9($,U.value,X[J],Y);else U.value=h5($,U.value,Y,{keepAliases:!0})}}function z4($,Z,z){if(u2($))z.push({path:[...Z],node:$});else if(B0($))for(let Q of $.items){let X=Q4(Q);if(X!==void 0)z4(Q.value,[...Z,X],z)}else if(m2($))$.items.forEach((Q,X)=>z4(Q,[...Z,X],z))}function WU($,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 TU($,Z,z){let Q=[];return z4($.contents,[],Q),Q.filter(({path:X,node:J})=>{let Y=WU(Z,X);return Y!==void 0&&!M0(WU(z,X),Y)&&!M0(J.toJS($),Y)}).map(({path:X,node:J})=>({path:X.join("."),alias:`*${J.source}`}))}function AU($,Z){let z=$.contents;for(let X=0;X<Z.length-1&&z!==void 0;X++)z=w_(z,Z[X]);let Q=Z[Z.length-1];if(B0(z)&&typeof Q==="string"){let X=B6(z,Q);return X?{node:X.value,put:(J)=>(X.value=J,!0)}:null}if(m2(z)&&typeof Q==="number"&&Q<z.items.length){let X=z,J=X.items[Q];return{node:J,put:(Y)=>d0(J)===void 0?(X.items[Q]=Y,!0):!1}}return null}function w_($,Z){if(B0($)&&typeof Z==="string")return B6($,Z)?.value;if(m2($)&&typeof Z==="number")return $.items[Z];return}function CU($,Z){let z=[];z4($.contents,[],z);let Q=[];for(let{path:X,node:J}of z){let Y=AU(Z,X);if(!Y||u2(Y.node)&&Y.node.source===J.source)continue;if(!Y.put(J.clone()))continue;Q.push({path:X.join("."),alias:`*${J.source}`})}return Q}function n9($,Z,z,Q){if(!N2($)||u2($))return;let X=$.anchor;if(X&&z.has(X))Q.push({path:[...Z],node:$});if(B0($))for(let J of $.items){let Y=Q4(J);if(Y!==void 0)n9(J.value,[...Z,Y],z,Q)}else if(m2($))$.items.forEach((J,Y)=>n9(J,[...Z,Y],z,Q))}function _U($,Z){let z=[];z4($.contents,[],z);let Q=new Set(z.map((Y)=>Y.node.source));if(Q.size===0)return[];let X=[];n9($.contents,[],Q,X);let J=[];for(let{path:Y,node:U}of X){let W=AU(Z,Y);if(!W)continue;let G=U.anchor;if(N2(W.node)&&W.node.anchor===G&&M0(U.toJS($),W.node.toJS(Z))||!W.put(U.clone()))continue;J.push({path:Y.join("."),alias:`&${G}`,kind:"anchor"})}return J}function x_($,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 U=Q-1;U>=0;U--)X[Y][U]=M0($[Y],Z[U])?X[Y+1][U+1]+1:Math.max(X[Y+1][U],X[Y][U+1]);let J=[];for(let Y=0,U=0;Y<z&&U<Q;)if(M0($[Y],Z[U]))J.push([Y,U]),Y++,U++;else if(X[Y+1][U]>=X[Y][U+1])Y++;else U++;return J}function y_($,Z,z,Q){let X=Z.items,J=X.map((G)=>IU($,G)),Y=[],U=0,W=0;for(let[G,V]of[...x_(J,z),[X.length,z.length]]){for(;U<G&&W<V;U++,W++)Y.push(h5($,X[U],z[W],Q));for(;W<V;W++)Y.push($.createNode(z[W]));if(G<X.length)Y.push(X[G]);U=G+1,W=V+1}Z.items=Y}function X4($,Z,z,Q){if(M0(z,Q))return Z;if(!$0(z)||!$0(Q)||!B0(Z))return h5($,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=Q4(J);return Y===void 0||!X.has(Y)});for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let U=B6(Z,J);if(!U)Z.items.push($.createPair(J,Y));else if(!M0(z[J],Y))U.value=X4($,U.value,z[J],Y)}return Z}function RU($,Z,z){let Q=$.contents;if(Q===null||Q===void 0)$.contents=new j1,Q=$.contents;if(!B0(Q))throw Error(`${z}: the document is not a mapping — faf left it unchanged.`);let X=Q;for(let J of Z){let Y=B6(X,J);if(Y&&B0(Y.value)){X=Y.value;continue}if(Y&&!jU(Y.value))throw Error(`${z}: ${J} is not a mapping — faf left it unchanged.`);let U=new j1;if(Y)Y.value=FU(Y.value,U);else X.items.push($.createPair(J,U));X=U}return X}function f5($,Z,z,Q,X){if(M0(z,Q))return;let J=RU($,Z.slice(0,-1),X),Y=Z[Z.length-1],U=B6(J,Y);if(Q===void 0)J.items=J.items.filter((W)=>W!==U);else if(!U)J.items.push($.createPair(Y,Q));else U.value=X4($,U.value,z,Q)}function PU($,Z,z){let Q=RU($,Z.slice(0,-1),z),X=Z[Z.length-1],J=B6(Q,X);if(J&&m2(J.value))return J.value;if(J&&!jU(J.value))throw Error(`${z}: ${Z.join(".")} is not a list — faf left it unchanged.`);let Y=new n$;if(J)J.value=FU(J.value,Y);else Q.items.push($.createPair(X,Y));return Y}function FU($,Z){if(!A0($))return Z;let z=[$.commentBefore,$.comment].filter(A2);if(z.length>0)Z.commentBefore=z.join(`
221
- `);return Z}function jU($){if($===null||$===void 0)return!0;return A0($)&&($.value===null||$.value===void 0)}var e9=new WeakMap;function J4($){return typeof $==="object"&&$!==null?e9.get($):void 0}function u5($,Z){e9.set($,Z)}function SU($,Z){let z=J4($);if(z)e9.set(Z,z);return Z}var EU=new WeakSet;function wU($){return EU.add($),$}function xU($){return typeof $==="object"&&$!==null&&EU.has($)}function m5($){let Z=n6($);return i(Y4(Z),Z,{read:!0})}function $3($){return $ instanceof ReferenceError&&/Excessive alias count/.test($.message)}function z3($){if($ instanceof F5||$3($))return $;let Z=$?.cause;return Z instanceof F5||$3(Z)?Z:null}function Q3($,Z){let z=$3(Z)?"its aliases expand too far":Z.message.split(`
222
- `)[0].replace(/ at line \d+, column \d+:?\s*$/,"").replace(/:\s*$/,""),Q=Z.linePos?.[0]?.line,X=n6($);return new v("not-yaml",X,`${X} is not valid YAML (${z}${Q===void 0?"":`, line ${Q}`}) — faf left it unchanged`,{cause:Z})}function a($,Z){try{return Z()}catch(z){if(z instanceof v)throw z;let Q=(z instanceof Error?z.message:String(z)).split(`
223
- `)[0].trim(),X=n6($);throw new v("not-yaml",X,`${X}: faf's scoring kernel could not read it (${Q}) — faf left it unchanged`,{cause:z})}}function t($){let Z=m5($),z=G0(Z),Q;try{Q=h0(z)}catch(J){let Y=z3(J);if(Y)throw Q3($,Y);throw J}let X=a$(Q,$);return u5(X,{real:Z,text:z}),X}function X3($){let Z=$._meta,z={...$};delete z._meta;let Q=m6(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,U)=>{if(U.includes("#"))return J;return`${Y} # found: ${X}`})}return Q}function v_($,Z,z,Q,X=!1){let J=m5($),Y=G0(J),U=[],W;try{W=g5(Y,(G)=>{vU(G,$);let V=G.clone();if(Z(G),U=CU(V,G),X)U=[...U,..._U(V,G)];if(Q)U=[...U,...Q(G,V.toJS()).filter((q)=>!U.some((K)=>K.path===q.path))]},$)}catch(G){let V=z3(G);if(V)throw Q3($,V);throw G}if(!W.changed)return{written:!1,text:Y,keptAliases:U};return o($,W.text,{expect:z&&z.real===J?z.text:Y}),{written:!0,text:W.text,keptAliases:U}}function g_(){return new Date().toISOString().replace(/[:.]/g,"-")}function h_($){if(!Z3($))return null;let Z=n6($),z=f0(i(Y4(Z),Z));if(!z)return null;let Q=`${Z}.bak-${g_()}`;return o(Q,z),Q}function y2($){if($.kind==="anchor")return`${$.path} holds an anchor (${$.alias}) that an alias reads — faf left it as written`;return`${$.path} is an alias (${$.alias}) — faf left it as written`}function Z3($){try{return kU($),!0}catch{return!1}}function f_($){let Z=$.getIn(["project","type"],!0);return A0(Z)?Z.value:Z}function vU($,Z){let z=$.contents;if(z!==null&&z!==void 0&&!B0(z))throw new v("not-yaml",n6(Z),`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${p6($.toJS())}. faf left it unchanged — fix it by hand.`)}function u_($,Z,z){vU($,z);let Q=$.contents,X=B0(Q)&&Q.items.some((V)=>A0(V.key)&&V.key.value==="_meta"),{_meta:J,...Y}=Z,U=f_($),W=B0(Q)?$.toJS():{},G=B0(Q)?Q:$.createNode({});if($.contents=G,t9($,G,W,X?{...Z}:Y),!X)c_($,J?.found,U)}function m_($,Z){let z=$.contents;if(B0(z)&&z.items.some((J)=>A0(J.key)&&J.key.value==="_meta"))return Z;let{_meta:Q,...X}=Z;return X}function c_($,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&&Z3($)){let W=v_($,(G)=>u_(G,Z,$),J4(Z),(G,V)=>TU(G,m_(G,Z),V),xU(Z));u5(Z,{real:m5($),text:W.text});for(let G of W.keptAliases??[])z.onAliasKept?.(G);return W.written}let Q=n6($),X=h_($);if(X)z.onReplacedBackup?.(X);let J=X3(Z),Y=X&&Z3($)?f0(i(Y4(Q),Q)):null,U=o($,J,{expect:Y});return u5(Z,{real:U,text:J}),!0}function p($){return G0(m5($))}function U2($,Z){let z;try{z=h0($)}catch(Q){let X=z3(Q);if(Z!==void 0&&X)throw Q3(Z,X);throw Q}return Z===void 0?z:a$(z,Z)}function bU($,Z){let z;try{z=kU(Z)}catch{return!1}if(!z.isSymbolicLink()&&!z.isFile())return!1;return i($,n6(Z),{read:!0}),!0}function m($=process.cwd()){let Z=["project.faf",".faf"];for(let Q of Z){let X=yU($,Q);if(bU($,X))return X}let z=Y4($);if(z!==$)for(let Q of Z){let X=yU(z,Q);if(bU(z,X))return X}return null}function y1($,Z=process.cwd()){return k_("git",["-C",Y4($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+b_($)}l();var b1=[{name:"TROPHY",indicator:`${P0("✪")} ${P0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${P0(C("★"))} ${P0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${A("◆")} ${A("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 C2($){return $.indicator}function M6($){for(let Z of b1)if($>=Z.threshold)return Z;return b1[b1.length-1]}var W3=null;function W4(){if(W3)return W3;try{let $=p0("faf-scoring-kernel");return W3=$,$}catch{throw Error(`faf-scoring-kernel not installed.
219
+ `,q=b_(X,J,Y,V,{...W,verifyAliasOrder:!1}),K=q!==null&&k_(q,Y,G,W),L=K&&q!==null?q:G.replace(/\r?\n/g,V);return{text:Q+L,changed:Q+L!==$,spliced:K}}function g_($){let Z=$.clone();if($.directives&&Z.directives)Z.directives.docEnd=$.directives.docEnd;return Z}function H0($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>H0(z,Z[Q]));if(e($)&&e(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&H0($[Q],Z[Q]))}return!1}function W4($){let Z=N0($.key)?$.key.value:$.key;return typeof Z==="string"||typeof Z==="number"||typeof Z==="boolean"?String(Z):void 0}function O6($,Z){return $.items.find((z)=>W4(z)===Z)}function PU($,Z){return N2(Z)?Z.toJS($):Z}function h_($,Z,z,Q){return Q.keepAliases===!0&&c2(Z)||H0(PU($,Z),z)}function p5($,Z,z,Q={}){if(h_($,Z,z,Q))return Z;if(e(z)&&K0(Z))return u_($,Z,z,Q),Z;if(Array.isArray(z)&&p2(Z))return p_($,Z,z,Q),Z;if(!e(z)&&!Array.isArray(z)&&N0(Z))return Z.value=z,Z;return f_(Z,$.createNode(z))}function f_($,Z){if(!N0($)&&!c2($))return Z;let z=$,Q=Z;if(p6(Z)&&Z.items.length>0&&!Z.flow)return Q.commentBefore=s9(Q.commentBefore,z.commentBefore,z.comment),Z;if(p6(Z))Z.flow=!0;return Q.comment=s9(Q.comment??z.comment),Q.commentBefore=s9(Q.commentBefore??z.commentBefore),Z}function s9(...$){let Z=$.filter(A2);return Z.length>0?Z.join(`
220
+ `):void 0}function u_($,Z,z,Q={}){for(let[X,J]of Object.entries(z)){if(J===void 0)continue;let Y=O6(Z,X);if(Y)Y.value=p5($,Y.value,J,Q);else Z.items.push($.createPair(X,J))}if(!Q.prune)return;Z.items=Z.items.filter((X)=>{let J=W4(X);return J===void 0||z[J]!==void 0})}function Q3($,Z,z,Q){let X=e(z)?z:{};for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let U=O6(Z,J);if(!U)Z.items.push($.createPair(J,Y));else if(Object.prototype.hasOwnProperty.call(X,J)&&H0(X[J],Y))continue;else if(e(Y)&&e(X[J])&&K0(U.value))Q3($,U.value,X[J],Y);else U.value=p5($,U.value,Y,{keepAliases:!0})}}function U4($,Z,z){if(c2($))z.push({path:[...Z],node:$});else if(K0($))for(let Q of $.items){let X=W4(Q);if(X!==void 0)U4(Q.value,[...Z,X],z)}else if(p2($))$.items.forEach((Q,X)=>U4(Q,[...Z,X],z))}function HU($,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 FU($,Z,z){let Q=[];return U4($.contents,[],Q),Q.filter(({path:X,node:J})=>{let Y=HU(Z,X);return Y!==void 0&&!H0(HU(z,X),Y)&&!H0(J.toJS($),Y)}).map(({path:X,node:J})=>({path:X.join("."),alias:`*${J.source}`}))}function RU($,Z){let z=$.contents;for(let X=0;X<Z.length-1&&z!==void 0;X++)z=m_(z,Z[X]);let Q=Z[Z.length-1];if(K0(z)&&typeof Q==="string"){let X=O6(z,Q);return X?{node:X.value,put:(J)=>(X.value=J,!0)}:null}if(p2(z)&&typeof Q==="number"&&Q<z.items.length){let X=z,J=X.items[Q];return{node:J,put:(Y)=>l0(J)===void 0?(X.items[Q]=Y,!0):!1}}return null}function m_($,Z){if(K0($)&&typeof Z==="string")return O6($,Z)?.value;if(p2($)&&typeof Z==="number")return $.items[Z];return}function jU($,Z){let z=[];U4($.contents,[],z);let Q=[];for(let{path:X,node:J}of z){let Y=RU(Z,X);if(!Y||c2(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 t9($,Z,z,Q){if(!N2($)||c2($))return;let X=$.anchor;if(X&&z.has(X))Q.push({path:[...Z],node:$});if(K0($))for(let J of $.items){let Y=W4(J);if(Y!==void 0)t9(J.value,[...Z,Y],z,Q)}else if(p2($))$.items.forEach((J,Y)=>t9(J,[...Z,Y],z,Q))}function SU($,Z){let z=[];U4($.contents,[],z);let Q=new Set(z.map((Y)=>Y.node.source));if(Q.size===0)return[];let X=[];t9($.contents,[],Q,X);let J=[];for(let{path:Y,node:U}of X){let W=RU(Z,Y);if(!W)continue;let G=U.anchor;if(N2(W.node)&&W.node.anchor===G&&H0(U.toJS($),W.node.toJS(Z))||!W.put(U.clone()))continue;J.push({path:Y.join("."),alias:`&${G}`,kind:"anchor"})}return J}function c_($,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 U=Q-1;U>=0;U--)X[Y][U]=H0($[Y],Z[U])?X[Y+1][U+1]+1:Math.max(X[Y+1][U],X[Y][U+1]);let J=[];for(let Y=0,U=0;Y<z&&U<Q;)if(H0($[Y],Z[U]))J.push([Y,U]),Y++,U++;else if(X[Y+1][U]>=X[Y][U+1])Y++;else U++;return J}function p_($,Z,z,Q){let X=Z.items,J=X.map((G)=>PU($,G)),Y=[],U=0,W=0;for(let[G,V]of[...c_(J,z),[X.length,z.length]]){for(;U<G&&W<V;U++,W++)Y.push(p5($,X[U],z[W],Q));for(;W<V;W++)Y.push($.createNode(z[W]));if(G<X.length)Y.push(X[G]);U=G+1,W=V+1}Z.items=Y}function G4($,Z,z,Q){if(H0(z,Q))return Z;if(!e(z)||!e(Q)||!K0(Z))return p5($,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=W4(J);return Y===void 0||!X.has(Y)});for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let U=O6(Z,J);if(!U)Z.items.push($.createPair(J,Y));else if(!H0(z[J],Y))U.value=G4($,U.value,z[J],Y)}return Z}function EU($,Z,z){let Q=$.contents;if(Q===null||Q===void 0)$.contents=new w1,Q=$.contents;if(!K0(Q))throw Error(`${z}: the document is not a mapping — faf left it unchanged.`);let X=Q;for(let J of Z){let Y=O6(X,J);if(Y&&K0(Y.value)){X=Y.value;continue}if(Y&&!yU(Y.value))throw Error(`${z}: ${J} is not a mapping — faf left it unchanged.`);let U=new w1;if(Y)Y.value=xU(Y.value,U);else X.items.push($.createPair(J,U));X=U}return X}function l5($,Z,z,Q,X){if(H0(z,Q))return;let J=EU($,Z.slice(0,-1),X),Y=Z[Z.length-1],U=O6(J,Y);if(Q===void 0)J.items=J.items.filter((W)=>W!==U);else if(!U)J.items.push($.createPair(Y,Q));else U.value=G4($,U.value,z,Q)}function wU($,Z,z){let Q=EU($,Z.slice(0,-1),z),X=Z[Z.length-1],J=O6(Q,X);if(J&&p2(J.value))return J.value;if(J&&!yU(J.value))throw Error(`${z}: ${Z.join(".")} is not a list — faf left it unchanged.`);let Y=new t$;if(J)J.value=xU(J.value,Y);else Q.items.push($.createPair(X,Y));return Y}function xU($,Z){if(!N0($))return Z;let z=[$.commentBefore,$.comment].filter(A2);if(z.length>0)Z.commentBefore=z.join(`
221
+ `);return Z}function yU($){if($===null||$===void 0)return!0;return N0($)&&($.value===null||$.value===void 0)}var X3=new WeakMap;function n2($){return typeof $==="object"&&$!==null?X3.get($):void 0}function v1($,Z){X3.set($,Z)}function bU($,Z){let z=n2($);if(z)X3.set(Z,z);return Z}var kU=new WeakSet;function vU($){return kU.add($),$}function gU($){return typeof $==="object"&&$!==null&&kU.has($)}function d5($){let Z=o6($);return n(g1(Z),Z,{read:!0})}function Y3($){return $ instanceof ReferenceError&&/Excessive alias count/.test($.message)}function W3($){if($ instanceof x5||Y3($))return $;let Z=$?.cause;return Z instanceof x5||Y3(Z)?Z:null}function G3($,Z){let z=Y3(Z)?"its aliases expand too far":Z.message.split(`
222
+ `)[0].replace(/ at line \d+, column \d+:?\s*$/,"").replace(/:\s*$/,""),Q=Z.linePos?.[0]?.line,X=o6($);return new k("not-yaml",X,`${X} is not valid YAML (${z}${Q===void 0?"":`, line ${Q}`}) — faf left it unchanged`,{cause:Z})}function o($,Z){try{return Z()}catch(z){if(z instanceof k)throw z;let Q=(z instanceof Error?z.message:String(z)).split(`
223
+ `)[0].trim(),X=o6($);throw new k("not-yaml",X,`${X}: faf's scoring kernel could not read it (${Q}) — faf left it unchanged`,{cause:z})}}function a($){let Z=d5($),z=W0(Z),Q;try{Q=S0(z)}catch(J){let Y=W3(J);if(Y)throw G3($,Y);throw J}let X=z4(Q,$);return v1(X,{real:Z,text:z}),X}function V3($){let Z=$._meta,z={...$};delete z._meta;let Q=l6(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,U)=>{if(U.includes("#"))return J;return`${Y} # found: ${X}`})}return Q}function n_($,Z,z,Q,X=!1){let J=d5($),Y=W0(J),U=[],W;try{W=c5(Y,(G)=>{pU(G,$);let V=G.clone();if(Z(G),U=jU(V,G),X)U=[...U,...SU(V,G)];if(Q)U=[...U,...Q(G,V.toJS()).filter((q)=>!U.some((K)=>K.path===q.path))]},$)}catch(G){let V=W3(G);if(V)throw G3($,V);throw G}if(!W.changed)return{written:!1,text:Y,keptAliases:U};return s($,W.text,{expect:z&&z.real===J?z.text:Y}),{written:!0,text:W.text,keptAliases:U}}function r_(){return new Date().toISOString().replace(/[:.]/g,"-")}function s_($){if(!U3($))return null;let Z=o6($),z=f0(n(g1(Z),Z));if(!z)return null;let Q=`${Z}.bak-${r_()}`;return s(Q,z),Q}function b2($){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 U3($){try{return cU($),!0}catch{return!1}}function o_($){let Z=$.getIn(["project","type"],!0);return N0(Z)?Z.value:Z}function pU($,Z){let z=$.contents;if(z!==null&&z!==void 0&&!K0(z))throw new k("not-yaml",o6(Z),`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${i6($.toJS())}. faf left it unchanged — fix it by hand.`)}function a_($,Z,z){pU($,z);let Q=$.contents,X=K0(Q)&&Q.items.some((V)=>N0(V.key)&&V.key.value==="_meta"),{_meta:J,...Y}=Z,U=o_($),W=K0(Q)?$.toJS():{},G=K0(Q)?Q:$.createNode({});if($.contents=G,Q3($,G,W,X?{...Z}:Y),!X)e_($,J?.found,U)}function t_($,Z){let z=$.contents;if(K0(z)&&z.items.some((J)=>N0(J.key)&&J.key.value==="_meta"))return Z;let{_meta:Q,...X}=Z;return X}function e_($,Z,z){if(!Z||Z.length===0||!J0(z))return;let Q=$.getIn(["project","type"],!0);if(N0(Q)&&!J0(Q.value)&&(Q.comment===null||Q.comment===void 0))Q.comment=` found: ${Z.join(" + ")}`}function k0($,Z,z={}){if(!z.replace&&U3($)){let W=n_($,(G)=>a_(G,Z,$),n2(Z),(G,V)=>FU(G,t_(G,Z),V),gU(Z));v1(Z,{real:d5($),text:W.text});for(let G of W.keptAliases??[])z.onAliasKept?.(G);return W.written}let Q=o6($),X=s_($);if(X)z.onReplacedBackup?.(X);let J=V3(Z),Y=X&&U3($)?f0(n(g1(Q),Q)):null,U=s($,J,{expect:Y});return v1(Z,{real:U,text:J}),!0}function l($){return W0(d5($))}function U2($,Z){let z;try{z=S0($)}catch(Q){let X=W3(Q);if(Z!==void 0&&X)throw G3(Z,X);throw Q}return Z===void 0?z:z4(z,Z)}function mU($,Z){let z;try{z=cU(Z)}catch{return!1}if(!z.isSymbolicLink()&&!z.isFile())return!1;return n($,o6(Z),{read:!0}),!0}function c($=process.cwd()){let Z=["project.faf",".faf"];for(let Q of Z){let X=fU($,Q);if(mU($,X))return X}let z=g1($);if(z!==$)for(let Q of Z){let X=fU(z,Q);if(mU(z,X))return X}return null}function h1($,Z=process.cwd()){return i_("git",["-C",g1($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+J3($)}function i5($,Z){let z=hU($),Q=hU(Z),X=uU(g1(Q),z);return X!==".."&&!X.startsWith(`..${d_}`)&&!l_(X)?uU(z,Q).split("\\").join("/")||J3(Q):J3(Q)}i();var f1=[{name:"TROPHY",indicator:`${_0("✪")} ${_0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${_0(C("★"))} ${_0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${A("◆")} ${A("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${r5("◇")} ${r5("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 C2($){return $.indicator}function N6($){for(let Z of f1)if($>=Z.threshold)return Z;return f1[f1.length-1]}var B3=null;function q4(){if(B3)return B3;try{let $=c0("faf-scoring-kernel");return B3=$,$}catch{throw Error(`faf-scoring-kernel not installed.
224
224
 
225
225
  Run: npm install faf-scoring-kernel
226
- `)}}var G3=($)=>$.startsWith("\uFEFF")?$.slice(1):$;function d_($){let Z={};for(let[z,Q]of Object.entries($.slots??{}))Z[QU.get(z)??z]=Q;return{...$,slots:Z}}function F0($){return d_(JSON.parse(W4().score_faf(G3($))))}function hU($){return W4().validate_faf(G3($))}function l5($){return W4().compile_fafb(G3($))}function fU($){return JSON.parse(W4().decompile_fafb($))}function uU(){return W4().sdk_version()}var mU=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function cU($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function pU($){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 U=parseInt(J[1],10);if(U>=0&&U<=100)Y=U}return{represents:X,sourceScore:Y}}function V3($){return $.unknown?"unknown (—)":`${$.score}%`}function k0($){return{score:$.score,tier:M6($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function D0($){let Z=pU($);if(Z){let z=Z.sourceScore;return{score:z,tier:z>=0?M6(z):b1[b1.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 i_($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)?X[Q]:void 0}function q3($){try{let Z=u6($,{logLevel:"error"}).getIn(["project","type"],!0);return A0(Z)&&typeof Z.comment==="string"&&Z.comment.includes(x1)}catch{return!1}}function n_($,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 r_($){try{let Z=u6($,{logLevel:"error"});if(Z.errors.length>0)return null;let z=Z.toJS();return $0(z)?z:null}catch{return null}}function d5($,Z,z={}){let Q=r_($);if(Q===null)return[];let X=$0(Q.project)&&!q3($)?Q.project.type:void 0,J=[];for(let Y of J0){let U=i_(Q,Y.path);if(Z.slots[Y.path]!=="empty"||!p2(U))continue;let W=l6.library.includes(Y.category),G=n_(Y.path,String(U).trim(),d6(X,Y),W,z.outOfType!==!1);if(G!==null)J.push(G)}return J}l();l();import{existsSync as s_,readFileSync as o_}from"fs";import{join as lU}from"path";import{homedir as a_}from"os";var t_=95,e_=30,$R=3,K3=lU(a_(),".config","faf"),H3=lU(K3,"star-nudge"),ZR="github.com/Wolfe-Jam/faf-cli";function zR($){if($.score<t_)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??$R))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??e_)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function QR(){try{if(!s_(H3))return{shown:0,lastShownMs:null};let $=o_(H3,"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 XR($){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 JR($,Z){try{E0(K3),x2(H3,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}),{root:K3,owns:XR,mark:"faf star-nudge state"})}catch{}}function dU($){let Z=Date.now(),z=QR();if(!zR({score:$,isTTY:Boolean(process.stdout.isTTY),isCI:Boolean(process.env.CI),optedOut:Boolean(process.env.FAF_NO_NUDGE),shownCount:z.shown,lastShownMs:z.lastShownMs,nowMs:Z}))return;console.log(""),console.log(` ${P0("★")} ${M("Enjoying faf-cli? A star helps others find it:")} ${ZR}`),JR(z.shown,Z)}function w0($,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=C2($.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),U=Y.slice(0,3).join(", "),W=Y.length>3?`, +${Y.length-3} more`:"",G=$.empty===1?"slot":"slots";console.log(M(` ${$.empty} ${G} from Trophy: ${U}${W}`))}if(YR(Q),z)console.log(""),UR($);dU($.score)}function YR($){for(let Z of $)console.log(M(` ${Z}`))}function UR($){for(let[Z,z]of Object.entries($.slots)){let Q=z==="populated"?A("●"):z==="slotignored"?M("—"):M("○");console.log(` ${Q} ${z==="slotignored"?M(`${Z}: slotignored`):Z}`)}}l();function i5($,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);U2(Q,z);let X=a(z,()=>D0(Q));if(Z.json){let J=t(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))}`:`${C2(X.tier)} ${C(V3(X))}`);return}w0(X,z,Z.verbose,d5(Q,X))}import{existsSync as JG}from"fs";import{dirname as HS,join as v3,relative as BS,resolve as MS}from"path";var k1="3.0";import{join as JW}from"path";var iU=[{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 GR}from"path";var v1={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 VR=v1.flutterDeps,qR=v1.mcpDeps,KR=v1.serverFrameworks,HR=v1.stateManagement,BR=v1.routing;function MR($){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 n5($){let Z=g($,"pubspec.yaml");if(Z===null)return null;let z=MR(Z),Q=(_)=>z.has(_.toLowerCase()),X=VR.some(Q)||/^flutter:\s*$/m.test(Z)||/\bsdk:\s*flutter\b/.test(Z),J=qR.find(Q),Y=KR.find(([_])=>Q(_)),U=HR.find(([_])=>Q(_)),W=U?U[1]:"",G=BR.find(([_])=>Q(_)),V=G?G[1]:"",q=Q("flutter_test")?"flutter_test":Q("test")?"test":"",K=/^executables:\s*$/m.test(Z),H=(X0($,"bin")??[]).some((_)=>_.name.endsWith(".dart")),L=K||H,B,D="",N;if(X)if(D="Flutter",I($,GR("lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(Z))B="mobile",N="pubspec.yaml (Flutter app)";else B="library",N="pubspec.yaml (Flutter package)";else if(J)B="mcp",N=`pubspec.yaml + ${J} (Dart MCP server)`;else if(Y)B="backend",D=Y[1],N=`pubspec.yaml + ${Y[0]} (Dart backend)`;else if(L)B="cli",N=K?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else B="library",N="pubspec.yaml (Dart package)";return{appType:B,isFlutter:X,framework:D,stateManagement:W,routing:V,testing:q,found:N}}import{join as DR}from"path";var r5={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 OR=r5.mcpModules,NR=r5.serverFrameworks,IR=r5.cliFrameworks;function TR($){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 rU($,Z){let z=Z.toLowerCase();for(let Q of $)if(Q===z||Q.startsWith(`${z}/`))return!0;return!1}function nU($,Z){let z;for(let Q of Z){if(!rU($,Q[0]))continue;if(!z||Q[0].length>z[0].length)z=Q}return z}function AR($,Z){let z;for(let Q of Z){if(!rU($,Q))continue;if(!z||Q.length>z.length)z=Q}return z}function CR($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function _R($){for(let{name:Z}of X0($,"cmd")??[]){let z=DR("cmd",Z),Q=T2($,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 RR($){let Z=g($,"main.go");return Z!==null&&/^package\s+main\b/m.test(Z)}function s5($){let Z=g($,"go.mod");if(Z===null)return null;let z=CR(Z),Q=TR(Z),X=AR(Q,OR),J=nU(Q,NR),Y=nU(Q,IR),U=_R($),W=RR($),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(U)G="cli",q="go.mod + cmd/ (Go CLI layout)";else if(W&&!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 r6={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 FR=r6.mcpPackages.map(($)=>$.toLowerCase()),jR=r6.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),SR=r6.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),ER=r6.grpcServerPackages.map(($)=>$.toLowerCase()),wR=r6.specializedSdks,sU=r6.baseSdk.toLowerCase();function xR($){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],U=($.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i)?.[1]||J||"").trim(),W=/<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($),K=new Set;for(let L of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))K.add(L[1].toLowerCase());for(let L of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))K.add(L[1].toLowerCase());let H=new Set;for(let L of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))H.add(L[1].toLowerCase());return{sdk:Q,outputType:X,targetFramework:U,isTestProject:W,useMaui:G,useWpf:V,useWindowsForms:q,packages:K,frameworkRefs:H}}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 oU($,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 yR($){let Z;for(let z of FR){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 bR($){let Z=$.toLowerCase();if(!Z)return;let z;for(let Q of wR){let X=Q[0].toLowerCase();if(Z===X||Z.startsWith(`${X}/`)){if(!z||X.length>z[0].length)z=Q}}return z}function o5($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function kR($,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 vR($,Z){let z=Z.replace(/\.csproj$/i,""),{sdk:Q,packages:X,frameworkRefs:J,outputType:Y}=$,U,W="",G,V=yR(X),q=bR(Q),K=oU(X,SR),H=oU(X,jR),L=ER.some((D)=>B3(X,D)),B=J.has("microsoft.aspnetcore.app");if(V)U="mcp",W="MCP",G=`${Z} + ${V} (C# MCP server)`;else if($.isTestProject||q?.[1]==="test"||K)U="library",W=K?.[1]||(q?.[1]==="test"?q[2]:"Test"),G=`${Z} + test (${W})`;else if($.useMaui)U="mobile",W="MAUI",G=`${Z} + UseMaui (MAUI)`;else if($.useWpf||$.useWindowsForms)U="backend",W=$.useWpf&&$.useWindowsForms?"WPF+WinForms":$.useWpf?"WPF":"Windows Forms",G=`${Z} + ${W}`;else if(q?.[1]==="web")U="backend",W=L?"gRPC":q[2],G=`${Z} + Sdk=${q[0]}${L?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(q?.[1]==="worker")U="backend",W=q[2],G=`${Z} + Sdk=${q[0]} (Worker)`;else if(q?.[1]==="blazor-wasm")U="backend",W=q[2],G=`${Z} + Sdk=${q[0]} (Blazor WASM)`;else if(q?.[1]==="aspire")U="backend",W=q[2],G=`${Z} + Sdk=${q[0]} (Aspire)`;else if(q?.[1]==="razor-lib")U="library",W=q[2],G=`${Z} + Sdk=${q[0]} (Razor class library)`;else if(B&&o5(Y))U="backend",W="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(B&&!o5(Y))U="library",W="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(H&&(o5(Y)||!Y))U="cli",W=H[1],G=`${Z} + ${H[0]} (C# CLI)`;else if(o5(Y))U="cli",G=`${Z} + OutputType=Exe (C# console)`;else{U="library";let D=Q?` Sdk=${Q}`:"";if(G=`${Z}${D} (C# class library)`.replace(" Sdk=Microsoft.NET.Sdk",""),!Q||Q.toLowerCase()===sU||Q.toLowerCase().startsWith(`${sU}/`))G=`${Z} (C# class library)`}return{appType:U,projectName:z,targetFramework:$.targetFramework,sdk:Q||"Microsoft.NET.Sdk",framework:W,found:G}}function g1($){return(X0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}function a5($){let Z=g1($);if(Z.length===0)return null;let z=null,Q=999;for(let X of Z){let J=g($,X);if(J===null)continue;let Y=xR(J),U=vR(Y,X),W=kR(U.appType,U.framework);if(!z||W<Q)z=U,Q=W}return z}import{join as s6}from"path";var _2={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 hR=_2.mcpArtifacts.map(($)=>$.toLowerCase()),fR=_2.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),uR=_2.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),mR=_2.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),cR=_2.androidPlugins.map(($)=>$.toLowerCase()),pR=_2.kmpPlugins.map(($)=>$.toLowerCase()),lR=_2.jvmKotlinPlugins.map(($)=>$.toLowerCase()),dR=_2.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),iR=_2.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),nR=_2.libraryPlugins.map(($)=>$.toLowerCase()),rR=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function M3($){return rR.some((Z)=>I($,Z))}function sR($){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 U=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bid\s*=\s*"([^"]+)"/);if(U&&(Q==="plugins"||Q.endsWith(".plugins"))){Z.set(U[1].replace(/-/g,".").toLowerCase(),U[2].toLowerCase()),Z.set(U[1].toLowerCase(),U[2].toLowerCase());continue}let W=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bmodule\s*=\s*"([^"]+)"/);if(W&&(Q==="libraries"||Q.endsWith(".libraries"))){let q=W[1].toLowerCase();z.set(q,W[2].toLowerCase()),z.set(q.replace(/-/g,"."),W[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(),K=G[1].toLowerCase();z.set(K,q),z.set(K.replace(/-/g,"."),q);continue}let V=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(V){let q=V[1].toLowerCase(),K=V[2];if(Q==="plugins"||Q.endsWith(".plugins")){let H=K.split(":")[0].toLowerCase();Z.set(q,H),Z.set(q.replace(/-/g,"."),H)}else if(Q==="libraries"||Q.endsWith(".libraries")){let H=K.split(":");if(H.length>=2){let L=`${H[0]}:${H[1]}`.toLowerCase();z.set(q,L),z.set(q.replace(/-/g,"."),L)}}}}return{plugins:Z,libraries:z}}function oR($){let Z=g($,s6("gradle","libs.versions.toml"));if(!Z)return{plugins:new Map,libraries:new Map};return sR(Z)}function aR($){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 tR($,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 eR($,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 U=Z.libraries.get(Y);if(U){z.add(U.includes(":")?U.split(":").slice(0,2).join(":"):U);break}}}return z}function eU($){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(),U=Q[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(Y&&U)z.add(`${Y}:${U}`.toLowerCase())}let X=new Set;for(let Y of $.matchAll(/<dependency>([\s\S]*?)<\/dependency>/gi)){let U=Y[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),W=Y[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(U&&W)X.add(`${U}:${W}`.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 L6($,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 G4($,Z,z){let Q;for(let[X,J]of Z){let Y=!1;if(z==="plugin")Y=L6($,X);else if(Y=$.has(X)||[...$].some((U)=>U===X||U.startsWith(`${X}:`)||U.startsWith(`${X}.`)),!Y&&z==="artifact")Y=[...$].some((U)=>U===X||U.startsWith(`${X}`));if(!Y)continue;if(!Q||X.length>Q[0].length)Q=[X,J]}return Q}function $P($){let Z;for(let z of hR)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 $W($,Z){let z=new Set,Q=!1,X=!1,J=[s6(Z,"src"),s6(Z,"src","main")],Y=(U,W)=>{if(W>4)return;let G=X0($,U);if(!G)return;for(let{name:V}of G){if(V==="androidMain"||V==="commonMain"||V==="jvmMain"||V==="iosMain")z.add(V);let q=s6(U,V),K=T2($,q);if(!K)continue;if(K.isDirectory())Y(q,W+1);else if(V.endsWith(".kt")||V.endsWith(".kts"))Q=!0;else if(V.endsWith(".java"))X=!0}};for(let U of J)Y(U,0);return{kotlin:Q,java:X,hints:z}}function ZP($){let Z=[],z=$.plugins,Q=$.artifacts,X=pR.some((P)=>L6(z,P))||$.sourceHints.has("commonMain"),J=L6(z,"com.android.application"),Y=!J&&cR.some((P)=>L6(z,P));if(J||Y)Z.push("android");if(X)Z.push("multiplatform");let U=$P(Q),W=G4(z,fR,"plugin"),G=G4($.parents,uR,"parent"),V=G4(Q,mR,"artifact"),q=G4(z,dR,"plugin"),K=G4(Q,iR,"artifact"),H=nR.some((P)=>L6(z,P)),L=$.packaging==="pom",B,D="",N;if(J)B="mobile",D=X?"Android+KMP":"Android",N=`${$.path||"root"} + com.android.application (${D})`;else if(U)B="mcp",D="MCP",Z.push("mcp"),N=`${$.path||"root"} + ${U} (JVM MCP server)`;else if(W||G||V){B="backend",D=W?.[1]||G?.[1]||V?.[1]||"JVM";let P=W?.[0]||G?.[0]||V?.[0]||"web";N=`${$.path||"root"} + ${P} (JVM backend)`}else if(X&&!Y)B="library",D="Kotlin Multiplatform",N=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(Y)B="library",D=X?"Android+KMP":"Android",N=`${$.path||"root"} + android library (${D})`;else if(K||$.hasApplicationPlugin&&($.hasMainClass||q)||q&&$.hasMainClass)B="cli",D=K?.[1]||"application",N=K?`${$.path||"root"} + ${K[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!H)B="cli",D="application",N=`${$.path||"root"} + application plugin (JVM CLI)`;else if(L)B="library",N=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{B="library";let P=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(N=`${$.path||"root"} (${P} library)`,H)N=`${$.path||"root"} + java-library (JVM library)`}let _="Java";if($.kotlinSources&&$.javaSources)_="Java/Kotlin";else if($.kotlinSources||lR.some((P)=>L6(z,P))||X)_="Kotlin";let E=[...new Set(Z)];return{appType:B,framework:D,facets:E,found:N,buildTool:$.buildTool,mainLanguage:_}}function zP($,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 aU($,Z,z){let Q=s6(Z,"build.gradle.kts"),X=s6(Z,"build.gradle"),J=I($,Q)?Q:I($,X)?X:null;if(!J)return null;let Y=g($,J);if(!Y)return null;let U=tR(Y,z),W=eR(Y,z),G=$W($,Z),V=/mainClass\s*[.=]/.test(Y)||/mainClassName\s*=/.test(Y)||/Main-Class/.test(Y),q=L6(U,"application")||L6(U,"org.gradle.application");return{path:Z||"build.gradle",plugins:U,artifacts:W,packaging:"jar",parents:new Set,hasMainClass:V,hasApplicationPlugin:q,sourceHints:G.hints,kotlinSources:G.kotlin||J.endsWith(".kts"),javaSources:G.java,buildTool:"gradle"}}function tU($,Z){let z=g($,s6(Z,"pom.xml"));if(!z)return null;let{packaging:Q,parents:X,artifacts:J}=eU(z),Y=$W($,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 V4($){if(!M3($))return null;let Z=oR($),z=[],Q=null;for(let G of["settings.gradle.kts","settings.gradle"])if(I($,G)){Q=g($,G);break}let X=Q?aR(Q):[],J=aU($,"",Z);if(J)z.push(J);for(let G of X){let V=aU($,G,Z);if(V)z.push(V)}let Y=tU($,"");if(Y){z.push(Y);let G=g($,"pom.xml");if(G){let{modules:V}=eU(G);for(let q of V){let K=tU($,q);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 U=null,W=999;for(let G of z){let V=ZP(G),q=zP(V.appType,V.facets);if(!U||q<W)U={appType:V.appType,framework:V.framework,buildTool:V.buildTool,mainLanguage:V.mainLanguage,facets:V.facets,found:V.found},W=q}if(U&&X.length>0&&!U.found.includes("multi-project"));return U}import{join as XP}from"path";var q4={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 JP=q4.mcpGems.map(($)=>$.toLowerCase()),YP=q4.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),ZW=q4.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),UP=q4.railsLayoutFiles;function WP($){return I($,"Gemfile")||I($,"gems.rb")||GP($)}function GP($){return(X0($)??[]).some((Z)=>Z.name.endsWith(".gemspec"))}function VP($){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 qP($){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 KP($){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 HP($){let Z=new Set,z=[];for(let X of["Gemfile","gems.rb"]){let J=g($,X);if(J){for(let Y of VP(J))Z.add(Y);z.push(X)}}let Q=g($,"Gemfile.lock")||g($,"gems.locked");if(Q){for(let X of qP(Q))Z.add(X);z.push("Gemfile.lock")}for(let{name:X}of X0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=g($,X);if(J){for(let Y of KP(J))Z.add(Y);z.push(X)}}return{gems:Z,sources:z}}function K4($,Z){let z=Z.toLowerCase();if($.has(z))return!0;return!1}function L3($,Z){let z;for(let[Q,X]of Z){if(!K4($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function BP($){let Z;for(let z of JP)if(K4($,z)&&(!Z||z.length>Z.length))Z=z;return Z}function zW($){for(let Z of UP)if(I($,Z))return Z;return}function MP($,Z){let z=L3(Z,ZW);if(z)return{hit:!0,why:z[0]};for(let{name:X}of X0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=g($,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 T2($,XP("bin",Y))?.isFile()===!0}).filter((Y)=>Y!=="rails");if(J.length>0&&!K4(Z,"rails")&&!zW($))return{hit:!0,why:`bin/${J[0]}`}}return{hit:!1,why:""}}function t5($){if(!WP($))return null;let{gems:Z,sources:z}=HP($),Q=z[0]||"Gemfile",X=z.some((D)=>D==="Gemfile"||D==="gems.rb"||D.includes("lock"))?"bundler":"rubygems",J=BP(Z),Y=L3(Z,YP),U=zW($),W=K4(Z,"rails")||K4(Z,"railties"),G=MP($,Z),V=I($,"config.ru"),q=W||!!U,K=Y&&Y[1]!=="Rails"&&!(Y[0]==="rack"&&!V)?Y:void 0,H,L="",B;if(J)H="mcp",L="MCP",B=`${Q} + gem ${J} (Ruby MCP)`;else if(q)if(H="backend",L="Rails",W&&U)B=`${Q} + rails + ${U} (Rails)`;else if(W)B=`${Q} + gem rails (Rails)`;else B=`${U} (Rails layout)`;else if(K)H="backend",L=K[1],B=`${Q} + gem ${K[0]} (Ruby backend)`;else if(G.hit)H="cli",L=L3(Z,ZW)?.[1]||"",B=`${Q} + ${G.why} (Ruby CLI)`;else H="library",B=`${Q} (Ruby library)`;return{appType:H,framework:L,packageManager:X,found:B}}import{join as DP}from"path";var b2={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 OP=b2.mcpPackageUrls.map(($)=>$.toLowerCase()),NP=b2.mcpProducts.map(($)=>$.toLowerCase()),IP=b2.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),TP=b2.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),AP=b2.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),CP=b2.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),_P=b2.appProductTypes,RP=b2.cliProductTypes,PP=b2.vaporLayoutFiles;function FP($){return I($,"Package.swift")||D3($).length>0}function D3($){return(X0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.endsWith(".xcodeproj")&&T2($,Z)?.isDirectory()===!0)}function jP($){let Z=SP($),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 U=[],W=/\.product\s*\(\s*name\s*:\s*"([^"]+)"/gi;while((J=W.exec(Z))!==null)U.push(J[1]);let G=/\.product\s*\(\s*name\s*:\s*'([^']+)'/gi;while((J=G.exec(Z))!==null)U.push(J[1]);let V=/\.library\s*\(/.test(z),q=/\.executable\s*\(/.test(z),K=/\.plugin\s*\(/.test(z)&&!V&&!q?!0:/\bproducts\s*:\s*\[[\s\S]*?\.plugin\s*\(/.test(z),H=/\.executabletarget\s*\(/.test(z),L=/\.target\s*\(/.test(z)&&!H?!0:(z.match(/\.target\s*\(/g)||[]).length>(z.match(/\.executabletarget\s*\(/g)||[]).length+(z.match(/\.testtarget\s*\(/g)||[]).length;return{packageUrls:Q,productNames:U,hasLibraryProduct:V,hasExecutableProduct:q,hasPluginProduct:!!K,hasExecutableTarget:H,hasLibraryTarget:L}}function SP($){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 EP($,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 QW($,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 XW($,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 wP($){let Z=$.map((z)=>z.toLowerCase());return NP.some((z)=>Z.includes(z))}function xP($){let Z=!1,z=!1,Q;for(let X of D3($)){let J=g($,DP(X,"project.pbxproj"));if(!J)continue;for(let Y of _P)if(J.includes(Y))Z=!0,Q=Y;for(let Y of RP)if(J.includes(Y)){if(z=!0,!Q)Q=Y}}return{hasApplication:Z,hasTool:z,hit:Q}}function yP($){for(let Z of PP)if(I($,Z))return Z;return}function H4($){if(!FP($))return null;let Z=I($,"Package.swift"),z=D3($),Q=z.length>0,X=null;if(Z){let S=g($,"Package.swift");if(S)X=jP(S)}let J=Q?xP($):{hasApplication:!1,hasTool:!1},Y=yP($),U=X?.packageUrls??[],W=X?.productNames??[],G=EP(U,OP),V=wP(W),q=QW(U,IP),K=XW(W,TP),H=QW(U,AP),L=XW(W,CP),B=!!(G||V),D=!!(q||K||Y),N=!!(X?.hasExecutableProduct||X?.hasExecutableTarget),_=!!(H||L),E=J.hasApplication,P=Z&&Q?"spm+xcode":Z?"spm":"xcode",y,w="",u;if(B)if(y="mcp",w="MCP",V)u="Package.swift + product MCP (Swift MCP)";else u=`Package.swift + ${G} (Swift MCP)`;else if(D)if(y="backend",w=K?.[1]||q?.[1]||(Y?"Vapor":""),K)u=`Package.swift + product ${K[1]} (Swift backend)`;else if(q)u=`Package.swift + ${q[1]} (Swift backend)`;else u=`${Y} (Swift backend layout)`;else if(E)y="app",w="",u=`${z[0]} + ${J.hit||"application"} (Swift app)`;else if(_||N&&!D&&!B)if(y="cli",w=L?.[1]||H?.[1]||"",L)u=`Package.swift + product ${L[1]} (Swift CLI)`;else if(H)u=`Package.swift + ${H[1]} (Swift CLI)`;else if(X?.hasExecutableProduct)u="Package.swift + .executable product (Swift CLI)";else u="Package.swift + .executableTarget (Swift CLI)";else if(J.hasTool&&!Z)y="cli",u=`${z[0]} + tool productType (Swift CLI)`;else if(Z)if(y="library",X?.hasLibraryProduct)u="Package.swift + .library product (Swift library)";else u="Package.swift (Swift library)";else y="library",u=`${z[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:y,framework:w,packageManager:P,found:u}}function bP($){let Z=g($,"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 kP($){let Z=g($,"Cargo.toml");return Z!==null&&/^\s*\[\[bin\]\]/m.test(Z)}function vP($,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=bP($);if(z&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(z))return`Cargo.toml name "${z}" → sdk`;return null}function gP($){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=g($,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 hP($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,z=g($,"pyproject.toml");if(z!==null){let X=z.match(Z);if(X)return`pyproject.toml depends on ${X[1]}`}let Q=g($,"requirements.txt");if(Q!==null){let X=Q.match(Z);if(X)return`requirements.txt contains ${X[1]}`}return null}function fP($,Z){let z=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let Q of z)if(Z.dependencies?.[Q]||Z.devDependencies?.[Q])return`${Q} dependency`}if(I($,"ios")&&I($,"android"))return"ios/ + android/ dirs";return null}function uP($,Z){let z=g($,"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=g($,"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 mP($,Z){if(!I($,"index.html"))return null;if(Z?.dependencies||Z?.devDependencies){let z={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((X)=>z[X]))return null}return"index.html (vanilla, no frontend framework)"}function cP($,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 pP($,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 lP($,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((U)=>z[U]),Y=X.some((U)=>z[U]);if(J&&Y)return"auth + payment dependencies";return null}function dP($,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 iP($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||I($,"pnpm-workspace.yaml")))return null;return"private workspace + multi-package"}var nP=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"]),YW=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,rP=new Set(["frontend","backend","database","css","ui","state"]);function sP($){if(I($,"pyproject.toml")||I($,"manage.py")||I($,"setup.py")||e5($,"requirements*.txt"))return!0;if(I($,"go.mod"))return!0;if(I($,"Cargo.toml"))return!0;if(I($,"Gemfile"))return!0;if(I($,"pom.xml")||e5($,"build.gradle*"))return!0;if(g1($).length>0)return!0;let Z=W2($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function $Z($){return w1($,()=>oP($))}function oP($){let Z=X0($)??[],z=[];for(let Q of Z){if(!Q.isDirectory()||Q.name.startsWith(".")||nP.has(Q.name))continue;let X=JW($,Q.name);if(!sP(X))continue;let J=zZ(X);if(!J)continue;let Y=ZZ(X).filter((V)=>rP.has(V.category)),U=Y.find((V)=>V.category==="frontend"),W=Y.find((V)=>V.category==="backend"),G=U??W??Y[0]??null;z.push({name:Q.name,language:J,topFramework:G?.name??null,frontend:!!U,backend:!!W||YW.test(J),hasFramework:!!G,appRoot:I(X,"manage.py")||I(X,"config.ru")||I(X,"bin/rails")||I(X,"artisan")})}return z}function aP($,Z){if(Z?.workspaces||I($,"pnpm-workspace.yaml"))return null;let z=$Z($),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 UW($){let Z=$Z($);if(Z.length<2)return null;let z=(Y)=>(Y.appRoot?2:0)+(YW.test(Y.language)?2:0)+(Y.hasFramework?1:0)+(Y.frontend?0.5:0),Q=[...Z].sort((Y,U)=>z(U)-z(Y)),X=new Set,J=[];for(let Y of Q){if(X.has(Y.language))continue;X.add(Y.language);let U=Y.frontend?"frontend":Y.backend?"backend":"service";J.push(Y.topFramework?`${Y.language} (${Y.topFramework} · ${U})`:`${Y.language} (${U})`)}return J.join("; ")}function W2($){let Z=g($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function e5($,Z){if(!Z.includes("*"))return I($,Z);let z=Z.split("/");if(z.length===1){let U=Z.split("*")[0];return(X0($)??[]).some((W)=>W.name.startsWith(U))}let Q=JW(...z.slice(0,-1)),X=z[z.length-1],J=X.split("*")[0],Y=X.split("*")[1]||"";return(X0($,Q)??[]).some((U)=>U.name.startsWith(J)&&U.name.endsWith(Y))}function tP($,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 e5(z,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!e5(z,$.pattern))return!1;let Q=g(z,$.pattern);return Q!==null&&Q.toLowerCase().includes($.key.toLowerCase())}default:return!1}}function ZZ($){let Z=W2($);return iU.map((z)=>{let X=z.signals.filter((J)=>tP(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 zZ($){let Z=W2($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(I($,"tsconfig.json"))return"TypeScript";if(I($,"Cargo.toml"))return"Rust";if(I($,"go.mod"))return"Go";if(g1($).length>0)return"C#";if(I($,"pyproject.toml")||I($,"setup.py"))return"Python";if(I($,"Gemfile"))return"Ruby";if(M3($)){let z=V4($);if(z)return z.mainLanguage==="Java/Kotlin"?"Kotlin":z.mainLanguage;return"Java"}if(I($,"Package.swift"))return"Swift";if(I($,"build.zig"))return"Zig";if(I($,"pubspec.yaml"))return"Dart";if(Z)return"JavaScript";return""}function WW($){let Z=[];if(I($,"SKILL.md"))Z.push("SKILL.md");for(let z of["skills",""])for(let Q of X0($,z||".")??[]){if(!Q.isDirectory()||Q.name.startsWith(".")||Q.name==="node_modules")continue;if(z===""&&Q.name==="skills")continue;let X=z?`${z}/${Q.name}/SKILL.md`:`${Q.name}/SKILL.md`;if(I($,X))Z.push(X)}return Z}function eP($){let Z=WW($);if(Z.length===0)return null;let z=[Z.length===1?Z[0]:`${Z.length} SKILL.md folders`];if(I($,".claude-plugin/plugin.json"))return z.push(".claude-plugin/plugin.json"),{type:"skills-plugin",found:z};return{type:"skills",found:z}}function GW($){if(WW($).length===0)return"";return I($,".claude-plugin/plugin.json")?"Claude Code plugin":"Agent Skills"}function VW($){let Z=W2($),z=ZZ($),Q=[],X=cP($,Z);if(X)return Q.push(X),{type:"documentation",found:Q};let J=vP($,Z);if(J)return Q.push(J),{type:"sdk",found:Q};let Y=gP($);if(Y)return Q.push(Y),{type:"extension",found:Q};let U=dP($,Z,z);if(U)return Q.push(U),{type:"mcpaas",found:Q};let W=lP($,Z);if(W)return Q.push(W),{type:"saas",found:Q};let G=uP($,Z);if(G)return Q.push(G),{type:"wasm",found:Q};let V=n5($);if(V)return Q.push(V.found),{type:V.appType,found:Q};let q=s5($);if(q)return Q.push(q.found),{type:q.appType,found:Q};let K=a5($);if(K)return Q.push(K.found),{type:K.appType,found:Q};let H=V4($);if(H)return Q.push(H.found),{type:H.appType,found:Q};let L=t5($);if(L)return Q.push(L.found),{type:L.appType,found:Q};let B=H4($);if(B)return Q.push(B.found),{type:B.appType,found:Q};let D=fP($,Z);if(D)return Q.push(D),{type:"mobile",found:Q};if(z.some((r)=>r.slug==="mcp"))return Q.push("MCP SDK signal"),{type:"mcp",found:Q};if(Z?.bin)return Q.push("package.json bin"),{type:"cli",found:Q};if(kP($))return Q.push("Cargo.toml [[bin]]"),{type:"cli",found:Q};if(I($,"build.zig")){if(Q.push("build.zig"),I($,"src/main.zig"))return Q.push("src/main.zig"),{type:"cli",found:Q};if(I($,"src/root.zig"))return Q.push("src/root.zig"),{type:"library",found:Q}}let _=z.some((r)=>r.slug==="svelte"||r.slug==="sveltekit");if(Z?.private===!0&&(I($,"pnpm-workspace.yaml")||Z?.workspaces!==void 0)&&_)return Q.push("private workspace","Svelte"),{type:"framework",found:Q};if(_)return Q.push("Svelte/SvelteKit"),{type:"svelte",found:Q};let P=z.some((r)=>r.category==="frontend"),y=z.some((r)=>r.category==="backend");if(Z?.private&&(Z.workspaces||I($,"pnpm-workspace.yaml"))&&P&&y)return Q.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:Q};let w=iP($,Z);if(w)return Q.push(w),{type:"monorepo-root",found:Q};let u=pP($,Z,z);if(u)return Q.push(u),{type:"website",found:Q};if(z.some((r)=>r.slug==="nextjs"||r.slug==="nuxt"))return Q.push(z.find((r)=>r.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:Q};let d=z.some((r)=>r.category==="frontend"),I0=z.some((r)=>r.category==="backend");if(d&&I0)return Q.push("frontend framework","backend framework"),{type:"fullstack",found:Q};if(d)return Q.push("frontend framework"),{type:"frontend",found:Q};if(I0)return Q.push("backend framework"),{type:"backend",found:Q};let S0=hP($);if(S0)return Q.push(S0),{type:"data-science",found:Q};let z0=mP($,Z);if(z0)return Q.push(z0),{type:"html",found:Q};let k=aP($,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};let n=eP($);if(n)return Q.push(...n.found),{type:n.type,found:Q};return Q.push(x1),{type:"library",found:Q}}function qW($){if(I($,"bunfig.toml"))return"Bun";if(I($,"deno.json")||I($,"deno.jsonc"))return"Deno";if(W2($))return"Node.js";if(I($,"Cargo.toml"))return"Rust";if(I($,"go.mod"))return"Go";if(g1($).length>0)return".NET";if(I($,"pubspec.yaml"))return"Dart";return""}var $F=new Set(["npm","pnpm","yarn","bun"]);function ZF($){let Z=W2($)?.packageManager;if(typeof Z!=="string")return"";let z=/^([a-z]+)@/i.exec(Z.trim())?.[1]?.toLowerCase()??"";return $F.has(z)?z:""}function zF($){if(I($,"pubspec.yaml"))return"pub";if(I($,"go.mod"))return"go modules";if(g1($).length>0)return"NuGet";if(I($,"pom.xml"))return"maven";return["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"].some((z)=>I($,z))?"gradle":""}var QF=[["bun.lockb","bun"],["bun.lock","bun"],["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"]];function KW($){return zF($)||ZF($)||(QF.find(([Z])=>I($,Z))?.[1]??"")}function HW($){if(I($,".github/workflows"))return"GitHub Actions";if(I($,".gitlab-ci.yml"))return"GitLab CI";if(I($,".circleci"))return"CircleCI";if(I($,"Jenkinsfile"))return"Jenkins";return null}function BW($){if(I($,"vercel.json"))return"Vercel";if(I($,"netlify.toml"))return"Netlify";if(I($,"wrangler.toml"))return"Cloudflare";if(I($,"fly.toml"))return"Fly.io";if(I($,"render.yaml"))return"Render";return null}var XF=["svelte.config.js","vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"];function JF($){for(let Q of XF){let X=g($,Q)?.match(/@sveltejs\/adapter-(\w+)/);if(X)return X[1]}let Z=W2($);return Object.keys({...Z?.dependencies,...Z?.devDependencies}).map((Q)=>/^@sveltejs\/adapter-(\w+)$/.exec(Q)?.[1]).find(Boolean)??null}function MW($){let Z=JF($);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 O3($){let Z=$?.devDependencies?.vite??$?.dependencies?.vite,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?"Vite":`Vite ${z}`}function LW($){let Z=W2($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return O3(Z);if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(I($,"tsconfig.json")&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function QZ($){return["package.json","Cargo.toml","pyproject.toml","go.mod","build.zig","build.zig.zon","src/index.ts","src/index.js","src/main.ts","src/cli.ts","src/main.rs","src/lib.rs","src/main.zig","src/root.zig","src/__init__.py","main.py","__main__.py","main.go","cmd/main.go","README.md","SPECIFICATION.md","BINARY-FORMAT.md","tsconfig.json","wrangler.toml","vercel.json"].filter((z)=>I($,z))}function XZ($,Z){let z={};if(Z?.scripts){for(let Q of["build","test","lint","dev","start"])if(Z.scripts[Q]){let X=I($,"bun.lock")||I($,"bun.lockb")?"bun run":"npm run";z[Q]=`${X} ${Q}`}}if(I($,"Cargo.toml")){if(!z.build)z.build="cargo build --release";if(!z.test)z.test="cargo test";if(!z.lint&&YF($))z.lint="cargo clippy"}if(I($,"build.zig")){if(!z.build)z.build="zig build";if(!z.test&&/\.step\(\s*"test"/.test(N3($,"build.zig")))z.test="zig build test"}if(I($,"go.mod")){if(!z.build)z.build="go build ./...";if(!z.test)z.test="go test ./..."}if(!z.test&&UF($))z.test="pytest";return z}function N3($,Z){return g($,Z)??""}function YF($){if(I($,"clippy.toml")||I($,".clippy.toml"))return!0;return/^\s*\[(workspace\.)?lints\.clippy\]/m.test(N3($,"Cargo.toml"))}function UF($){if(I($,"pytest.ini")||I($,"conftest.py"))return!0;return["pyproject.toml","setup.cfg","tox.ini"].some((Z)=>/\bpytest\b/.test(N3($,Z)))}function DW($,Z,z,Q){let X=[];if(Q&&Q!=="Unknown")X.push(Q);let J=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let Y of z)if(J.has(Y.category))X.push(Y.name);if(I($,"bunfig.toml"))X.push("Bun");else if(I($,"deno.json")||I($,"deno.jsonc"))X.push("Deno");if(X.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let U of Y)if(!X.some((W)=>W.toLowerCase().includes(U.toLowerCase())))X.push(U)}return X}function WF($){let Z=$?.dependencies?.svelte??$?.devDependencies?.svelte,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?NaN:Number(z)}function JZ($){return I3($).data}function I3($){let Z=W2($),z=ZZ($),Q=VW($),X=Q.type,J=Q.found.some((s)=>s.startsWith("polyglot:")),Y=J&&UW($)||zZ($),U=qW($),W=KW($),G=HW($),V=BW($),q=LW($),K=z.find((s)=>s.slug==="sveltekit")??z.find((s)=>s.category==="frontend"),H=z.find((s)=>s.category==="css"),L=z.find((s)=>s.category==="ui"),B=z.find((s)=>s.category==="state"),D=z.find((s)=>s.category==="backend"),N=z.find((s)=>s.category==="database"),_=(s)=>d6(X,s)??d6("library",s)===!0,E=X==="framework",P=z.some((s)=>s.slug==="svelte"||s.slug==="sveltekit"),y=E&&P?"svelte":E?null:null,w=X==="svelte"||y==="svelte",u=w?MW($):null,S=w&&z.some((s)=>s.slug==="sveltekit"),d={},I0=J0.filter((s)=>s.path.startsWith("stack."));for(let s of I0){let Y0=s.path.replace("stack.","");switch(Y0){case"frontend":d[Y0]=K?.name??GW($);break;case"css_framework":d[Y0]=H?.name??"";break;case"ui_library":d[Y0]=L?.name??"";break;case"state_management":d[Y0]=B?.name??(w&&WF(Z)>=5?"Runes":"");break;case"backend":d[Y0]=w?S?"SvelteKit":D?.name??"":D?.name??"";break;case"api_type":d[Y0]=S?"Server Routes":"";break;case"runtime":d[Y0]=U;break;case"database":d[Y0]=N?.name??"";break;case"connection":d[Y0]=N?.name??"";break;case"hosting":if(w&&u)d[Y0]=u;else d[Y0]=V??"";break;case"build":d[Y0]=S?O3(Z):q??"";break;case"cicd":d[Y0]=G??"";break;case"package_manager":d[Y0]=W;break;default:d[Y0]="";break}}let S0={};for(let s of I0){let Y0=s.path.replace("stack.","");S0[Y0]=_(s)?d[Y0]:"slotignored"}let z0={},k=J0.filter((s)=>s.path.startsWith("monorepo."));for(let s of k){let Y0=s.path.replace("monorepo.","");if(!_(s))z0[Y0]="slotignored";else z0[Y0]=""}let n={name:Z?.name??$.split("/").pop()??"project",goal:J?"":Z?.description??"",main_language:Y,type:X};if(E&&y)n.framework=y;let r=DW($,Z,z,J?zZ($):Y);if(J){for(let s of $Z($))for(let Y0 of[s.language,s.topFramework])if(Y0&&!r.includes(Y0))r.push(Y0)}let L2=QZ($),HX=XZ($,Z),b8={faf_version:k1,project:n,stack:S0,human_context:{who:"",what:J?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:z0,_meta:{found:Q.found}};if(r.length>0)b8.tech_stack=r;if(L2.length>0)b8.key_files=L2;if(Object.keys(HX).length>0)b8.commands=HX;return{data:b8,facts:d}}var i0={goal:["use\\s+cases?","goals?"],what:["description","overview","purpose","introduction","what","what\\s+is\\s+(?!new\\b)\\S+","what\\s+it\\s+does"],who:["audience","target\\s+audience","for\\s+whom","who","who\\s+is\\s+(?:this|it)\\s+for","who\\s+it.s\\s+for"],why:["why","why\\s+(?:use\\s+)?(?!not\\b)\\S+","motivations?","(?:the\\s+)?problem","rationale","mission","vision"],where:["deployment","where","where\\s+it\\s+runs","hosting","platforms","supported\\s+platforms","platform\\s+support"],when:["status","(?:project|current)\\s+status","timeline","since","launched"],how:["architecture","how","how\\s+it\\s+works","how\\s+does\\s+it\\s+work","under\\s+the\\s+hood","internals","approach","methodology"]},h1={MIN_LENGTH:8,MAX_LENGTH:280},GF=[/^(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,/^(welcome|hello|hi|thanks|thank\s+you)\b/i,/\bwelcome[.!]?$/i,/^(copyright\b|\(c\)|©)/i,/\ball\s+rights\s+reserved\b/i,/^(?:(?:dual-)?licen[cs]ed\s+under|permission\s+is\s+hereby)\b/i,/\b(npm|pnpm|yarn|bun)\s+(i|install|add)\s|\bpip3?\s+install\s|\bcargo\s+(add|install)\s|\bgo\s+(get|install)\s|\bbrew\s+install\s/i,/^please\b/i,/\bto get started\b|\bread the (docs|documentation|guide)\b|\bstart with the (docs|documentation|guide)\b|\bread the announcement\b|\bcheck out (the|our)\b/i,/^["“'‘][\s\S]*["”'’]$/,/\?$/,/(&mdash;|&ndash;|[—–,;]|\s-)\s*$/,/^(the\s+)?mono-?repo\s+(for|of|containing|with)\b/i,/\bmono-?repo(\s+root)?\.?$/i,/[a-z]{2,}\.[A-Z][a-z]{2,}/,/^#{1,6}\s/,/\*\*[^*\n]{1,30}:\*\*[\s\S]*\*\*[^*\n]{1,30}:\*\*/];function OW($){return VF.some((Z)=>Z.test($))}var VF=[/\b(no longer (maintained|supported|developed)|unmaintained|deprecated|archived|end[- ]of[- ]life)\b/i,/^(sponsored|supported|funded|backed|brought to you) by\b/i,/\b(we['’]re|we are) hiring\b|^join (us|our)\b/i,/\b(documentation|docs) (is |are )?(available|can be found|lives?) (at|on|in)\b/i,/^looking for\b|\?\s/i,/^moved to\b|\b(has )?moved to\b|\bmirror of\b/i,/^(requires?|needs)\b/i,/^status\s*:/i,/^(warning|important|note|caution|attention|heads[- ]up|disclaimer|notice|danger)\s*:/i,/\b(t-?shirts?|mugs|stickers|merch(andise)?|donate|sponsor (us|me))\b/i,/^(?:\p{Extended_Pictographic}|\p{Emoji_Modifier}|\u200d|\ufe0f|\s)+[\p{L}\p{N} '-]{1,30}:\s/u];function YZ($){return/^\[!/.test($)||/^(⚠|🚧|❗|⛔|❌|🛑)/u.test($)||/\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($)}function UZ($){let Z=$.findIndex((z)=>z.trim()!=="");if(Z>=0&&/^[-=]{3,}\s*$/.test($[Z+1]??""))return $.slice(Z+2);return $}function C0($){let Z=$.trim();if(Z.length<h1.MIN_LENGTH)return!1;if(Z.length>h1.MAX_LENGTH)return!1;if(GF.some((z)=>z.test(Z)))return!1;if(/^(\||[-*+](\s|$))/.test(Z))return!1;if(Z.split(`
236
- `).length>4)return!1;if(qF(Z))return!1;return!0}function o6($){let Z=$.trim(),z=/[.!?…]+(?=\s+\S|\s*$)/g;for(let Q=z.exec(Z);Q;Q=z.exec(Z)){let X=Q.index+Q[0].length,J=Z.slice(0,X);if(X<Z.length){let Y=Z.slice(X).trimStart();if(/(\.\.\.|…)$/.test(J))continue;if(/\b(e\.g|i\.e|vs|cf|approx|dr|mr|mrs|ms|st|jr|sr|no|fig)\.$/i.test(J))continue;if(/(\betc\.|(?:\b[A-Za-z]\.){2,})$/.test(J)&&/^[a-z]/.test(Y))continue}return J.endsWith("?")?null:J}return null}function qF($){if(KF.test($))return!0;if($.includes("```"))return!0;if(/(^|\s)[-=]{3,}(\s|$)/.test($))return!0;if(/^\d+\.\s/.test($))return!0;if(/:\s*$/.test($))return!0;let z=$.replace(/&nbsp;/gi," ").split(/\s*(?:\||·|•|&bull;)\s*/i).map((Q)=>Q.trim()).filter(Boolean);if(z.length>=3&&z.every((Q)=>Q.length<=24))return!0;return HF($)>0.5}var KF=/<\/?(?:p|div|img|br|hr|h[1-6]|picture|source|table|thead|tbody|tr|td|th|ul|ol|li|dl|dt|dd|details|summary|section|header|footer|center|video|iframe|svg|blockquote|pre)\b[^>]*>/i;function HF($){let Z=$.replace(/!\[[^\]]*\]\([^)]*\)/g,""),z=[...Z.matchAll(/\[([^\]]*)\]\([^)]*\)/g)].map((X)=>X[1]).join(""),Q=Z.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").trim();if(!Q)return $.trim()?1:0;return z.length/Q.length}var a6=($)=>new RegExp(`^(${$.join("|")})\\s*[:?]?$`,"i"),NW=a6(i0.goal),IW=a6(i0.what),TW=a6(i0.who),AW=a6(i0.why),CW=a6(i0.where),_W=a6(i0.when),RW=a6(i0.how),T3=String.raw`(?:\*\*|__|\*|_)`,BF=String.raw`(?:(?:\p{Extended_Pictographic}|\p{Emoji_Modifier}|\u200d|\ufe0f)+\s*)?`,PW=String.raw`${BF}${T3}?[^*[\]:]{1,30}(?::${T3}?|${T3}:)`,FW=String.raw`\[[^\]]+\]\([^)]*\)`,MF=new RegExp(String.raw`^${PW}\s*(?:${FW}|https?:\/\/\S+)(?:\s*\([^()]{1,30}\))?\s*$`,"u"),LF=new RegExp(String.raw`^(?:${PW}\s*)?(?:\*\*)?${FW}`,"u");function DF($){let Z=UZ($.split(`
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(/^<\/?[a-z][\w-]*/i.test(Q)&&(OF.test(Q)||Q.replace(/<[^>]*>/g,"").trim()==="")){z++;continue}if(/^#\s/.test(Q)){z++;continue}if(MF.test(Q)){z++;continue}if(LF.test(Q)&&/[|·•]|&bull;/i.test(Q)){z++;continue}if(/^\[[^\]]+\]:\s*\S/.test(Q)){z++;continue}if(/^https?:\/\/\S*\)?\s*$/.test(Q)){z++;continue}if(Q===""){z++;continue}break}return Z.slice(z).join(`
238
- `)}var OF=/^<\/?(?:p|div|img|h[1-6]|picture|source|table|center|details|summary|video|svg|br|hr)\b/i;function NF($,Z){let z=$.replace(/^>\s*/,"");return!/^>/.test((Z??"").trim())&&z&&!YZ(z)?z:null}function jW($){let z=DF($).split(`
239
- `),Q=[];for(let[X,J]of z.entries()){let Y=J.trim();if(Q.length===0&&/^>/.test(Y))return NF(Y,z[X+1]);if(Y===""){if(Q.length>0)break;continue}if(/^(#|>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(Y))break;if(/^\[[^\]]+\]:\s*\S/.test(Y))continue;if(/^https?:\/\/\S*\)?\s*$/.test(Y))continue;if(/^\*\*[^*]+\*\*\s*$/.test(Y)&&Q.length===0)continue;Q.push(Y)}if(Q.length===0)return null;return Q.join(" ").trim()}function t6($,Z){return SW($,Z)?.text??null}function SW($,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=[];Q++;while(Q<z.length){let U=z[Q].trim();if(U.match(/^(#{1,6})\s+/))break;if(U===""){if(Y.length>0)break;Q++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(U))break;Y.push(U),Q++}if(Y.length===0)return null;return{text:Y.join(" ").trim(),heading:J[2].trim()}}Q++}return null}function IF($){let Z=t6($,NW);if(Z&&C0(Z))return Z;let z=jW($);if(z&&C0(z))return z;return}function TF($){let Z=t6($,IW);if(Z&&C0(Z))return Z;return}function AF($){let Z=t6($,TW);if(Z&&C0(Z))return Z;return}function CF($){let Z=t6($,AW);if(Z&&C0(Z))return Z;return}function _F($){let Z=t6($,CW);if(Z&&C0(Z))return Z;return}function RF($){let Z=t6($,_W);if(Z&&C0(Z))return Z;return}function PF($){let Z=t6($,RW);if(Z&&C0(Z))return Z;return}function A3($){let Z=["README.md","README.MD","Readme.md","readme.md"],z=null;for(let H of Z)if(I($,H)){z=H;break}if(!z)return{};let Q=g($,z);if(Q===null)return{};Q=Q.replace(/<!--[\s\S]*?-->/g,"");let X={},J=IF(Q);if(J)X.project={goal:J};let Y={},U=TF(Q);if(U)Y.what=U;let W=AF(Q);if(W)Y.who=W;let G=CF(Q);if(G)Y.why=G;let V=_F(Q);if(V)Y.where=V;let q=RF(Q);if(q)Y.when=q;let K=PF(Q);if(K)Y.how=K;if(Object.keys(Y).length>0)X.human_context=Y;return X}function EW($){let Z=["README.md","README.MD","Readme.md","readme.md"].find((Y)=>I($,Y));if(!Z)return{};let z=g($,Z);if(z===null)return{};let Q=z.replace(/<!--[\s\S]*?-->/g,""),X={},J=(Y,U)=>{let W=SW(Q,U);if(!W)return!1;let G=C0(W.text)?W.text:/:\s*$/.test(W.text)?o6(W.text):null;if(G&&C0(G))return X[Y]={value:G,source:`${Z} § ${W.heading}`},!0;return!1};if(!J("project.goal",NW)){let Y=jW(Q);if(Y&&C0(Y))X["project.goal"]={value:Y,source:`${Z} § first paragraph`};else if(Y&&Y.length>h1.MAX_LENGTH){let U=o6(Y);if(U&&C0(U))X["project.goal"]={value:U,source:`${Z} § first sentence`}}}return J("human_context.what",IW),J("human_context.who",TW),J("human_context.why",AW),J("human_context.where",CW),J("human_context.when",_W),J("human_context.how",RW),X}function FF($,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 U=Y[1].trim();U=U.replace(/\s*#.*$/,"").trim();let W=U.match(/^"((?:[^"\\]|\\.)*)"$/)||U.match(/^'((?:[^'\\]|\\.)*)'$/);if(W)return W[1];return U}}return null}function B4($){let Z=g($,"Cargo.toml");if(Z===null)return{};let z=FF(Z,"description");if(z&&C0(z))return{project:{goal:z}};return{}}import{join as wW}from"path";var jF=[{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"}],SF=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function EF($){let Z=[],z=(Q,X)=>{for(let J of X0($,Q)??[])if(J.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(J.name))Z.push(wW(Q,J.name));else if(J.isDirectory()&&X>0&&!J.name.startsWith(".")&&!SF.has(J.name))z(wW(Q,J.name),X-1)};return z(".",1),Z}function M4($){return[...$].join(" · ")}function C3($){let Z=EF($);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=g($,X);if(J===null)continue;for(let Y of J.matchAll(/^\s*image:\s*["']?([^\s"'#]+)/gm)){let U=Y[1].toLowerCase(),W=U.replace(/:[^/]*$/,"").split("/").pop()??U,G=U.replace(/:[^/]*$/,"");for(let{re:V,slot:q,label:K}of jF)if(V.test(W)||V.test(G))z[q].add(K)}}let Q={};if(z.database.size)Q.database=M4(z.database);if(z.cache.size)Q.cache=M4(z.cache);if(z.search.size)Q.search=M4(z.search);if(z.storage.size)Q.storage=M4(z.storage);if(z.runtime.size)Q.runtime=`Docker Compose (${M4(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 wF}from"path";var xF=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),yF=[{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 _3($,Z){for(let z of Z){let Q=$.find((X)=>z.test(X));if(Q)return Q}return null}function bF($){let Z=[$];for(let z of X0($)??[])if(z.isDirectory()&&!z.name.startsWith(".")&&!xF.has(z.name))Z.push(wF($,z.name));return Z}function kF($){let Z=0;if(I($,"manage.py")||I($,"pyproject.toml")||I($,"Gemfile"))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function R3($){return w1($,()=>vF($))}function vF($){let Z=[];for(let Q of bF($)){let X=Q===$,J=X?"":`cd ${Q.slice($.length+1)} && `;for(let Y of yF){let U=g(Q,Y.file);if(U===null)continue;let W=Y.targets(U);if(W.length===0)continue;let G={},V=_3(W,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),q=_3(W,[/^build$/i,/^compile$/i,/^build/i]),K=_3(W,[/^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(K)G.lint=`${J}${Y.runner} ${K}`;if(Object.keys(G).length===0)continue;Z.push({score:Object.keys(G).length+(X?10:kF(Q)),commands:G})}}let z=Z.sort((Q,X)=>X.score-Q.score)[0];return z?{commands:z.commands}:{}}var gF=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function P3($){for(let Z of gF)if(I($,Z))return{security:{secrets:".env",example:Z}};return{}}function hF($,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 F3($){return[A3($),B4($),C3($),R3($),P3($)].reduce(hF,{})}import{join as fF,extname as uF,resolve as mF}from"path";var j3={"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 cF=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),pF=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),lF={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"]},dF=[["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 iF($,Z){for(let[z,Q]of dF)if(z in $)return Q;return Z.length>0?"framework":"config"}function nF($,Z){try{let z=JSON.parse(g($,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 rF($,Z){if(Z.isFile())return!0;if(!Z.isSymbolicLink())return!1;return T2($,Z.name)?.isFile()===!0}function sF($,Z){if(Z.isDirectory())return!0;if(!Z.isSymbolicLink())return!1;return T2($,Z.name)?.isDirectory()===!0}function oF($){let Z=[],z=mF($),Q=new Set,X=X0(z);if(!X)return Z;for(let J of X){let Y=J.name;if(Y.endsWith(".xcodeproj")?!sF(z,J):!rF(z,J))continue;if(Y.toLowerCase().endsWith(".csproj")){let W=a5(z);if(W){let G={mainLanguage:"C#",packageManager:"NuGet",buildTool:"dotnet"};if(W.appType==="backend"&&W.framework)G.backend=W.framework;else if(W.appType==="cli"&&W.framework)G.framework=W.framework;else if(W.appType==="mcp")G.apiType="MCP";else if(W.appType==="mobile"&&W.framework)G.framework=W.framework;if(W.targetFramework)G.runtime=W.targetFramework;let V=W.framework?[W.framework,"C#",".NET"]:["C#",".NET"];Z.push({slots:G,priority:36,frameworks:V,fileName:Y})}continue}if(Y.endsWith(".xcodeproj")){let W=H4(z);if(W){let G={mainLanguage:"Swift",packageManager:W.packageManager==="spm"?"spm":"Xcode",buildTool:W.packageManager.includes("spm")?"swift build":"xcodebuild"};if(W.appType==="backend"&&W.framework)G.backend=W.framework;else if(W.appType==="cli"&&W.framework)G.framework=W.framework;else if(W.appType==="mcp")G.apiType="MCP";else if(W.appType==="app"&&W.framework)G.framework=W.framework;let V=W.framework?[W.framework,"Swift"]:["Swift"];Z.push({slots:G,priority:36,frameworks:V,fileName:Y})}continue}let U=j3[Y];if(!U)continue;if(Y==="manifest.json"&&nF(z,Y)!=="chrome")continue;if(Y==="pubspec.yaml"){let W=n5(z);if(W){let G={mainLanguage:"Dart",packageManager:"pub"};if(W.isFlutter){if(G.framework="Flutter",W.stateManagement)G.stateManagement=W.stateManagement}else if(W.appType==="backend"&&W.framework)G.backend=W.framework;else if(W.appType==="mcp")G.apiType="MCP";Z.push({slots:G,priority:U.priority,frameworks:W.isFlutter?["Flutter","Dart"]:["Dart"],fileName:Y});continue}}if(Y==="go.mod"){let W=s5(z);if(W){let G={mainLanguage:"Go",packageManager:"go modules",buildTool:"go build"};if(W.appType==="backend"&&W.framework)G.backend=W.framework;else if(W.appType==="cli"&&W.framework)G.framework=W.framework;else if(W.appType==="mcp")G.apiType="MCP";let V=W.framework?[W.framework,"Go"]:["Go"];Z.push({slots:G,priority:U.priority,frameworks:V,fileName:Y});continue}}if(Y==="Gemfile"||Y==="Gemfile.lock"||Y==="gems.rb"){let W=t5(z);if(W){let G={mainLanguage:"Ruby",packageManager:W.packageManager};if(W.appType==="backend"&&W.framework)G.backend=W.framework;else if(W.appType==="cli"&&W.framework)G.framework=W.framework;else if(W.appType==="mcp")G.apiType="MCP";let V=W.framework?[W.framework,"Ruby"]:["Ruby"];Z.push({slots:G,priority:U.priority??35,frameworks:V,fileName:Y});continue}}if(Y==="Package.swift"){let W=H4(z);if(W){let G={mainLanguage:"Swift",packageManager:W.packageManager==="xcode"?"Xcode":"spm",buildTool:"swift build"};if(W.appType==="backend"&&W.framework)G.backend=W.framework;else if(W.appType==="cli"&&W.framework)G.framework=W.framework;else if(W.appType==="mcp")G.apiType="MCP";else if(W.appType==="app"&&W.framework)G.framework=W.framework;let V=W.framework?[W.framework,"Swift"]:["Swift"];Z.push({slots:G,priority:U.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 W=V4(z);if(W){let G={mainLanguage:W.mainLanguage==="Java/Kotlin"?"Kotlin":W.mainLanguage,packageManager:W.buildTool==="maven"?"maven":"gradle",buildTool:W.buildTool};if(W.appType==="backend"&&W.framework)G.backend=W.framework;else if(W.appType==="cli"&&W.framework)G.framework=W.framework;else if(W.appType==="mcp")G.apiType="MCP";else if(W.appType==="mobile")G.framework=W.framework||"Android";if(W.facets.includes("multiplatform"))G.framework=W.framework||"Kotlin Multiplatform";let V=W.framework?[W.framework,"JVM",W.mainLanguage==="Kotlin"?"Kotlin":"Java"]:["JVM",W.mainLanguage==="Kotlin"?"Kotlin":"Java"];Z.push({slots:G,priority:U.priority??35,frameworks:V,fileName:Y});continue}}Z.push({slots:U.slots||{},priority:U.priority,frameworks:U.frameworks,fileName:Y})}return Z}function aF($){let Z=[];for(let z of w1($,()=>xW($,2,{count:0}))){let Q=j3[`*${z}`],X=Q?.slots?.mainLanguage;if(X)Z.push({slots:{mainLanguage:X},priority:Q.priority,frameworks:Q.frameworks})}return Z}function tF($){let Z=[...oF($),...aF($)],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:iF(G.slots,G.frameworks),priority:G.priority})}let Y=[...J.values()].sort((G,V)=>V.priority-G.priority||G.fileName.localeCompare(V.fileName)),U=[];if(z.mainLanguage)U.push(z.mainLanguage.toLowerCase());if(z.framework)U.push(z.framework.toLowerCase());let W=U.length>0?U.join("-"):"unknown-stack";return{slotFills:z,frameworks:[...X],confirmedCount:Z.length,discoveredFormats:Y,stackSignature:W}}function S3($){let{slotFills:Z}=tF($),z={};for(let[Q,X]of Object.entries(Z)){let J=lF[Q];if(!J||!X)continue;let[Y,U]=J;if(Y==="project")(z.project??={})[U]=X;else(z.stack??={})[U]=X}return z}function xW($,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=uF(J.name);if(pF.has(Y))Q.add(Y);continue}if(cF.has(J.name)||J.name.startsWith("."))continue;for(let Y of xW(fF($,J.name),Z-1,z))Q.add(Y)}return Q}function f1($){let Z=JZ($),z=F3($),Q={};if(z.stack)Q.stack=z.stack;if(z.commands)Q.commands=z.commands;if(z.security)Q.security=z.security;let X=L4(Q,bW(Z));return Uj(X),L4(X,S3($))}function bW($){let Z={...$};if($0(Z.project)&&"goal"in Z.project)Z.project={...Z.project,goal:""};if($0(Z.human_context))Z.human_context=Object.fromEntries(Object.keys(Z.human_context).map((z)=>[z,""]));return Z}function kW($,Z){let z=Yj(a$(Z,"updateExistingFaf: the existing .faf")),{data:Q,facts:X}=I3($),J=Q,{project:Y,human_context:U,...W}=F3($),G=L4(z,W),V=L4(G,bW(J)),q=Zj(L4(V,S3($)),z),K=zj(eF(Z,z,J)?Qj(yW(q,z),z,X):yW(q,z),z);return wU(SU(Z,K))}function eF($,Z,z){if(!U0(v0(Z,"project.type"))){let X=J4($)?.text;return X===void 0||!q3(X)}return!(z._meta?.found??[]).includes(x1)}function E3($){return $.canonical?[$.path,$.canonical]:[$.path]}function v0($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)?X[Q]:void 0}function D6($,Z,z){let[Q,X]=Z.split("."),J=$[Q];if(!$0(J))return;if(z===void 0?!(X in J):J[X]===z)return;let Y={...J};if(z===void 0)delete Y[X];else Y[X]=z;$[Q]=Y}var O6=($)=>typeof $==="string"&&$.trim()===e$;function $j($,Z){let z=Z.map((Q)=>v0($,Q));return z.some(O6)&&z.every((Q)=>U0(Q)||O6(Q))}function yW($,Z){let z={...$};for(let Q of J0){let X=E3(Q);if(!$j(Z,X))continue;for(let J of X){let Y=v0(Z,J);if(v0(z,J)!==Y)D6(z,J,Y)}}return z}function e6($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)&&Object.prototype.hasOwnProperty.call(X,Q)}function Zj($,Z){let z={...$};for(let Q of J0){if(!Q.canonical||!e6(Z,Q.canonical)||e6(Z,Q.path))continue;let X=v0(z,Q.path);D6(z,Q.path,void 0);let J=v0(z,Q.canonical);if(WZ(X)&&U0(J))D6(z,Q.canonical,X)}return z}function zj($,Z){let z={...$};for(let Q of J0){if(!Q.canonical||!e6(Z,Q.canonical)||e6(Z,Q.path))continue;let X=v0(z,Q.canonical);if(WZ(X)||O6(X))D6(z,Q.path,X)}return z}function Qj($,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 U=d6(X,Y);if(U===null)return $;if(U){let W=typeof X==="string"&&b5[X]?.has(Y.path)===!0;Xj(J,Z,Y,Y.path.startsWith("stack.")?z[Y.path.slice(6)]:void 0,W)}else Jj(J,Y)}return J}function Xj($,Z,z,Q,X=!1){let J=E3(z),Y=(W)=>!U0(v0($,W))&&!O6(v0($,W));for(let W of J){if(!O6(v0($,W)))continue;if(X)D6($,W,J.some(Y)?void 0:"");else if(!O6(v0(Z,W)))D6($,W,e6(Z,W)?v0(Z,W):"")}if(!WZ(Q))return;let U=J.filter((W)=>e6($,W));if(U.some((W)=>!U0(v0($,W))))return;for(let W of U.length>0?U:[z.path])D6($,W,Q)}function Jj($,Z){let z=E3(Z).filter((X)=>e6($,X)),Q=(X)=>!U0(v0($,X))&&!O6(v0($,X));if(z.some(Q))return;for(let X of z.length>0?z:[Z.path])if(U0(v0($,X)))D6($,X,e$)}function Yj($){let Z=$.project;if(Z===null||Z===void 0||$0(Z)||Array.isArray(Z))return $;return{...$,project:{name:String(Z)}}}function Uj($){let Z=$.project?.type??"library",z=l6[Z]||l6.library;for(let Q of J0){if(z.includes(Q.category)||b5[Z]?.has(Q.path))continue;let[X,J]=Q.path.split(".");if(X==="stack"&&$.stack)$.stack[J]="slotignored";if(X==="monorepo"&&$.monorepo)$.monorepo[J]="slotignored"}}function L4($,Z){return vW($,Z,"")}function Wj($){let Z=H6.get($);return Z!==void 0&&Z.category!=="human"}function WZ($){if(typeof $==="number"||typeof $==="boolean")return!0;return typeof $==="string"&&$.trim()!==""&&!U0($)&&!O6($)}function Gj($,Z){return Wj($)&&WZ(Z)}function vW($,Z,z){let Q={...$};for(let[X,J]of Object.entries(Z)){let Y=Q[X],U=z?`${z}.${X}`:X;if(U==="_meta"&&Y!==void 0)continue;if(p2(Y)){if(Gj(U,J))Q[X]=J;continue}if(U0(Y))Q[X]=J;else if($0(J)&&$0(Y))Q[X]=vW(Y,J,U)}return Q}import{existsSync as gW,lstatSync as Vj}from"fs";import{join as qj,basename as Kj}from"path";import{createHash as Hj}from"crypto";var G2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($),P2=($)=>typeof $==="number"&&Number.isFinite($),R2=($)=>typeof $==="string",Bj=/^v?\d+\.\d+\.\d+$/,Mj=new Set(["birth","doubled","peak","current"]);function mW($){return G2($)&&R2($.version)&&Bj.test($.version)&&P2($.score)}var Lj=($)=>P2($.birthDNA)?$.birthDNA:P2($.birthWeight)?$.birthWeight:null,Dj=($)=>G2($)&&P2($.birthDNA)&&R2($.born),hW=($)=>G2($)&&R2($.born)&&P2($.birthDNA)&&P2($.lastScore)&&R2($.endedAt),Oj=($)=>Array.isArray($)&&$.length>0&&$.every(mW),Nj=($)=>G2($)&&P2($.score)&&R2($.version),Ij=($)=>G2($)&&Array.isArray($.milestones)&&$.milestones.every(G2);function fW($){return G2($)&&Dj($.birthCertificate)&&Oj($.versions)&&Nj($.current)&&Ij($.growth)}function Tj($){try{return Vj($),!0}catch{return!1}}var w3=($)=>`${JSON.stringify($,null,2)}
242
- `,Aj=new Set(["version","score","lastSync"]),Cj=new Set(["type","score","date","version","label","emoji"]),uW=($,Z)=>Object.keys($).every((z)=>Z.has(z)),x3={birth:{label:"Birth",emoji:"\uD83D\uDC23"},doubled:{label:"Doubled",emoji:"2️⃣"},peak:{label:"Peak",emoji:"\uD83C\uDFD4️"},current:{label:"Current",emoji:"\uD83D\uDCCD"}},cW=($)=>$.growth.milestones.filter((Z)=>Z.type==="peak"||Z.type==="current"),pW=($)=>uW($.current,Aj)&&cW($).every((Z)=>uW(Z,Cj)),_j=($)=>cW($).every((Z)=>Z.label===x3[Z.type].label&&Z.emoji===x3[Z.type].emoji);function Rj($){return pW($)&&_j($)}var Pj=".faf-dna is not in faf's shape: faf reads it and leaves it as it is.",Fj=".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.",jj=".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.",Sj=".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.",Ej=".faf-dna has no birth certificate faf can read: faf leaves it as it is.";function wj($){if(!Array.isArray($))return[];return $.filter((Z)=>G2(Z)&&R2(Z.type)&&Mj.has(Z.type)&&P2(Z.score))}var $1=($,Z="")=>R2($)?$:Z;function xj($,Z){if(!Array.isArray($))return[];return $.filter(mW).map((z)=>({version:z.version,timestamp:$1(z.timestamp),score:z.score,changes:Array.isArray(z.changes)?z.changes.filter(R2):[],growth:P2(z.growth)?z.growth:z.score-Z}))}function yj($,Z,z,Q){return{version:$1($.version,Z?.version??"v1.0.0"),score:P2($.score)?$.score:Z?.score??z,lastSync:$1($.lastSync,Q)}}function lW($){if(!G2($)||!G2($.birthCertificate))return null;let Z=$.birthCertificate,z=Lj(Z);if(z===null)return null;let Q=$1(Z.born),X=xj($.versions,z),J=yj(G2($.current)?$.current:{},X[X.length-1],z,Q),Y=G2($.growth)?$.growth:{};return{birthCertificate:{born:Q,birthDNA:z,birthDNASource:Z.birthDNASource==="legacy"||Z.birthWeightSource==="legacy"?"legacy":"init",projectDNA:$1(Z.projectDNA),certificate:$1(Z.certificate)},versions:X,current:J,growth:{totalGrowth:J.score-z,daysActive:P2(Y.daysActive)?Y.daysActive:0,milestones:wj(Array.isArray(Y.milestones)?Y.milestones:$.milestones)},lastModified:$1($.lastModified,Q),format:"faf-dna-v1",...Array.isArray($.priorLineage)&&$.priorLineage.some(hW)?{priorLineage:$.priorLineage.filter(hW)}:{}}}function dW($){try{return lW(JSON.parse($))?.birthCertificate??null}catch{return null}}class o0{projectPath;dnaPath;dna=null;own=!1;text;reason=null;constructor($){this.projectPath=$,this.dnaPath=qj($,".faf-dna")}exists(){return gW(this.dnaPath)}birth($){if(i(this.projectPath,".faf-dna"),Tj(this.dnaPath))throw new v("exists",this.dnaPath,`${this.dnaPath} is already there: a birth certificate is written once and never replaced — not written; original kept`);let Z=new Date().toISOString();return this.own=!0,this.dna={birthCertificate:{born:Z,birthDNA:$,birthDNASource:"init",projectDNA:this.generateProjectDNA(),certificate:this.generateCertificate()},versions:[{version:"v1.0.0",timestamp:Z,score:$,changes:["Birth — initial context"],growth:0}],current:{version:"v1.0.0",score:$,lastSync:Z},growth:{totalGrowth:0,daysActive:0,milestones:[{type:"birth",score:$,date:Z,version:"v1.0.0",label:"Birth",emoji:"\uD83D\uDC23"}]},lastModified:Z,format:"faf-dna-v1"},this.text=void 0,this.save(),this.dna}isFafShape(){return this.load()!==null&&this.own}readOnlyReason(){return this.load(),this.own?null:this.reason}recordGrowth($,Z){if(!this.dna&&!this.load())return null;if(!this.own)return null;let z=this.dna;if($===z.current.score)return z;let Q=new Date().toISOString(),X=z.birthCertificate.birthDNA,J=$-X,Y=this.incrementVersion(z.versions[z.versions.length-1].version);return z.versions.push({version:Y,timestamp:Q,score:$,changes:Z,growth:J}),z.current={version:Y,score:$,lastSync:Q},z.growth.totalGrowth=J,z.growth.daysActive=this.daysSince(z.birthCertificate.born),this.updateMilestones($,Y,Q),this.save(),z}getJourney(){if(!this.dna&&!this.load())return"";let $=this.dna,Z=$.birthCertificate.birthDNA,z=$.growth.milestones.find((J)=>J.type==="peak"),Q=$.current.score,X=`${Z}%`;if(z&&z.score!==Z){if(X+=` → ${z.score}%`,Q<z.score)X+=` ← ${Q}%`}else if(Q!==Z)X+=` → ${Q}%`;return X}getBirthDNADisplay(){if(!this.dna&&!this.load())return null;let $=this.dna;return{current:$.current.score,birthDNA:$.birthCertificate.birthDNA,growth:$.current.score-$.birthCertificate.birthDNA,born:R2($.birthCertificate.born)?$.birthCertificate.born:""}}getLog(){if(!this.dna&&!this.load())return[];return this.dna.versions.map(($)=>{let Z=$.growth>50?"\uD83D\uDE80":$.growth>20?"\uD83D\uDCC8":"\uD83D\uDCCA",z=R2($.timestamp)?$.timestamp.split("T")[0]:"",Q=Array.isArray($.changes)?$.changes.filter(R2).join(", "):"";return`${$.version} — ${$.score}% ${Z} (${z}) ${Q}`})}load(){if(this.dna)return this.dna;if(!gW(this.dnaPath))return null;let $=this.read();if($===null)return null;let{text:Z,raw:z}=$;if(fW(z)&&w3(z)===Z&&Rj(z))this.own=!0,this.reason=null,this.dna=z;else this.own=!1,this.dna=lW(z),this.reason=!this.dna?Ej:!fW(z)?Pj:w3(z)!==Z?Fj:pW(z)?Sj:jj;return this.text=Z,this.dna}read(){let $;try{$=G0(i(this.projectPath,".faf-dna"))}catch(Z){return this.reason=Z instanceof Error?Z.message:String(Z),null}try{return{text:$,raw:JSON.parse($)}}catch{return this.reason=".faf-dna is not JSON: faf leaves it as it is.",null}}save(){if(!this.dna)return;this.dna.lastModified=new Date().toISOString();let $=w3(this.dna),Z=this.text??null;o(this.dnaPath,$,{root:this.projectPath,expect:Z}),this.text=$}generateProjectDNA(){return Hj("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=Kj(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=(W)=>Q.some((G)=>G.type===W),J=(W)=>Q.push({type:W,score:$,date:z,version:Z,...x3[W]});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!X("doubled"))J("doubled");let Y=Q.find((W)=>W.type==="peak");if(!Y||$>Y.score){if(Y)Q.splice(Q.indexOf(Y),1);J("peak")}let U=Q.findIndex((W)=>W.type==="current");if(U>=0)Q.splice(U,1);J("current")}}import{spawnSync as nW}from"child_process";import{readFileSync as bj}from"fs";import{isAbsolute as kj,join as iW}from"path";function y3($){let Z=nW("git",["check-ignore","-v","--",".faf-dna"],{cwd:$,encoding:"utf-8"});if(Z.status!==0||typeof Z.stdout!=="string")return null;let z=/^(.*):(\d+):(.*)\t/.exec(Z.stdout);if(!z)return null;let[,Q,X,J]=z;if(J.startsWith("!"))return null;if(vj($,Q,Number(X)))return null;return`${Q}:${X}: ${J}`}function vj($,Z,z){if(z<2)return!1;let Q=nW("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}),X=kj(Z)?[Z]:[iW($,Z),...Q.status===0?[iW(Q.stdout.trim(),Z)]:[]];for(let J of X)try{return(bj(J,"utf-8").split(/\r?\n/)[z-2]??"").trim().startsWith("#")}catch{}return!1}function GZ($){let Z=y3($);if(!Z)return null;return`.faf-dna is gitignored (${Z}): a fresh clone loses the birth certificate. Commit it, or put the reason in a # comment above that line.`}import{spawnSync as gj}from"child_process";var hj=["certificate","born","birthDNA","projectDNA"];function D4($,Z){let z=gj("git",Z,{cwd:$,encoding:"utf-8"});return{ok:z.status===0&&typeof z.stdout==="string",out:typeof z.stdout==="string"?z.stdout:""}}function rW($){let Z=D4($,["rev-parse","--is-inside-work-tree"]);return Z.ok&&Z.out.trim()==="true"}function sW($){let Z=D4($,["log","--diff-filter=A","--reverse","--format=%h%x09%cs","--",".faf-dna"]),z=Z.ok?Z.out.split(`
243
- `)[0]:"";if(!z)return null;let[Q,X]=z.split("\t");return{commit:Q,date:X??""}}function VZ($){if(!rW($))return null;if(D4($,["check-ignore","-q","--",".faf-dna"]).ok)return null;if(sW($))return null;return'The birth certificate is not committed yet. Commit it to make it permanent: git add .faf-dna && git commit -m "faf: birth certificate"'}function oW($,Z){if(!rW($))return{state:"cannot",why:"this is not a git repository, so there is no birth commit to check against."};if(D4($,["rev-parse","--is-shallow-repository"]).out.trim()==="true")return{state:"cannot",why:"this is a shallow clone, so the commit that first added .faf-dna may be missing. Fetch the full history (git fetch --unshallow) and run it again."};let z=sW($);if(!z)return{state:"cannot",why:Z?'.faf-dna is not committed yet. Commit it to make it permanent: git add .faf-dna && git commit -m "faf: birth certificate"':"there is no .faf-dna, and no commit ever added one."};let Q=D4($,["show",`${z.commit}:./.faf-dna`]),X=Q.ok?dW(Q.out):null;if(!X)return{state:"cannot",why:`the .faf-dna in ${z.commit} has no birth certificate faf can read.`};if(!Z)return{state:"changed",...z,fields:[".faf-dna is missing"]};let J=hj.filter((Y)=>X[Y]!==Z[Y]);return J.length===0?{state:"same",...z}:{state:"changed",...z,fields:[...J]}}l();l();import{statSync as aW}from"fs";import{homedir as fj}from"os";import{parse as uj,resolve as tW}from"path";function eW($,Z){try{let z=aW($,{bigint:!0}),Q=aW(Z,{bigint:!0});return z.isDirectory()&&z.ino!==0n&&z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function mj($){let Z=tW($),z=tW(fj()),Q=uj(Z).root;if(Z===z)return"home";if(Z===Q||Z==="/"||/^[A-Za-z]:[\\/]?$/.test(Z))return"root";if(eW(Z,z))return"home";if(eW(Z,Q))return"root";return null}function u1($=process.cwd(),Z="faf"){let z=mj($);if(z===null)return;let Q=z==="home"?"your home directory (~)":"the filesystem root";console.error(`${A("faf")}: ${Q} is not a project.`),console.error(""),console.error(` ${C("cd")} into a real repo (or any folder you mean to own), then run again:`),console.error(M(" cd /path/to/your-project")),console.error(M(` ${Z}`)),console.error(""),console.error(M(" Home will never be a git repo for this. project.faf belongs with the code.")),process.exit(1)}import{statSync as cj}from"fs";import{dirname as pj,resolve as $G}from"path";function lj($,Z){if($.reason==="not-utf8"||$.reason==="changed"||$.reason==="exists"||$.reason==="not-yaml"||$.reason==="unplaceable")return"";if($.reason==="not-owned")return Z&&!$.message.includes("--force")?" Use --force to replace it.":"";return $.onWrite?" Nothing was written to it.":" Nothing was read from or written to it."}function m1($){return $ instanceof v||$ instanceof c2}function c1($,Z){return $ instanceof v?`faf: ${$.message}${lj($,Z)}`:`faf: ${$.message}`}function V2($){if($===void 0)return;let Z=pj($G($)),z;try{z=cj(Z).isDirectory()?null:"is not a folder"}catch(Q){let X=Q?.code;if(X!=="ENOENT"&&X!=="ENOTDIR")throw Q;z="does not exist"}if(z!==null)throw new c2($G($),`${Z} ${z} — nothing written`)}var N6=($,Z,z)=>({value:$,source:Z,confidence:z});function ZG($,Z={}){let z=Z.toolingRoot?null:dj($),Q=ij($),X={},J=(Y,U)=>{if(U&&C0(U.value))X[Y]=U};return J("what",aj(z,Q)),J("who",tj(Q)),J("why",ej(Q)),J("when",$S(Q)),J("how",ZS(Q)),X}function dj($){let Z=g($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function ij($){let Z=g($,"README.md");if(Z===null)return"";return UZ(Z.replace(/<!--[\s\S]*?-->/g,"").split(`
226
+ `)}}var M3=($)=>$.startsWith("\uFEFF")?$.slice(1):$;function zP($){let Z={};for(let[z,Q]of Object.entries($.slots??{}))Z[WU.get(z)??z]=Q;return{...$,slots:Z}}function P0($){return zP(JSON.parse(q4().score_faf(M3($))))}function dU($){return q4().validate_faf(M3($))}function s5($){return q4().compile_fafb(M3($))}function iU($){return JSON.parse(q4().decompile_fafb($))}function nU(){return q4().sdk_version()}var rU=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function sU($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function oU($){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 U=parseInt(J[1],10);if(U>=0&&U<=100)Y=U}return{represents:X,sourceScore:Y}}function L3($){return $.unknown?"unknown (—)":`${$.score}%`}function v0($){return{score:$.score,tier:N6($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function M0($){let Z=oU($);if(Z){let z=Z.sourceScore;return{score:z,tier:z>=0?N6(z):f1[f1.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Z.represents,...z<0?{unknown:!0}:{}}}return v0(P0($))}function QP($,Z){let[z,Q]=Z.split("."),X=$[z];return e(X)?X[Q]:void 0}function D3($){try{let Z=l2($,{logLevel:"error"}).getIn(["project","type"],!0);return N0(Z)&&typeof Z.comment==="string"&&Z.comment.includes(k1)}catch{return!1}}function XP($,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 JP($){try{let Z=l2($,{logLevel:"error"});if(Z.errors.length>0)return null;let z=Z.toJS();return e(z)?z:null}catch{return null}}function o5($,Z,z={}){let Q=JP($);if(Q===null)return[];let X=e(Q.project)&&!D3($)?Q.project.type:void 0,J=[];for(let Y of X0){let U=QP(Q,Y.path);if(Z.slots[Y.path]!=="empty"||!i2(U))continue;let W=n6.library.includes(Y.category),G=XP(Y.path,String(U).trim(),r6(X,Y),W,z.outOfType!==!1);if(G!==null)J.push(G)}return J}i();i();import{existsSync as YP,readFileSync as UP}from"fs";import{join as aU}from"path";import{homedir as WP}from"os";var GP=95,VP=30,qP=3,O3=aU(WP(),".config","faf"),N3=aU(O3,"star-nudge"),KP="github.com/Wolfe-Jam/faf-cli";function HP($){if($.score<GP)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??qP))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??VP)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function BP(){try{if(!YP(N3))return{shown:0,lastShownMs:null};let $=UP(N3,"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 MP($){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 LP($,Z){try{E0(O3),y2(N3,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}),{root:O3,owns:MP,mark:"faf star-nudge state"})}catch{}}function tU($){let Z=Date.now(),z=BP();if(!HP({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(` ${_0("★")} ${M("Enjoying faf-cli? A star helps others find it:")} ${KP}`),LP(z.shown,Z)}function w0($,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=C2($.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),U=Y.slice(0,3).join(", "),W=Y.length>3?`, +${Y.length-3} more`:"",G=$.empty===1?"slot":"slots";console.log(M(` ${$.empty} ${G} from Trophy: ${U}${W}`))}if(DP(Q),z)console.log(""),OP($);tU($.score)}function DP($){for(let Z of $)console.log(M(` ${Z}`))}function OP($){for(let[Z,z]of Object.entries($.slots)){let Q=z==="populated"?A("●"):z==="slotignored"?M("—"):M("○");console.log(` ${Q} ${z==="slotignored"?M(`${Z}: slotignored`):Z}`)}}i();function a5($,Z={}){let z=$??c();if(!z)console.error(`Error: project.faf not found
227
+
228
+ Run 'faf init' to create one.`),process.exit(2);let Q=l(z);U2(Q,z);let X=o(z,()=>M0(Q));if(Z.json){let J=a(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(L3(X))}`:`${C2(X.tier)} ${C(L3(X))}`);return}w0(X,z,Z.verbose,o5(Q,X))}import{existsSync as KG}from"fs";import{dirname as _S,join as c3,relative as PS,resolve as FS}from"path";var u1="3.0";import{join as KW}from"path";var eU=[{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 IP}from"path";var m1={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 TP=m1.flutterDeps,AP=m1.mcpDeps,CP=m1.serverFrameworks,_P=m1.stateManagement,PP=m1.routing;function FP($){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 t5($){let Z=g($,"pubspec.yaml");if(Z===null)return null;let z=FP(Z),Q=(_)=>z.has(_.toLowerCase()),X=TP.some(Q)||/^flutter:\s*$/m.test(Z)||/\bsdk:\s*flutter\b/.test(Z),J=AP.find(Q),Y=CP.find(([_])=>Q(_)),U=_P.find(([_])=>Q(_)),W=U?U[1]:"",G=PP.find(([_])=>Q(_)),V=G?G[1]:"",q=Q("flutter_test")?"flutter_test":Q("test")?"test":"",K=/^executables:\s*$/m.test(Z),L=(Q0($,"bin")??[]).some((_)=>_.name.endsWith(".dart")),B=K||L,H,D="",N;if(X)if(D="Flutter",I($,IP("lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(Z))H="mobile",N="pubspec.yaml (Flutter app)";else H="library",N="pubspec.yaml (Flutter package)";else if(J)H="mcp",N=`pubspec.yaml + ${J} (Dart MCP server)`;else if(Y)H="backend",D=Y[1],N=`pubspec.yaml + ${Y[0]} (Dart backend)`;else if(B)H="cli",N=K?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else H="library",N="pubspec.yaml (Dart package)";return{appType:H,isFlutter:X,framework:D,stateManagement:W,routing:V,testing:q,found:N}}import{join as jP}from"path";var e5={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 SP=e5.mcpModules,EP=e5.serverFrameworks,wP=e5.cliFrameworks;function xP($){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 ZW($,Z){let z=Z.toLowerCase();for(let Q of $)if(Q===z||Q.startsWith(`${z}/`))return!0;return!1}function $W($,Z){let z;for(let Q of Z){if(!ZW($,Q[0]))continue;if(!z||Q[0].length>z[0].length)z=Q}return z}function yP($,Z){let z;for(let Q of Z){if(!ZW($,Q))continue;if(!z||Q.length>z.length)z=Q}return z}function bP($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function kP($){for(let{name:Z}of Q0($,"cmd")??[]){let z=jP("cmd",Z),Q=T2($,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 vP($){let Z=g($,"main.go");return Z!==null&&/^package\s+main\b/m.test(Z)}function $Z($){let Z=g($,"go.mod");if(Z===null)return null;let z=bP(Z),Q=xP(Z),X=yP(Q,SP),J=$W(Q,EP),Y=$W(Q,wP),U=kP($),W=vP($),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(U)G="cli",q="go.mod + cmd/ (Go CLI layout)";else if(W&&!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 a6={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 hP=a6.mcpPackages.map(($)=>$.toLowerCase()),fP=a6.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),uP=a6.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),mP=a6.grpcServerPackages.map(($)=>$.toLowerCase()),cP=a6.specializedSdks,zW=a6.baseSdk.toLowerCase();function pP($){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],U=($.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i)?.[1]||J||"").trim(),W=/<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($),K=new Set;for(let B of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))K.add(B[1].toLowerCase());for(let B of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))K.add(B[1].toLowerCase());let L=new Set;for(let B of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))L.add(B[1].toLowerCase());return{sdk:Q,outputType:X,targetFramework:U,isTestProject:W,useMaui:G,useWpf:V,useWindowsForms:q,packages:K,frameworkRefs:L}}function I3($,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(!I3($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function lP($){let Z;for(let z of hP){if(!I3($,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 dP($){let Z=$.toLowerCase();if(!Z)return;let z;for(let Q of cP){let X=Q[0].toLowerCase();if(Z===X||Z.startsWith(`${X}/`)){if(!z||X.length>z[0].length)z=Q}}return z}function ZZ($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function iP($,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 nP($,Z){let z=Z.replace(/\.csproj$/i,""),{sdk:Q,packages:X,frameworkRefs:J,outputType:Y}=$,U,W="",G,V=lP(X),q=dP(Q),K=QW(X,uP),L=QW(X,fP),B=mP.some((D)=>I3(X,D)),H=J.has("microsoft.aspnetcore.app");if(V)U="mcp",W="MCP",G=`${Z} + ${V} (C# MCP server)`;else if($.isTestProject||q?.[1]==="test"||K)U="library",W=K?.[1]||(q?.[1]==="test"?q[2]:"Test"),G=`${Z} + test (${W})`;else if($.useMaui)U="mobile",W="MAUI",G=`${Z} + UseMaui (MAUI)`;else if($.useWpf||$.useWindowsForms)U="backend",W=$.useWpf&&$.useWindowsForms?"WPF+WinForms":$.useWpf?"WPF":"Windows Forms",G=`${Z} + ${W}`;else if(q?.[1]==="web")U="backend",W=B?"gRPC":q[2],G=`${Z} + Sdk=${q[0]}${B?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(q?.[1]==="worker")U="backend",W=q[2],G=`${Z} + Sdk=${q[0]} (Worker)`;else if(q?.[1]==="blazor-wasm")U="backend",W=q[2],G=`${Z} + Sdk=${q[0]} (Blazor WASM)`;else if(q?.[1]==="aspire")U="backend",W=q[2],G=`${Z} + Sdk=${q[0]} (Aspire)`;else if(q?.[1]==="razor-lib")U="library",W=q[2],G=`${Z} + Sdk=${q[0]} (Razor class library)`;else if(H&&ZZ(Y))U="backend",W="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(H&&!ZZ(Y))U="library",W="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(L&&(ZZ(Y)||!Y))U="cli",W=L[1],G=`${Z} + ${L[0]} (C# CLI)`;else if(ZZ(Y))U="cli",G=`${Z} + OutputType=Exe (C# console)`;else{U="library";let D=Q?` Sdk=${Q}`:"";if(G=`${Z}${D} (C# class library)`.replace(" Sdk=Microsoft.NET.Sdk",""),!Q||Q.toLowerCase()===zW||Q.toLowerCase().startsWith(`${zW}/`))G=`${Z} (C# class library)`}return{appType:U,projectName:z,targetFramework:$.targetFramework,sdk:Q||"Microsoft.NET.Sdk",framework:W,found:G}}function c1($){return(Q0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}function zZ($){let Z=c1($);if(Z.length===0)return null;let z=null,Q=999;for(let X of Z){let J=g($,X);if(J===null)continue;let Y=pP(J),U=nP(Y,X),W=iP(U.appType,U.framework);if(!z||W<Q)z=U,Q=W}return z}import{join as t6}from"path";var _2={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 sP=_2.mcpArtifacts.map(($)=>$.toLowerCase()),oP=_2.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),aP=_2.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),tP=_2.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),eP=_2.androidPlugins.map(($)=>$.toLowerCase()),$F=_2.kmpPlugins.map(($)=>$.toLowerCase()),ZF=_2.jvmKotlinPlugins.map(($)=>$.toLowerCase()),zF=_2.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),QF=_2.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),XF=_2.libraryPlugins.map(($)=>$.toLowerCase()),JF=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function T3($){return JF.some((Z)=>I($,Z))}function YF($){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 U=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bid\s*=\s*"([^"]+)"/);if(U&&(Q==="plugins"||Q.endsWith(".plugins"))){Z.set(U[1].replace(/-/g,".").toLowerCase(),U[2].toLowerCase()),Z.set(U[1].toLowerCase(),U[2].toLowerCase());continue}let W=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bmodule\s*=\s*"([^"]+)"/);if(W&&(Q==="libraries"||Q.endsWith(".libraries"))){let q=W[1].toLowerCase();z.set(q,W[2].toLowerCase()),z.set(q.replace(/-/g,"."),W[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(),K=G[1].toLowerCase();z.set(K,q),z.set(K.replace(/-/g,"."),q);continue}let V=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(V){let q=V[1].toLowerCase(),K=V[2];if(Q==="plugins"||Q.endsWith(".plugins")){let L=K.split(":")[0].toLowerCase();Z.set(q,L),Z.set(q.replace(/-/g,"."),L)}else if(Q==="libraries"||Q.endsWith(".libraries")){let L=K.split(":");if(L.length>=2){let B=`${L[0]}:${L[1]}`.toLowerCase();z.set(q,B),z.set(q.replace(/-/g,"."),B)}}}}return{plugins:Z,libraries:z}}function UF($){let Z=g($,t6("gradle","libs.versions.toml"));if(!Z)return{plugins:new Map,libraries:new Map};return YF(Z)}function WF($){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 GF($,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 VF($,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 U=Z.libraries.get(Y);if(U){z.add(U.includes(":")?U.split(":").slice(0,2).join(":"):U);break}}}return z}function YW($){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(),U=Q[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(Y&&U)z.add(`${Y}:${U}`.toLowerCase())}let X=new Set;for(let Y of $.matchAll(/<dependency>([\s\S]*?)<\/dependency>/gi)){let U=Y[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),W=Y[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(U&&W)X.add(`${U}:${W}`.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 I6($,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 K4($,Z,z){let Q;for(let[X,J]of Z){let Y=!1;if(z==="plugin")Y=I6($,X);else if(Y=$.has(X)||[...$].some((U)=>U===X||U.startsWith(`${X}:`)||U.startsWith(`${X}.`)),!Y&&z==="artifact")Y=[...$].some((U)=>U===X||U.startsWith(`${X}`));if(!Y)continue;if(!Q||X.length>Q[0].length)Q=[X,J]}return Q}function qF($){let Z;for(let z of sP)for(let Q of $){if(Q===z||Q.startsWith(`${z}:`)||Q.startsWith(z.replace(/:mcp$/,":"))){if(!Z||z.length>Z.length)Z=z}if(Q.startsWith("io.modelcontextprotocol")||Q.includes("spring-ai-starter-mcp")||Q.includes("spring-ai-mcp")){if(!Z||Q.length>Z.length)Z=Q}}return Z}function UW($,Z){let z=new Set,Q=!1,X=!1,J=[t6(Z,"src"),t6(Z,"src","main")],Y=(U,W)=>{if(W>4)return;let G=Q0($,U);if(!G)return;for(let{name:V}of G){if(V==="androidMain"||V==="commonMain"||V==="jvmMain"||V==="iosMain")z.add(V);let q=t6(U,V),K=T2($,q);if(!K)continue;if(K.isDirectory())Y(q,W+1);else if(V.endsWith(".kt")||V.endsWith(".kts"))Q=!0;else if(V.endsWith(".java"))X=!0}};for(let U of J)Y(U,0);return{kotlin:Q,java:X,hints:z}}function KF($){let Z=[],z=$.plugins,Q=$.artifacts,X=$F.some((j)=>I6(z,j))||$.sourceHints.has("commonMain"),J=I6(z,"com.android.application"),Y=!J&&eP.some((j)=>I6(z,j));if(J||Y)Z.push("android");if(X)Z.push("multiplatform");let U=qF(Q),W=K4(z,oP,"plugin"),G=K4($.parents,aP,"parent"),V=K4(Q,tP,"artifact"),q=K4(z,zF,"plugin"),K=K4(Q,QF,"artifact"),L=XF.some((j)=>I6(z,j)),B=$.packaging==="pom",H,D="",N;if(J)H="mobile",D=X?"Android+KMP":"Android",N=`${$.path||"root"} + com.android.application (${D})`;else if(U)H="mcp",D="MCP",Z.push("mcp"),N=`${$.path||"root"} + ${U} (JVM MCP server)`;else if(W||G||V){H="backend",D=W?.[1]||G?.[1]||V?.[1]||"JVM";let j=W?.[0]||G?.[0]||V?.[0]||"web";N=`${$.path||"root"} + ${j} (JVM backend)`}else if(X&&!Y)H="library",D="Kotlin Multiplatform",N=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(Y)H="library",D=X?"Android+KMP":"Android",N=`${$.path||"root"} + android library (${D})`;else if(K||$.hasApplicationPlugin&&($.hasMainClass||q)||q&&$.hasMainClass)H="cli",D=K?.[1]||"application",N=K?`${$.path||"root"} + ${K[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!L)H="cli",D="application",N=`${$.path||"root"} + application plugin (JVM CLI)`;else if(B)H="library",N=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{H="library";let j=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(N=`${$.path||"root"} (${j} library)`,L)N=`${$.path||"root"} + java-library (JVM library)`}let _="Java";if($.kotlinSources&&$.javaSources)_="Java/Kotlin";else if($.kotlinSources||ZF.some((j)=>I6(z,j))||X)_="Kotlin";let E=[...new Set(Z)];return{appType:H,framework:D,facets:E,found:N,buildTool:$.buildTool,mainLanguage:_}}function HF($,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 XW($,Z,z){let Q=t6(Z,"build.gradle.kts"),X=t6(Z,"build.gradle"),J=I($,Q)?Q:I($,X)?X:null;if(!J)return null;let Y=g($,J);if(!Y)return null;let U=GF(Y,z),W=VF(Y,z),G=UW($,Z),V=/mainClass\s*[.=]/.test(Y)||/mainClassName\s*=/.test(Y)||/Main-Class/.test(Y),q=I6(U,"application")||I6(U,"org.gradle.application");return{path:Z||"build.gradle",plugins:U,artifacts:W,packaging:"jar",parents:new Set,hasMainClass:V,hasApplicationPlugin:q,sourceHints:G.hints,kotlinSources:G.kotlin||J.endsWith(".kts"),javaSources:G.java,buildTool:"gradle"}}function JW($,Z){let z=g($,t6(Z,"pom.xml"));if(!z)return null;let{packaging:Q,parents:X,artifacts:J}=YW(z),Y=UW($,Z);return{path:Z?`${Z}/pom.xml`:"pom.xml",plugins:new Set,artifacts:J,packaging:Q,parents:X,hasMainClass:/<mainClass>/.test(z),hasApplicationPlugin:!1,sourceHints:Y.hints,kotlinSources:Y.kotlin,javaSources:Y.java,buildTool:"maven"}}function H4($){if(!T3($))return null;let Z=UF($),z=[],Q=null;for(let G of["settings.gradle.kts","settings.gradle"])if(I($,G)){Q=g($,G);break}let X=Q?WF(Q):[],J=XW($,"",Z);if(J)z.push(J);for(let G of X){let V=XW($,G,Z);if(V)z.push(V)}let Y=JW($,"");if(Y){z.push(Y);let G=g($,"pom.xml");if(G){let{modules:V}=YW(G);for(let q of V){let K=JW($,q);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 U=null,W=999;for(let G of z){let V=KF(G),q=HF(V.appType,V.facets);if(!U||q<W)U={appType:V.appType,framework:V.framework,buildTool:V.buildTool,mainLanguage:V.mainLanguage,facets:V.facets,found:V.found},W=q}if(U&&X.length>0&&!U.found.includes("multi-project"));return U}import{join as MF}from"path";var B4={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 LF=B4.mcpGems.map(($)=>$.toLowerCase()),DF=B4.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),WW=B4.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),OF=B4.railsLayoutFiles;function NF($){return I($,"Gemfile")||I($,"gems.rb")||IF($)}function IF($){return(Q0($)??[]).some((Z)=>Z.name.endsWith(".gemspec"))}function TF($){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 AF($){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 CF($){let Z=new Set;for(let z of $.split(`
234
+ `)){let X=z.replace(/#.*$/,"").match(/add_(?:runtime_|development_)?dependency\s*\(?\s*['"]([^'"]+)['"]/i);if(X)Z.add(X[1].toLowerCase())}return Z}function _F($){let Z=new Set,z=[];for(let X of["Gemfile","gems.rb"]){let J=g($,X);if(J){for(let Y of TF(J))Z.add(Y);z.push(X)}}let Q=g($,"Gemfile.lock")||g($,"gems.locked");if(Q){for(let X of AF(Q))Z.add(X);z.push("Gemfile.lock")}for(let{name:X}of Q0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=g($,X);if(J){for(let Y of CF(J))Z.add(Y);z.push(X)}}return{gems:Z,sources:z}}function M4($,Z){let z=Z.toLowerCase();if($.has(z))return!0;return!1}function A3($,Z){let z;for(let[Q,X]of Z){if(!M4($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function PF($){let Z;for(let z of LF)if(M4($,z)&&(!Z||z.length>Z.length))Z=z;return Z}function GW($){for(let Z of OF)if(I($,Z))return Z;return}function FF($,Z){let z=A3(Z,WW);if(z)return{hit:!0,why:z[0]};for(let{name:X}of Q0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=g($,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 T2($,MF("bin",Y))?.isFile()===!0}).filter((Y)=>Y!=="rails");if(J.length>0&&!M4(Z,"rails")&&!GW($))return{hit:!0,why:`bin/${J[0]}`}}return{hit:!1,why:""}}function QZ($){if(!NF($))return null;let{gems:Z,sources:z}=_F($),Q=z[0]||"Gemfile",X=z.some((D)=>D==="Gemfile"||D==="gems.rb"||D.includes("lock"))?"bundler":"rubygems",J=PF(Z),Y=A3(Z,DF),U=GW($),W=M4(Z,"rails")||M4(Z,"railties"),G=FF($,Z),V=I($,"config.ru"),q=W||!!U,K=Y&&Y[1]!=="Rails"&&!(Y[0]==="rack"&&!V)?Y:void 0,L,B="",H;if(J)L="mcp",B="MCP",H=`${Q} + gem ${J} (Ruby MCP)`;else if(q)if(L="backend",B="Rails",W&&U)H=`${Q} + rails + ${U} (Rails)`;else if(W)H=`${Q} + gem rails (Rails)`;else H=`${U} (Rails layout)`;else if(K)L="backend",B=K[1],H=`${Q} + gem ${K[0]} (Ruby backend)`;else if(G.hit)L="cli",B=A3(Z,WW)?.[1]||"",H=`${Q} + ${G.why} (Ruby CLI)`;else L="library",H=`${Q} (Ruby library)`;return{appType:L,framework:B,packageManager:X,found:H}}import{join as jF}from"path";var k2={version:1,_doc:"SINGLE SOURCE of Swift detection KNOWLEDGE (Truth-is-faf-cli). Kill line: Package.swift alone ≠ app. Static parse of products + package URLs + product names + light xcodeproj productType. Never execute Package.swift / swift build. 2026-08-03 post-intel swift-edition.",mcpPackageUrls:["modelcontextprotocol/swift-sdk","github.com/modelcontextprotocol/swift-sdk"],mcpProducts:["MCP"],serverPackageUrls:[["vapor/vapor","Vapor"],["github.com/vapor/vapor","Vapor"],["hummingbird-project/hummingbird","Hummingbird"],["github.com/hummingbird-project/hummingbird","Hummingbird"]],serverProducts:[["Vapor","Vapor"],["Hummingbird","Hummingbird"]],cliPackageUrls:[["apple/swift-argument-parser","ArgumentParser"],["github.com/apple/swift-argument-parser","ArgumentParser"]],cliProducts:[["ArgumentParser","ArgumentParser"]],appProductTypes:["com.apple.product-type.application"],cliProductTypes:["com.apple.product-type.tool"],vaporLayoutFiles:["Sources/App/configure.swift","Sources/App/routes.swift","Sources/App/entrypoint.swift"]};var SF=k2.mcpPackageUrls.map(($)=>$.toLowerCase()),EF=k2.mcpProducts.map(($)=>$.toLowerCase()),wF=k2.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),xF=k2.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),yF=k2.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),bF=k2.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),kF=k2.appProductTypes,vF=k2.cliProductTypes,gF=k2.vaporLayoutFiles;function hF($){return I($,"Package.swift")||C3($).length>0}function C3($){return(Q0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.endsWith(".xcodeproj")&&T2($,Z)?.isDirectory()===!0)}function fF($){let Z=uF($),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 U=[],W=/\.product\s*\(\s*name\s*:\s*"([^"]+)"/gi;while((J=W.exec(Z))!==null)U.push(J[1]);let G=/\.product\s*\(\s*name\s*:\s*'([^']+)'/gi;while((J=G.exec(Z))!==null)U.push(J[1]);let V=/\.library\s*\(/.test(z),q=/\.executable\s*\(/.test(z),K=/\.plugin\s*\(/.test(z)&&!V&&!q?!0:/\bproducts\s*:\s*\[[\s\S]*?\.plugin\s*\(/.test(z),L=/\.executabletarget\s*\(/.test(z),B=/\.target\s*\(/.test(z)&&!L?!0:(z.match(/\.target\s*\(/g)||[]).length>(z.match(/\.executabletarget\s*\(/g)||[]).length+(z.match(/\.testtarget\s*\(/g)||[]).length;return{packageUrls:Q,productNames:U,hasLibraryProduct:V,hasExecutableProduct:q,hasPluginProduct:!!K,hasExecutableTarget:L,hasLibraryTarget:B}}function uF($){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 mF($,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 VW($,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 qW($,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 cF($){let Z=$.map((z)=>z.toLowerCase());return EF.some((z)=>Z.includes(z))}function pF($){let Z=!1,z=!1,Q;for(let X of C3($)){let J=g($,jF(X,"project.pbxproj"));if(!J)continue;for(let Y of kF)if(J.includes(Y))Z=!0,Q=Y;for(let Y of vF)if(J.includes(Y)){if(z=!0,!Q)Q=Y}}return{hasApplication:Z,hasTool:z,hit:Q}}function lF($){for(let Z of gF)if(I($,Z))return Z;return}function L4($){if(!hF($))return null;let Z=I($,"Package.swift"),z=C3($),Q=z.length>0,X=null;if(Z){let S=g($,"Package.swift");if(S)X=fF(S)}let J=Q?pF($):{hasApplication:!1,hasTool:!1},Y=lF($),U=X?.packageUrls??[],W=X?.productNames??[],G=mF(U,SF),V=cF(W),q=VW(U,wF),K=qW(W,xF),L=VW(U,yF),B=qW(W,bF),H=!!(G||V),D=!!(q||K||Y),N=!!(X?.hasExecutableProduct||X?.hasExecutableTarget),_=!!(L||B),E=J.hasApplication,j=Z&&Q?"spm+xcode":Z?"spm":"xcode",x,w="",u;if(H)if(x="mcp",w="MCP",V)u="Package.swift + product MCP (Swift MCP)";else u=`Package.swift + ${G} (Swift MCP)`;else if(D)if(x="backend",w=K?.[1]||q?.[1]||(Y?"Vapor":""),K)u=`Package.swift + product ${K[1]} (Swift backend)`;else if(q)u=`Package.swift + ${q[1]} (Swift backend)`;else u=`${Y} (Swift backend layout)`;else if(E)x="app",w="",u=`${z[0]} + ${J.hit||"application"} (Swift app)`;else if(_||N&&!D&&!H)if(x="cli",w=B?.[1]||L?.[1]||"",B)u=`Package.swift + product ${B[1]} (Swift CLI)`;else if(L)u=`Package.swift + ${L[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)x="cli",u=`${z[0]} + tool productType (Swift CLI)`;else if(Z)if(x="library",X?.hasLibraryProduct)u="Package.swift + .library product (Swift library)";else u="Package.swift (Swift library)";else x="library",u=`${z[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:x,framework:w,packageManager:j,found:u}}function dF($){let Z=g($,"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 iF($){let Z=g($,"Cargo.toml");return Z!==null&&/^\s*\[\[bin\]\]/m.test(Z)}function nF($,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=dF($);if(z&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(z))return`Cargo.toml name "${z}" → sdk`;return null}function rF($){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=g($,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 sF($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,z=g($,"pyproject.toml");if(z!==null){let X=z.match(Z);if(X)return`pyproject.toml depends on ${X[1]}`}let Q=g($,"requirements.txt");if(Q!==null){let X=Q.match(Z);if(X)return`requirements.txt contains ${X[1]}`}return null}function oF($,Z){let z=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let Q of z)if(Z.dependencies?.[Q]||Z.devDependencies?.[Q])return`${Q} dependency`}if(I($,"ios")&&I($,"android"))return"ios/ + android/ dirs";return null}function aF($,Z){let z=g($,"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=g($,"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 tF($,Z){if(!I($,"index.html"))return null;if(Z?.dependencies||Z?.devDependencies){let z={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((X)=>z[X]))return null}return"index.html (vanilla, no frontend framework)"}function eF($,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 $R($,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 ZR($,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((U)=>z[U]),Y=X.some((U)=>z[U]);if(J&&Y)return"auth + payment dependencies";return null}function zR($,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 QR($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||I($,"pnpm-workspace.yaml")))return null;return"private workspace + multi-package"}var XR=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"]),HW=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,JR=new Set(["frontend","backend","database","css","ui","state"]);function YR($){if(I($,"pyproject.toml")||I($,"manage.py")||I($,"setup.py")||XZ($,"requirements*.txt"))return!0;if(I($,"go.mod"))return!0;if(I($,"Cargo.toml"))return!0;if(I($,"Gemfile"))return!0;if(I($,"pom.xml")||XZ($,"build.gradle*"))return!0;if(c1($).length>0)return!0;let Z=W2($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function JZ($){return b1($,()=>UR($))}function UR($){let Z=Q0($)??[],z=[];for(let Q of Z){if(!Q.isDirectory()||Q.name.startsWith(".")||XR.has(Q.name))continue;let X=KW($,Q.name);if(!YR(X))continue;let J=UZ(X);if(!J)continue;let Y=YZ(X).filter((V)=>JR.has(V.category)),U=Y.find((V)=>V.category==="frontend"),W=Y.find((V)=>V.category==="backend"),G=U??W??Y[0]??null;z.push({name:Q.name,language:J,topFramework:G?.name??null,frontend:!!U,backend:!!W||HW.test(J),hasFramework:!!G,appRoot:I(X,"manage.py")||I(X,"config.ru")||I(X,"bin/rails")||I(X,"artisan")})}return z}function WR($,Z){if(Z?.workspaces||I($,"pnpm-workspace.yaml"))return null;let z=JZ($),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 BW($){let Z=JZ($);if(Z.length<2)return null;let z=(Y)=>(Y.appRoot?2:0)+(HW.test(Y.language)?2:0)+(Y.hasFramework?1:0)+(Y.frontend?0.5:0),Q=[...Z].sort((Y,U)=>z(U)-z(Y)),X=new Set,J=[];for(let Y of Q){if(X.has(Y.language))continue;X.add(Y.language);let U=Y.frontend?"frontend":Y.backend?"backend":"service";J.push(Y.topFramework?`${Y.language} (${Y.topFramework} · ${U})`:`${Y.language} (${U})`)}return J.join("; ")}function W2($){let Z=g($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function XZ($,Z){if(!Z.includes("*"))return I($,Z);let z=Z.split("/");if(z.length===1){let U=Z.split("*")[0];return(Q0($)??[]).some((W)=>W.name.startsWith(U))}let Q=KW(...z.slice(0,-1)),X=z[z.length-1],J=X.split("*")[0],Y=X.split("*")[1]||"";return(Q0($,Q)??[]).some((U)=>U.name.startsWith(J)&&U.name.endsWith(Y))}function GR($,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 XZ(z,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!XZ(z,$.pattern))return!1;let Q=g(z,$.pattern);return Q!==null&&Q.toLowerCase().includes($.key.toLowerCase())}default:return!1}}function YZ($){let Z=W2($);return eU.map((z)=>{let X=z.signals.filter((J)=>GR(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 UZ($){let Z=W2($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(I($,"tsconfig.json"))return"TypeScript";if(I($,"Cargo.toml"))return"Rust";if(I($,"go.mod"))return"Go";if(c1($).length>0)return"C#";if(I($,"pyproject.toml")||I($,"setup.py"))return"Python";if(I($,"Gemfile"))return"Ruby";if(T3($)){let z=H4($);if(z)return z.mainLanguage==="Java/Kotlin"?"Kotlin":z.mainLanguage;return"Java"}if(I($,"Package.swift"))return"Swift";if(I($,"build.zig"))return"Zig";if(I($,"pubspec.yaml"))return"Dart";if(Z)return"JavaScript";return""}function MW($){let Z=[];if(I($,"SKILL.md"))Z.push("SKILL.md");for(let z of["skills",""])for(let Q of Q0($,z||".")??[]){if(!Q.isDirectory()||Q.name.startsWith(".")||Q.name==="node_modules")continue;if(z===""&&Q.name==="skills")continue;let X=z?`${z}/${Q.name}/SKILL.md`:`${Q.name}/SKILL.md`;if(I($,X))Z.push(X)}return Z}function VR($){let Z=MW($);if(Z.length===0)return null;let z=[Z.length===1?Z[0]:`${Z.length} SKILL.md folders`];if(I($,".claude-plugin/plugin.json"))return z.push(".claude-plugin/plugin.json"),{type:"skills-plugin",found:z};return{type:"skills",found:z}}function LW($){if(MW($).length===0)return"";return I($,".claude-plugin/plugin.json")?"Claude Code plugin":"Agent Skills"}function DW($){let Z=W2($),z=YZ($),Q=[],X=eF($,Z);if(X)return Q.push(X),{type:"documentation",found:Q};let J=nF($,Z);if(J)return Q.push(J),{type:"sdk",found:Q};let Y=rF($);if(Y)return Q.push(Y),{type:"extension",found:Q};let U=zR($,Z,z);if(U)return Q.push(U),{type:"mcpaas",found:Q};let W=ZR($,Z);if(W)return Q.push(W),{type:"saas",found:Q};let G=aF($,Z);if(G)return Q.push(G),{type:"wasm",found:Q};let V=t5($);if(V)return Q.push(V.found),{type:V.appType,found:Q};let q=$Z($);if(q)return Q.push(q.found),{type:q.appType,found:Q};let K=zZ($);if(K)return Q.push(K.found),{type:K.appType,found:Q};let L=H4($);if(L)return Q.push(L.found),{type:L.appType,found:Q};let B=QZ($);if(B)return Q.push(B.found),{type:B.appType,found:Q};let H=L4($);if(H)return Q.push(H.found),{type:H.appType,found:Q};let D=oF($,Z);if(D)return Q.push(D),{type:"mobile",found:Q};if(z.some((f)=>f.slug==="mcp"))return Q.push("MCP SDK signal"),{type:"mcp",found:Q};if(Z?.bin)return Q.push("package.json bin"),{type:"cli",found:Q};if(iF($))return Q.push("Cargo.toml [[bin]]"),{type:"cli",found:Q};if(I($,"build.zig")){if(Q.push("build.zig"),I($,"src/main.zig"))return Q.push("src/main.zig"),{type:"cli",found:Q};if(I($,"src/root.zig"))return Q.push("src/root.zig"),{type:"library",found:Q}}let _=z.some((f)=>f.slug==="svelte"||f.slug==="sveltekit");if(Z?.private===!0&&(I($,"pnpm-workspace.yaml")||Z?.workspaces!==void 0)&&_)return Q.push("private workspace","Svelte"),{type:"framework",found:Q};if(_)return Q.push("Svelte/SvelteKit"),{type:"svelte",found:Q};let j=z.some((f)=>f.category==="frontend"),x=z.some((f)=>f.category==="backend");if(Z?.private&&(Z.workspaces||I($,"pnpm-workspace.yaml"))&&j&&x)return Q.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:Q};let w=QR($,Z);if(w)return Q.push(w),{type:"monorepo-root",found:Q};let u=$R($,Z,z);if(u)return Q.push(u),{type:"website",found:Q};if(z.some((f)=>f.slug==="nextjs"||f.slug==="nuxt"))return Q.push(z.find((f)=>f.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:Q};let d=z.some((f)=>f.category==="frontend"),y0=z.some((f)=>f.category==="backend");if(d&&y0)return Q.push("frontend framework","backend framework"),{type:"fullstack",found:Q};if(d)return Q.push("frontend framework"),{type:"frontend",found:Q};if(y0)return Q.push("backend framework"),{type:"backend",found:Q};let j0=sF($);if(j0)return Q.push(j0),{type:"data-science",found:Q};let $0=tF($,Z);if($0)return Q.push($0),{type:"html",found:Q};let S2=WR($,Z);if(S2)return Q.push(S2),{type:"fullstack",found:Q};if(Z?.main&&!Z?.bin)return Q.push("package.json main (no bin)"),{type:"library",found:Q};let v=VR($);if(v)return Q.push(...v.found),{type:v.type,found:Q};return Q.push(k1),{type:"library",found:Q}}function OW($){if(I($,"bunfig.toml"))return"Bun";if(I($,"deno.json")||I($,"deno.jsonc"))return"Deno";if(W2($))return"Node.js";if(I($,"Cargo.toml"))return"Rust";if(I($,"go.mod"))return"Go";if(c1($).length>0)return".NET";if(I($,"pubspec.yaml"))return"Dart";return""}var qR=new Set(["npm","pnpm","yarn","bun"]);function KR($){let Z=W2($)?.packageManager;if(typeof Z!=="string")return"";let z=/^([a-z]+)@/i.exec(Z.trim())?.[1]?.toLowerCase()??"";return qR.has(z)?z:""}function HR($){if(I($,"pubspec.yaml"))return"pub";if(I($,"go.mod"))return"go modules";if(c1($).length>0)return"NuGet";if(I($,"pom.xml"))return"maven";return["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"].some((z)=>I($,z))?"gradle":""}var BR=[["bun.lockb","bun"],["bun.lock","bun"],["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"]];function NW($){return HR($)||KR($)||(BR.find(([Z])=>I($,Z))?.[1]??"")}function IW($){if(I($,".github/workflows"))return"GitHub Actions";if(I($,".gitlab-ci.yml"))return"GitLab CI";if(I($,".circleci"))return"CircleCI";if(I($,"Jenkinsfile"))return"Jenkins";return null}function TW($){if(I($,"vercel.json"))return"Vercel";if(I($,"netlify.toml"))return"Netlify";if(I($,"wrangler.toml"))return"Cloudflare";if(I($,"fly.toml"))return"Fly.io";if(I($,"render.yaml"))return"Render";return null}var MR=["svelte.config.js","vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"];function LR($){for(let Q of MR){let X=g($,Q)?.match(/@sveltejs\/adapter-(\w+)/);if(X)return X[1]}let Z=W2($);return Object.keys({...Z?.dependencies,...Z?.devDependencies}).map((Q)=>/^@sveltejs\/adapter-(\w+)$/.exec(Q)?.[1]).find(Boolean)??null}function AW($){let Z=LR($);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 _3($){let Z=$?.devDependencies?.vite??$?.dependencies?.vite,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?"Vite":`Vite ${z}`}function CW($){let Z=W2($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return _3(Z);if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(I($,"tsconfig.json")&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function WZ($){return["package.json","Cargo.toml","pyproject.toml","go.mod","build.zig","build.zig.zon","src/index.ts","src/index.js","src/main.ts","src/cli.ts","src/main.rs","src/lib.rs","src/main.zig","src/root.zig","src/__init__.py","main.py","__main__.py","main.go","cmd/main.go","README.md","SPECIFICATION.md","BINARY-FORMAT.md","tsconfig.json","wrangler.toml","vercel.json"].filter((z)=>I($,z))}function GZ($,Z){let z={};if(Z?.scripts){for(let Q of["build","test","lint","dev","start"])if(Z.scripts[Q]){let X=I($,"bun.lock")||I($,"bun.lockb")?"bun run":"npm run";z[Q]=`${X} ${Q}`}}if(I($,"Cargo.toml")){if(!z.build)z.build="cargo build --release";if(!z.test)z.test="cargo test";if(!z.lint&&DR($))z.lint="cargo clippy"}if(I($,"build.zig")){if(!z.build)z.build="zig build";if(!z.test&&/\.step\(\s*"test"/.test(P3($,"build.zig")))z.test="zig build test"}if(I($,"go.mod")){if(!z.build)z.build="go build ./...";if(!z.test)z.test="go test ./..."}if(!z.test&&OR($))z.test="pytest";return z}function P3($,Z){return g($,Z)??""}function DR($){if(I($,"clippy.toml")||I($,".clippy.toml"))return!0;return/^\s*\[(workspace\.)?lints\.clippy\]/m.test(P3($,"Cargo.toml"))}function OR($){if(I($,"pytest.ini")||I($,"conftest.py"))return!0;return["pyproject.toml","setup.cfg","tox.ini"].some((Z)=>/\bpytest\b/.test(P3($,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(I($,"bunfig.toml"))X.push("Bun");else if(I($,"deno.json")||I($,"deno.jsonc"))X.push("Deno");if(X.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let U of Y)if(!X.some((W)=>W.toLowerCase().includes(U.toLowerCase())))X.push(U)}return X}function NR($){let Z=$?.dependencies?.svelte??$?.devDependencies?.svelte,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?NaN:Number(z)}function VZ($){return F3($).data}function F3($){let Z=W2($),z=YZ($),Q=DW($),X=Q.type,J=Q.found.some((r)=>r.startsWith("polyglot:")),Y=J&&BW($)||UZ($),U=OW($),W=NW($),G=IW($),V=TW($),q=CW($),K=z.find((r)=>r.slug==="sveltekit")??z.find((r)=>r.category==="frontend"),L=z.find((r)=>r.category==="css"),B=z.find((r)=>r.category==="ui"),H=z.find((r)=>r.category==="state"),D=z.find((r)=>r.category==="backend"),N=z.find((r)=>r.category==="database"),_=(r)=>r6(X,r)??r6("library",r)===!0,E=X==="framework",j=z.some((r)=>r.slug==="svelte"||r.slug==="sveltekit"),x=E&&j?"svelte":E?null:null,w=X==="svelte"||x==="svelte",u=w?AW($):null,S=w&&z.some((r)=>r.slug==="sveltekit"),d={},y0=X0.filter((r)=>r.path.startsWith("stack."));for(let r of y0){let Y0=r.path.replace("stack.","");switch(Y0){case"frontend":d[Y0]=K?.name??LW($);break;case"css_framework":d[Y0]=L?.name??"";break;case"ui_library":d[Y0]=B?.name??"";break;case"state_management":d[Y0]=H?.name??(w&&NR(Z)>=5?"Runes":"");break;case"backend":d[Y0]=w?S?"SvelteKit":D?.name??"":D?.name??"";break;case"api_type":d[Y0]=S?"Server Routes":"";break;case"runtime":d[Y0]=U;break;case"database":d[Y0]=N?.name??"";break;case"connection":d[Y0]=N?.name??"";break;case"hosting":if(w&&u)d[Y0]=u;else d[Y0]=V??"";break;case"build":d[Y0]=S?_3(Z):q??"";break;case"cicd":d[Y0]=G??"";break;case"package_manager":d[Y0]=W;break;default:d[Y0]="";break}}let j0={};for(let r of y0){let Y0=r.path.replace("stack.","");j0[Y0]=_(r)?d[Y0]:"slotignored"}let $0={},S2=X0.filter((r)=>r.path.startsWith("monorepo."));for(let r of S2){let Y0=r.path.replace("monorepo.","");if(!_(r))$0[Y0]="slotignored";else $0[Y0]=""}let v={name:Z?.name??$.split("/").pop()??"project",goal:J?"":Z?.description??"",main_language:Y,type:X};if(E&&x)v.framework=x;let f=_W($,Z,z,J?UZ($):Y);if(J){for(let r of JZ($))for(let Y0 of[r.language,r.topFramework])if(Y0&&!f.includes(Y0))f.push(Y0)}let C0=WZ($),L2=GZ($,Z),f8={faf_version:u1,project:v,stack:j0,human_context:{who:"",what:J?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:$0,_meta:{found:Q.found}};if(f.length>0)f8.tech_stack=f;if(C0.length>0)f8.key_files=C0;if(Object.keys(L2).length>0)f8.commands=L2;return{data:f8,facts:d}}var d0={goal:["use\\s+cases?","goals?"],what:["description","overview","purpose","introduction","what","what\\s+is\\s+(?!new\\b)\\S+","what\\s+it\\s+does"],who:["audience","target\\s+audience","for\\s+whom","who","who\\s+is\\s+(?:this|it)\\s+for","who\\s+it.s\\s+for"],why:["why","why\\s+(?:use\\s+)?(?!not\\b)\\S+","motivations?","(?:the\\s+)?problem","rationale","mission","vision"],where:["deployment","where","where\\s+it\\s+runs","hosting","platforms","supported\\s+platforms","platform\\s+support"],when:["status","(?:project|current)\\s+status","timeline","since","launched"],how:["architecture","how","how\\s+it\\s+works","how\\s+does\\s+it\\s+work","under\\s+the\\s+hood","internals","approach","methodology"]},p1={MIN_LENGTH:8,MAX_LENGTH:280},IR=[/^(see|see\s+the?)\s+readme/i,/^(tbd|todo|fixme|coming\s+soon)\b/i,/^(software|application|app|project|tool|library|framework)\.?$/i,/^(for\s+users|for\s+developers)\.?$/i,/^(description|goal|name|title)\.?$/i,/^lorem\s+ipsum/i,/^example(\s+\w+)?\.?$/i,/^(welcome|hello|hi|thanks|thank\s+you)\b/i,/\bwelcome[.!]?$/i,/^(copyright\b|\(c\)|©)/i,/\ball\s+rights\s+reserved\b/i,/^(?:(?:dual-)?licen[cs]ed\s+under|permission\s+is\s+hereby)\b/i,/\b(npm|pnpm|yarn|bun)\s+(i|install|add)\s|\bpip3?\s+install\s|\bcargo\s+(add|install)\s|\bgo\s+(get|install)\s|\bbrew\s+install\s/i,/^please\b/i,/\bto get started\b|\bread the (docs|documentation|guide)\b|\bstart with the (docs|documentation|guide)\b|\bread the announcement\b|\bcheck out (the|our)\b/i,/^["“'‘][\s\S]*["”'’]$/,/\?$/,/(&mdash;|&ndash;|[—–,;]|\s-)\s*$/,/^(the\s+)?mono-?repo\s+(for|of|containing|with)\b/i,/\bmono-?repo(\s+root)?\.?$/i,/[a-z]{2,}\.[A-Z][a-z]{2,}/,/^#{1,6}\s/,/\*\*[^*\n]{1,30}:\*\*[\s\S]*\*\*[^*\n]{1,30}:\*\*/];function PW($){return TR.some((Z)=>Z.test($))}var TR=[/\b(no longer (maintained|supported|developed)|unmaintained|deprecated|archived|end[- ]of[- ]life)\b/i,/^(sponsored|supported|funded|backed|brought to you) by\b/i,/\b(we['’]re|we are) hiring\b|^join (us|our)\b/i,/\b(documentation|docs) (is |are )?(available|can be found|lives?) (at|on|in)\b/i,/^looking for\b|\?\s/i,/^moved to\b|\b(has )?moved to\b|\bmirror of\b/i,/^(requires?|needs)\b/i,/^status\s*:/i,/^(warning|important|note|caution|attention|heads[- ]up|disclaimer|notice|danger)\s*:/i,/\b(t-?shirts?|mugs|stickers|merch(andise)?|donate|sponsor (us|me))\b/i,/^(?:\p{Extended_Pictographic}|\p{Emoji_Modifier}|\u200d|\ufe0f|\s)+[\p{L}\p{N} '-]{1,30}:\s/u];function qZ($){return/^\[!/.test($)||/^(⚠|🚧|❗|⛔|❌|🛑)/u.test($)||/\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($)}function KZ($){let Z=$.findIndex((z)=>z.trim()!=="");if(Z>=0&&/^[-=]{3,}\s*$/.test($[Z+1]??""))return $.slice(Z+2);return $}function I0($){let Z=$.trim();if(Z.length<p1.MIN_LENGTH)return!1;if(Z.length>p1.MAX_LENGTH)return!1;if(IR.some((z)=>z.test(Z)))return!1;if(/^(\||[-*+](\s|$))/.test(Z))return!1;if(Z.split(`
236
+ `).length>4)return!1;if(AR(Z))return!1;return!0}function e6($){let Z=$.trim(),z=/[.!?…]+(?=\s+\S|\s*$)/g;for(let Q=z.exec(Z);Q;Q=z.exec(Z)){let X=Q.index+Q[0].length,J=Z.slice(0,X);if(X<Z.length){let Y=Z.slice(X).trimStart();if(/(\.\.\.|…)$/.test(J))continue;if(/\b(e\.g|i\.e|vs|cf|approx|dr|mr|mrs|ms|st|jr|sr|no|fig)\.$/i.test(J))continue;if(/(\betc\.|(?:\b[A-Za-z]\.){2,})$/.test(J)&&/^[a-z]/.test(Y))continue}return J.endsWith("?")?null:J}return null}function AR($){if(CR.test($))return!0;if($.includes("```"))return!0;if(/(^|\s)[-=]{3,}(\s|$)/.test($))return!0;if(/^\d+\.\s/.test($))return!0;if(/:\s*$/.test($))return!0;let z=$.replace(/&nbsp;/gi," ").split(/\s*(?:\||·|•|&bull;)\s*/i).map((Q)=>Q.trim()).filter(Boolean);if(z.length>=3&&z.every((Q)=>Q.length<=24))return!0;return _R($)>0.5}var CR=/<\/?(?:p|div|img|br|hr|h[1-6]|picture|source|table|thead|tbody|tr|td|th|ul|ol|li|dl|dt|dd|details|summary|section|header|footer|center|video|iframe|svg|blockquote|pre)\b[^>]*>/i;function _R($){let Z=$.replace(/!\[[^\]]*\]\([^)]*\)/g,""),z=[...Z.matchAll(/\[([^\]]*)\]\([^)]*\)/g)].map((X)=>X[1]).join(""),Q=Z.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").trim();if(!Q)return $.trim()?1:0;return z.length/Q.length}var $1=($)=>new RegExp(`^(${$.join("|")})\\s*[:?]?$`,"i"),FW=$1(d0.goal),RW=$1(d0.what),jW=$1(d0.who),SW=$1(d0.why),EW=$1(d0.where),wW=$1(d0.when),xW=$1(d0.how),R3=String.raw`(?:\*\*|__|\*|_)`,PR=String.raw`(?:(?:\p{Extended_Pictographic}|\p{Emoji_Modifier}|\u200d|\ufe0f)+\s*)?`,yW=String.raw`${PR}${R3}?[^*[\]:]{1,30}(?::${R3}?|${R3}:)`,bW=String.raw`\[[^\]]+\]\([^)]*\)`,FR=new RegExp(String.raw`^${yW}\s*(?:${bW}|https?:\/\/\S+)(?:\s*\([^()]{1,30}\))?\s*$`,"u"),RR=new RegExp(String.raw`^(?:${yW}\s*)?(?:\*\*)?${bW}`,"u");function jR($){let Z=KZ($.split(`
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(/^<\/?[a-z][\w-]*/i.test(Q)&&(SR.test(Q)||Q.replace(/<[^>]*>/g,"").trim()==="")){z++;continue}if(/^#\s/.test(Q)){z++;continue}if(FR.test(Q)){z++;continue}if(RR.test(Q)&&/[|·•]|&bull;/i.test(Q)){z++;continue}if(/^\[[^\]]+\]:\s*\S/.test(Q)){z++;continue}if(/^https?:\/\/\S*\)?\s*$/.test(Q)){z++;continue}if(Q===""){z++;continue}break}return Z.slice(z).join(`
238
+ `)}var SR=/^<\/?(?:p|div|img|h[1-6]|picture|source|table|center|details|summary|video|svg|br|hr)\b/i;function ER($,Z){let z=$.replace(/^>\s*/,"");return!/^>/.test((Z??"").trim())&&z&&!qZ(z)?z:null}function kW($){let z=jR($).split(`
239
+ `),Q=[];for(let[X,J]of z.entries()){let Y=J.trim();if(Q.length===0&&/^>/.test(Y))return ER(Y,z[X+1]);if(Y===""){if(Q.length>0)break;continue}if(/^(#|>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(Y))break;if(/^\[[^\]]+\]:\s*\S/.test(Y))continue;if(/^https?:\/\/\S*\)?\s*$/.test(Y))continue;if(/^\*\*[^*]+\*\*\s*$/.test(Y)&&Q.length===0)continue;Q.push(Y)}if(Q.length===0)return null;return Q.join(" ").trim()}function Z1($,Z){return vW($,Z)?.text??null}function vW($,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=[];Q++;while(Q<z.length){let U=z[Q].trim();if(U.match(/^(#{1,6})\s+/))break;if(U===""){if(Y.length>0)break;Q++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(U))break;Y.push(U),Q++}if(Y.length===0)return null;return{text:Y.join(" ").trim(),heading:J[2].trim()}}Q++}return null}function wR($){let Z=Z1($,FW);if(Z&&I0(Z))return Z;let z=kW($);if(z&&I0(z))return z;return}function xR($){let Z=Z1($,RW);if(Z&&I0(Z))return Z;return}function yR($){let Z=Z1($,jW);if(Z&&I0(Z))return Z;return}function bR($){let Z=Z1($,SW);if(Z&&I0(Z))return Z;return}function kR($){let Z=Z1($,EW);if(Z&&I0(Z))return Z;return}function vR($){let Z=Z1($,wW);if(Z&&I0(Z))return Z;return}function gR($){let Z=Z1($,xW);if(Z&&I0(Z))return Z;return}function j3($){let Z=["README.md","README.MD","Readme.md","readme.md"],z=null;for(let L of Z)if(I($,L)){z=L;break}if(!z)return{};let Q=g($,z);if(Q===null)return{};Q=Q.replace(/<!--[\s\S]*?-->/g,"");let X={},J=wR(Q);if(J)X.project={goal:J};let Y={},U=xR(Q);if(U)Y.what=U;let W=yR(Q);if(W)Y.who=W;let G=bR(Q);if(G)Y.why=G;let V=kR(Q);if(V)Y.where=V;let q=vR(Q);if(q)Y.when=q;let K=gR(Q);if(K)Y.how=K;if(Object.keys(Y).length>0)X.human_context=Y;return X}function gW($){let Z=["README.md","README.MD","Readme.md","readme.md"].find((Y)=>I($,Y));if(!Z)return{};let z=g($,Z);if(z===null)return{};let Q=z.replace(/<!--[\s\S]*?-->/g,""),X={},J=(Y,U)=>{let W=vW(Q,U);if(!W)return!1;let G=I0(W.text)?W.text:/:\s*$/.test(W.text)?e6(W.text):null;if(G&&I0(G))return X[Y]={value:G,source:`${Z} § ${W.heading}`},!0;return!1};if(!J("project.goal",FW)){let Y=kW(Q);if(Y&&I0(Y))X["project.goal"]={value:Y,source:`${Z} § first paragraph`};else if(Y&&Y.length>p1.MAX_LENGTH){let U=e6(Y);if(U&&I0(U))X["project.goal"]={value:U,source:`${Z} § first sentence`}}}return J("human_context.what",RW),J("human_context.who",jW),J("human_context.why",SW),J("human_context.where",EW),J("human_context.when",wW),J("human_context.how",xW),X}function hR($,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 U=Y[1].trim();U=U.replace(/\s*#.*$/,"").trim();let W=U.match(/^"((?:[^"\\]|\\.)*)"$/)||U.match(/^'((?:[^'\\]|\\.)*)'$/);if(W)return W[1];return U}}return null}function D4($){let Z=g($,"Cargo.toml");if(Z===null)return{};let z=hR(Z,"description");if(z&&I0(z))return{project:{goal:z}};return{}}import{join as hW}from"path";var fR=[{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"}],uR=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function mR($){let Z=[],z=(Q,X)=>{for(let J of Q0($,Q)??[])if(J.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(J.name))Z.push(hW(Q,J.name));else if(J.isDirectory()&&X>0&&!J.name.startsWith(".")&&!uR.has(J.name))z(hW(Q,J.name),X-1)};return z(".",1),Z}function O4($){return[...$].join(" · ")}function S3($){let Z=mR($);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=g($,X);if(J===null)continue;for(let Y of J.matchAll(/^\s*image:\s*["']?([^\s"'#]+)/gm)){let U=Y[1].toLowerCase(),W=U.replace(/:[^/]*$/,"").split("/").pop()??U,G=U.replace(/:[^/]*$/,"");for(let{re:V,slot:q,label:K}of fR)if(V.test(W)||V.test(G))z[q].add(K)}}let Q={};if(z.database.size)Q.database=O4(z.database);if(z.cache.size)Q.cache=O4(z.cache);if(z.search.size)Q.search=O4(z.search);if(z.storage.size)Q.storage=O4(z.storage);if(z.runtime.size)Q.runtime=`Docker Compose (${O4(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 pR=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),lR=[{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 E3($,Z){for(let z of Z){let Q=$.find((X)=>z.test(X));if(Q)return Q}return null}function dR($){let Z=[$];for(let z of Q0($)??[])if(z.isDirectory()&&!z.name.startsWith(".")&&!pR.has(z.name))Z.push(cR($,z.name));return Z}function iR($){let Z=0;if(I($,"manage.py")||I($,"pyproject.toml")||I($,"Gemfile"))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function w3($){return b1($,()=>nR($))}function nR($){let Z=[];for(let Q of dR($)){let X=Q===$,J=X?"":`cd ${Q.slice($.length+1)} && `;for(let Y of lR){let U=g(Q,Y.file);if(U===null)continue;let W=Y.targets(U);if(W.length===0)continue;let G={},V=E3(W,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),q=E3(W,[/^build$/i,/^compile$/i,/^build/i]),K=E3(W,[/^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(K)G.lint=`${J}${Y.runner} ${K}`;if(Object.keys(G).length===0)continue;Z.push({score:Object.keys(G).length+(X?10:iR(Q)),commands:G})}}let z=Z.sort((Q,X)=>X.score-Q.score)[0];return z?{commands:z.commands}:{}}var rR=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function x3($){for(let Z of rR)if(I($,Z))return{security:{secrets:".env",example:Z}};return{}}function sR($,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 y3($){return[j3($),D4($),S3($),w3($),x3($)].reduce(sR,{})}import{join as oR,extname as aR,resolve as tR}from"path";var b3={"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 eR=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),$j=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),Zj={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"]},zj=[["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 Qj($,Z){for(let[z,Q]of zj)if(z in $)return Q;return Z.length>0?"framework":"config"}function Xj($,Z){try{let z=JSON.parse(g($,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 Jj($,Z){if(Z.isFile())return!0;if(!Z.isSymbolicLink())return!1;return T2($,Z.name)?.isFile()===!0}function Yj($,Z){if(Z.isDirectory())return!0;if(!Z.isSymbolicLink())return!1;return T2($,Z.name)?.isDirectory()===!0}function Uj($){let Z=[],z=tR($),Q=new Set,X=Q0(z);if(!X)return Z;for(let J of X){let Y=J.name;if(Y.endsWith(".xcodeproj")?!Yj(z,J):!Jj(z,J))continue;if(Y.toLowerCase().endsWith(".csproj")){let W=zZ(z);if(W){let G={mainLanguage:"C#",packageManager:"NuGet",buildTool:"dotnet"};if(W.appType==="backend"&&W.framework)G.backend=W.framework;else if(W.appType==="cli"&&W.framework)G.framework=W.framework;else if(W.appType==="mcp")G.apiType="MCP";else if(W.appType==="mobile"&&W.framework)G.framework=W.framework;if(W.targetFramework)G.runtime=W.targetFramework;let V=W.framework?[W.framework,"C#",".NET"]:["C#",".NET"];Z.push({slots:G,priority:36,frameworks:V,fileName:Y})}continue}if(Y.endsWith(".xcodeproj")){let W=L4(z);if(W){let G={mainLanguage:"Swift",packageManager:W.packageManager==="spm"?"spm":"Xcode",buildTool:W.packageManager.includes("spm")?"swift build":"xcodebuild"};if(W.appType==="backend"&&W.framework)G.backend=W.framework;else if(W.appType==="cli"&&W.framework)G.framework=W.framework;else if(W.appType==="mcp")G.apiType="MCP";else if(W.appType==="app"&&W.framework)G.framework=W.framework;let V=W.framework?[W.framework,"Swift"]:["Swift"];Z.push({slots:G,priority:36,frameworks:V,fileName:Y})}continue}let U=b3[Y];if(!U)continue;if(Y==="manifest.json"&&Xj(z,Y)!=="chrome")continue;if(Y==="pubspec.yaml"){let W=t5(z);if(W){let G={mainLanguage:"Dart",packageManager:"pub"};if(W.isFlutter){if(G.framework="Flutter",W.stateManagement)G.stateManagement=W.stateManagement}else if(W.appType==="backend"&&W.framework)G.backend=W.framework;else if(W.appType==="mcp")G.apiType="MCP";Z.push({slots:G,priority:U.priority,frameworks:W.isFlutter?["Flutter","Dart"]:["Dart"],fileName:Y});continue}}if(Y==="go.mod"){let W=$Z(z);if(W){let G={mainLanguage:"Go",packageManager:"go modules",buildTool:"go build"};if(W.appType==="backend"&&W.framework)G.backend=W.framework;else if(W.appType==="cli"&&W.framework)G.framework=W.framework;else if(W.appType==="mcp")G.apiType="MCP";let V=W.framework?[W.framework,"Go"]:["Go"];Z.push({slots:G,priority:U.priority,frameworks:V,fileName:Y});continue}}if(Y==="Gemfile"||Y==="Gemfile.lock"||Y==="gems.rb"){let W=QZ(z);if(W){let G={mainLanguage:"Ruby",packageManager:W.packageManager};if(W.appType==="backend"&&W.framework)G.backend=W.framework;else if(W.appType==="cli"&&W.framework)G.framework=W.framework;else if(W.appType==="mcp")G.apiType="MCP";let V=W.framework?[W.framework,"Ruby"]:["Ruby"];Z.push({slots:G,priority:U.priority??35,frameworks:V,fileName:Y});continue}}if(Y==="Package.swift"){let W=L4(z);if(W){let G={mainLanguage:"Swift",packageManager:W.packageManager==="xcode"?"Xcode":"spm",buildTool:"swift build"};if(W.appType==="backend"&&W.framework)G.backend=W.framework;else if(W.appType==="cli"&&W.framework)G.framework=W.framework;else if(W.appType==="mcp")G.apiType="MCP";else if(W.appType==="app"&&W.framework)G.framework=W.framework;let V=W.framework?[W.framework,"Swift"]:["Swift"];Z.push({slots:G,priority:U.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 W=H4(z);if(W){let G={mainLanguage:W.mainLanguage==="Java/Kotlin"?"Kotlin":W.mainLanguage,packageManager:W.buildTool==="maven"?"maven":"gradle",buildTool:W.buildTool};if(W.appType==="backend"&&W.framework)G.backend=W.framework;else if(W.appType==="cli"&&W.framework)G.framework=W.framework;else if(W.appType==="mcp")G.apiType="MCP";else if(W.appType==="mobile")G.framework=W.framework||"Android";if(W.facets.includes("multiplatform"))G.framework=W.framework||"Kotlin Multiplatform";let V=W.framework?[W.framework,"JVM",W.mainLanguage==="Kotlin"?"Kotlin":"Java"]:["JVM",W.mainLanguage==="Kotlin"?"Kotlin":"Java"];Z.push({slots:G,priority:U.priority??35,frameworks:V,fileName:Y});continue}}Z.push({slots:U.slots||{},priority:U.priority,frameworks:U.frameworks,fileName:Y})}return Z}function Wj($){let Z=[];for(let z of b1($,()=>fW($,2,{count:0}))){let Q=b3[`*${z}`],X=Q?.slots?.mainLanguage;if(X)Z.push({slots:{mainLanguage:X},priority:Q.priority,frameworks:Q.frameworks})}return Z}function Gj($){let Z=[...Uj($),...Wj($)],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:Qj(G.slots,G.frameworks),priority:G.priority})}let Y=[...J.values()].sort((G,V)=>V.priority-G.priority||G.fileName.localeCompare(V.fileName)),U=[];if(z.mainLanguage)U.push(z.mainLanguage.toLowerCase());if(z.framework)U.push(z.framework.toLowerCase());let W=U.length>0?U.join("-"):"unknown-stack";return{slotFills:z,frameworks:[...X],confirmedCount:Z.length,discoveredFormats:Y,stackSignature:W}}function k3($){let{slotFills:Z}=Gj($),z={};for(let[Q,X]of Object.entries(Z)){let J=Zj[Q];if(!J||!X)continue;let[Y,U]=J;if(Y==="project")(z.project??={})[U]=X;else(z.stack??={})[U]=X}return z}function fW($,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=aR(J.name);if($j.has(Y))Q.add(Y);continue}if(eR.has(J.name)||J.name.startsWith("."))continue;for(let Y of fW(oR($,J.name),Z-1,z))Q.add(Y)}return Q}function l1($){let Z=VZ($),z=y3($),Q={};if(z.stack)Q.stack=z.stack;if(z.commands)Q.commands=z.commands;if(z.security)Q.security=z.security;let X=N4(Q,mW(Z));return Oj(X),N4(X,k3($))}function mW($){let Z={...$};if(e(Z.project)&&"goal"in Z.project)Z.project={...Z.project,goal:""};if(e(Z.human_context))Z.human_context=Object.fromEntries(Object.keys(Z.human_context).map((z)=>[z,""]));return Z}function cW($,Z){let z=Dj(z4(Z,"updateExistingFaf: the existing .faf")),{data:Q,facts:X}=F3($),J=Q,{project:Y,human_context:U,...W}=y3($),G=N4(z,W),V=N4(G,mW(J)),q=Kj(N4(V,k3($)),z),K=Hj(Vj(Z,z,J)?Bj(uW(q,z),z,X):uW(q,z),z);return vU(bU(Z,K))}function Vj($,Z,z){if(!J0(g0(Z,"project.type"))){let X=n2($)?.text;return X===void 0||!D3(X)}return!(z._meta?.found??[]).includes(k1)}function v3($){return $.canonical?[$.path,$.canonical]:[$.path]}function g0($,Z){let[z,Q]=Z.split("."),X=$[z];return e(X)?X[Q]:void 0}function T6($,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 A6=($)=>typeof $==="string"&&$.trim()===X4;function qj($,Z){let z=Z.map((Q)=>g0($,Q));return z.some(A6)&&z.every((Q)=>J0(Q)||A6(Q))}function uW($,Z){let z={...$};for(let Q of X0){let X=v3(Q);if(!qj(Z,X))continue;for(let J of X){let Y=g0(Z,J);if(g0(z,J)!==Y)T6(z,J,Y)}}return z}function z1($,Z){let[z,Q]=Z.split("."),X=$[z];return e(X)&&Object.prototype.hasOwnProperty.call(X,Q)}function Kj($,Z){let z={...$};for(let Q of X0){if(!Q.canonical||!z1(Z,Q.canonical)||z1(Z,Q.path))continue;let X=g0(z,Q.path);T6(z,Q.path,void 0);let J=g0(z,Q.canonical);if(HZ(X)&&J0(J))T6(z,Q.canonical,X)}return z}function Hj($,Z){let z={...$};for(let Q of X0){if(!Q.canonical||!z1(Z,Q.canonical)||z1(Z,Q.path))continue;let X=g0(z,Q.canonical);if(HZ(X)||A6(X))T6(z,Q.path,X)}return z}function Bj($,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 U=r6(X,Y);if(U===null)return $;if(U){let W=typeof X==="string"&&f5[X]?.has(Y.path)===!0;Mj(J,Z,Y,Y.path.startsWith("stack.")?z[Y.path.slice(6)]:void 0,W)}else Lj(J,Y)}return J}function Mj($,Z,z,Q,X=!1){let J=v3(z),Y=(W)=>!J0(g0($,W))&&!A6(g0($,W));for(let W of J){if(!A6(g0($,W)))continue;if(X)T6($,W,J.some(Y)?void 0:"");else if(!A6(g0(Z,W)))T6($,W,z1(Z,W)?g0(Z,W):"")}if(!HZ(Q))return;let U=J.filter((W)=>z1($,W));if(U.some((W)=>!J0(g0($,W))))return;for(let W of U.length>0?U:[z.path])T6($,W,Q)}function Lj($,Z){let z=v3(Z).filter((X)=>z1($,X)),Q=(X)=>!J0(g0($,X))&&!A6(g0($,X));if(z.some(Q))return;for(let X of z.length>0?z:[Z.path])if(J0(g0($,X)))T6($,X,X4)}function Dj($){let Z=$.project;if(Z===null||Z===void 0||e(Z)||Array.isArray(Z))return $;return{...$,project:{name:String(Z)}}}function Oj($){let Z=$.project?.type??"library",z=n6[Z]||n6.library;for(let Q of X0){if(z.includes(Q.category)||f5[Z]?.has(Q.path))continue;let[X,J]=Q.path.split(".");if(X==="stack"&&$.stack)$.stack[J]="slotignored";if(X==="monorepo"&&$.monorepo)$.monorepo[J]="slotignored"}}function N4($,Z){return pW($,Z,"")}function Nj($){let Z=D6.get($);return Z!==void 0&&Z.category!=="human"}function HZ($){if(typeof $==="number"||typeof $==="boolean")return!0;return typeof $==="string"&&$.trim()!==""&&!J0($)&&!A6($)}function Ij($,Z){return Nj($)&&HZ(Z)}function pW($,Z,z){let Q={...$};for(let[X,J]of Object.entries(Z)){let Y=Q[X],U=z?`${z}.${X}`:X;if(U==="_meta"&&Y!==void 0)continue;if(i2(Y)){if(Ij(U,J))Q[X]=J;continue}if(J0(Y))Q[X]=J;else if(e(J)&&e(Y))Q[X]=pW(Y,J,U)}return Q}import{existsSync as lW,lstatSync as Tj}from"fs";import{join as Aj,basename as Cj}from"path";import{createHash as _j}from"crypto";var G2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($),F2=($)=>typeof $==="number"&&Number.isFinite($),P2=($)=>typeof $==="string",Pj=/^v?\d+\.\d+\.\d+$/,Fj=new Set(["birth","doubled","peak","current"]);function rW($){return G2($)&&P2($.version)&&Pj.test($.version)&&F2($.score)}var Rj=($)=>F2($.birthDNA)?$.birthDNA:F2($.birthWeight)?$.birthWeight:null,jj=($)=>G2($)&&F2($.birthDNA)&&P2($.born),dW=($)=>G2($)&&P2($.born)&&F2($.birthDNA)&&F2($.lastScore)&&P2($.endedAt),Sj=($)=>Array.isArray($)&&$.length>0&&$.every(rW),Ej=($)=>G2($)&&F2($.score)&&P2($.version),wj=($)=>G2($)&&Array.isArray($.milestones)&&$.milestones.every(G2);function iW($){return G2($)&&jj($.birthCertificate)&&Sj($.versions)&&Ej($.current)&&wj($.growth)}function xj($){try{return Tj($),!0}catch{return!1}}var g3=($)=>`${JSON.stringify($,null,2)}
242
+ `,yj=new Set(["version","score","lastSync"]),bj=new Set(["type","score","date","version","label","emoji"]),nW=($,Z)=>Object.keys($).every((z)=>Z.has(z)),h3={birth:{label:"Birth",emoji:"\uD83D\uDC23"},doubled:{label:"Doubled",emoji:"2️⃣"},peak:{label:"Peak",emoji:"\uD83C\uDFD4️"},current:{label:"Current",emoji:"\uD83D\uDCCD"}},sW=($)=>$.growth.milestones.filter((Z)=>Z.type==="peak"||Z.type==="current"),oW=($)=>nW($.current,yj)&&sW($).every((Z)=>nW(Z,bj)),kj=($)=>sW($).every((Z)=>Z.label===h3[Z.type].label&&Z.emoji===h3[Z.type].emoji);function vj($){return oW($)&&kj($)}var gj=".faf-dna is not in faf's shape: faf reads it and leaves it as it is.",hj=".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.",fj=".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.",uj=".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.",mj=".faf-dna has no birth certificate faf can read: faf leaves it as it is.";function cj($){if(!Array.isArray($))return[];return $.filter((Z)=>G2(Z)&&P2(Z.type)&&Fj.has(Z.type)&&F2(Z.score))}var Q1=($,Z="")=>P2($)?$:Z;function pj($,Z){if(!Array.isArray($))return[];return $.filter(rW).map((z)=>({version:z.version,timestamp:Q1(z.timestamp),score:z.score,changes:Array.isArray(z.changes)?z.changes.filter(P2):[],growth:F2(z.growth)?z.growth:z.score-Z}))}function lj($,Z,z,Q){return{version:Q1($.version,Z?.version??"v1.0.0"),score:F2($.score)?$.score:Z?.score??z,lastSync:Q1($.lastSync,Q)}}function aW($){if(!G2($)||!G2($.birthCertificate))return null;let Z=$.birthCertificate,z=Rj(Z);if(z===null)return null;let Q=Q1(Z.born),X=pj($.versions,z),J=lj(G2($.current)?$.current:{},X[X.length-1],z,Q),Y=G2($.growth)?$.growth:{};return{birthCertificate:{born:Q,birthDNA:z,birthDNASource:Z.birthDNASource==="legacy"||Z.birthWeightSource==="legacy"?"legacy":"init",projectDNA:Q1(Z.projectDNA),certificate:Q1(Z.certificate)},versions:X,current:J,growth:{totalGrowth:J.score-z,daysActive:F2(Y.daysActive)?Y.daysActive:0,milestones:cj(Array.isArray(Y.milestones)?Y.milestones:$.milestones)},lastModified:Q1($.lastModified,Q),format:"faf-dna-v1",...Array.isArray($.priorLineage)&&$.priorLineage.some(dW)?{priorLineage:$.priorLineage.filter(dW)}:{}}}function tW($){try{return aW(JSON.parse($))?.birthCertificate??null}catch{return null}}class s0{projectPath;dnaPath;dna=null;own=!1;text;reason=null;constructor($){this.projectPath=$,this.dnaPath=Aj($,".faf-dna")}exists(){return lW(this.dnaPath)}birth($){if(n(this.projectPath,".faf-dna"),xj(this.dnaPath))throw new k("exists",this.dnaPath,`${this.dnaPath} is already there: a birth certificate is written once and never replaced — not written; original kept`);let Z=new Date().toISOString();return this.own=!0,this.dna={birthCertificate:{born:Z,birthDNA:$,birthDNASource:"init",projectDNA:this.generateProjectDNA(),certificate:this.generateCertificate()},versions:[{version:"v1.0.0",timestamp:Z,score:$,changes:["Birth — initial context"],growth:0}],current:{version:"v1.0.0",score:$,lastSync:Z},growth:{totalGrowth:0,daysActive:0,milestones:[{type:"birth",score:$,date:Z,version:"v1.0.0",label:"Birth",emoji:"\uD83D\uDC23"}]},lastModified:Z,format:"faf-dna-v1"},this.text=void 0,this.save(),this.dna}isFafShape(){return this.load()!==null&&this.own}readOnlyReason(){return this.load(),this.own?null:this.reason}recordGrowth($,Z){if(!this.dna&&!this.load())return null;if(!this.own)return null;let z=this.dna;if($===z.current.score)return z;let Q=new Date().toISOString(),X=z.birthCertificate.birthDNA,J=$-X,Y=this.incrementVersion(z.versions[z.versions.length-1].version);return z.versions.push({version:Y,timestamp:Q,score:$,changes:Z,growth:J}),z.current={version:Y,score:$,lastSync:Q},z.growth.totalGrowth=J,z.growth.daysActive=this.daysSince(z.birthCertificate.born),this.updateMilestones($,Y,Q),this.save(),z}getJourney(){if(!this.dna&&!this.load())return"";let $=this.dna,Z=$.birthCertificate.birthDNA,z=$.growth.milestones.find((J)=>J.type==="peak"),Q=$.current.score,X=`${Z}%`;if(z&&z.score!==Z){if(X+=` → ${z.score}%`,Q<z.score)X+=` ← ${Q}%`}else if(Q!==Z)X+=` → ${Q}%`;return X}getBirthDNADisplay(){if(!this.dna&&!this.load())return null;let $=this.dna;return{current:$.current.score,birthDNA:$.birthCertificate.birthDNA,growth:$.current.score-$.birthCertificate.birthDNA,born:P2($.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=P2($.timestamp)?$.timestamp.split("T")[0]:"",Q=Array.isArray($.changes)?$.changes.filter(P2).join(", "):"";return`${$.version} — ${$.score}% ${Z} (${z}) ${Q}`})}load(){if(this.dna)return this.dna;if(!lW(this.dnaPath))return null;let $=this.read();if($===null)return null;let{text:Z,raw:z}=$;if(iW(z)&&g3(z)===Z&&vj(z))this.own=!0,this.reason=null,this.dna=z;else this.own=!1,this.dna=aW(z),this.reason=!this.dna?mj:!iW(z)?gj:g3(z)!==Z?hj:oW(z)?uj:fj;return this.text=Z,this.dna}read(){let $;try{$=W0(n(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 $=g3(this.dna),Z=this.text??null;s(this.dnaPath,$,{root:this.projectPath,expect:Z}),this.text=$}generateProjectDNA(){return _j("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=Cj(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=(W)=>Q.some((G)=>G.type===W),J=(W)=>Q.push({type:W,score:$,date:z,version:Z,...h3[W]});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!X("doubled"))J("doubled");let Y=Q.find((W)=>W.type==="peak");if(!Y||$>Y.score){if(Y)Q.splice(Q.indexOf(Y),1);J("peak")}let U=Q.findIndex((W)=>W.type==="current");if(U>=0)Q.splice(U,1);J("current")}}import{spawnSync as $G}from"child_process";import{readFileSync as dj}from"fs";import{isAbsolute as ij,join as eW}from"path";function f3($){let Z=$G("git",["check-ignore","-v","--",".faf-dna"],{cwd:$,encoding:"utf-8"});if(Z.status!==0||typeof Z.stdout!=="string")return null;let z=/^(.*):(\d+):(.*)\t/.exec(Z.stdout);if(!z)return null;let[,Q,X,J]=z;if(J.startsWith("!"))return null;if(nj($,Q,Number(X)))return null;return`${Q}:${X}: ${J}`}function nj($,Z,z){if(z<2)return!1;let Q=$G("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}),X=ij(Z)?[Z]:[eW($,Z),...Q.status===0?[eW(Q.stdout.trim(),Z)]:[]];for(let J of X)try{return(dj(J,"utf-8").split(/\r?\n/)[z-2]??"").trim().startsWith("#")}catch{}return!1}function BZ($){let Z=f3($);if(!Z)return null;return`.faf-dna is gitignored (${Z}): a fresh clone loses the birth certificate. Commit it, or put the reason in a # comment above that line.`}import{spawnSync as rj}from"child_process";var sj=["certificate","born","birthDNA","projectDNA"];function I4($,Z){let z=rj("git",Z,{cwd:$,encoding:"utf-8"});return{ok:z.status===0&&typeof z.stdout==="string",out:typeof z.stdout==="string"?z.stdout:""}}function ZG($){let Z=I4($,["rev-parse","--is-inside-work-tree"]);return Z.ok&&Z.out.trim()==="true"}function zG($){let Z=I4($,["log","--diff-filter=A","--reverse","--format=%h%x09%cs","--",".faf-dna"]),z=Z.ok?Z.out.split(`
243
+ `)[0]:"";if(!z)return null;let[Q,X]=z.split("\t");return{commit:Q,date:X??""}}function MZ($){if(!ZG($))return null;if(I4($,["check-ignore","-q","--",".faf-dna"]).ok)return null;if(zG($))return null;return'The birth certificate is not committed yet. Commit it to make it permanent: git add .faf-dna && git commit -m "faf: birth certificate"'}function QG($,Z){if(!ZG($))return{state:"cannot",why:"this is not a git repository, so there is no birth commit to check against."};if(I4($,["rev-parse","--is-shallow-repository"]).out.trim()==="true")return{state:"cannot",why:"this is a shallow clone, so the commit that first added .faf-dna may be missing. Fetch the full history (git fetch --unshallow) and run it again."};let z=zG($);if(!z)return{state:"cannot",why:Z?'.faf-dna is not committed yet. Commit it to make it permanent: git add .faf-dna && git commit -m "faf: birth certificate"':"there is no .faf-dna, and no commit ever added one."};let Q=I4($,["show",`${z.commit}:./.faf-dna`]),X=Q.ok?tW(Q.out):null;if(!X)return{state:"cannot",why:`the .faf-dna in ${z.commit} has no birth certificate faf can read.`};if(!Z)return{state:"changed",...z,fields:[".faf-dna is missing"]};let J=sj.filter((Y)=>X[Y]!==Z[Y]);return J.length===0?{state:"same",...z}:{state:"changed",...z,fields:[...J]}}i();i();import{statSync as XG}from"fs";import{homedir as oj}from"os";import{parse as aj,resolve as JG}from"path";function YG($,Z){try{let z=XG($,{bigint:!0}),Q=XG(Z,{bigint:!0});return z.isDirectory()&&z.ino!==0n&&z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function tj($){let Z=JG($),z=JG(oj()),Q=aj(Z).root;if(Z===z)return"home";if(Z===Q||Z==="/"||/^[A-Za-z]:[\\/]?$/.test(Z))return"root";if(YG(Z,z))return"home";if(YG(Z,Q))return"root";return null}function d1($=process.cwd(),Z="faf"){let z=tj($);if(z===null)return;let Q=z==="home"?"your home directory (~)":"the filesystem root";console.error(`${A("faf")}: ${Q} is not a project.`),console.error(""),console.error(` ${C("cd")} into a real repo (or any folder you mean to own), then run again:`),console.error(M(" cd /path/to/your-project")),console.error(M(` ${Z}`)),console.error(""),console.error(M(" Home will never be a git repo for this. project.faf belongs with the code.")),process.exit(1)}import{statSync as ej}from"fs";import{dirname as $S,resolve as UG}from"path";function ZS($,Z){if($.reason==="not-utf8"||$.reason==="changed"||$.reason==="exists"||$.reason==="not-yaml"||$.reason==="unplaceable")return"";if($.reason==="not-owned")return Z&&!$.message.includes("--force")?" Use --force to replace it.":"";return $.onWrite?" Nothing was written to it.":" Nothing was read from or written to it."}function i1($){return $ instanceof k||$ instanceof d2}function n1($,Z){return $ instanceof k?`faf: ${$.message}${ZS($,Z)}`:`faf: ${$.message}`}function V2($){if($===void 0)return;let Z=$S(UG($)),z;try{z=ej(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 d2(UG($),`${Z} ${z} — nothing written`)}var C6=($,Z,z)=>({value:$,source:Z,confidence:z});function WG($,Z={}){let z=Z.toolingRoot?null:zS($),Q=QS($),X={},J=(Y,U)=>{if(U&&I0(U.value))X[Y]=U};return J("what",WS(z,Q)),J("who",GS(Q)),J("why",VS(Q)),J("when",qS(Q)),J("how",KS(Q)),X}function zS($){let Z=g($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function QS($){let Z=g($,"README.md");if(Z===null)return"";return KZ(Z.replace(/<!--[\s\S]*?-->/g,"").split(`
244
244
  `)).filter((z)=>!/^\s*\[!\[/.test(z)&&!/^\s*!\[/.test(z)&&!/^\s*\[[^\]]+\]:\s*\S/.test(z)&&!/^\s*https?:\/\/\S*\)?\s*$/.test(z)).join(`
245
- `).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function b3($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim()}function nj($){if(!$)return 0;return($.match(/\[[^\]]*\]\([^)]*\)/g)??[]).join("").length/$.length}function O4($,Z){let z=new RegExp(`^#{1,6}\\s+(${Z.join("|")})\\s*[:?]?\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n#|(?![\\s\\S]))`,"im"),Q=$.match(z);if(!Q||!Q[2]||Q[2].trim().length<=20||nj(Q[2])>0.4)return null;return{body:b3(Q[2]),heading:Q[1].trim()}}function rj($){let Z=$.split(`
246
- `).map((z)=>z.trim()).filter(Boolean);return Z.length>0&&Z.every((z)=>/^\[[^\]]+\]:\s*\S/.test(z))}function sj($){let Z=$.trim();if(!/^https?:\/\//.test(Z))return!1;return Z.replace(/https?:\/\/\S+\)?/g," ").replace(/\s+/g," ").trim()===""}function oj($){let Z=$.trim();if(rj(Z))return!0;if(sj(Z))return!0;if(/^>/.test(Z))return!0;if(/^(```|~~~|[-*+]\s|\d+\.\s|\|)/.test(Z))return!0;if(YZ(Z))return!0;let Q=Z.replace(/&nbsp;/gi," ").split(/\s*(?:\||·|•|&bull;)\s*/i).map((X)=>X.trim()).filter(Boolean);if(Q.length>=3&&Q.every((X)=>X.length<=24))return!0;return!1}function aj($,Z){if($?.description&&$.description.length>20)return N6(b3($.description),"package.json:description",0.95);let z=O4(Z,i0.what);if(z)return N6(z.body,`README:## ${z.heading}`,0.8);let X=Z.split(/^#{2,6}\s/m)[0].split(/\n\s*\n/).map((U)=>U.replace(/\s+/g," ").trim()).find((U)=>U.length>30&&!U.startsWith("#")&&!oj(U));if(!X)return null;let J=b3(X);if(J.length<=h1.MAX_LENGTH)return N6(J,"README:first-paragraph",0.5);let Y=o6(J);return Y?N6(Y,"README:first-sentence",0.5):null}function tj($){let Z=O4($,i0.who);return Z?N6(Z.body,`README:## ${Z.heading}`,0.8):null}function ej($){let Z=O4($,i0.why);return Z?N6(Z.body,`README:## ${Z.heading}`,0.8):null}function $S($){let Z=O4($,i0.when);return Z?N6(Z.body,`README:## ${Z.heading}`,0.8):null}function ZS($){let Z=O4($,i0.how);return Z?N6(Z.body,`README:## ${Z.heading}`,0.7):null}function N4($,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 I4($,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 T4($,Z){return`cannot set ${$}: ${Z.at} is ${p6(Z.value)}, not a mapping. `+`faf will not replace it — make ${Z.at} a mapping in project.faf by hand, then run again.`}function qZ($,Z,z){let Q=I4($,Z);if(Q)throw Error(T4(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}var QG=["project.goal","human_context.who","human_context.what","human_context.why","human_context.where","human_context.when","human_context.how"];function k3($){return QG.includes($)}function zS($,Z){if(Z)return null;let z=g($,"package.json");if(z===null)return null;try{let Q=JSON.parse(z).description;return typeof Q==="string"&&Q.trim()?Q.trim():null}catch{return null}}function A4($,Z){let Q=(JZ($)._meta?.found??[]).some((q)=>q.startsWith("polyglot:")),X={},J=new Set(Z?QG.filter((q)=>QS(N4(Z,q))):[]),Y=[],U=US($),W=(q,K,H)=>{if(X[q]||J.has(q)||!K)return;let L=XG(K,U),B=zG(L),D=o6(L),N=D&&D!==L?zG(D):null;if(!C0(L)||VS(K,U)||WS(q,L)||Y.some((_)=>qS(_,B)||_===N))return;if(Y.push(B),N)Y.push(N);X[q]={value:L,source:KS(H)}};GS($,W);let G=zS($,Q);W("project.goal",G,"package.json description"),W("human_context.what",G,"package.json description"),W("project.goal",B4($).project?.goal,"Cargo.toml description");let V=ZG($,{toolingRoot:Q});for(let q of["who","what","why","where","when","how"]){let K=V[q];if(K)W(`human_context.${q}`,K.value,K.source)}return X}function QS($){return p2($)||typeof $==="string"&&$.trim()!==""&&!U0($)}function XG($,Z=new Set){let z=[],Q=$.replace(/`([^`]+)`/g,(X,J)=>`${z.push(J)-1}`);return YS(Q.replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/(?<![\w\]])\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/(?<![\w\]])\[([^\]]+)\]\[[^\]]*\]/g,"$1").replace(/(?<![\w\]])\[([^\]]+)\](?![[(:])/g,(X,J)=>Z.has(J.toLowerCase())?J:X).replace(/<\/?(?:a|b|i|em|strong|code|kbd|span|sup|sub|mark|small|u|s)\b[^>]*>/gi,"").replace(/_\*\*(.+?)\*\*_/g,"$1").replace(/\*\*_(.+?)_\*\*/g,"$1").replace(/[\s\S]*/,XS).replace(/(^|[^\w])(__)(?=\S)(.+?)(?<=\S)\2(?!\w|\.\w)/g,"$1$3").replace(/(^|[^\w])(_)(?=[^\s_])(.+?)(?<=[^\s_])\2(?!\w|\.\w)/g,"$1$3")).replace(/\uE000(\d+)\uE000/g,(X,J)=>z[Number(J)]).replace(/\s+/g," ").trim()}function XS($){for(let Z=0;Z<4;Z++){let z=$.replace(/(?<![\w/.*\\])(\*\*?)(?=[\p{L}\p{N}\p{Extended_Pictographic}])([^*\n]*?[\p{L}\p{N}.!?):])\1(?!\*)/gu,"$2");if(z===$)break;$=z}return $}var JS={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",bull:"•",mdash:"—",ndash:"–",hellip:"…",copy:"©",reg:"®",trade:"™"};function YS($){return $.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi,(Z,z)=>{if(z[0]!=="#")return JS[z.toLowerCase()]??Z;let Q=z[1].toLowerCase()==="x"?Number.parseInt(z.slice(2),16):Number(z.slice(1));if(!Number.isFinite(Q)||Q<=31||Q>1114111||Q>=55296&&Q<=57343)return Z;return String.fromCodePoint(Q)})}function US($){let Z=["README.md","README.MD","Readme.md","readme.md"].find((Q)=>I($,Q)),z=Z?g($,Z)??"":"";return new Set([...z.matchAll(/^ {0,3}\[([^\]]+)\]:\s*\S/gm)].map((Q)=>Q[1].toLowerCase()))}function WS($,Z){if($==="project.goal"||$==="human_context.what")return OW(Z);if($==="human_context.why")return/^[\p{L}\p{N}._-]+ (is|are) (a|an|the)\b/iu.test(Z);return!1}function GS($,Z){for(let[z,Q]of Object.entries(EW($)))if(k3(z))Z(z,Q.value,Q.source)}function VS($,Z){return XG($.replace(/`[^`]*`/g," "),Z).includes("**")}function zG($){return $.toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function qS($,Z){let[z,Q]=$.length<=Z.length?[$,Z]:[Z,$];if(Q.includes(z)&&z.length>=0.6*Q.length)return!0;let X=new Set($.split(" ")),J=new Set(Z.split(" "));return[...X].filter((U)=>J.has(U)).length/new Set([...X,...J]).size>=0.7}function KS($){if($==="README:first-paragraph")return"README.md § first paragraph";if($==="README:first-sentence")return"README.md § first sentence";let Z=$.match(/^README:##\s*(.+)$/);if(Z)return`README.md § ${Z[1].trim()}`;return $.replace(/^package\.json:description$/,"package.json description")}function KZ($,Z){let z=Object.values(A4($,Z)).filter((U)=>Boolean(U));if(z.length===0)return null;let Q=(U)=>{let W=U.split(/[\s:§]/)[0];return W==="README"?"README.md":W},X=[...new Set(z.map((U)=>Q(U.source)))].join(", "),[J,Y]=z.length===1?["suggestion","it"]:["suggestions","them"];return`${z.length} ${J} for the goal and the six W's (${X}) — confirm ${Y} in 'faf go'`}function g3($={}){u1(process.cwd(),"faf init");let Z=process.cwd(),z=$.output?$.output.endsWith(".faf")?$.output:v3(Z,$.output):v3(Z,"project.faf"),Q=$.force===!0||$.new===!0;if(JG(z)&&!Q)console.error(`project.faf already exists. Use ${C("--new")} for a fresh one; .faf-dna is kept as it is.`),process.exit(1);V2($.output);let X=f1(Z),J;b0(z,X,{replace:Q,onReplacedBackup:(K)=>{J=K}});let Y=p(z),U=a(z,()=>D0(Y)),W=HS(MS(z)),G=new o0(W),V=!G.exists();if(V)G.birth(U.score);if(console.log(`${A("created")} ${z}`),J){let K=BS(Z,J)||J;console.log(M(` kept the previous file at ${K}`))}w0(U,z),console.log(M(V?` \uD83E\uDDEC Birth DNA ${U.score}% — your journey starts here (faf dna)`:" \uD83E\uDDEC .faf-dna kept as it is — your birth certificate (faf dna)")),LS(W,V,$.force===!0);let q=KZ(Z,X);if(q)console.log(M(`
245
+ `).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function u3($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim()}function XS($){if(!$)return 0;return($.match(/\[[^\]]*\]\([^)]*\)/g)??[]).join("").length/$.length}function T4($,Z){let z=new RegExp(`^#{1,6}\\s+(${Z.join("|")})\\s*[:?]?\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n#|(?![\\s\\S]))`,"im"),Q=$.match(z);if(!Q||!Q[2]||Q[2].trim().length<=20||XS(Q[2])>0.4)return null;return{body:u3(Q[2]),heading:Q[1].trim()}}function JS($){let Z=$.split(`
246
+ `).map((z)=>z.trim()).filter(Boolean);return Z.length>0&&Z.every((z)=>/^\[[^\]]+\]:\s*\S/.test(z))}function YS($){let Z=$.trim();if(!/^https?:\/\//.test(Z))return!1;return Z.replace(/https?:\/\/\S+\)?/g," ").replace(/\s+/g," ").trim()===""}function US($){let Z=$.trim();if(JS(Z))return!0;if(YS(Z))return!0;if(/^>/.test(Z))return!0;if(/^(```|~~~|[-*+]\s|\d+\.\s|\|)/.test(Z))return!0;if(qZ(Z))return!0;let Q=Z.replace(/&nbsp;/gi," ").split(/\s*(?:\||·|•|&bull;)\s*/i).map((X)=>X.trim()).filter(Boolean);if(Q.length>=3&&Q.every((X)=>X.length<=24))return!0;return!1}function WS($,Z){if($?.description&&$.description.length>20)return C6(u3($.description),"package.json:description",0.95);let z=T4(Z,d0.what);if(z)return C6(z.body,`README:## ${z.heading}`,0.8);let X=Z.split(/^#{2,6}\s/m)[0].split(/\n\s*\n/).map((U)=>U.replace(/\s+/g," ").trim()).find((U)=>U.length>30&&!U.startsWith("#")&&!US(U));if(!X)return null;let J=u3(X);if(J.length<=p1.MAX_LENGTH)return C6(J,"README:first-paragraph",0.5);let Y=e6(J);return Y?C6(Y,"README:first-sentence",0.5):null}function GS($){let Z=T4($,d0.who);return Z?C6(Z.body,`README:## ${Z.heading}`,0.8):null}function VS($){let Z=T4($,d0.why);return Z?C6(Z.body,`README:## ${Z.heading}`,0.8):null}function qS($){let Z=T4($,d0.when);return Z?C6(Z.body,`README:## ${Z.heading}`,0.8):null}function KS($){let Z=T4($,d0.how);return Z?C6(Z.body,`README:## ${Z.heading}`,0.7):null}function A4($,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 C4($,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 _4($,Z){return`cannot set ${$}: ${Z.at} is ${i6(Z.value)}, not a mapping. `+`faf will not replace it — make ${Z.at} a mapping in project.faf by hand, then run again.`}function LZ($,Z,z){let Q=C4($,Z);if(Q)throw Error(_4(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}var VG=["project.goal","human_context.who","human_context.what","human_context.why","human_context.where","human_context.when","human_context.how"];function m3($){return VG.includes($)}function HS($,Z){if(Z)return null;let z=g($,"package.json");if(z===null)return null;try{let Q=JSON.parse(z).description;return typeof Q==="string"&&Q.trim()?Q.trim():null}catch{return null}}function P4($,Z){let Q=(VZ($)._meta?.found??[]).some((q)=>q.startsWith("polyglot:")),X={},J=new Set(Z?VG.filter((q)=>BS(A4(Z,q))):[]),Y=[],U=OS($),W=(q,K,L)=>{if(X[q]||J.has(q)||!K)return;let B=qG(K,U),H=GG(B),D=e6(B),N=D&&D!==B?GG(D):null;if(!I0(B)||TS(K,U)||NS(q,B)||Y.some((_)=>AS(_,H)||_===N))return;if(Y.push(H),N)Y.push(N);X[q]={value:B,source:CS(L)}};IS($,W);let G=HS($,Q);W("project.goal",G,"package.json description"),W("human_context.what",G,"package.json description"),W("project.goal",D4($).project?.goal,"Cargo.toml description");let V=WG($,{toolingRoot:Q});for(let q of["who","what","why","where","when","how"]){let K=V[q];if(K)W(`human_context.${q}`,K.value,K.source)}return X}function BS($){return i2($)||typeof $==="string"&&$.trim()!==""&&!J0($)}function qG($,Z=new Set){let z=[],Q=$.replace(/`([^`]+)`/g,(X,J)=>`${z.push(J)-1}`);return DS(Q.replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/(?<![\w\]])\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/(?<![\w\]])\[([^\]]+)\]\[[^\]]*\]/g,"$1").replace(/(?<![\w\]])\[([^\]]+)\](?![[(:])/g,(X,J)=>Z.has(J.toLowerCase())?J:X).replace(/<\/?(?:a|b|i|em|strong|code|kbd|span|sup|sub|mark|small|u|s)\b[^>]*>/gi,"").replace(/_\*\*(.+?)\*\*_/g,"$1").replace(/\*\*_(.+?)_\*\*/g,"$1").replace(/[\s\S]*/,MS).replace(/(^|[^\w])(__)(?=\S)(.+?)(?<=\S)\2(?!\w|\.\w)/g,"$1$3").replace(/(^|[^\w])(_)(?=[^\s_])(.+?)(?<=[^\s_])\2(?!\w|\.\w)/g,"$1$3")).replace(/\uE000(\d+)\uE000/g,(X,J)=>z[Number(J)]).replace(/\s+/g," ").trim()}function MS($){for(let Z=0;Z<4;Z++){let z=$.replace(/(?<![\w/.*\\])(\*\*?)(?=[\p{L}\p{N}\p{Extended_Pictographic}])([^*\n]*?[\p{L}\p{N}.!?):])\1(?!\*)/gu,"$2");if(z===$)break;$=z}return $}var LS={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",bull:"•",mdash:"—",ndash:"–",hellip:"…",copy:"©",reg:"®",trade:"™"};function DS($){return $.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi,(Z,z)=>{if(z[0]!=="#")return LS[z.toLowerCase()]??Z;let Q=z[1].toLowerCase()==="x"?Number.parseInt(z.slice(2),16):Number(z.slice(1));if(!Number.isFinite(Q)||Q<=31||Q>1114111||Q>=55296&&Q<=57343)return Z;return String.fromCodePoint(Q)})}function OS($){let Z=["README.md","README.MD","Readme.md","readme.md"].find((Q)=>I($,Q)),z=Z?g($,Z)??"":"";return new Set([...z.matchAll(/^ {0,3}\[([^\]]+)\]:\s*\S/gm)].map((Q)=>Q[1].toLowerCase()))}function NS($,Z){if($==="project.goal"||$==="human_context.what")return PW(Z);if($==="human_context.why")return/^[\p{L}\p{N}._-]+ (is|are) (a|an|the)\b/iu.test(Z);return!1}function IS($,Z){for(let[z,Q]of Object.entries(gW($)))if(m3(z))Z(z,Q.value,Q.source)}function TS($,Z){return qG($.replace(/`[^`]*`/g," "),Z).includes("**")}function GG($){return $.toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function AS($,Z){let[z,Q]=$.length<=Z.length?[$,Z]:[Z,$];if(Q.includes(z)&&z.length>=0.6*Q.length)return!0;let X=new Set($.split(" ")),J=new Set(Z.split(" "));return[...X].filter((U)=>J.has(U)).length/new Set([...X,...J]).size>=0.7}function CS($){if($==="README:first-paragraph")return"README.md § first paragraph";if($==="README:first-sentence")return"README.md § first sentence";let Z=$.match(/^README:##\s*(.+)$/);if(Z)return`README.md § ${Z[1].trim()}`;return $.replace(/^package\.json:description$/,"package.json description")}function DZ($,Z){let z=Object.values(P4($,Z)).filter((U)=>Boolean(U));if(z.length===0)return null;let Q=(U)=>{let W=U.split(/[\s:§]/)[0];return W==="README"?"README.md":W},X=[...new Set(z.map((U)=>Q(U.source)))].join(", "),[J,Y]=z.length===1?["suggestion","it"]:["suggestions","them"];return`${z.length} ${J} for the goal and the six W's (${X}) — confirm ${Y} in 'faf go'`}function p3($={}){d1(process.cwd(),"faf init");let Z=process.cwd(),z=$.output?$.output.endsWith(".faf")?$.output:c3(Z,$.output):c3(Z,"project.faf"),Q=$.force===!0||$.new===!0;if(KG(z)&&!Q)console.error(`project.faf already exists. Use ${C("--new")} for a fresh one; .faf-dna is kept as it is.`),process.exit(1);V2($.output);let X=l1(Z),J;k0(z,X,{replace:Q,onReplacedBackup:(K)=>{J=K}});let Y=l(z),U=o(z,()=>M0(Y)),W=_S(FS(z)),G=new s0(W),V=!G.exists();if(V)G.birth(U.score);if(console.log(`${A("created")} ${z}`),J){let K=PS(Z,J)||J;console.log(M(` kept the previous file at ${K}`))}w0(U,z),console.log(M(V?` \uD83E\uDDEC Birth DNA ${U.score}% — your journey starts here (faf dna)`:" \uD83E\uDDEC .faf-dna kept as it is — your birth certificate (faf dna)")),RS(W,V,$.force===!0);let q=DZ(Z,X);if(q)console.log(M(`
247
247
  ${q}`));if(U.score<100)console.log(M(`${q?"":`
248
- `} run ${C("'faf go'")} to fill empty slots`));DS(Z,U.score<100)}function LS($,Z,z){if(!Z&&z)console.error(`faf: ${C("--force")} no longer starts a new birth: the birth certificate is written once. project.faf was replaced, as ${C("--new")} does.`);let Q=GZ($);if(Q)console.error(`faf: ${Q}`);let X=Z?VZ($):null;if(X)console.log(M(` ${X}`))}function DS($,Z){if(OS($))return;console.log(M(`${Z?"":`
249
- `} next: ${C("'faf card init'")} — your repo's business card`))}function OS($){return[["agent.fafa"],[".fafa"],[".well-known","fafa"]].some((Z)=>JG(v3($,...Z)))}l();function I6($){let Z=$.readOnlyReason();if(Z)console.error(`faf: ${Z}`)}function NS($,Z){let z=oW(process.cwd(),$.load()?.birthCertificate??null);if(Z)console.log(JSON.stringify(z,null,2));else if(z.state==="same")console.log(`${A("✓")} Birth certificate matches the commit that first added .faf-dna (${z.commit}, ${z.date}).`);else if(z.state==="changed")console.error(`${C("×")} The birth certificate differs from the commit that first added .faf-dna (${z.commit}, ${z.date}): ${z.fields.join(", ")}. The original: git show ${z.commit}:.faf-dna`);else console.error(`faf: cannot verify: ${z.why}`);process.exit(z.state==="same"?0:z.state==="changed"?1:2)}function IS($,Z){let z=Z.birthCertificate,Q=Z.growth.milestones.find((X)=>X.type==="peak");return{born:z.born,birth_dna:z.birthDNA,certificate:z.certificate,current:Z.current.score,version:Z.current.version,growth:Z.current.score-z.birthDNA,peak:Q?Q.score:Math.max(z.birthDNA,...Z.versions.map((X)=>X.score)),journey:$.getJourney(),versions:Z.versions.map((X)=>({version:X.version,score:X.score,timestamp:X.timestamp,changes:Array.isArray(X.changes)?X.changes:[]})),prior_lives:(Z.priorLineage??[]).map((X)=>({born:X.born,birth_dna:X.birthDNA,last_score:X.lastScore,ended_at:X.endedAt,certificate:X.certificate})),gitignored:y3(process.cwd())!==null,faf_written:$.readOnlyReason()===null,note:$.readOnlyReason()}}function YG($={}){let Z=new o0(process.cwd());if($.verify){NS(Z,$.json===!0);return}let z=Z.load();if(!z){let q=Z.readOnlyReason();console.error(q?`${C("×")} ${q}`:`${C("×")} No FAF DNA found. Run ${C("'faf init'")} to start your journey.`),process.exit(1)}if($.json){console.log(JSON.stringify(IS(Z,z),null,2));return}let Q=Z.getJourney(),X=Z.getBirthDNADisplay(),J=X.born.split("T")[0]||"unknown";console.log(),console.log(P0(C("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${A(C(Q))}`),console.log(),console.log(M(` Birth DNA ${X.birthDNA}% (born ${J}) · current ${X.current}% · growth ${X.growth>=0?"+":""}${X.growth}%`));let Y=Z.readOnlyReason();if(Y)console.log(M(` ${Y} Your birth certificate is protected: faf never changes it.`));let U=GZ(process.cwd());if(U)console.log(M(` ⚠ ${U}`));let W=VZ(process.cwd());if(W)console.log(M(` ⚠ ${W}`));let G=Z.getLog();if(G.length>1){console.log(),console.log(M(" history:"));for(let q of G)console.log(M(` ${q}`))}let V=Z.load()?.priorLineage??[];if(V.length>0){console.log(),console.log(M(` earlier ${V.length===1?"life":"lives"}:`));for(let q of V){let K=q.lastScore===q.birthDNA?`${q.birthDNA}%`:`${q.birthDNA}% → ${q.lastScore}%`;console.log(M(` ${K} born ${q.born.slice(0,10)}, reset ${q.endedAt.slice(0,10)} ${q.certificate}`))}}console.log()}import{existsSync as TS}from"fs";import{join as AS}from"path";l();function HZ(){u1(process.cwd(),"faf auto");let $=process.cwd(),Z=AS($,"project.faf");if(TS(Z)){let Y=t(Z);a(Z,()=>F0(p(Z)));let U=[],W=b0(Z,kW($,Y),{onAliasKept:(G)=>U.push(y2(G))});console.log(`${W?A("updated"):M("unchanged")} ${Z}`);for(let G of U)console.log(M(` ${G}`))}else b0(Z,f1($)),console.log(`${A("created")} ${Z}`);let z=p(Z),Q=a(Z,()=>k0(F0(z))),X=new o0($);if(X.exists())X.recordGrowth(Q.score,["faf auto"]),I6(X);w0(Q,Z,!1,d5(z,Q,{outOfType:!1}));let J=KZ($,t(Z));if(J)console.log(M(`
248
+ `} run ${C("'faf go'")} to fill empty slots`));jS(Z,U.score<100)}function RS($,Z,z){if(!Z&&z)console.error(`faf: ${C("--force")} no longer starts a new birth: the birth certificate is written once. project.faf was replaced, as ${C("--new")} does.`);let Q=BZ($);if(Q)console.error(`faf: ${Q}`);let X=Z?MZ($):null;if(X)console.log(M(` ${X}`))}function jS($,Z){if(SS($))return;console.log(M(`${Z?"":`
249
+ `} next: ${C("'faf card init'")} — your repo's business card`))}function SS($){return[["agent.fafa"],[".fafa"],[".well-known","fafa"]].some((Z)=>KG(c3($,...Z)))}i();function _6($){let Z=$.readOnlyReason();if(Z)console.error(`faf: ${Z}`)}function ES($,Z){let z=QG(process.cwd(),$.load()?.birthCertificate??null);if(Z)console.log(JSON.stringify(z,null,2));else if(z.state==="same")console.log(`${A("✓")} Birth certificate matches the commit that first added .faf-dna (${z.commit}, ${z.date}).`);else if(z.state==="changed")console.error(`${C("×")} The birth certificate differs from the commit that first added .faf-dna (${z.commit}, ${z.date}): ${z.fields.join(", ")}. The original: git show ${z.commit}:.faf-dna`);else console.error(`faf: cannot verify: ${z.why}`);process.exit(z.state==="same"?0:z.state==="changed"?1:2)}function wS($,Z){let z=Z.birthCertificate,Q=Z.growth.milestones.find((X)=>X.type==="peak");return{born:z.born,birth_dna:z.birthDNA,certificate:z.certificate,current:Z.current.score,version:Z.current.version,growth:Z.current.score-z.birthDNA,peak:Q?Q.score:Math.max(z.birthDNA,...Z.versions.map((X)=>X.score)),journey:$.getJourney(),versions:Z.versions.map((X)=>({version:X.version,score:X.score,timestamp:X.timestamp,changes:Array.isArray(X.changes)?X.changes:[]})),prior_lives:(Z.priorLineage??[]).map((X)=>({born:X.born,birth_dna:X.birthDNA,last_score:X.lastScore,ended_at:X.endedAt,certificate:X.certificate})),gitignored:f3(process.cwd())!==null,faf_written:$.readOnlyReason()===null,note:$.readOnlyReason()}}function HG($={}){let Z=new s0(process.cwd());if($.verify){ES(Z,$.json===!0);return}let z=Z.load();if(!z){let q=Z.readOnlyReason();console.error(q?`${C("×")} ${q}`:`${C("×")} No FAF DNA found. Run ${C("'faf init'")} to start your journey.`),process.exit(1)}if($.json){console.log(JSON.stringify(wS(Z,z),null,2));return}let Q=Z.getJourney(),X=Z.getBirthDNADisplay(),J=X.born.split("T")[0]||"unknown";console.log(),console.log(_0(C("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${A(C(Q))}`),console.log(),console.log(M(` Birth DNA ${X.birthDNA}% (born ${J}) · current ${X.current}% · growth ${X.growth>=0?"+":""}${X.growth}%`));let Y=Z.readOnlyReason();if(Y)console.log(M(` ${Y} Your birth certificate is protected: faf never changes it.`));let U=BZ(process.cwd());if(U)console.log(M(` ⚠ ${U}`));let W=MZ(process.cwd());if(W)console.log(M(` ⚠ ${W}`));let G=Z.getLog();if(G.length>1){console.log(),console.log(M(" history:"));for(let q of G)console.log(M(` ${q}`))}let V=Z.load()?.priorLineage??[];if(V.length>0){console.log(),console.log(M(` earlier ${V.length===1?"life":"lives"}:`));for(let q of V){let K=q.lastScore===q.birthDNA?`${q.birthDNA}%`:`${q.birthDNA}% → ${q.lastScore}%`;console.log(M(` ${K} born ${q.born.slice(0,10)}, reset ${q.endedAt.slice(0,10)} ${q.certificate}`))}}console.log()}import{existsSync as xS}from"fs";import{join as yS}from"path";i();function OZ(){d1(process.cwd(),"faf auto");let $=process.cwd(),Z=yS($,"project.faf");if(xS(Z)){let Y=a(Z);o(Z,()=>P0(l(Z)));let U=[],W=k0(Z,cW($,Y),{onAliasKept:(G)=>U.push(b2(G))});console.log(`${W?A("updated"):M("unchanged")} ${Z}`);for(let G of U)console.log(M(` ${G}`))}else k0(Z,l1($)),console.log(`${A("created")} ${Z}`);let z=l(Z),Q=o(Z,()=>v0(P0(z))),X=new s0($);if(X.exists())X.recordGrowth(Q.score,["faf auto"]),_6(X);w0(Q,Z,!1,o5(z,Q,{outOfType:!1}));let J=DZ($,a(Z));if(J)console.log(M(`
250
250
  ${J}`));if(Q.score<100)console.log(M(`${J?"":`
251
- `} run ${C("'faf go'")} to reach ✪ Trophy`))}import{existsSync as SS}from"fs";import{join as ES}from"path";var p1="(one line, every word earns its place)",CS=[{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,help:"one sentence: what it does, and for whom"},{path:"human_context.who",question:`Who is this for? ${p1}`,header:"Who",type:"text",required:!0,help:"the people who use it, not the author"},{path:"human_context.what",question:`What are they building? ${p1}`,header:"What",type:"text",required:!0,help:"what they make or do with it"},{path:"human_context.why",question:`Why does it exist? ${p1}`,header:"Why",type:"text",required:!0,help:"the problem it removes"},{path:"human_context.where",question:`Where does it run or ship? ${p1}`,header:"Where",type:"text",required:!0,help:"where it runs or ships: platform, store, registry"},{path:"human_context.when",question:`When — what stage is it at, and since when? ${p1}`,header:"When",type:"text",required:!0,help:"the stage it is at, and since when"},{path:"human_context.how",question:`How does it work? ${p1}`,header:"How",type:"text",required:!0,help:"the mechanism, and the choice that shapes the code"}],_S=[{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}],BZ=[...CS,..._S],UG=new Map(BZ.map(($)=>[$.path,$])),ac=Object.fromEntries(BZ.map(($)=>[$.path,$]));function WG($){return UG.get($)?.help??""}function MZ($){let Z=UG.get($);if(Z)return Z.question;let z=H6.get($)??J0.find((Q)=>Q.canonical===$);return z?`${z.description}?`.replace(/\?\?$/,"?"):`${$}?`}function f3($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||U0(Z)}return!1}function RS($,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 PS($){if($==="project.goal")return!0;return H6.get($)?.category==="human"}function FS($,Z=f3){let z=[],Q=[];for(let X of BZ){let J=RS($,X.path);if(J==="slotignored")continue;if(!Z(J))continue;(PS(X.path)?z:Q).push(X.path)}return{human:z,sourceable:Q}}function jS($,Z,z=f3){let Q=FS(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"?h3(Q):[];return{status:X,score:$,gaps:Q,ask:J}}function h3($){return $.human.map((Z)=>({path:Z,question:MZ(Z)}))}function GG($,Z={}){let z=Math.max(1,Z.maxRounds??5),Q=Z.isEmpty??f3,X=[],J=0;for(let U=0;U<=z;U++){let W=$.read();if(!W)return{status:"no-faf",score:0,rounds:J,history:X,ask:[]};let G=$.score(W.yaml);X.push(G);let V=jS(G,W.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:h3(V.gaps)}:{status:"stuck",score:G,rounds:J,history:X,ask:[]};if(J>=z)return{status:"capped",score:G,rounds:J,history:X,ask:h3(V.gaps)};$.runAuto(),J++}return{status:"capped",score:X[X.length-1]??0,rounds:J,history:X,ask:[]}}l();function VG($={}){let Z=process.cwd(),z=ES(Z,"project.faf"),Q=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;wS(GG({read:()=>SS(z)?{data:t(z),yaml:p(z)}:{data:{},yaml:""},score:(J)=>J?a(z,()=>k0(F0(J))).score:0,runAuto:()=>HZ()},{maxRounds:Q}))}function wS($){if($.history.length>1)console.log(M(`
251
+ `} run ${C("'faf go'")} to reach ✪ Trophy`))}import{existsSync as uS}from"fs";import{join as mS}from"path";var r1="(one line, every word earns its place)",bS=[{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,help:"one sentence: what it does, and for whom"},{path:"human_context.who",question:`Who is this for? ${r1}`,header:"Who",type:"text",required:!0,help:"the people who use it, not the author"},{path:"human_context.what",question:`What are they building? ${r1}`,header:"What",type:"text",required:!0,help:"what they make or do with it"},{path:"human_context.why",question:`Why does it exist? ${r1}`,header:"Why",type:"text",required:!0,help:"the problem it removes"},{path:"human_context.where",question:`Where does it run or ship? ${r1}`,header:"Where",type:"text",required:!0,help:"where it runs or ships: platform, store, registry"},{path:"human_context.when",question:`When — what stage is it at, and since when? ${r1}`,header:"When",type:"text",required:!0,help:"the stage it is at, and since when"},{path:"human_context.how",question:`How does it work? ${r1}`,header:"How",type:"text",required:!0,help:"the mechanism, and the choice that shapes the code"}],kS=[{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}],NZ=[...bS,...kS],BG=new Map(NZ.map(($)=>[$.path,$])),Hp=Object.fromEntries(NZ.map(($)=>[$.path,$]));function MG($){return BG.get($)?.help??""}function IZ($){let Z=BG.get($);if(Z)return Z.question;let z=D6.get($)??X0.find((Q)=>Q.canonical===$);return z?`${z.description}?`.replace(/\?\?$/,"?"):`${$}?`}function d3($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||J0(Z)}return!1}function vS($,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 gS($){if($==="project.goal")return!0;return D6.get($)?.category==="human"}function hS($,Z=d3){let z=[],Q=[];for(let X of NZ){let J=vS($,X.path);if(J==="slotignored")continue;if(!Z(J))continue;(gS(X.path)?z:Q).push(X.path)}return{human:z,sourceable:Q}}function fS($,Z,z=d3){let Q=hS(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"?l3(Q):[];return{status:X,score:$,gaps:Q,ask:J}}function l3($){return $.human.map((Z)=>({path:Z,question:IZ(Z)}))}function LG($,Z={}){let z=Math.max(1,Z.maxRounds??5),Q=Z.isEmpty??d3,X=[],J=0;for(let U=0;U<=z;U++){let W=$.read();if(!W)return{status:"no-faf",score:0,rounds:J,history:X,ask:[]};let G=$.score(W.yaml);X.push(G);let V=fS(G,W.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:l3(V.gaps)}:{status:"stuck",score:G,rounds:J,history:X,ask:[]};if(J>=z)return{status:"capped",score:G,rounds:J,history:X,ask:l3(V.gaps)};$.runAuto(),J++}return{status:"capped",score:X[X.length-1]??0,rounds:J,history:X,ask:[]}}i();function DG($={}){let Z=process.cwd(),z=mS(Z,"project.faf"),Q=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;cS(LG({read:()=>uS(z)?{data:a(z),yaml:l(z)}:{data:{},yaml:""},score:(J)=>J?o(z,()=>v0(P0(J))).score:0,runAuto:()=>OZ()},{maxRounds:Q}))}function cS($){if($.history.length>1)console.log(M(`
252
252
  climb: ${$.history.join("% → ")}%`));switch(console.log(""),$.status){case"done":console.log(`${A("done")} — ✪ 100% AI-readiness. The .faf is complete.`);break;case"needs-human":{let Z=$.ask.length;console.log(`${C("Sourced everything detection can.")} ${Z} question${Z===1?"":"s"} only you can answer:`);for(let z of $.ask)console.log(` ${M("•")} ${z.question}`);console.log(M(`
253
- 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 AE}from"fs";import{join as EG}from"path";import{join as QE}from"path";import{dirname as LG,resolve as DG}from"path";var KG=100;var xS="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",yS=[/^<(script|pre|style|textarea)(?=\s|>|$)/i,/^<!--/,/^<\?/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp(`^</?(?:${xS})(?=\\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")],bS=[/<\/(?:script|pre|style|textarea)>/i,/-->/,/\?>/,/>/,/\]\]>/],kS=["","-->","?>",">","]]>"],vS=/[#`~*+_=<>0-9-]/,gS=/(\d{1,9})([.)])/y,hS=/#{1,6}(?:[ \t]+|$)/y,fS=/`{3,}(?!.*`)|~{3,}/y,uS=/(?:`{3,}|~{3,})(?=[ \t]*$)/y,mS=/(?:=+|-+)[ \t]*$/y,cS=/[^ \t\f\v\r\n]/;function C4($,Z,z){return $.lastIndex=z,$.exec(Z)}var pS=($)=>$==="quote"||$==="list"||$==="item";function lS($){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],U=Y===" "||Y==="\t";for(let G=0;G<3;G++)if(Y==="*-_"[G])Q[G]++;else if(!U)X[G]=!1;let W="*-_".indexOf(Y);Z[J]=W>=0&&X[W]&&Q[W]>=3?1:0}return Z}var l1=($)=>$===" "||$==="\t";function dS($,Z){if($==="document"||$==="quote"||$==="item")return Z!=="item";return $==="list"&&Z==="item"}var qG=($)=>$==="paragraph"||$==="code"||$==="html";function iS($){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(iS),$.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}>`:kS[$.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"&&qG(Z.kind);while(!z&&!this.deep){this.findNextNonspace();let Q=this.nextNonspace;if(!this.indented&&!vS.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(!qG($.kind)&&this.offset<this.ln.length&&!this.blank)this.addChild({kind:"paragraph"})}addHtmlLine($){if($.type>5)return;let Z=bS[$.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),l1(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?C4(uS,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&&l1(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??=lS(this.ln),this.breaks[this.nextNonspace]===1}startQuote(){if(!this.containers||this.indented||this.ch!==">")return 0;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),l1(this.ln[this.offset]))this.advanceOffset(1,!0);return this.closeUnmatched(),this.addChild({kind:"quote"}),1}startHeading(){if(this.indented||this.ch!=="#"||!C4(hS,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:C4(fS,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=yS[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!=="-"||!C4(mS,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||l1(Q)))return null;if(Z&&!cS.test(this.ln.slice(this.nextNonspace+z.width)))return null;return z}markerKind($){let Z=this.ch;if(Z==="*"||Z==="+"||Z==="-")return{width:1,kind:{bullet:Z,delimiter:null}};let z=Z>="0"&&Z<="9"?C4(gS,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&&l1(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,l1(this.ln[this.offset]))this.advanceOffset(1,!0);return $+1}addChild($){while(!dS(this.tip.kind,$.kind))this.stack.pop();if(this.tip.hasChild=!0,this.stack.push($),pS($.kind)&&this.stack.length-1>100)this.deep=!0}closeUnmatched(){if(!this.allClosed)this.stack.length=this.matched+1,this.allClosed=!0}findNextNonspace(){let $=this.ln,Z=this.offset,z=this.column;if(this.scannedFrom!==-1&&this.offset>=this.scannedFrom&&this.offset<=this.nextNonspace)Z=this.nextNonspace,z=this.nextNonspaceColumn;else{this.scannedFrom=this.offset;for(;Z<$.length;Z++)if($[Z]===" ")z++;else if($[Z]==="\t")z+=4-z%4;else break}this.blank=Z>=$.length,this.nextNonspace=Z,this.nextNonspaceColumn=z,this.indent=z-this.column,this.indented=this.indent>=4}advanceNextNonspace(){this.offset=this.nextNonspace,this.column=this.nextNonspaceColumn}advanceOffset($,Z){let z=$;while(z>0&&this.offset<this.ln.length){if(this.ln[this.offset]!=="\t"){this.offset++,this.column++,z--;continue}let Q=4-this.column%4,X=Z&&Q>z;this.column+=X?z:Q,this.offset+=X?0:1,z-=Z?Math.min(Q,z):1}}}var l2="<!-- faf:start -->",d2="<!-- faf:end -->",HG="\uFEFF";function Z1($){return $.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter((Z,z,Q)=>Z!==""||z<Q.length-1)??[]}var q2=($)=>$.replace(/\r?\n$|\r$/,""),OG=($)=>q2($).replace(/^\uFEFF/,"").trimEnd();function*u3($){let Z=0;for(let z of Z1($)){let Q=q2(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 nS($,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 m3($,Z,z){let[Q,X]=[new F2(!0),new F2(!1)].map((J)=>({reader:J,start:-1,found:null}));for(let J of u3($)){let Y=[Q,X].map((W)=>W.reader.line(J.content));if(Q.reader.tooDeep)return null;let U=[Q,X].filter((W,G)=>Y[G]===null);if(U.length>0)nS(U,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 BG=($)=>(Z)=>Z===$;function R4($,Z=l2,z=d2){return m3($,BG(Z),BG(z))}function MG($,Z){let z=[];for(let Q of[!0,!1]){let X=new F2(Q);for(let J of Z1($))X.line(q2(J));if(X.clone().line(Z)!==null)z.push(X.closer())}return z}var rS=16;function sS($){let Z=new F2(!0);return $.map((z)=>{let Q=Z.overflowAt(q2(z),rS),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(q2(X)),X})}function oS($,Z,z){let X=sS(Z1($).map((Y)=>{let U=OG(Y);return U===Z||U===z?` ${Y}`:Y})).join(""),J=MG(X,z);while(J.length>0&&J[0]!==null){let Y=`${X}
254
- ${J[0]}`,U=MG(Y,z);if(U.length>=J.length)break;X=Y,J=U}return X}function aS($,Z,z){let Q=$.slice(Z.length+1,$.length-z.length-1),X=Z1(Q).map((J)=>q2(J)===""?`>${J}`:`> ${J}`).join("");return`${Z}
253
+ 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 bE}from"fs";import{join as gG}from"path";import{join as LE}from"path";import{dirname as CG,resolve as _G}from"path";var NG=100;var pS="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",lS=[/^<(script|pre|style|textarea)(?=\s|>|$)/i,/^<!--/,/^<\?/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp(`^</?(?:${pS})(?=\\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")],dS=[/<\/(?:script|pre|style|textarea)>/i,/-->/,/\?>/,/>/,/\]\]>/],iS=["","-->","?>",">","]]>"],nS=/[#`~*+_=<>0-9-]/,rS=/(\d{1,9})([.)])/y,sS=/#{1,6}(?:[ \t]+|$)/y,oS=/`{3,}(?!.*`)|~{3,}/y,aS=/(?:`{3,}|~{3,})(?=[ \t]*$)/y,tS=/(?:=+|-+)[ \t]*$/y,eS=/[^ \t\f\v\r\n]/;function F4($,Z,z){return $.lastIndex=z,$.exec(Z)}var $E=($)=>$==="quote"||$==="list"||$==="item";function ZE($){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],U=Y===" "||Y==="\t";for(let G=0;G<3;G++)if(Y==="*-_"[G])Q[G]++;else if(!U)X[G]=!1;let W="*-_".indexOf(Y);Z[J]=W>=0&&X[W]&&Q[W]>=3?1:0}return Z}var s1=($)=>$===" "||$==="\t";function zE($,Z){if($==="document"||$==="quote"||$==="item")return Z!=="item";return $==="list"&&Z==="item"}var OG=($)=>$==="paragraph"||$==="code"||$==="html";function QE($){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(QE),$.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}>`:iS[$.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"&&OG(Z.kind);while(!z&&!this.deep){this.findNextNonspace();let Q=this.nextNonspace;if(!this.indented&&!nS.test(this.ln.charAt(Q)))break;let X=0;for(let J of this.starts)if(X=J(Z),X!==0)break;if(X===0)break;this.noteOverflow(Q,X),Z=this.tip,z=X===2}if(!z)this.advanceNextNonspace();return Z}noteOverflow($,Z){if(Z===1&&this.limit>=0&&this.overflow<0&&this.stack.length-1>this.limit)this.overflow=$}addText($){if($.kind==="code")this.hiddenIn=$.fence?"code fence":"indented code";else if($.kind==="html")this.addHtmlLine($);else if(!OG($.kind)&&this.offset<this.ln.length&&!this.blank)this.addChild({kind:"paragraph"})}addHtmlLine($){if($.type>5)return;let Z=dS[$.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),s1(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?F4(aS,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&&s1(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??=ZE(this.ln),this.breaks[this.nextNonspace]===1}startQuote(){if(!this.containers||this.indented||this.ch!==">")return 0;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),s1(this.ln[this.offset]))this.advanceOffset(1,!0);return this.closeUnmatched(),this.addChild({kind:"quote"}),1}startHeading(){if(this.indented||this.ch!=="#"||!F4(sS,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:F4(oS,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=lS[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!=="-"||!F4(tS,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||s1(Q)))return null;if(Z&&!eS.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"?F4(rS,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&&s1(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,s1(this.ln[this.offset]))this.advanceOffset(1,!0);return $+1}addChild($){while(!zE(this.tip.kind,$.kind))this.stack.pop();if(this.tip.hasChild=!0,this.stack.push($),$E($.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 r2="<!-- faf:start -->",s2="<!-- faf:end -->",IG="\uFEFF";function X1($){return $.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter((Z,z,Q)=>Z!==""||z<Q.length-1)??[]}var q2=($)=>$.replace(/\r?\n$|\r$/,""),PG=($)=>q2($).replace(/^\uFEFF/,"").trimEnd();function*i3($){let Z=0;for(let z of X1($)){let Q=q2(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 XE($,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 n3($,Z,z){let[Q,X]=[new R2(!0),new R2(!1)].map((J)=>({reader:J,start:-1,found:null}));for(let J of i3($)){let Y=[Q,X].map((W)=>W.reader.line(J.content));if(Q.reader.tooDeep)return null;let U=[Q,X].filter((W,G)=>Y[G]===null);if(U.length>0)XE(U,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 TG=($)=>(Z)=>Z===$;function j4($,Z=r2,z=s2){return n3($,TG(Z),TG(z))}function AG($,Z){let z=[];for(let Q of[!0,!1]){let X=new R2(Q);for(let J of X1($))X.line(q2(J));if(X.clone().line(Z)!==null)z.push(X.closer())}return z}var JE=16;function YE($){let Z=new R2(!0);return $.map((z)=>{let Q=Z.overflowAt(q2(z),JE),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(q2(X)),X})}function UE($,Z,z){let X=YE(X1($).map((Y)=>{let U=PG(Y);return U===Z||U===z?` ${Y}`:Y})).join(""),J=AG(X,z);while(J.length>0&&J[0]!==null){let Y=`${X}
254
+ ${J[0]}`,U=AG(Y,z);if(U.length>=J.length)break;X=Y,J=U}return X}function WE($,Z,z){let Q=$.slice(Z.length+1,$.length-z.length-1),X=X1(Q).map((J)=>q2(J)===""?`>${J}`:`> ${J}`).join("");return`${Z}
255
255
  ${X}
256
- ${z}`}function _4($,Z,z,Q=l2,X=d2,J="the file"){let Y=(W)=>{let G=`${$}${W}${z}`,V=R4(G,Q,X);return V&&V.start===$.length&&V.end===$.length+W.length?G:null},U=Y(Z)??Y(aS(Z,Q,X));if(U===null)throw new v("unplaceable",J,`${J}: faf could not place its block where the next run finds it again — faf left it unchanged`,{onWrite:!0});return U}function c3($,Z=l2,z=d2){return`${Z}
257
- ${oS($.trim(),Z,z)}
258
- ${z}`}function LZ($,Z,z=l2,Q=d2,X){if($===null)return _4("",Z,`
259
- `,z,Q,X);let J=R4($,z,Q);if(J)return _4($.slice(0,J.start),Z,$.slice(J.end),z,Q,X);let Y=$.startsWith(HG)?HG:"";return _4(Y,Z,`
256
+ ${z}`}function R4($,Z,z,Q=r2,X=s2,J="the file"){let Y=(W)=>{let G=`${$}${W}${z}`,V=j4(G,Q,X);return V&&V.start===$.length&&V.end===$.length+W.length?G:null},U=Y(Z)??Y(WE(Z,Q,X));if(U===null)throw new k("unplaceable",J,`${J}: faf could not place its block where the next run finds it again — faf left it unchanged`,{onWrite:!0});return U}function r3($,Z=r2,z=s2){return`${Z}
257
+ ${UE($.trim(),Z,z)}
258
+ ${z}`}function TZ($,Z,z=r2,Q=s2,X){if($===null)return R4("",Z,`
259
+ `,z,Q,X);let J=j4($,z,Q);if(J)return R4($.slice(0,J.start),Z,$.slice(J.end),z,Q,X);let Y=$.startsWith(IG)?IG:"";return R4(Y,Z,`
260
260
 
261
- ${$.slice(Y.length)}`,z,Q,X)}function T6($){try{return G0($)}catch(Z){if(Z.code==="ENOENT")return null;throw Z}}function K2($,Z,z=l2,Q=d2,X={}){let J=c3(Z,z,Q),Y=DG($),U=X.root??LG(Y),W=i(U,Y),G=T6(W);o(W,LZ(G,J,z,Q,Y),{root:U,expect:G})}var tS="<!-- faf:";function eS($){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 $E($,Z){let z=[new F2(!0),new F2(!1)],Q=!1;for(let{content:X}of u3($)){if(Q){if(X===Z)return"too deep";continue}let[J,Y]=z.map((W)=>W.line(X));Q=z[0].tooDeep;let U=J??Y;if(X===Z&&(Q||U!==null))return Q?"too deep":U}return null}function ZE($,Z,z){let Q=[new F2(!0),new F2(!1)];for(let{content:X}of u3($)){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 p3($,Z,z=l2,Q=d2){if(Z===null||R4(Z,z,Q))return null;let X=OG(Z1(Z)[0]??"");if(X.startsWith(tS)&&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=$E(Z,z);if(J==="too deep")return`${$}: faf's block is now on top; the file nests more than ${KG} 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 ${eS(J)} and is left as you had it — delete it by hand if you no longer want it.`;if(ZE(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 DZ($,Z,z=l2,Q=d2,X={}){try{let J=DG($);return p3(Z,T6(i(X.root??LG(J),J)),z,Q)}catch{return null}}var zE=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 l3($){return $.split("_").map((Z)=>{if(!Z)return Z;let z=Z.toUpperCase();return zE.has(z)?z:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function q0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function u0($){let Z=H6.get($);if(Z?.label)return Z.label;let z=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return l3(z)}var XE=y0.claude,JE="STATUS: SYNC ACTIVE";function NG($,Z){K2(QE($,XE),Z)}function i2($,Z={}){let z=String($.project?.name??"").trim(),Q=String($.project?.main_language??"").trim(),X=String($.project?.type??"").trim(),J=String($.project?.goal??"").trim(),Y=`<!-- faf: ${[z,Q,X,J].join(" | ")} -->`,U=[];if(Z.doc)U.push(`doc=${Z.doc}`);else U.push(`claim=${Z.claim??"project.faf"}`);if(typeof Z.score==="number")U.push(`score=${Z.score}`);if(U.push(`family=${Z.family??"FAF"}`),Z.siblings&&Z.siblings.length>0)U.push(`siblings=${Z.siblings.join(",")}`);let W=`<!-- faf: ${U.join(" | ")} -->`;return`${Y}
262
- ${W}`}function IG($){let Z=[],z=$.project?.name??"Project",Q=$.project?.main_language??"",X=$.project?.goal??"";if(Z.push(i2($)),Z.push(""),Z.push(`# CLAUDE.md — ${z}`),Z.push(""),X)Z.push("## What This Is"),Z.push(""),Z.push(X),Z.push("");let J=$.stack??{},Y=[];if(Q)Y.push(`**Language:** ${Q}`);for(let[G,V]of Object.entries(J))if(V&&V!=="slotignored"&&String(V).trim())Y.push(`**${u0(`stack.${G}`)}:** ${V}`);if(Y.length>0){Z.push("## Stack"),Z.push("");for(let G of Y)Z.push(`- ${G}`);Z.push("")}let U=$.human_context??{},W=[["who",U.who],["what",U.what],["why",U.why],["where",U.where],["when",U.when],["how",U.how]].filter(([,G])=>G&&String(G).trim()).map(([G,V])=>`- **${u0(`human_context.${G}`)}:** ${V}`);if(W.length>0)Z.push("## Context"),Z.push(""),Z.push(...W),Z.push("");return Z.push("---"),Z.push(""),Z.push(`*${JE} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
263
- `)}import{existsSync as _p,lstatSync as FG,readFileSync as NZ,realpathSync as d3,statSync as YE}from"fs";import{homedir as UE}from"os";import{basename as WE,dirname as i3,join as n2,resolve as Q1}from"path";function z1($){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 A6($){return z1($).cmd}var TG=200,AG=200,CG=12,GE="# Project Context (from project.faf)",VE="*This section is managed by tri-sync.";function qE($){let Z=0;for(let z=0;z<$.length;z++)Z=(Z<<5)-Z+$.charCodeAt(z)|0;return Z}function KE($){let Z=$.replace(/[^a-zA-Z0-9]/g,"-");if(Z.length<=TG)return Z;return`${Z.slice(0,TG)}-${Math.abs(qE($)).toString(36)}`}function jG($){try{let Z=FG($);if(Z.isSymbolicLink()){let z=YE($);return z.isDirectory()||z.isFile()}return Z.isDirectory()||Z.isFile()}catch{return!1}}function _G($){try{return FG($).isFile()}catch{return!1}}function HE($){let Z=$;for(;;){if(jG(n2(Z,".git")))return Z;let z=i3(Z);if(z===Z)return null;Z=z}}function BE($){let Z;try{Z=NZ(n2($,".git"),"utf-8").trim()}catch{return $}try{if(!Z.startsWith("gitdir:"))return $;let z=Q1($,Z.slice(7).trim()),Q=n2(z,"commondir");if(!_G(Q))return $;let X=Q1(z,NZ(Q,"utf-8").trim());if(Q1(i3(z))!==n2(X,"worktrees"))return $;let J=n2(z,"gitdir");if(!_G(J))return $;let Y=NZ(J,"utf-8").trim();if(d3(Q1(z,Y))!==n2(d3($),".git"))return $;if(WE(X)!==".git")return jG(n2(X,".git"))?$:X;return i3(X)}catch{return $}}function ME($){let Z=Q1($);try{Z=d3.native(Z)}catch{}let z=HE(Z);return(z?BE(z):Z).normalize("NFC")}function LE($,Z={}){if(Z.memoryDir)return Q1(Z.memoryDir);let z=Z.configDir||process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR||process.env.CLAUDE_CONFIG_DIR||n2(UE(),".claude");return n2(Q1(z),"projects",KE(ME($)),"memory").normalize("NFC")}var DE=new Set(["target_user","core_problem","mission_purpose"]),OE=["who","what","why","where","when","how"];function NE($){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:** ${q0(Z.name)?Z.name:"Project"}`,...z.filter(([,Y])=>q0(Y)).map(([Y,U])=>`- **${Y}:** ${U}`),...OZ("Stack",Object.entries($.stack??{}).filter(([Y,U])=>!DE.has(Y)&&q0(U)).map(([Y,U])=>`- **${u0(`stack.${Y}`)}:** ${U}`)),...OZ("Context",OE.filter((Y)=>q0(Q[Y])).map((Y)=>`- **${u0(`human_context.${Y}`)}:** ${Q[Y]}`)),...OZ("Commands",Object.entries($.commands??{}).filter(([,Y])=>q0(Y)).slice(0,CG).map(([Y,U])=>`- ${Y}: \`${A6(U)}\``)),...OZ("Key files",X.filter(q0).slice(0,CG).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(`
264
- `)}function OZ($,Z){return Z.length>0?["",`### ${$}`,...Z]:[]}function IE($){return m3($,(Z)=>Z.trimEnd()===GE,(Z)=>Z.startsWith(VE))}function RG($){if($==="")return 0;let Z=$.match(/\r\n|\r|\n/g)?.length??0;return/(\r\n|\r|\n)$/.test($)?Z:Z+1}function TE($,Z,z){if($===null)return{text:LZ(null,Z,void 0,void 0,z),action:"created",head:"",tail:""};let Q=R4($),X=Q??IE($);if(X){let Y=$.slice(0,X.start),U=$.slice(X.end);return{text:_4(Y,Z,U,void 0,void 0,z),action:Q?"updated":"migrated",head:Y,tail:U}}let J=$.startsWith("\uFEFF")?"\uFEFF":"";return{text:LZ($,Z,void 0,void 0,z),action:"added",head:J,tail:$.slice(J.length)}}function PG($){return $>AG?[`MEMORY.md is ${$} lines. Claude Code loads the first ${AG}; lines after that are kept in the file but not loaded.`]:[]}function SG($,Z,z={}){let Q=LE($,z);E0(Q);let X=i(Q,y0.memory),J=T6(X),Y=TE(J,c3(NE(Z)),X);if(Y.text===J){let K=RG(J);return{path:X,action:"unchanged",written:!1,preserved:!0,lines:K,warnings:PG(K)}}let U=o(X,Y.text,{root:Q,expect:J}),W=NZ(U,"utf-8"),G=W===Y.text&&W.startsWith(Y.head)&&W.endsWith(Y.tail),V=RG(W),q=Y.action==="added"?p3(y0.memory,J):null;return{path:U,action:Y.action,written:!0,preserved:G,lines:V,warnings:[...q?[q]:[],...PG(V)]}}l();function P4(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function wG($={}){let Z=process.cwd(),z=m(Z);if(!z)console.error(`Error: project.faf not found
261
+ ${$.slice(Y.length)}`,z,Q,X)}function P6($){try{return W0($)}catch(Z){if(Z.code==="ENOENT")return null;throw Z}}function K2($,Z,z=r2,Q=s2,X={}){let J=r3(Z,z,Q),Y=_G($),U=X.root??CG(Y),W=n(U,Y),G=P6(W);s(W,TZ(G,J,z,Q,Y),{root:U,expect:G})}var GE="<!-- faf:";function VE($){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 qE($,Z){let z=[new R2(!0),new R2(!1)],Q=!1;for(let{content:X}of i3($)){if(Q){if(X===Z)return"too deep";continue}let[J,Y]=z.map((W)=>W.line(X));Q=z[0].tooDeep;let U=J??Y;if(X===Z&&(Q||U!==null))return Q?"too deep":U}return null}function KE($,Z,z){let Q=[new R2(!0),new R2(!1)];for(let{content:X}of i3($)){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 s3($,Z,z=r2,Q=s2){if(Z===null||j4(Z,z,Q))return null;let X=PG(X1(Z)[0]??"");if(X.startsWith(GE)&&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=qE(Z,z);if(J==="too deep")return`${$}: faf's block is now on top; the file nests more than ${NG} 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 ${VE(J)} and is left as you had it — delete it by hand if you no longer want it.`;if(KE(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 AZ($,Z,z=r2,Q=s2,X={}){try{let J=_G($);return s3(Z,P6(n(X.root??CG(J),J)),z,Q)}catch{return null}}var HE=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 t3($){return $.split("_").map((Z)=>{if(!Z)return Z;let z=Z.toUpperCase();return HE.has(z)?z:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function F0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function S4($){if($===null||$===void 0)return null;if(typeof $==="string"){let Z=$.replace(/\s+/g," ").trim();if(Z===""||Z.toLowerCase()==="slotignored"||J0(Z))return null;return Z}if(typeof $==="number"||typeof $==="boolean")return String($);if($ instanceof Date){let Z=$.toISOString();return Z.endsWith("T00:00:00.000Z")?Z.slice(0,10):Z}if(Array.isArray($)){let Z=$.map(S4).filter((z)=>z!==null);return Z.length?Z.join(", "):null}if(typeof $==="object"){let Z=Object.entries($).map(([z,Q])=>{let X=S4(Q);return X===null?null:`${z}: ${X}`}).filter((z)=>z!==null);return Z.length?Z.join("; "):null}return null}var o3=new WeakMap;function BE($){let Z=n2($);if(!Z)return;if(!o3.has(Z)){let z;try{z=l2(Z.text,{schema:"failsafe"}).toJS()}catch{z=void 0}o3.set(Z,z)}return o3.get(Z)}function ME($,Z){if(typeof Z!=="string")return $;let z;try{z=S0(Z)}catch{return $}return typeof z==="number"&&(Object.is(z,$)||Number.isNaN(z)&&Number.isNaN($))?Z:$}function a3($,Z){if(typeof $==="number")return ME($,Z);if(Array.isArray($))return $.map((z,Q)=>a3(z,Array.isArray(Z)?Z[Q]:void 0));if($!==null&&typeof $==="object"&&!($ instanceof Date)){let z=Z!==null&&typeof Z==="object"&&!Array.isArray(Z)?Z:{};return Object.fromEntries(Object.entries($).map(([Q,X])=>[Q,a3(X,z[Q])]))}return $}function E4($,Z){let z=$,Q=BE($);for(let X of Z)z=z!==null&&typeof z==="object"?z[X]:void 0,Q=Q!==null&&typeof Q==="object"?Q[X]:void 0;return S4(a3(z,Q))}function v2($){let Z=[];for(let z of["who","what","why","where","when","how"]){let Q=E4($,["human_context",z]);if(Q!==null)Z.push([o0(`human_context.${z}`),Q])}return Z}function o0($){let Z=D6.get($);if(Z?.label)return Z.label;let z=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return t3(z)}var DE=b0.claude,OE="STATUS: SYNC ACTIVE";function FG($,Z){K2(LE($,DE),Z)}function o2($,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(" | ")} -->`,U=[];if(Z.doc)U.push(`doc=${Z.doc}`);else U.push(`claim=${Z.claim??"project.faf"}`);if(typeof Z.score==="number")U.push(`score=${Z.score}`);if(U.push(`family=${Z.family??"FAF"}`),Z.siblings&&Z.siblings.length>0)U.push(`siblings=${Z.siblings.join(",")}`);let W=`<!-- faf: ${U.join(" | ")} -->`;return`${Y}
262
+ ${W}`}function RG($,Z="project.faf"){let z=[],Q=$.project?.name??"Project",X=$.project?.main_language??"",J=$.project?.goal??"";if(z.push(o2($,{claim:Z})),z.push(""),z.push(`# CLAUDE.md — ${Q}`),z.push(""),J)z.push("## What This Is"),z.push(""),z.push(J),z.push("");let Y=$.stack??{},U=[];if(X)U.push(`**Language:** ${X}`);for(let[G,V]of Object.entries(Y))if(V&&V!=="slotignored"&&String(V).trim())U.push(`**${o0(`stack.${G}`)}:** ${V}`);if(U.length>0){z.push("## Stack"),z.push("");for(let G of U)z.push(`- ${G}`);z.push("")}let W=v2($).map(([G,V])=>`- **${G}:** ${V}`);if(W.length>0)z.push("## Context"),z.push(""),z.push(...W),z.push("");return z.push("---"),z.push(""),z.push(`*${OE} — ${new Date().toISOString()}*`),z.push(""),z.join(`
263
+ `)}import{existsSync as cp,lstatSync as bG,readFileSync as _Z,realpathSync as e3,statSync as NE}from"fs";import{homedir as IE}from"os";import{basename as TE,dirname as $z,join as a2,resolve as Y1}from"path";function J1($){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 F6($){return J1($).cmd}var jG=200,SG=200,EG=12,AE="# Project Context (from project.faf)",CE="*This section is managed by tri-sync.";function _E($){let Z=0;for(let z=0;z<$.length;z++)Z=(Z<<5)-Z+$.charCodeAt(z)|0;return Z}function PE($){let Z=$.replace(/[^a-zA-Z0-9]/g,"-");if(Z.length<=jG)return Z;return`${Z.slice(0,jG)}-${Math.abs(_E($)).toString(36)}`}function kG($){try{let Z=bG($);if(Z.isSymbolicLink()){let z=NE($);return z.isDirectory()||z.isFile()}return Z.isDirectory()||Z.isFile()}catch{return!1}}function wG($){try{return bG($).isFile()}catch{return!1}}function FE($){let Z=$;for(;;){if(kG(a2(Z,".git")))return Z;let z=$z(Z);if(z===Z)return null;Z=z}}function RE($){let Z;try{Z=_Z(a2($,".git"),"utf-8").trim()}catch{return $}try{if(!Z.startsWith("gitdir:"))return $;let z=Y1($,Z.slice(7).trim()),Q=a2(z,"commondir");if(!wG(Q))return $;let X=Y1(z,_Z(Q,"utf-8").trim());if(Y1($z(z))!==a2(X,"worktrees"))return $;let J=a2(z,"gitdir");if(!wG(J))return $;let Y=_Z(J,"utf-8").trim();if(e3(Y1(z,Y))!==a2(e3($),".git"))return $;if(TE(X)!==".git")return kG(a2(X,".git"))?$:X;return $z(X)}catch{return $}}function jE($){let Z=Y1($);try{Z=e3.native(Z)}catch{}let z=FE(Z);return(z?RE(z):Z).normalize("NFC")}function SE($,Z={}){if(Z.memoryDir)return Y1(Z.memoryDir);let z=Z.configDir||process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR||process.env.CLAUDE_CONFIG_DIR||a2(IE(),".claude");return a2(Y1(z),"projects",PE(jE($)),"memory").normalize("NFC")}var EE=new Set(["target_user","core_problem","mission_purpose"]);function wE($){let Z=$.project??{},z=[["Goal",Z.goal],["Language",Z.main_language],["Type",Z.type]],Q=Array.isArray($.key_files)?$.key_files:[];return["## Project context — from project.faf","",`- **Name:** ${F0(Z.name)?Z.name:"Project"}`,...z.filter(([,J])=>F0(J)).map(([J,Y])=>`- **${J}:** ${Y}`),...CZ("Stack",Object.entries($.stack??{}).filter(([J,Y])=>!EE.has(J)&&F0(Y)).map(([J,Y])=>`- **${o0(`stack.${J}`)}:** ${Y}`)),...CZ("Context",v2($).map(([J,Y])=>`- **${J}:** ${Y}`)),...CZ("Commands",Object.entries($.commands??{}).filter(([,J])=>F0(J)).slice(0,EG).map(([J,Y])=>`- ${J}: \`${F6(Y)}\``)),...CZ("Key files",Q.filter(F0).slice(0,EG).map((J)=>`- ${J}`)),"","*faf keeps this block in step with project.faf. Everything outside it is Claude's own and is kept as written.*"].join(`
264
+ `)}function CZ($,Z){return Z.length>0?["",`### ${$}`,...Z]:[]}function xE($){return n3($,(Z)=>Z.trimEnd()===AE,(Z)=>Z.startsWith(CE))}function xG($){if($==="")return 0;let Z=$.match(/\r\n|\r|\n/g)?.length??0;return/(\r\n|\r|\n)$/.test($)?Z:Z+1}function yE($,Z,z){if($===null)return{text:TZ(null,Z,void 0,void 0,z),action:"created",head:"",tail:""};let Q=j4($),X=Q??xE($);if(X){let Y=$.slice(0,X.start),U=$.slice(X.end);return{text:R4(Y,Z,U,void 0,void 0,z),action:Q?"updated":"migrated",head:Y,tail:U}}let J=$.startsWith("\uFEFF")?"\uFEFF":"";return{text:TZ($,Z,void 0,void 0,z),action:"added",head:J,tail:$.slice(J.length)}}function yG($){return $>SG?[`MEMORY.md is ${$} lines. Claude Code loads the first ${SG}; lines after that are kept in the file but not loaded.`]:[]}function vG($,Z,z={}){let Q=SE($,z);E0(Q);let X=n(Q,b0.memory),J=P6(X),Y=yE(J,r3(wE(Z)),X);if(Y.text===J){let K=xG(J);return{path:X,action:"unchanged",written:!1,preserved:!0,lines:K,warnings:yG(K)}}let U=s(X,Y.text,{root:Q,expect:J}),W=_Z(U,"utf-8"),G=W===Y.text&&W.startsWith(Y.head)&&W.endsWith(Y.tail),V=xG(W),q=Y.action==="added"?s3(b0.memory,J):null;return{path:U,action:Y.action,written:!0,preserved:G,lines:V,warnings:[...q?[q]:[],...yG(V)]}}i();function w4(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function hG($={}){let Z=process.cwd(),z=c(Z);if(!z)console.error(`Error: project.faf not found
265
265
 
266
- Run 'faf init' to create one.`),process.exit(2);let Q=EG(Z,"CLAUDE.md");if(xG(z,Z),P4())yG(z,Z);if($.watch)console.log(M("watching for changes... (Ctrl+C to stop)")),_E(z,Q,Z)}function xG($,Z){let z=t($),Q=IG(z),X=DZ(EG(Z,"CLAUDE.md"),"CLAUDE.md");if(NG(Z,Q),console.log(`${A("◆")} sync .faf → CLAUDE.md`),X)console.log(M(` ${X}`));let J=a($,()=>k0(F0(p($))));w0(J,$)}var CE={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 yG($,Z){try{let z=SG(Z,t($));console.log(`${A("◆")} sync .faf → MEMORY.md ${M(`${CE[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 _E($,Z,z){let{watch:Q}=p0("fs"),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{if(console.log(M("change detected...")),xG($,z),P4())yG($,z)},200)};if(Q($,J),AE(Z))Q(Z,J)}import{statSync as bG}from"fs";import{dirname as kG,resolve as F4}from"path";l();function n3($){return $.length>=4&&$[0]===70&&$[1]===65&&$[2]===70&&$[3]===66}var r3="FAFB header (a .fafb faf compiled)";function s3($){return/\.faf$/i.test($)?$.replace(/\.faf$/i,".fafb"):`${$}.fafb`}function o3($,Z){if(F4($)===F4(Z))return!0;try{let z=bG($),Q=bG(Z);return z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function vG($,Z={}){let z=$??m();if(!z)console.error(`Error: project.faf not found
266
+ Run 'faf init' to create one.`),process.exit(2);let Q=gG(Z,"CLAUDE.md");if(fG(z,Z),w4())uG(z,Z);if($.watch)console.log(M("watching for changes... (Ctrl+C to stop)")),vE(z,Q,Z)}function fG($,Z){let z=a($),Q=RG(z,i5(Z,$)),X=AZ(gG(Z,"CLAUDE.md"),"CLAUDE.md");if(FG(Z,Q),console.log(`${A("◆")} sync .faf → CLAUDE.md`),X)console.log(M(` ${X}`));let J=o($,()=>v0(P0(l($))));w0(J,$)}var kE={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 uG($,Z){try{let z=vG(Z,a($));console.log(`${A("◆")} sync .faf → MEMORY.md ${M(`${kE[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 vE($,Z,z){let{watch:Q}=c0("fs"),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{if(console.log(M("change detected...")),fG($,z),w4())uG($,z)},200)};if(Q($,J),bE(Z))Q(Z,J)}import{statSync as mG}from"fs";import{dirname as cG,resolve as x4}from"path";i();function Zz($){return $.length>=4&&$[0]===70&&$[1]===65&&$[2]===70&&$[3]===66}var zz="FAFB header (a .fafb faf compiled)";function Qz($){return/\.faf$/i.test($)?$.replace(/\.faf$/i,".fafb"):`${$}.fafb`}function Xz($,Z){if(x4($)===x4(Z))return!0;try{let z=mG($),Q=mG(Z);return z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function pG($,Z={}){let z=$??c();if(!z)console.error(`Error: project.faf not found
267
267
 
268
- Run 'faf init' to create one.`),process.exit(2);let Q=p(z);U2(Q,z);let X=a(z,()=>l5(Q)),J=Z.output??s3(z);if(o3(J,z))console.error(`faf: ${F4(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);V2(Z.output);let Y=Z.output?kG(F4(J)):kG(F4(z));x2(J,X,{root:Y,owns:n3,mark:r3,force:Z.force}),console.log(`${A("compiled")} ${J} ${M(`(${X.length} bytes)`)}`)}import{readFileSync as pE}from"fs";import{dirname as lE,resolve as iG}from"path";import{createHash as SE}from"crypto";import{resolve as EE}from"path";class m0 extends Error{constructor($){super($);this.name="JsonEditError"}}var RE=new Set([" ","\t",`
269
- `,"\r"]);class e3{s;i=0;constructor($){this.s=$}parse(){if(this.s.startsWith("\uFEFF"))this.i=1;let $=this.value();if(this.ws(),this.i!==this.s.length)this.fail("text after the end of the JSON value");return $}fail($){throw new m0(`not valid JSON (${$} at offset ${this.i})`)}ws(){while(this.i<this.s.length&&RE.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 a3=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function t3($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>t3(z,Z[Q]));if(a3($)&&a3(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&t3($[Q],Z[Q]))}return!1}class $z{s;style;after;edits=[];constructor($,Z,z){this.s=$;this.style=Z;this.after=z}startsLine($){let Z=this.s.lastIndexOf(`
268
+ Run 'faf init' to create one.`),process.exit(2);let Q=l(z);U2(Q,z);let X=o(z,()=>s5(Q)),J=Z.output??Qz(z);if(Xz(J,z))console.error(`faf: ${x4(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);V2(Z.output);let Y=Z.output?cG(x4(J)):cG(x4(z));y2(J,X,{root:Y,owns:Zz,mark:zz,force:Z.force}),console.log(`${A("compiled")} ${J} ${M(`(${X.length} bytes)`)}`)}import{readFileSync as Zw}from"fs";import{dirname as zw,resolve as eG}from"path";import{createHash as mE}from"crypto";import{resolve as cE}from"path";class u0 extends Error{constructor($){super($);this.name="JsonEditError"}}var gE=new Set([" ","\t",`
269
+ `,"\r"]);class Uz{s;i=0;constructor($){this.s=$}parse(){if(this.s.startsWith("\uFEFF"))this.i=1;let $=this.value();if(this.ws(),this.i!==this.s.length)this.fail("text after the end of the JSON value");return $}fail($){throw new u0(`not valid JSON (${$} at offset ${this.i})`)}ws(){while(this.i<this.s.length&&gE.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 Jz=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function Yz($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>Yz(z,Z[Q]));if(Jz($)&&Jz(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&Yz($[Q],Z[Q]))}return!1}class Wz{s;style;after;edits=[];constructor($,Z,z){this.s=$;this.style=Z;this.after=z}startsLine($){let Z=this.s.lastIndexOf(`
270
270
  `,$-1);return Z>=0&&/^[ \t]*$/.test(this.s.slice(Z+1,$))}indentOf($){return this.startsLine($)?this.s.slice(this.s.lastIndexOf(`
271
271
  `,$-1)+1,$):""}render($,Z,z){if(!z)return JSON.stringify($);return JSON.stringify($,null,this.style.unit).split(`
272
- `).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 U=z?`${z}.${J}`:J,W=$.members.filter((K)=>K.key===J);if(W.length>1)throw new m0(`the key "${U}" is there more than once`);let G=W[0];if(!G){if($.members.length===0)X[J]=Y;else this.insert($,J,Y,z);continue}let V=this.startsLine(G.keyStart);if(a3(Y)){if(G.value.kind!=="object")throw new m0(`"${U}" is not an object, so faf cannot add its keys to it`);this.apply(G.value,Y,U,V||this.s.slice(G.value.start,G.value.end).includes(`
273
- `));continue}let q=JSON.parse(this.s.slice(G.value.start,G.value.end));if(t3(q,Y))continue;if(G.value.kind==="object"||G.value.kind==="array")throw new m0(`"${U}" 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],U=(this.after[Q]?.[Z]??[]).map((q)=>X.find((K)=>K.key===q)).find((q)=>q!==void 0);if(this.startsLine(X[0].keyStart)){let q=U&&U!==J?X[X.indexOf(U)+1]:J,K=this.indentOf(q.keyStart),H=this.s.slice(q.keyEnd,q.value.start),L=this.s.lastIndexOf(`
274
- `,q.keyStart-1),B=L>0&&this.s[L-1]==="\r"?L-1:L,D=`${this.style.eol}${K}${JSON.stringify(Z)}${H}${this.render(z,K,!0)},`;this.edits.push({start:B,end:B,text:D});return}let W=U??J,G=this.s.slice(W.keyEnd,W.value.start),V=X.length>1?this.s.slice(X[0].value.end,X[1].keyStart):", ";this.edits.push({start:W.value.end,end:W.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),U=Z.map((W)=>`,${this.style.eol}${Y}${this.render(W,Y,!0)}`).join("");this.edits.push({start:X.end,end:X.end,text:U});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(`
275
- `,$-1)+1;while(Z<$&&(this.s[Z]===" "||this.s[Z]==="\t"))Z++;return Z}}function gG($,Z){let z=$.includes(`\r
272
+ `).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 U=z?`${z}.${J}`:J,W=$.members.filter((K)=>K.key===J);if(W.length>1)throw new u0(`the key "${U}" is there more than once`);let G=W[0];if(!G){if($.members.length===0)X[J]=Y;else this.insert($,J,Y,z);continue}let V=this.startsLine(G.keyStart);if(Jz(Y)){if(G.value.kind!=="object")throw new u0(`"${U}" is not an object, so faf cannot add its keys to it`);this.apply(G.value,Y,U,V||this.s.slice(G.value.start,G.value.end).includes(`
273
+ `));continue}let q=JSON.parse(this.s.slice(G.value.start,G.value.end));if(Yz(q,Y))continue;if(G.value.kind==="object"||G.value.kind==="array")throw new u0(`"${U}" 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],U=(this.after[Q]?.[Z]??[]).map((q)=>X.find((K)=>K.key===q)).find((q)=>q!==void 0);if(this.startsLine(X[0].keyStart)){let q=U&&U!==J?X[X.indexOf(U)+1]:J,K=this.indentOf(q.keyStart),L=this.s.slice(q.keyEnd,q.value.start),B=this.s.lastIndexOf(`
274
+ `,q.keyStart-1),H=B>0&&this.s[B-1]==="\r"?B-1:B,D=`${this.style.eol}${K}${JSON.stringify(Z)}${L}${this.render(z,K,!0)},`;this.edits.push({start:H,end:H,text:D});return}let W=U??J,G=this.s.slice(W.keyEnd,W.value.start),V=X.length>1?this.s.slice(X[0].value.end,X[1].keyStart):", ";this.edits.push({start:W.value.end,end:W.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),U=Z.map((W)=>`,${this.style.eol}${Y}${this.render(W,Y,!0)}`).join("");this.edits.push({start:X.end,end:X.end,text:U});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(`
275
+ `,$-1)+1;while(Z<$&&(this.s[Z]===" "||this.s[Z]==="\t"))Z++;return Z}}function lG($,Z){let z=$.includes(`\r
276
276
  `)?`\r
277
277
  `:`
278
278
  `,Q=Z.members[0],X=Q?$.lastIndexOf(`
279
- `,Q.keyStart-1):-1,J=Q&&X>=0?$.slice(X+1,Q.keyStart):"";return{eol:z,unit:/^[ \t]+$/.test(J)?J:" "}}function d1($,Z,z={}){let Q=new e3($).parse();if(Q.kind!=="object")throw new m0("the JSON is not an object");let X=new $z($,gG($,Q),z);return X.apply(Q,Z,"",$.slice(Q.start,Q.end).includes(`
280
- `)),IZ($,X.edits)}function IZ($,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 hG($){let Z=new e3($).parse();if(Z.kind!=="object")throw new m0("the JSON is not an object");return Z}function PE($,Z,z,Q){let X=Z.members.filter((Y)=>Y.key===z);if(X.length>1)throw new m0(`the key "${Q}.${z}" is there more than once`);let J=X[0]?.value;return J?.kind==="string"?JSON.parse($.slice(J.start,J.end)):void 0}function fG($,Z,z,Q){let X=hG($),J=new $z($,gG($,X),{}),Y=$.slice(X.start,X.end).includes(`
281
- `),U=X.members.filter((q)=>q.key===Z);if(U.length>1)throw new m0(`the key "${Z}" is there more than once`);if(U.length===0)return J.apply(X,{[Z]:z},"",Y),IZ($,J.edits);let W=U[0],G=W.value;if(G.kind!=="array")throw new m0(`"${Z}" is not an array, so faf cannot add its rows to it`);let V=[];for(let q of z){let K=q[Q.id],H=G.items.filter((D,N)=>D.kind==="object"&&PE($,D,Q.id,`${Z}[${N}]`)===K);if(H.length>1)throw new m0(`the ${Z} row ${JSON.stringify(K)} is there more than once`);if(H.length===0){V.push(q);continue}let L=H[0],B=Object.fromEntries(Q.update.map((D)=>[D,q[D]]));J.apply(L,B,`${Z}[${G.items.indexOf(L)}]`,$.slice(L.start,L.end).includes(`
282
- `))}return J.append(G,V,W.keyStart,Y),IZ($,J.edits)}function FE($,Z){let z=$.lastIndexOf(`
283
- `,Z-1);return z>=0&&/^[ \t]*$/.test($.slice(z+1,Z))}function jE($,Z,z){if(Z.members.length===1)return{start:Z.start,end:Z.end,text:"{}"};let Q=Z.members.indexOf(z);if(FE($,z.keyStart)&&$[z.value.end]===","){let X=$.lastIndexOf(`
284
- `,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 uG($,Z){let z=[],Q=hG($);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 mG($,Z){let{count:z,chain:Q}=uG($,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 Zz($,Z,z={}){let{count:Q,chain:X}=uG($,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 IZ($,[jE($,J.obj,J.member)]).text}var pG="one.faf/render";function Qz($){return`sha256:${SE("sha256").update($,"utf8").digest("hex")}`}var wE=/^sha256:[0-9a-f]{64}$/,xE=/^<meta name="faf-render" content="(sha256:[0-9a-f]{64})">$/,yE='<meta name="faf-render"',bE='<meta name="description" content="Visual render of project.faf.';function kE($){let Z=$.split(/(?<=\n)/),z=Z.findIndex((Q)=>Q.startsWith(bE));return Z.splice(z+1,0,`<meta name="faf-render" content="${Qz($)}">
285
- `),Z.join("")}function lG($){let Z=$.split(/(?<=\n)/),z=[],Q=!1;if(Z.forEach((X,J)=>{let Y=X.replace(/\r?\n$/,""),U=xE.exec(Y);if(U)z.push({at:J,hash:U[1]});else if(Y.startsWith(yE))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 zz=["_meta",pG];function vE($){return d1($,{_meta:{[pG]:Qz($)}}).text}function gE($){try{return Zz($,zz,{dropEmptyParent:!0})??$}catch{return $}}function hE($){let Z;try{Z=mG($,zz)}catch{return null}if(Z.count===0)return null;if(Z.count>1||typeof Z.value!=="string"||!wE.test(Z.value))return"many";let z=Zz($,zz,{dropEmptyParent:!0});return z===null?"many":{hash:Z.value,canonical:z}}function dG($,Z){return $==="html"?kE(Z):vE(Z)}function fE($,Z){if($==="json")return gE(Z);let z=lG(Z);return z===null||z==="many"?Z:z.canonical}function cG($,Z){let z=new TextDecoder().decode($),Q=Z==="html"?lG(z):hE(z);if(Q===null)return"none";if(Q==="many")return"mismatch";return Buffer.from(z,"utf-8").equals(Buffer.from($))&&Q.hash===Qz(Q.canonical)&&dG(Z,Q.canonical)===z?"match":"mismatch"}function uE($){let Z=new TextDecoder().decode($);if(!Z.includes(`\r
279
+ `,Q.keyStart-1):-1,J=Q&&X>=0?$.slice(X+1,Q.keyStart):"";return{eol:z,unit:/^[ \t]+$/.test(J)?J:" "}}function o1($,Z,z={}){let Q=new Uz($).parse();if(Q.kind!=="object")throw new u0("the JSON is not an object");let X=new Wz($,lG($,Q),z);return X.apply(Q,Z,"",$.slice(Q.start,Q.end).includes(`
280
+ `)),PZ($,X.edits)}function PZ($,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 dG($){let Z=new Uz($).parse();if(Z.kind!=="object")throw new u0("the JSON is not an object");return Z}function hE($,Z,z,Q){let X=Z.members.filter((Y)=>Y.key===z);if(X.length>1)throw new u0(`the key "${Q}.${z}" is there more than once`);let J=X[0]?.value;return J?.kind==="string"?JSON.parse($.slice(J.start,J.end)):void 0}function iG($,Z,z,Q){let X=dG($),J=new Wz($,lG($,X),{}),Y=$.slice(X.start,X.end).includes(`
281
+ `),U=X.members.filter((q)=>q.key===Z);if(U.length>1)throw new u0(`the key "${Z}" is there more than once`);if(U.length===0)return J.apply(X,{[Z]:z},"",Y),PZ($,J.edits);let W=U[0],G=W.value;if(G.kind!=="array")throw new u0(`"${Z}" is not an array, so faf cannot add its rows to it`);let V=[];for(let q of z){let K=q[Q.id],L=G.items.filter((D,N)=>D.kind==="object"&&hE($,D,Q.id,`${Z}[${N}]`)===K);if(L.length>1)throw new u0(`the ${Z} row ${JSON.stringify(K)} is there more than once`);if(L.length===0){V.push(q);continue}let B=L[0],H=Object.fromEntries(Q.update.map((D)=>[D,q[D]]));J.apply(B,H,`${Z}[${G.items.indexOf(B)}]`,$.slice(B.start,B.end).includes(`
282
+ `))}return J.append(G,V,W.keyStart,Y),PZ($,J.edits)}function fE($,Z){let z=$.lastIndexOf(`
283
+ `,Z-1);return z>=0&&/^[ \t]*$/.test($.slice(z+1,Z))}function uE($,Z,z){if(Z.members.length===1)return{start:Z.start,end:Z.end,text:"{}"};let Q=Z.members.indexOf(z);if(fE($,z.keyStart)&&$[z.value.end]===","){let X=$.lastIndexOf(`
284
+ `,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 nG($,Z){let z=[],Q=dG($);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 rG($,Z){let{count:z,chain:Q}=nG($,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 Gz($,Z,z={}){let{count:Q,chain:X}=nG($,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 PZ($,[uE($,J.obj,J.member)]).text}var oG="one.faf/render";function qz($){return`sha256:${mE("sha256").update($,"utf8").digest("hex")}`}var pE=/^sha256:[0-9a-f]{64}$/,lE=/^<meta name="faf-render" content="(sha256:[0-9a-f]{64})">$/,dE='<meta name="faf-render"',iE='<meta name="description" content="Visual render of project.faf.';function nE($){let Z=$.split(/(?<=\n)/),z=Z.findIndex((Q)=>Q.startsWith(iE));return Z.splice(z+1,0,`<meta name="faf-render" content="${qz($)}">
285
+ `),Z.join("")}function aG($){let Z=$.split(/(?<=\n)/),z=[],Q=!1;if(Z.forEach((X,J)=>{let Y=X.replace(/\r?\n$/,""),U=lE.exec(Y);if(U)z.push({at:J,hash:U[1]});else if(Y.startsWith(dE))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 Vz=["_meta",oG];function rE($){return o1($,{_meta:{[oG]:qz($)}}).text}function sE($){try{return Gz($,Vz,{dropEmptyParent:!0})??$}catch{return $}}function oE($){let Z;try{Z=rG($,Vz)}catch{return null}if(Z.count===0)return null;if(Z.count>1||typeof Z.value!=="string"||!pE.test(Z.value))return"many";let z=Gz($,Vz,{dropEmptyParent:!0});return z===null?"many":{hash:Z.value,canonical:z}}function tG($,Z){return $==="html"?nE(Z):rE(Z)}function aE($,Z){if($==="json")return sE(Z);let z=aG(Z);return z===null||z==="many"?Z:z.canonical}function sG($,Z){let z=new TextDecoder().decode($),Q=Z==="html"?aG(z):oE(z);if(Q===null)return"none";if(Q==="many")return"mismatch";return Buffer.from(z,"utf-8").equals(Buffer.from($))&&Q.hash===qz(Q.canonical)&&tG(Z,Q.canonical)===z?"match":"mismatch"}function tE($){let Z=new TextDecoder().decode($);if(!Z.includes(`\r
286
286
  `)||/(?:^|[^\r])\n/.test(Z)||!Buffer.from(Z,"utf-8").equals($))return null;return Buffer.from(Z.replace(/\r\n/g,`
287
- `),"utf-8")}function mE($,Z,z){let Q=cG($,z);return Q!=="match"&&Z!==null&&cG(Z,z)==="match"?"match":Q}function H2($,Z,z){let Q=EE($),X=i(z.root,Q),J=fE(z.format,Z),Y=dG(z.format,J),U=f0(X);if(U===null)return o(X,Y,{root:z.root,expect:null}),{path:X,result:"created"};if(U.equals(Buffer.from(Y,"utf-8")))return{path:X,result:"unchanged"};let W=uE(U),G=W===null?Y:Y.replace(/\r?\n/g,`\r
288
- `);if(W!==null&&U.equals(Buffer.from(G,"utf-8")))return{path:X,result:"unchanged"};if(z.force!==!0&&!cE(Q,U,W,J,z))return{path:X,result:"unchanged"};return o(X,G,{root:z.root,expect:U}),{path:X,result:"updated"}}function cE($,Z,z,Q,X){let J=mE(Z,z,X.format);if(J==="match")return!0;if(J==="mismatch")throw new v("not-owned",$,`${$} was edited since faf wrote it — faf left it unchanged. Use --force to replace it.`,{onWrite:!0});if(!X.hasMark(Z))throw new v("not-owned",$,`${$} has no ${X.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});let Y=Buffer.from(Q,"utf-8");if(Z.equals(Y)||z!==null&&z.equals(Y))return!1;throw new v("not-owned",$,`${$} has no faf render hash (written before 7.13), so faf cannot tell whether it was edited — faf left it unchanged. Use --force once to replace it; after that faf recognises its own output.`,{onWrite:!0})}l();function nG($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let z=new Uint8Array(pE($));if(String.fromCharCode(z[0],z[1],z[2],z[3])!=="FAFB")console.error("Error: Not a valid .fafb file (missing FAFB magic bytes)."),process.exit(3);let Q=a($,()=>fU(z)),X=JSON.stringify(Q,null,2);if(!Z.output){console.log(X);return}if(o3(Z.output,$))console.error(`faf: ${iG(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);V2(Z.output);let{result:J}=H2(Z.output,`${X}
289
- `,{root:lE(iG(Z.output)),format:"json",hasMark:()=>!1,mark:'faf render hash (`_meta["one.faf/render"]`)',force:Z.force});console.log(`${A("decompiled")} ${Z.output}${J==="unchanged"?` ${M("(unchanged)")}`:""}`)}import{existsSync as dE}from"fs";import{dirname as iE,resolve as nE}from"path";function rG($){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(!cU(z)||typeof z.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!mU.test(z.about.represents))Z.push(`about.represents must be "owner/repo" format (got: ${z.about.represents})`);if(z.about.source_score!==void 0){let Q=z.about.source_score;if(typeof Q!=="number"||Q<0||Q>100)Z.push(`about.source_score must be a number 0-100 (got: ${Q})`)}}return{valid:Z.length===0,errors:Z}}l();function Xz($,Z={}){let z=$??m();if(!z)console.error(`Error: project.faf not found
287
+ `),"utf-8")}function eE($,Z,z){let Q=sG($,z);return Q!=="match"&&Z!==null&&sG(Z,z)==="match"?"match":Q}function H2($,Z,z){let Q=cE($),X=n(z.root,Q),J=aE(z.format,Z),Y=tG(z.format,J),U=f0(X);if(U===null)return s(X,Y,{root:z.root,expect:null}),{path:X,result:"created"};if(U.equals(Buffer.from(Y,"utf-8")))return{path:X,result:"unchanged"};let W=tE(U),G=W===null?Y:Y.replace(/\r?\n/g,`\r
288
+ `);if(W!==null&&U.equals(Buffer.from(G,"utf-8")))return{path:X,result:"unchanged"};if(z.force!==!0&&!$w(Q,U,W,J,z))return{path:X,result:"unchanged"};return s(X,G,{root:z.root,expect:U}),{path:X,result:"updated"}}function $w($,Z,z,Q,X){let J=eE(Z,z,X.format);if(J==="match")return!0;if(J==="mismatch")throw new k("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 k("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 k("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 $V($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let z=new Uint8Array(Zw($));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=o($,()=>iU(z)),X=JSON.stringify(Q,null,2);if(!Z.output){console.log(X);return}if(Xz(Z.output,$))console.error(`faf: ${eG(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);V2(Z.output);let{result:J}=H2(Z.output,`${X}
289
+ `,{root:zw(eG(Z.output)),format:"json",hasMark:()=>!1,mark:'faf render hash (`_meta["one.faf/render"]`)',force:Z.force});console.log(`${A("decompiled")} ${Z.output}${J==="unchanged"?` ${M("(unchanged)")}`:""}`)}import{existsSync as Qw}from"fs";import{dirname as Xw,resolve as Jw}from"path";function ZV($){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(!sU(z)||typeof z.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!rU.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 Kz($,Z={}){let z=$??c();if(!z)console.error(`Error: project.faf not found
290
290
 
291
- Run 'faf init' to create one.`),process.exit(2);let Q=U2(p(z),z),X=rG(Q);if(!X.valid){console.log(`${C("invalid")} ${z}`);for(let U of X.errors)console.log(` ${M("x")} ${U}`);process.exit(3)}let J=p(z);if(!hU(J))console.log(`${C("invalid yaml")} ${z}`),process.exit(3);console.log(`${A("valid")} ${z}`),rE(sE(Q,iE(z)));let Y=a(z,()=>D0(J));if(w0(Y,z,Z.verbose),Z.strict&&Y.score<100)console.log(M(`
292
- --strict requires 100%`)),process.exit(1)}function rE($){for(let Z of $.missing)console.log(` ${C("!")} key_files: ${Z} ${C("not found")}`);for(let Z of $.skipped)console.log(` ${M("○")} key_files: ${Z} ${M("not checked (pattern)")}`)}function sE($,Z){let z=$.instant_context,Q=$.key_files??z?.key_files,X={missing:[],skipped:[]};if(!Array.isArray(Q))return X;for(let J of Q){if(typeof J!=="string")continue;let Y=J.indexOf(" — "),U=(Y>0?J.slice(0,Y):J).trim();if(!U)continue;if(/[*?[\]{}]/.test(U))X.skipped.push(U);else if(!dE(nE(Z,U)))X.missing.push(U)}return X}import{join as ew,resolve as $x}from"path";import{join as oE}from"path";var a0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),sG=($)=>Array.isArray($)?$.join(", "):String($),aE=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),tE=new Set(["target_user","core_problem","mission_purpose"]);function eE($){let Z=[],z=(k="")=>Z.push(k),Q=$.ai_instructions,X=$.preferences,J=$.instant_context,Y=$.security,U=$.commands,W=$.key_files??J?.key_files,G=a0($.project?.default_branch)?String($.project?.default_branch):"main",V=U?Object.entries(U).filter(([,k])=>a0(k)):[],q=V.filter(([k])=>/test/i.test(k)),K=V.filter(([k])=>/lint|check/i.test(k)&&!/test/i.test(k)),H=V.filter(([k])=>!/test|lint|check/i.test(k)),L=(k)=>{let n=k.toLowerCase();if(/install|deps/.test(n))return 0;if(/^build$|build/.test(n)&&!/rebuild/.test(n))return 1;if(/^dev$|develop/.test(n))return 2;if(/^start$|run/.test(n))return 3;return 4},B=[...H].sort((k,n)=>L(k[0])-L(n[0])||k[0].localeCompare(n[0])),D=[...q,...K],N=B.find(([k])=>/build/i.test(k)),_=q[0]?A6(q[0][1]):void 0,E=N?A6(N[1]):void 0;z(i2($)),z(),z(`# AGENTS.md — ${$.project?.name??"Project"}`),z();let P=[];if($.project?.main_language)P.push(String($.project.main_language));if(a0($.project?.type))P.push(`type: ${String($.project?.type)}`);if(a0($.project?.version))P.push(`v${String($.project?.version)}`);let y=$.project?.goal?String($.project.goal).trim():"";if(P.length)y+=(y?" — ":"")+P.join(" · ");if(y)z(y),z();if(z("> Authored by faf — do not edit the managed block; refresh with `faf export --agents`. Hand-written content outside the managed block is preserved."),z(),B.length){z("## Setup & build"),z(),z("```bash");for(let[k,n]of B){let{cmd:r,note:L2}=z1(n);z(`${r} # ${L2??k}`)}z("```"),z()}if(D.length){z("## Run the tests"),z(),z("```bash");for(let[,k]of D){let{cmd:n,note:r}=z1(k);z(r?`${n} # ${r}`:n)}z("```"),z()}if(W&&W.length){z("## Where things live"),z();let k=W.map((n)=>{let r=String(n),L2=r.indexOf(" — ");return L2>0?{path:r.slice(0,L2),role:r.slice(L2+3)}:{path:r,role:""}});if(k.some((n)=>n.role)){z("| Path | Role |"),z("|------|------|");for(let n of k)z(`| \`${n.path}\` | ${n.role} |`)}else for(let n of k)z(`- \`${n.path}\``);z()}let w=new Map,u=(k)=>{if(!k)return;for(let[n,r]of Object.entries(k)){if(aE.has(n)||!a0(r))continue;let L2=l3(n);if(!w.has(L2))w.set(L2,sG(r))}};u(Q?.working_style),u(X);let S=$.conventions??[];if(w.size||S.length){z("## Conventions"),z();for(let[k,n]of w)z(`- **${k}:** ${n}`);for(let k of S)if(a0(k))z(`- ${k}`);z()}let d=(Q?.warnings??[]).filter((k)=>a0(k)),I0=["read the tree"];if(_)I0.push(`run the tests (\`${_}\`)`);if(E)I0.push("build the project");for(let[,k]of K.slice(0,1))I0.push(`\`${A6(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 S0=[];for(let[,k]of K)S0.push(`\`${A6(k)}\` exits 0`);for(let[,k]of q)S0.push(`\`${A6(k)}\` passes`);if(S0.push("changes committed with a conventional message"),z("## Definition of Done"),z(),z(`Done when: ${[...new Set(S0)].join(" · ")}.`),z(),z("## When stuck"),z(),z(`Ask a clarifying question, propose a short plan, or open a draft PR with notes — do not push large speculative changes to \`${G}\`.`),z(),Y&&(a0(Y.secrets)||(Y.never??[]).length)){if(z("## Security & secrets"),z(),a0(Y.secrets)){let k=a0(Y.example)?` (see \`${Y.example}\`)`:"";z(`- Secrets live in \`${Y.secrets}\`${k}. Never read or commit them.`)}for(let k of Y.never??[])if(a0(k))z(`- Never read or commit \`${k}\`.`);z()}if(z("## Commit & PR"),z(),X&&a0(X.commit_style))z(`- Commit style: ${sG(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[n,r]of Object.entries($.stack)){if(tE.has(n))continue;if(q0(r))k.push(`- **${u0(`stack.${n}`)}:** ${r.trim()}`)}if(k.length){z("## Stack"),z();for(let n of k)z(n);z()}}let z0=$.generated;if(a0(z0))z(`*Context authored: ${String(z0)}*`);return Z.join(`
293
- `)}function oG($,Z){K2(oE($,y0.agents),eE(Z))}function $w($,Z){let z=[],Q=(W)=>I($,W),X=(W)=>g($,W)??"";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 U=Q("pyproject.toml")?X("pyproject.toml"):"";if(/\[tool\.black\]/.test(U))J.push("black");if(/\[tool\.ruff\]/.test(U))J.push("ruff");if(/\[tool\.mypy\]/.test(U))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 Jz($,Z){let z={...Z},Q=null,X=g($,"package.json");if(X!==null)try{Q=JSON.parse(X)}catch{Q=null}let J=XZ($,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 U=QZ($);if(U.length)z.key_files=U}if(!Z.security){let W=[".env",".env.local",".env.development"].find((G)=>I($,G));if(W){let G=[".env.example",".env.sample",".env.template"].find((V)=>I($,V));z.security={secrets:W,...G?{example:G}:{}}}}if(!Z.conventions){let U=$w($,Q);if(U.length)z.conventions=U}return z}import{join as Zw}from"path";function zw($){let Z=[];if(Z.push(i2($)),Z.push(""),Z.push("# .cursorrules"),Z.push(`# Authored from project.faf — ${$.project?.name??"Project"}`),Z.push(""),$.project?.main_language)Z.push(`language: ${$.project.main_language}`);if($.stack){Z.push(""),Z.push("# Stack");for(let[z,Q]of Object.entries($.stack))if(q0(Q))Z.push(`# ${u0(`stack.${z}`)}: ${Q.trim()}`)}return Z.push(""),Z.join(`
294
- `)}function aG($,Z){K2(Zw($,y0.cursorrules),zw(Z),"# faf:start","# faf:end")}import{join as Qw}from"path";var Xw=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),Jw=new Set(["target_user","core_problem","mission_purpose"]);function Yw($){let Z=[],z=$.instant_context,Q=$.commands,X=$.key_files??z?.key_files,J=Q?Object.entries(Q).filter(([,K])=>Xw(K)):[],Y=J.filter(([K])=>/test/i.test(K)),U=J.filter(([K])=>/lint|check/i.test(K)&&!/test/i.test(K)),W=J.filter(([K])=>!/test|lint|check/i.test(K)),G=(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},V=[...W].sort((K,H)=>G(K[0])-G(H[0])||K[0].localeCompare(H[0])),q=[...Y,...U];if(Z.push(i2($)),Z.push(""),Z.push(`# GEMINI.md — ${$.project?.name??"Project"}`),Z.push(""),Z.push("> Authored from project.faf — refresh with `faf export --gemini`."),Z.push(""),$.project?.name)Z.push(`Project: ${$.project.name}`);if($.project?.goal)Z.push(`Goal: ${$.project.goal}`);if($.project?.main_language)Z.push(`Language: ${$.project.main_language}`);if(V.length){Z.push(""),Z.push("## Setup & build"),Z.push(""),Z.push("```bash");for(let[K,H]of V){let{cmd:L,note:B}=z1(H);Z.push(`${L} # ${B??K}`)}Z.push("```")}if(q.length){Z.push(""),Z.push("## Test & verify"),Z.push(""),Z.push("```bash");for(let[,K]of q){let{cmd:H,note:L}=z1(K);Z.push(L?`${H} # ${L}`:H)}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[H,L]of Object.entries($.stack)){if(Jw.has(H))continue;if(q0(L))K.push(`- ${u0(`stack.${H}`)}: ${L.trim()}`)}if(K.length){Z.push(""),Z.push("## Stack");for(let H of K)Z.push(H)}}return Z.push(""),Z.push("## Before changing things"),Z.push(""),Z.push("- Ask first: dependency installs, deletions, migrations, schema changes, publish/release."),Z.push("- Never: force-push · push straight to `main` · commit secrets."),Z.push(""),Z.join(`
295
- `)}function tG($,Z){K2(Qw($,y0.gemini),Yw(Z))}import{join as Uw}from"path";var eG=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],Ww=new Set([...eG.map(([$])=>$),"cicd"]);function Gw($){let Z=[],z=$.project?.name??"Project";if(Z.push(i2($)),Z.push(""),Z.push(`# GitHub Copilot Instructions — ${z}`),Z.push(""),Z.push("> Authored from project.faf by FAF. Copilot reads these instructions on every request in this repository — keep them short and broadly applicable."),Z.push(""),q0($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let Q=$.stack??{},X=[];if(q0($.project?.main_language))X.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[G,V]of Object.entries(Q)){if(Ww.has(G))continue;if(q0(V))X.push(`- **${u0(`stack.${G}`)}:** ${V.trim()}`)}if(X.length>0)Z.push("## Tech stack","",...X,"");let J=[];for(let[G,V]of eG){let q=Q[G];if(q0(q))J.push(`- ${V} \`${q.trim()}\`.`)}if(q0(Q.cicd))J.push(`- CI runs on ${Q.cicd.trim()}.`);if(J.length>0)Z.push("## Build & run","",...J,"");let Y=$.human_context??{},W=[["who",Y.who],["what",Y.what],["why",Y.why],["where",Y.where],["when",Y.when],["how",Y.how]].filter(([,G])=>q0(G)).map(([G,V])=>`- **${u0(`human_context.${G}`)}:** ${V.trim()}`);if(W.length>0)Z.push("## Project context","",...W,"");return Z.join(`
296
- `)}function $V($,Z){E0($,".github"),K2(Uw($,".github",y0.copilot),Gw(Z),l2,d2,{root:$})}import{existsSync as Vw}from"fs";import{join as qw}from"path";var Kw="https://mcpaas.live/grok/mcp/v1",ZV="mcp_servers.grok-faf-mcp";function Hw($){return[`[${ZV}]`,`url = "${Kw}"`,""].join(`
297
- `)}function zV($,Z){let z=Hw(Z);E0($,".grok");let Q=i($,qw(".grok","config.toml"));if(!Vw(Q))return o(Q,`# grok-faf-mcp — wired by FAF from project.faf
291
+ Run 'faf init' to create one.`),process.exit(2);let Q=U2(l(z),z),X=ZV(Q);if(!X.valid){console.log(`${C("invalid")} ${z}`);for(let U of X.errors)console.log(` ${M("x")} ${U}`);process.exit(3)}let J=l(z);if(!dU(J))console.log(`${C("invalid yaml")} ${z}`),process.exit(3);console.log(`${A("valid")} ${z}`),Yw(Uw(Q,Xw(z)));let Y=o(z,()=>M0(J));if(w0(Y,z,Z.verbose),Z.strict&&Y.score<100)console.log(M(`
292
+ --strict requires 100%`)),process.exit(1)}function Yw($){for(let Z of $.missing)console.log(` ${C("!")} key_files: ${Z} ${C("not found")}`);for(let Z of $.skipped)console.log(` ${M("○")} key_files: ${Z} ${M("not checked (pattern)")}`)}function Uw($,Z){let z=$.instant_context,Q=$.key_files??z?.key_files,X={missing:[],skipped:[]};if(!Array.isArray(Q))return X;for(let J of Q){if(typeof J!=="string")continue;let Y=J.indexOf(" — "),U=(Y>0?J.slice(0,Y):J).trim();if(!U)continue;if(/[*?[\]{}]/.test(U))X.skipped.push(U);else if(!Qw(Jw(Z,U)))X.missing.push(U)}return X}import{join as Kx,resolve as Hx}from"path";import{join as Ww}from"path";var a0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),zV=($)=>Array.isArray($)?$.join(", "):String($),Gw=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),Vw=new Set(["target_user","core_problem","mission_purpose"]);function qw($,Z="project.faf"){let z=[],Q=(v="")=>z.push(v),X=$.ai_instructions,J=$.preferences,Y=$.instant_context,U=$.security,W=$.commands,G=$.key_files??Y?.key_files,V=a0($.project?.default_branch)?String($.project?.default_branch):"main",q=W?Object.entries(W).filter(([,v])=>a0(v)):[],K=q.filter(([v])=>/test/i.test(v)),L=q.filter(([v])=>/lint|check/i.test(v)&&!/test/i.test(v)),B=q.filter(([v])=>!/test|lint|check/i.test(v)),H=(v)=>{let f=v.toLowerCase();if(/install|deps/.test(f))return 0;if(/^build$|build/.test(f)&&!/rebuild/.test(f))return 1;if(/^dev$|develop/.test(f))return 2;if(/^start$|run/.test(f))return 3;return 4},D=[...B].sort((v,f)=>H(v[0])-H(f[0])||v[0].localeCompare(f[0])),N=[...K,...L],_=D.find(([v])=>/build/i.test(v)),E=K[0]?F6(K[0][1]):void 0,j=_?F6(_[1]):void 0;Q(o2($,{claim:Z})),Q(),Q(`# AGENTS.md — ${$.project?.name??"Project"}`),Q();let x=[];if($.project?.main_language)x.push(String($.project.main_language));if(a0($.project?.type))x.push(`type: ${String($.project?.type)}`);if(a0($.project?.version))x.push(`v${String($.project?.version)}`);let w=$.project?.goal?String($.project.goal).trim():"";if(x.length)w+=(w?" — ":"")+x.join(" · ");if(w)Q(w),Q();if(Q("> Authored by faf — do not edit the managed block; refresh with `faf export --agents`. Hand-written content outside the managed block is preserved."),Q(),D.length){Q("## Setup & build"),Q(),Q("```bash");for(let[v,f]of D){let{cmd:C0,note:L2}=J1(f);Q(`${C0} # ${L2??v}`)}Q("```"),Q()}if(N.length){Q("## Run the tests"),Q(),Q("```bash");for(let[,v]of N){let{cmd:f,note:C0}=J1(v);Q(C0?`${f} # ${C0}`:f)}Q("```"),Q()}if(G&&G.length){Q("## Where things live"),Q();let v=G.map((f)=>{let C0=String(f),L2=C0.indexOf(" — ");return L2>0?{path:C0.slice(0,L2),role:C0.slice(L2+3)}:{path:C0,role:""}});if(v.some((f)=>f.role)){Q("| Path | Role |"),Q("|------|------|");for(let f of v)Q(`| \`${f.path}\` | ${f.role} |`)}else for(let f of v)Q(`- \`${f.path}\``);Q()}let u=new Map,S=(v)=>{if(!v)return;for(let[f,C0]of Object.entries(v)){if(Gw.has(f)||!a0(C0))continue;let L2=t3(f);if(!u.has(L2))u.set(L2,zV(C0))}};S(X?.working_style),S(J);let d=$.conventions??[];if(u.size||d.length){Q("## Conventions"),Q();for(let[v,f]of u)Q(`- **${v}:** ${f}`);for(let v of d)if(a0(v))Q(`- ${v}`);Q()}let y0=(X?.warnings??[]).filter((v)=>a0(v)),j0=["read the tree"];if(E)j0.push(`run the tests (\`${E}\`)`);if(j)j0.push("build the project");for(let[,v]of L.slice(0,1))j0.push(`\`${F6(v)}\``);Q("## Guardrails"),Q();for(let v of y0)Q(`- ${v}`);Q(`- **Always OK:** ${[...new Set(j0)].join(" · ")}.`),Q("- **Ask first:** dependency installs, deletions, migrations, schema changes, publish/release."),Q(`- **Never:** force-push · push straight to \`${V}\` (branch and open a PR) · commit secrets.`),Q();let $0=[];for(let[,v]of L)$0.push(`\`${F6(v)}\` exits 0`);for(let[,v]of K)$0.push(`\`${F6(v)}\` passes`);if($0.push("changes committed with a conventional message"),Q("## Definition of Done"),Q(),Q(`Done when: ${[...new Set($0)].join(" · ")}.`),Q(),Q("## When stuck"),Q(),Q(`Ask a clarifying question, propose a short plan, or open a draft PR with notes — do not push large speculative changes to \`${V}\`.`),Q(),U&&(a0(U.secrets)||(U.never??[]).length)){if(Q("## Security & secrets"),Q(),a0(U.secrets)){let v=a0(U.example)?` (see \`${U.example}\`)`:"";Q(`- Secrets live in \`${U.secrets}\`${v}. Never read or commit them.`)}for(let v of U.never??[])if(a0(v))Q(`- Never read or commit \`${v}\`.`);Q()}if(Q("## Commit & PR"),Q(),J&&a0(J.commit_style))Q(`- Commit style: ${zV(J.commit_style)}`);else Q("- Conventional Commits preferred (`feat:`, `fix:`, `chore:`, …).");if(Q(`- Branch off \`${V}\` and open a PR — never commit to \`${V}\` directly.`),Q("- If build/test scripts or layout change, refresh this file in the **same PR** (`faf export --agents`)."),Q(),$.stack){let v=[];for(let[f,C0]of Object.entries($.stack)){if(Vw.has(f))continue;if(F0(C0))v.push(`- **${o0(`stack.${f}`)}:** ${C0.trim()}`)}if(v.length){Q("## Stack"),Q();for(let f of v)Q(f);Q()}}Q("## Project facts"),Q(),Q(`The six W's (who, what, why, where, when, how) and the project's other facts are in \`${Z}\`.`),Q();let S2=$.generated;if(a0(S2))Q(`*Context authored: ${String(S2)}*`);return z.join(`
293
+ `)}function QV($,Z,z="project.faf"){K2(Ww($,b0.agents),qw(Z,z))}function Kw($,Z){let z=[],Q=(W)=>I($,W),X=(W)=>g($,W)??"";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 U=Q("pyproject.toml")?X("pyproject.toml"):"";if(/\[tool\.black\]/.test(U))J.push("black");if(/\[tool\.ruff\]/.test(U))J.push("ruff");if(/\[tool\.mypy\]/.test(U))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 Hz($,Z){let z={...Z},Q=n2(Z);if(Q)v1(z,Q);let X=null,J=g($,"package.json");if(J!==null)try{X=JSON.parse(J)}catch{X=null}let Y=GZ($,X);if(Object.keys(Y).length)z.commands={...Y,...Z.commands??{}};let U=Z.key_files??Z.instant_context?.key_files;if(!U||U.length===0){let W=WZ($);if(W.length)z.key_files=W}if(!Z.security){let G=[".env",".env.local",".env.development"].find((V)=>I($,V));if(G){let V=[".env.example",".env.sample",".env.template"].find((q)=>I($,q));z.security={secrets:G,...V?{example:V}:{}}}}if(!Z.conventions){let W=Kw($,X);if(W.length)z.conventions=W}return z}import{join as Hw}from"path";function Bw($,Z="project.faf"){let z=[];if(z.push(o2($,{claim:Z})),z.push(""),z.push("# .cursorrules"),z.push(`# Authored from ${Z} — ${$.project?.name??"Project"}`),z.push(""),$.project?.main_language)z.push(`language: ${$.project.main_language}`);if($.stack){z.push(""),z.push("# Stack");for(let[X,J]of Object.entries($.stack))if(F0(J))z.push(`# ${o0(`stack.${X}`)}: ${J.trim()}`)}let Q=v2($);if(Q.length>0){z.push(""),z.push("# Context");for(let[X,J]of Q)z.push(`# ${X}: ${J}`)}return z.push(""),z.join(`
294
+ `)}function XV($,Z,z="project.faf"){K2(Hw($,b0.cursorrules),Bw(Z,z),"# faf:start","# faf:end")}import{join as Mw}from"path";var Lw=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),Dw=new Set(["target_user","core_problem","mission_purpose"]);function Ow($,Z="project.faf"){let z=[],Q=$.instant_context,X=$.commands,J=$.key_files??Q?.key_files,Y=X?Object.entries(X).filter(([,B])=>Lw(B)):[],U=Y.filter(([B])=>/test/i.test(B)),W=Y.filter(([B])=>/lint|check/i.test(B)&&!/test/i.test(B)),G=Y.filter(([B])=>!/test|lint|check/i.test(B)),V=(B)=>{let H=B.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},q=[...G].sort((B,H)=>V(B[0])-V(H[0])||B[0].localeCompare(H[0])),K=[...U,...W];if(z.push(o2($,{claim:Z})),z.push(""),z.push(`# GEMINI.md — ${$.project?.name??"Project"}`),z.push(""),z.push(`> Authored from ${Z} — 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(q.length){z.push(""),z.push("## Setup & build"),z.push(""),z.push("```bash");for(let[B,H]of q){let{cmd:D,note:N}=J1(H);z.push(`${D} # ${N??B}`)}z.push("```")}if(K.length){z.push(""),z.push("## Test & verify"),z.push(""),z.push("```bash");for(let[,B]of K){let{cmd:H,note:D}=J1(B);z.push(D?`${H} # ${D}`:H)}z.push("```")}if(J&&J.length){z.push(""),z.push("## Where things live"),z.push("");for(let B of J)z.push(`- \`${B}\``)}if($.stack){let B=[];for(let[H,D]of Object.entries($.stack)){if(Dw.has(H))continue;if(F0(D))B.push(`- ${o0(`stack.${H}`)}: ${D.trim()}`)}if(B.length){z.push(""),z.push("## Stack");for(let H of B)z.push(H)}}let L=v2($);if(L.length>0){z.push(""),z.push("## Context"),z.push("");for(let[B,H]of L)z.push(`- **${B}:** ${H}`)}return z.push(""),z.push("## Before changing things"),z.push(""),z.push("- Ask first: dependency installs, deletions, migrations, schema changes, publish/release."),z.push("- Never: force-push · push straight to `main` · commit secrets."),z.push(""),z.join(`
295
+ `)}function JV($,Z,z="project.faf"){K2(Mw($,b0.gemini),Ow(Z,z))}import{join as Nw}from"path";var YV=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],Iw=new Set([...YV.map(([$])=>$),"cicd"]);function Tw($,Z="project.faf"){let z=[],Q=$.project?.name??"Project";if(z.push(o2($,{claim:Z})),z.push(""),z.push(`# GitHub Copilot Instructions — ${Q}`),z.push(""),z.push(`> Authored from ${Z} by FAF. Copilot reads these instructions on every request in this repository — keep them short and broadly applicable.`),z.push(""),F0($.project?.goal))z.push($.project.goal.trim()),z.push("");let X=$.stack??{},J=[];if(F0($.project?.main_language))J.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[W,G]of Object.entries(X)){if(Iw.has(W))continue;if(F0(G))J.push(`- **${o0(`stack.${W}`)}:** ${G.trim()}`)}if(J.length>0)z.push("## Tech stack","",...J,"");let Y=[];for(let[W,G]of YV){let V=X[W];if(F0(V))Y.push(`- ${G} \`${V.trim()}\`.`)}if(F0(X.cicd))Y.push(`- CI runs on ${X.cicd.trim()}.`);if(Y.length>0)z.push("## Build & run","",...Y,"");let U=v2($).map(([W,G])=>`- **${W}:** ${G}`);if(U.length>0)z.push("## Project context","",...U,"");return z.join(`
296
+ `)}function UV($,Z,z="project.faf"){E0($,".github"),K2(Nw($,".github",b0.copilot),Tw(Z,z),r2,s2,{root:$})}import{existsSync as Aw}from"fs";import{join as Cw}from"path";var _w="https://mcpaas.live/grok/mcp/v1",WV="mcp_servers.grok-faf-mcp";function Pw($){return[`[${WV}]`,`url = "${_w}"`,""].join(`
297
+ `)}function GV($,Z){let z=Pw(Z);E0($,".grok");let Q=n($,Cw(".grok","config.toml"));if(!Aw(Q))return s(Q,`# grok-faf-mcp — wired by FAF from project.faf
298
298
 
299
- `+z,{root:$,expect:null}),"created";let X=G0(Q);if(X.includes(`[${ZV}]`))return"unchanged";let J=X.endsWith(`
299
+ `+z,{root:$,expect:null}),"created";let X=W0(Q);if(X.includes(`[${WV}]`))return"unchanged";let J=X.endsWith(`
300
300
 
301
301
  `)?"":X.endsWith(`
302
302
  `)?`
303
303
  `:`
304
304
 
305
- `;return o(Q,X+J+z,{root:$,expect:X}),"merged"}import{join as Bw}from"path";var Mw=[{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 Uz($){if(!q0($))return null;let Z=$.trim();if(/^(none|n\/a)$/i.test(Z))return null;return Z}function Yz($,Z){if(!$)return null;return Uz($[Z])}function Lw($){let Z=[],z=Uz($.project?.name)??"Project",Q=Uz($.project?.goal);if(Z.push(`# ${z}`),Z.push(""),Q)Z.push(`> ${Q}`),Z.push("");let X=$.human_context;for(let{key:Y,heading:U}of Mw){let W=Yz(X,Y);if(!W)continue;Z.push(`## ${U}`),Z.push(""),Z.push(W),Z.push("")}let J=Yz($.project,"homepage")??Yz($.project,"url");if(J&&/^(https?:)?\/\//i.test(J))Z.push("## Links"),Z.push(""),Z.push(`- [Homepage](${J})`),Z.push("");return`${Z.join(`
305
+ `;return s(Q,X+J+z,{root:$,expect:X}),"merged"}import{join as Fw}from"path";var Rw=[{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 jw($){return S4($)}function VV($){let Z=/^(\d+)([.)])(\s|$)/.exec($);if(Z)return`${Z[1]}\\${$.slice(Z[1].length)}`;if(/^([-*_])(\s*\1){2,}\s*$/.test($))return`\\${$}`;return/^(#|>|<|[-*+](\s|$)|```|~~~|\[[^\]]*\]:)/.test($)?`\\${$}`:$}function qV($,Z){if(!$)return null;return jw($[Z])}function Sw($){let Z=[],z=E4($,["project","name"])??"Project",Q=E4($,["project","goal"]);if(Z.push(`# ${z}`),Z.push(""),Q)Z.push(`> ${VV(Q)}`),Z.push("");for(let{key:J,heading:Y}of Rw){let U=E4($,["human_context",J]);if(!U)continue;Z.push(`## ${Y}`),Z.push(""),Z.push(VV(U)),Z.push("")}let X=qV($.project,"homepage")??qV($.project,"url");if(X&&/^(https?:)?\/\//i.test(X))Z.push("## Links"),Z.push(""),Z.push(`- [Homepage](${X})`),Z.push("");return`${Z.join(`
306
306
  `).trimEnd()}
307
- `}function QV($,Z){K2(Bw($,y0.llms),Lw(Z))}l();import{join as Dw}from"path";import{deprecate as Ow}from"node:util";var XV=U4.orange,Nw=U4.cyan,Iw=U4.cyanDeep,Tw="#FF9500",Aw="#FF3B30",Cw="#E6EDF3",_w="#6E7681",JV={TROPHY:{glyph:"✪",color:XV},GOLD:{glyph:"★",color:XV},SILVER:{glyph:"◆",color:Nw},BRONZE:{glyph:"◇",color:Iw},GREEN:{glyph:"●",color:Cw},YELLOW:{glyph:"●",color:Tw},RED:{glyph:"○",color:Aw},WHITE:{glyph:"♡",color:_w}};function i1($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var YV=["who","what","why","where","when","how"];function TZ($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,z])=>`<div class="row"><div class="k">${i1(Z)}</div><div class="v">${i1(z)}</div></div>`).join(`
308
- `)}function UV($,Z,z="project.faf"){let Q=i1($.project?.name??"Project"),X=Z.tier?.name??"WHITE",J=JV[X]??JV.WHITE,Y=Z.inherited?Z.represents?`inherited from ${i1(Z.represents)}`:"inherited":`${Z.score}%`,U=X==="TROPHY"&&!Z.inherited,W=$.human_context??{},G=YV.map((B)=>[B,W[B]]),V=Object.entries(W).filter(([B])=>!YV.includes(B)),q=[["goal",$.project?.goal],["main_language",$.project?.main_language],["type",$.project?.type],["framework",$.project?.framework],["faf_version",$.faf_version]],K=Object.entries($.stack??{}),H=K.filter(([,B])=>B&&B!=="slotignored"&&String(B).trim()!==""),L=K.filter(([,B])=>B==="slotignored").length;return`<!DOCTYPE html>
307
+ `}function KV($,Z){K2(Fw($,b0.llms),Sw(Z))}i();import{join as Ew}from"path";import{deprecate as ww}from"node:util";var HV=V4.orange,xw=V4.cyan,yw=V4.cyanDeep,bw="#FF9500",kw="#FF3B30",vw="#E6EDF3",gw="#6E7681",BV={TROPHY:{glyph:"✪",color:HV},GOLD:{glyph:"★",color:HV},SILVER:{glyph:"◆",color:xw},BRONZE:{glyph:"◇",color:yw},GREEN:{glyph:"●",color:vw},YELLOW:{glyph:"●",color:bw},RED:{glyph:"○",color:kw},WHITE:{glyph:"♡",color:gw}};function a1($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var MV=["who","what","why","where","when","how"];function FZ($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,z])=>`<div class="row"><div class="k">${a1(Z)}</div><div class="v">${a1(z)}</div></div>`).join(`
308
+ `)}function LV($,Z,z="project.faf"){let Q=a1($.project?.name??"Project"),X=Z.tier?.name??"WHITE",J=BV[X]??BV.WHITE,Y=Z.inherited?Z.represents?`inherited from ${a1(Z.represents)}`:"inherited":`${Z.score}%`,U=X==="TROPHY"&&!Z.inherited,W=$.human_context??{},G=MV.map((H)=>[H,W[H]]),V=Object.entries(W).filter(([H])=>!MV.includes(H)),q=[["goal",$.project?.goal],["main_language",$.project?.main_language],["type",$.project?.type],["framework",$.project?.framework],["faf_version",$.faf_version]],K=Object.entries($.stack??{}),L=K.filter(([,H])=>H&&H!=="slotignored"&&String(H).trim()!==""),B=K.filter(([,H])=>H==="slotignored").length;return`<!DOCTYPE html>
309
309
  <html lang="en">
310
310
  <head>
311
311
  <meta charset="UTF-8">
@@ -346,116 +346,116 @@ footer strong{color:#e6edf3}
346
346
  <div class="eyebrow">project.faf · visual render</div>
347
347
  <header>
348
348
  <h1>${Q}</h1>
349
- <span class="badge">${J.glyph} ${i1(X)}</span>
349
+ <span class="badge">${J.glyph} ${a1(X)}</span>
350
350
  <span class="score">${Y}</span>
351
351
  </header>
352
352
  <div class="meter"><span></span></div>
353
- ${U?'<p class="award statline"><span class="awd-pre">✅ All Required slots filled.</span> <span class="awd-win">100% Trophy ✪ Awarded</span></p>':`<p class="muted statline">${Z.populated}/${Z.active} slots populated · ${Z.total} total${L?` · ${L} slotignored`:""}</p>`}
353
+ ${U?'<p class="award statline"><span class="awd-pre">✅ All Required slots filled.</span> <span class="awd-win">100% Trophy ✪ Awarded</span></p>':`<p class="muted statline">${Z.populated}/${Z.active} slots populated · ${Z.total} total${B?` · ${B} slotignored`:""}</p>`}
354
354
 
355
355
  <section>
356
356
  <h2>The 6 W's</h2>
357
- ${TZ(G)||'<p class="muted">No human_context yet.</p>'}
358
- ${V.length?TZ(V):""}
357
+ ${FZ(G)||'<p class="muted">No human_context yet.</p>'}
358
+ ${V.length?FZ(V):""}
359
359
  </section>
360
360
 
361
361
  <section>
362
362
  <h2>Project</h2>
363
- ${TZ(q)||'<p class="muted">—</p>'}
363
+ ${FZ(q)||'<p class="muted">—</p>'}
364
364
  </section>
365
365
 
366
366
  <section>
367
367
  <h2>Stack</h2>
368
- ${H.length?TZ(H):'<p class="muted">No active stack slots.</p>'}
368
+ ${L.length?FZ(L):'<p class="muted">No active stack slots.</p>'}
369
369
  </section>
370
370
 
371
371
  <footer>
372
- Rendered on-demand from your current <strong>${i1(z)}</strong><br>
372
+ Rendered on-demand from your current <strong>${a1(z)}</strong><br>
373
373
  <strong>Humans like visuals. <span style="color:#00D4D4">We gave them one.</span></strong>
374
374
  </footer>
375
375
  </div>
376
376
  </body>
377
377
  </html>
378
- `}var Rw='<meta name="description" content="Visual render of project.faf.';function Pw($){return new TextDecoder().decode($).split(/\r?\n/).some((Z)=>Z.trim().startsWith(Rw)&&Z.includes(" by faf"))}function AZ($,Z,z,Q="project.faf",X={}){H2(Dw($,"project.html"),UV(Z,z,Q),{root:$,format:"html",hasMark:Pw,mark:"faf mark (the `Visual render of project.faf` description line)",force:X.force})}var Gd=Ow(UV,"faf-cli: generateProjectHtml is deprecated, use renderProjectHtml","FAF0001");import{join as rw}from"path";import{deprecate as sw}from"node:util";var r2="https://faf.one/ext/context/v1",X1="io.modelcontextprotocol.registry/publisher-provided";function s2($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:"application/vnd.faf+yaml",iana:"https://www.iana.org/assignments/media-types/application/vnd.faf+yaml",deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function j4($,Z={}){let z={"one.faf/context":s2($,Z)},Q=new TextEncoder().encode(JSON.stringify(z)).length;if(Q>4096)throw Error(`publisher-provided _meta is ${Q}B — exceeds the registry ${"4096"}B cap`);return{["io.modelcontextprotocol.registry/publisher-provided"]:z}}var WV="JSONRPC",Vz="1.0",_Z=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],qz="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";var GV="1.0",Wz={a2a:"application/a2a-agent-card+json",server_card:"application/mcp-server-card+json",fafa:"application/vnd.fafa+yaml"};function VV($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function J1($,Z={}){let z=VV($);if(z.length>0)return z;let Q=Z.doorUrl?.trim();if(Q)return[{protocol:"a2a",location:Q,version:Vz}];return[]}function Fw($){try{return`https://${S4($)}/.well-known/fafa`}catch{return}}function qV($,Z,z={}){let Q=s2(Z,z),X=$.agent??{},J={fafaSpecVersion:String($.version??GV),mediaTypes:[..._Z],provenance:{faf:Q.faf,mediaType:Q.mediaType},generated:Q.generated};if(X.id)J.agentId=X.id;let Y=Fw($);if(Y)J.passport=Y;return{uri:r2,description:"FAF passport and project DNA as typed parts",required:!1,params:J}}function jw($){let Z=new Set;for(let z of $.capabilities??[])if(z.cites_spec&&_Z.includes(z.cites_spec))Z.add(z.cites_spec);return["text/plain",...Z]}function KV($,Z={}){let z=$.agent??{},Q=J1($,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 U=String(z.vendor??"").trim(),W=String(z.homepage??"").trim(),G=U&&W?{organization:U,url:W}:void 0,V=($.capabilities??[]).map((q)=>{let K=String(q.name??"").trim();if(!K)throw Error("A2A skill missing capabilities[].name");let H=Array.isArray(q.tags)?q.tags.map(String):[],L=q.cites_spec&&_Z.includes(q.cites_spec)?[q.cites_spec,"text/plain"]:void 0;return{id:K,name:K,description:String(q.description??"").trim()||K,tags:H,...L?{inputModes:L}:{}}});return{name:X,description:J,supportedInterfaces:Q.map((q)=>({url:String(q.location),protocolBinding:WV,protocolVersion:String(q.version??Vz)})),...G?{provider:G}:{},version:Y,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[...Z.extensions??[]]},defaultInputModes:jw($),defaultOutputModes:["text/plain","application/json"],skills:V}}var RZ=["mcp","cli","library"],Sw=/^[a-z0-9][a-z0-9._-]*$/,Ew=/^(@[a-z0-9~][a-z0-9-._~]*\/)?[a-z0-9~][a-z0-9-._~]*$/,ww=/^[A-Za-z0-9]([A-Za-z0-9._-]*[A-Za-z0-9])?$/,xw=/^[A-Za-z0-9][^\s]*$/,yw=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,bw=["a2a","mcp"],kw=/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/;function x($){return String($??"").trim()}function CZ($){return Array.isArray($)?$.map(x).filter(Boolean):[]}function vw($){return x($).toLowerCase().replace(/^https?:\/\//,"").replace(/\/.*$/,"").replace(/^www\./,"")}function gw($,Z,z){let Q=["display_name","description","version"].filter((X)=>!x($[X]));if(Q.length)throw Error(`Missing answer: ${Q.join(", ")}`);if(!Sw.test(Z))throw Error("Short name: lowercase letters, digits, dots, hyphens or underscores.");if(!kw.test(z))throw Error(`Domain "${$.domain}" is not a domain name (e.g. example.com).`)}function hw($,Z){return($.skills??[]).filter((z)=>x(z.name)).map((z)=>({name:x(z.name),type:x(z.type)||"tool",description:x(z.description)||x(z.name),tags:Z.length?Z:[x(z.name).toLowerCase()]}))}function fw($){let Z=($.packages??[]).filter((z)=>x(z.registryType)&&x(z.identifier));for(let z of Z){let Q=x(z.registryType),X=x(z.identifier);if(Q==="npm"&&!Ew.test(X))throw Error(`Package "${X}" is not an npm package name (e.g. weather-mcp or @acme/weather).`);if(Q==="pypi"&&!ww.test(X))throw Error(`Package "${X}" is not a PyPI package name (e.g. weather-mcp or weather_mcp).`);if(Q==="cargo"&&!yw.test(X))throw Error(`Package "${X}" is not a crate name (e.g. weather-mcp or weather_mcp).`);if(Q!=="npm"&&Q!=="pypi"&&Q!=="cargo"&&!xw.test(X))throw Error(`Package "${X}" is not a ${Q} package identifier: it must start with a letter or digit and have no spaces.`)}return Z.map((z)=>({registryType:x(z.registryType),identifier:x(z.identifier),...x(z.version)?{version:x(z.version)}:{}}))}function HV($){if(/\s/.test($))return!1;try{let Z=new URL($);return(Z.protocol==="http:"||Z.protocol==="https:")&&Z.hostname!==""}catch{return!1}}function uw($){if(!HV(x($.url)))throw Error(`Where it runs: "${x($.url)}" is not an http(s) URL (or give an npm package).`);if(!bw.includes(x($.protocol).toLowerCase()))throw Error(`Protocol "${x($.protocol)}": a2a or mcp.`)}function mw($){let Z=x($.package_kind).toLowerCase()||"mcp";if(!RZ.includes(Z))throw Error(`Kind "${x($.package_kind)}" is not one faf knows: mcp, cli or library.`);return Z}function cw($,Z){let z=($.endpoints??[]).filter((J)=>x(J.url));z.forEach(uw);let Q=mw($),X=[...z.map((J)=>({protocol:x(J.protocol).toLowerCase(),transport:"http",location:x(J.url)})),...Z.map((J)=>({protocol:Q,transport:"stdio",location:J.identifier}))];if(X.length===0)throw Error("Missing answer: endpoints (a URL, or a package people install)");return X}function pw($,Z,z,Q){let X={domain:Z},J=[["repository",x($.repository)],["icon",x($.icon)],["organizationUrl",x($.organization_url)]];for(let[U,W]of J)if(W)X[U]=W;if(z.length)X.keywords=z;let Y=CZ($.example_requests);if(Y.length)X.examples=Y;if(Q.length)X.packages=Q;return X}function BV($){let Z=x($.handle).toLowerCase(),z=vw($.domain);gw($,Z,z);let Q=CZ($.tags),X=fw($),J=x($.homepage);if(J&&!HV(J))throw Error(`Homepage: "${J}" is not an http(s) URL.`);let Y={name:Z,displayName:x($.display_name),id:`urn:air:${z}:agent:${Z}`,...x($.organization)?{vendor:x($.organization)}:{},version:x($.version),description:x($.description),homepage:J||`https://${z}`,...x($.license)?{license:x($.license)}:{}};return{version:GV,agent:Y,capabilities:hw($,Q),endpoints:cw($,X),metadata:{cards:pw($,z,Q,X)}}}function MV($){return m6($,{lineWidth:0})}function S4($){let Z=x($.agent?.id),z=/^urn:air:([^:]+):/.exec(Z);if(z)return z[1];let Q=x($.metadata?.cards?.domain);if(Q)return Q;try{return new URL(x($.agent?.homepage)).hostname.replace(/^www\./,"")}catch{throw Error("The .fafa names no domain (agent.id urn:air, metadata.cards.domain or agent.homepage).")}}function LV($){let Z=x($.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 DV($){return`${S4($).split(".").reverse().join(".")}/${LV($)}`}function Gz($){let Z=$.replace(/\s+/g," ").trim();return Z.length<=100?Z:`${Z.slice(0,97).trimEnd()}...`}function n1($){return($.endpoints??[]).filter((Z)=>x(Z.protocol).toLowerCase()==="mcp"&&/^https?:\/\//.test(x(Z.location))).map((Z)=>({type:"streamable-http",url:x(Z.location)}))}function lw($){if(!$)return;try{let Z=new URL($).hostname.replace(/^www\./,"");return{url:$,source:Z.split(".")[0]}}catch{return}}function dw($){let Z=$.agent??{},z=$.metadata?.cards??{},Q=x(Z.description),X=x(Z.version);if(!Q||!X)throw Error("An MCP card needs agent.description and agent.version in .fafa");let J={name:DV($),version:X,description:Gz(Q)},Y=x(Z.displayName);if(Y)J.title=Gz(Y);let U=x(Z.homepage);if(U)J.websiteUrl=U;let W=lw(x(z.repository));if(W)J.repository=W;if(x(z.icon))J.icons=[{src:x(z.icon)}];return J}function iw($){return($.metadata?.cards?.packages??[]).map((Z)=>({registryType:x(Z.registryType),identifier:x(Z.identifier),...x(Z.version)?{version:x(Z.version)}:{},transport:{type:"stdio"}}))}function Kz($){return($.endpoints??[]).some((Z)=>x(Z.protocol).toLowerCase()==="mcp")}function E4($){return Kz($)&&(n1($).length>0||iw($).length>0)}function OV($){let Z=x($.agent?.displayName);return{name:DV($),...Z?{title:Gz(Z)}:{}}}function NV($,Z,z={}){let Q=n1($);if(Q.length===0)throw Error("A Server Card describes a remote MCP server: the .fafa has no mcp endpoint at an http(s) URL.");return{$schema:qz,...dw($),remotes:Q,...Z?{_meta:{"one.faf/context":s2(Z,z)}}:{}}}function nw($,Z,z){if(!Z.includes("a2a")||J1($,z).length===0)return;return z.a2aCardUrl??`https://${S4($)}/.well-known/agent-card.json`}function IV($,Z,z={}){let Q=S4($),X=LV($),J=$.agent??{},Y=x(J.displayName)||x(J.name),U=x(J.description),W=x(J.version),G=z.now??new Date().toISOString(),V=(H,L,B)=>({identifier:`urn:air:${Q}:${H}:${X}`,displayName:Y,type:L,description:U,url:B,...W?{version:W}:{},updatedAt:G}),q=[],K=nw($,Z,z);if(K)q.push(V("a2a",Wz.a2a,K));if(Z.includes("server_card")){let H=n1($)[0];if(H)q.push(V("mcp",Wz.server_card,`${H.url.replace(/\/+$/,"")}/server-card`))}if(z.listFafa!==!1)q.push(V("agent",Wz.fafa,`https://${Q}/.well-known/fafa`));return q}function TV($){let Z=$.agent??{},z=x(Z.vendor)||x(Z.displayName)||x(Z.name);if(!z)return;let Q;try{Q=S4($)}catch{Q=void 0}return{displayName:z,...Q?{identifier:Q}:{}}}function AV($){let Z=$.metadata?.cards??{},z=CZ(Z.keywords),Q=CZ(Z.examples);return{...z.length?{tags:z}:{},...Q.length?{representativeQueries:Q}:{}}}var ow=qz,aw=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function CV($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&aw.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 tw($){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 PZ($,Z={}){let z={$schema:ow,name:CV($),version:String($.project?.version??"0.1.0"),description:tw($)},Q=Hz($)??$.project?.name;if(Q&&Q.length<=100)z.title=Q;let X=$.project?.homepage??$.project?.website??$.project?.url;if(X)z.websiteUrl=X;if(Z.remoteUrl)z.remotes=[{type:"streamable-http",url:Z.remoteUrl}];return z._meta={"one.faf/context":s2($,Z)},z}function _V($){return CV($)}function Hz($){let Z=$.project?.title;if(typeof Z==="string"){let z=Z.trim();if(z&&z.length<=100)return z}return}function RV($){try{return JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return}}var Y1=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function w4($){let Z=RV($);return Y1(Z)&&Y1(Z._meta)&&Y1(Z._meta["one.faf/context"])}function FZ($){let Z=RV($),z=Y1(Z)&&Y1(Z._meta)?Z._meta[X1]:void 0;return Y1(z)&&Y1(z["one.faf/context"])}function PV($,Z,z={},Q={}){let X=PZ(Z,z),J=rw($,"server-card");return H2(J,`${JSON.stringify(X,null,2)}
379
- `,{root:$,format:"json",hasMark:w4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:Q.force}),J}function jZ($,Z){let z={name:Z.name,title:Z.title,version:Z.version,_meta:Z.meta};return d1($,z,{"":{name:["$schema"],title:["name"],version:["description","title","name"]}})}var Td=sw(PZ,"faf-cli: generateServerCard is deprecated, use buildServerCard","FAF0002");l();function x4($,Z,z,Q){let X=DZ(ew($,Z),Z,Q?.[0],Q?.[1],{root:$});if(z(),console.log(` ${Z}`),X)console.log(M(` ${X}`))}function Zx($){try{return $(),!0}catch(Z){if(!m1(Z))throw Z;return console.error(c1(Z,!0)),!1}}function U1($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
378
+ `}var hw='<meta name="description" content="Visual render of project.faf.';function fw($){return new TextDecoder().decode($).split(/\r?\n/).some((Z)=>Z.trim().startsWith(hw)&&Z.includes(" by faf"))}function RZ($,Z,z,Q="project.faf",X={}){H2(Ew($,"project.html"),LV(Z,z,Q),{root:$,format:"html",hasMark:fw,mark:"faf mark (the `Visual render of project.faf` description line)",force:X.force})}var jd=ww(LV,"faf-cli: generateProjectHtml is deprecated, use renderProjectHtml","FAF0001");import{join as Ux}from"path";import{deprecate as Wx}from"node:util";var t2="https://faf.one/ext/context/v1",U1="io.modelcontextprotocol.registry/publisher-provided";function e2($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:"application/vnd.faf+yaml",iana:"https://www.iana.org/assignments/media-types/application/vnd.faf+yaml",deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function y4($,Z={}){let z={"one.faf/context":e2($,Z)},Q=new TextEncoder().encode(JSON.stringify(z)).length;if(Q>4096)throw Error(`publisher-provided _meta is ${Q}B — exceeds the registry ${"4096"}B cap`);return{["io.modelcontextprotocol.registry/publisher-provided"]:z}}var DV="JSONRPC",Lz="1.0",SZ=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],Dz="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";var OV="1.0",Bz={a2a:"application/a2a-agent-card+json",server_card:"application/mcp-server-card+json",fafa:"application/vnd.fafa+yaml"};function NV($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function W1($,Z={}){let z=NV($);if(z.length>0)return z;let Q=Z.doorUrl?.trim();if(Q)return[{protocol:"a2a",location:Q,version:Lz}];return[]}function uw($){try{return`https://${b4($)}/.well-known/fafa`}catch{return}}function IV($,Z,z={}){let Q=e2(Z,z),X=$.agent??{},J={fafaSpecVersion:String($.version??OV),mediaTypes:[...SZ],provenance:{faf:Q.faf,mediaType:Q.mediaType},generated:Q.generated};if(X.id)J.agentId=X.id;let Y=uw($);if(Y)J.passport=Y;return{uri:t2,description:"FAF passport and project DNA as typed parts",required:!1,params:J}}function mw($){let Z=new Set;for(let z of $.capabilities??[])if(z.cites_spec&&SZ.includes(z.cites_spec))Z.add(z.cites_spec);return["text/plain",...Z]}function TV($,Z={}){let z=$.agent??{},Q=W1($,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 U=String(z.vendor??"").trim(),W=String(z.homepage??"").trim(),G=U&&W?{organization:U,url:W}:void 0,V=($.capabilities??[]).map((q)=>{let K=String(q.name??"").trim();if(!K)throw Error("A2A skill missing capabilities[].name");let L=Array.isArray(q.tags)?q.tags.map(String):[],B=q.cites_spec&&SZ.includes(q.cites_spec)?[q.cites_spec,"text/plain"]:void 0;return{id:K,name:K,description:String(q.description??"").trim()||K,tags:L,...B?{inputModes:B}:{}}});return{name:X,description:J,supportedInterfaces:Q.map((q)=>({url:String(q.location),protocolBinding:DV,protocolVersion:String(q.version??Lz)})),...G?{provider:G}:{},version:Y,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[...Z.extensions??[]]},defaultInputModes:mw($),defaultOutputModes:["text/plain","application/json"],skills:V}}var EZ=["mcp","cli","library"],cw=/^[a-z0-9][a-z0-9._-]*$/,pw=/^(@[a-z0-9~][a-z0-9-._~]*\/)?[a-z0-9~][a-z0-9-._~]*$/,lw=/^[A-Za-z0-9]([A-Za-z0-9._-]*[A-Za-z0-9])?$/,dw=/^[A-Za-z0-9][^\s]*$/,iw=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,nw=["a2a","mcp"],rw=/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/;function y($){return String($??"").trim()}function jZ($){return Array.isArray($)?$.map(y).filter(Boolean):[]}function sw($){return y($).toLowerCase().replace(/^https?:\/\//,"").replace(/\/.*$/,"").replace(/^www\./,"")}function ow($,Z,z){let Q=["display_name","description","version"].filter((X)=>!y($[X]));if(Q.length)throw Error(`Missing answer: ${Q.join(", ")}`);if(!cw.test(Z))throw Error("Short name: lowercase letters, digits, dots, hyphens or underscores.");if(!rw.test(z))throw Error(`Domain "${$.domain}" is not a domain name (e.g. example.com).`)}function aw($,Z){return($.skills??[]).filter((z)=>y(z.name)).map((z)=>({name:y(z.name),type:y(z.type)||"tool",description:y(z.description)||y(z.name),tags:Z.length?Z:[y(z.name).toLowerCase()]}))}function tw($){let Z=($.packages??[]).filter((z)=>y(z.registryType)&&y(z.identifier));for(let z of Z){let Q=y(z.registryType),X=y(z.identifier);if(Q==="npm"&&!pw.test(X))throw Error(`Package "${X}" is not an npm package name (e.g. weather-mcp or @acme/weather).`);if(Q==="pypi"&&!lw.test(X))throw Error(`Package "${X}" is not a PyPI package name (e.g. weather-mcp or weather_mcp).`);if(Q==="cargo"&&!iw.test(X))throw Error(`Package "${X}" is not a crate name (e.g. weather-mcp or weather_mcp).`);if(Q!=="npm"&&Q!=="pypi"&&Q!=="cargo"&&!dw.test(X))throw Error(`Package "${X}" is not a ${Q} package identifier: it must start with a letter or digit and have no spaces.`)}return Z.map((z)=>({registryType:y(z.registryType),identifier:y(z.identifier),...y(z.version)?{version:y(z.version)}:{}}))}function AV($){if(/\s/.test($))return!1;try{let Z=new URL($);return(Z.protocol==="http:"||Z.protocol==="https:")&&Z.hostname!==""}catch{return!1}}function ew($){if(!AV(y($.url)))throw Error(`Where it runs: "${y($.url)}" is not an http(s) URL (or give an npm package).`);if(!nw.includes(y($.protocol).toLowerCase()))throw Error(`Protocol "${y($.protocol)}": a2a or mcp.`)}function $x($){let Z=y($.package_kind).toLowerCase()||"mcp";if(!EZ.includes(Z))throw Error(`Kind "${y($.package_kind)}" is not one faf knows: mcp, cli or library.`);return Z}function Zx($,Z){let z=($.endpoints??[]).filter((J)=>y(J.url));z.forEach(ew);let Q=$x($),X=[...z.map((J)=>({protocol:y(J.protocol).toLowerCase(),transport:"http",location:y(J.url)})),...Z.map((J)=>({protocol:Q,transport:"stdio",location:J.identifier}))];if(X.length===0)throw Error("Missing answer: endpoints (a URL, or a package people install)");return X}function zx($,Z,z,Q){let X={domain:Z},J=[["repository",y($.repository)],["icon",y($.icon)],["organizationUrl",y($.organization_url)]];for(let[U,W]of J)if(W)X[U]=W;if(z.length)X.keywords=z;let Y=jZ($.example_requests);if(Y.length)X.examples=Y;if(Q.length)X.packages=Q;return X}function CV($){let Z=y($.handle).toLowerCase(),z=sw($.domain);ow($,Z,z);let Q=jZ($.tags),X=tw($),J=y($.homepage);if(J&&!AV(J))throw Error(`Homepage: "${J}" is not an http(s) URL.`);let Y={name:Z,displayName:y($.display_name),id:`urn:air:${z}:agent:${Z}`,...y($.organization)?{vendor:y($.organization)}:{},version:y($.version),description:y($.description),homepage:J||`https://${z}`,...y($.license)?{license:y($.license)}:{}};return{version:OV,agent:Y,capabilities:aw($,Q),endpoints:Zx($,X),metadata:{cards:zx($,z,Q,X)}}}function _V($){return l6($,{lineWidth:0})}function b4($){let Z=y($.agent?.id),z=/^urn:air:([^:]+):/.exec(Z);if(z)return z[1];let Q=y($.metadata?.cards?.domain);if(Q)return Q;try{return new URL(y($.agent?.homepage)).hostname.replace(/^www\./,"")}catch{throw Error("The .fafa names no domain (agent.id urn:air, metadata.cards.domain or agent.homepage).")}}function PV($){let Z=y($.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 FV($){return`${b4($).split(".").reverse().join(".")}/${PV($)}`}function Mz($){let Z=$.replace(/\s+/g," ").trim();return Z.length<=100?Z:`${Z.slice(0,97).trimEnd()}...`}function t1($){return($.endpoints??[]).filter((Z)=>y(Z.protocol).toLowerCase()==="mcp"&&/^https?:\/\//.test(y(Z.location))).map((Z)=>({type:"streamable-http",url:y(Z.location)}))}function Qx($){if(!$)return;try{let Z=new URL($).hostname.replace(/^www\./,"");return{url:$,source:Z.split(".")[0]}}catch{return}}function Xx($){let Z=$.agent??{},z=$.metadata?.cards??{},Q=y(Z.description),X=y(Z.version);if(!Q||!X)throw Error("An MCP card needs agent.description and agent.version in .fafa");let J={name:FV($),version:X,description:Mz(Q)},Y=y(Z.displayName);if(Y)J.title=Mz(Y);let U=y(Z.homepage);if(U)J.websiteUrl=U;let W=Qx(y(z.repository));if(W)J.repository=W;if(y(z.icon))J.icons=[{src:y(z.icon)}];return J}function Jx($){return($.metadata?.cards?.packages??[]).map((Z)=>({registryType:y(Z.registryType),identifier:y(Z.identifier),...y(Z.version)?{version:y(Z.version)}:{},transport:{type:"stdio"}}))}function Oz($){return($.endpoints??[]).some((Z)=>y(Z.protocol).toLowerCase()==="mcp")}function k4($){return Oz($)&&(t1($).length>0||Jx($).length>0)}function RV($){let Z=y($.agent?.displayName);return{name:FV($),...Z?{title:Mz(Z)}:{}}}function jV($,Z,z={}){let Q=t1($);if(Q.length===0)throw Error("A Server Card describes a remote MCP server: the .fafa has no mcp endpoint at an http(s) URL.");return{$schema:Dz,...Xx($),remotes:Q,...Z?{_meta:{"one.faf/context":e2(Z,z)}}:{}}}function Yx($,Z,z){if(!Z.includes("a2a")||W1($,z).length===0)return;return z.a2aCardUrl??`https://${b4($)}/.well-known/agent-card.json`}function SV($,Z,z={}){let Q=b4($),X=PV($),J=$.agent??{},Y=y(J.displayName)||y(J.name),U=y(J.description),W=y(J.version),G=z.now??new Date().toISOString(),V=(L,B,H)=>({identifier:`urn:air:${Q}:${L}:${X}`,displayName:Y,type:B,description:U,url:H,...W?{version:W}:{},updatedAt:G}),q=[],K=Yx($,Z,z);if(K)q.push(V("a2a",Bz.a2a,K));if(Z.includes("server_card")){let L=t1($)[0];if(L)q.push(V("mcp",Bz.server_card,`${L.url.replace(/\/+$/,"")}/server-card`))}if(z.listFafa!==!1)q.push(V("agent",Bz.fafa,`https://${Q}/.well-known/fafa`));return q}function EV($){let Z=$.agent??{},z=y(Z.vendor)||y(Z.displayName)||y(Z.name);if(!z)return;let Q;try{Q=b4($)}catch{Q=void 0}return{displayName:z,...Q?{identifier:Q}:{}}}function wV($){let Z=$.metadata?.cards??{},z=jZ(Z.keywords),Q=jZ(Z.examples);return{...z.length?{tags:z}:{},...Q.length?{representativeQueries:Q}:{}}}var Gx=Dz,Vx=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function xV($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&Vx.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 qx($){let Z=String($.project?.goal??$.context??$.project?.name??"MCP server").replace(/\s+/g," ").trim();if(!Z)return"MCP server";return Z.length<=100?Z:`${Z.slice(0,97).trimEnd()}...`}function wZ($,Z={}){let z={$schema:Gx,name:xV($),version:String($.project?.version??"0.1.0"),description:qx($)},Q=Nz($)??$.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":e2($,Z)},z}function yV($){return xV($)}function Nz($){let Z=$.project?.title;if(typeof Z==="string"){let z=Z.trim();if(z&&z.length<=100)return z}return}function bV($){try{return JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return}}var G1=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function v4($){let Z=bV($);return G1(Z)&&G1(Z._meta)&&G1(Z._meta["one.faf/context"])}function xZ($){let Z=bV($),z=G1(Z)&&G1(Z._meta)?Z._meta[U1]:void 0;return G1(z)&&G1(z["one.faf/context"])}function kV($,Z,z={},Q={}){let X=wZ(Z,z),J=Ux($,"server-card");return H2(J,`${JSON.stringify(X,null,2)}
379
+ `,{root:$,format:"json",hasMark:v4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:Q.force}),J}function yZ($,Z){let z={name:Z.name,title:Z.title,version:Z.version,_meta:Z.meta};return o1($,z,{"":{name:["$schema"],title:["name"],version:["description","title","name"]}})}var ud=Wx(wZ,"faf-cli: generateServerCard is deprecated, use buildServerCard","FAF0002");i();function g4($,Z,z,Q){let X=AZ(Kx($,Z),Z,Q?.[0],Q?.[1],{root:$});if(z(),console.log(` ${Z}`),X)console.log(M(` ${X}`))}function Bx($){try{return $(),!0}catch(Z){if(!i1(Z))throw Z;return console.error(n1(Z,!0)),!1}}function V1($={}){let Z=c();if(!Z)console.error(`Error: project.faf not found
380
380
 
381
- Run 'faf init' to create one.`),process.exit(2);let z=$.output?$x(process.cwd(),$.output):process.cwd();if($.output)E0(z);let Q=t(Z),X=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.llms&&!$.conductor&&!$.html&&!$.card,J=0,Y=(W)=>{if(!Zx(W))J++};if(X||$.agents)Y(()=>x4(z,"AGENTS.md",()=>oG(z,Jz(z,Q))));if(X||$.cursor)Y(()=>x4(z,".cursorrules",()=>aG(z,Q),["# faf:start","# faf:end"]));if(X||$.gemini)Y(()=>x4(z,"GEMINI.md",()=>tG(z,Jz(z,Q))));if(X||$.copilot)Y(()=>x4(z,".github/copilot-instructions.md",()=>$V(z,Q)));if($.grok)Y(()=>{let W=zV(z,Q);console.log(` .grok/config.toml (${W})`)});if($.llms)Y(()=>x4(z,"llms.txt",()=>QV(z,Q)));if(X||$.html)Y(()=>{let W=a(Z,()=>D0(p(Z)));AZ(z,Q,W,Z,{force:$.force}),console.log(" project.html")});let U=Q.app_type==="server-card"||Q.project?.type==="server-card";if($.card||X&&U)Y(()=>{let W=PV(z,Q,{},{force:$.force});console.log(` ${W.replace(`${z}/`,"")}`)});if(console.log(`${A("exported")} ${M(`from ${Z}`)}`),J>0)process.exit(1)}import{existsSync as qx,lstatSync as Kx}from"fs";import{dirname as yV,resolve as Iz}from"path";import{existsSync as FV}from"fs";import{basename as zx,dirname as y4,join as jV}from"path";import{deprecate as Qx}from"node:util";var Bz=["a2a","mcp","registry","catalog","ard"];function SZ($){return h0(G0(i(y4($),zx($))))}function SV($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let Q of Z){let X=jV($,Q);if(FV(X))return X}let z=y4($);if(z!==$)for(let Q of Z){let X=jV(z,Q);if(FV(X))return X}return null}function EV($,Z,z={}){if(J1($,z).length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");return KV($,{doorUrl:z.doorUrl,extensions:Z?[qV($,Z,z)]:[]})}var ad=Qx(EV,"faf-cli: generateA2ACard is deprecated, use buildA2ACard","FAF0003");function Xx($,Z={},z={}){return IV($,["a2a","server_card"],{now:z.now??Z.generated??new Date().toISOString(),a2aCardUrl:z.a2aCardUrl,doorUrl:z.doorUrl})}var Jx=["url","type","updatedAt"];function Yx($,Z,z){let Q=[];try{let X=JSON.parse($.replace(/^\uFEFF/,"")).entries;Q=Array.isArray(X)?X:[]}catch{return Z}return Z.map((X)=>{let J=Q.find((U)=>U&&typeof U==="object"&&U.identifier===X.identifier);if(!J)return X;let Y=J.url===X.url&&J.type===X.type;return{...X,updatedAt:Y?J.updatedAt??X.updatedAt:z}})}function Mz($,Z,z,Q=new Date().toISOString()){if($===null){let Y={specVersion:"1.0",...z?{host:z}:{},entries:Z};return{text:`${JSON.stringify(Y,null,2)}
382
- `,changed:!0}}let X=fG($,"entries",Yx($,Z,Q),{id:"identifier",update:Jx});if(!z||Ux(X.text))return X;let J=d1(X.text,{host:z},{"":{host:["specVersion"]}});return{text:J.text,changed:X.changed||J.changed}}function Ux($){try{let Z=JSON.parse($);return Object.prototype.hasOwnProperty.call(Z,"host")}catch{return!0}}var EZ="no mcp endpoint in agent.fafa";function Lz($){return $!==void 0&&!Kz($)}var wV="project.faf type is not an MCP server";function Wx($){let Z=$.project?.type??$.app_type;return typeof Z==="string"&&Z.trim()!==""?Z.trim():void 0}function Dz($,Z){if($===void 0||Z!==void 0)return!1;let z=Wx($);return z!==void 0&&!/^mcp/i.test(z)}function b4($,Z={}){return[...J1($,Z).length>0?["a2a"]:[],...n1($).length>0?["mcp"]:[],...E4($)?["registry"]:[],"catalog","ard"]}function wZ($){let Z=$.opts??{},z=$.faf,Q=$.fafa,X=Lz(Q),J=$.targets?.filter((V)=>V==="mcp"||V==="registry")??[];if(X&&J.length)throw Error(`${J.join(", ")}: ${EZ} — these cards describe an MCP server.`);let Y=Dz(z,Q),U=(z?Bz:Q?b4(Q,Z):[]).filter((V)=>!(X||Y)||V!=="mcp"&&V!=="registry"),W=new Set($.targets?.length?$.targets:U),G={};if(z)G.block=s2(z,Z);if(W.has("mcp"))if(Q&&n1(Q).length>0)G.mcp=NV(Q,z,Z);else if(z)G.mcp=PZ(z,Z);else throw Error("A Server Card needs an MCP endpoint at an http(s) URL in the .fafa, or a project.faf.");if(W.has("registry"))if(Q&&E4(Q))G.registry={...OV(Q),...z?{_meta:j4(z,Z)}:{}};else if(z){let V=Hz(z);G.registry={name:_V(z),...V?{title:V}:{},_meta:j4(z,Z)}}else throw Error("A registry entry needs a package or a remote MCP URL in the .fafa, or a project.faf.");if(W.has("a2a")||W.has("catalog")||W.has("ard")){if(!$.fafa){if($.targets?.some((V)=>V==="a2a"||V==="catalog"||V==="ard"))throw Error("A2A/catalog/ARD require a .fafa (agent.fafa). Will not invent an agent.")}}if(W.has("a2a")&&$.fafa)if(J1($.fafa,Z).length===0){if($.targets?.includes("a2a"))throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.")}else G.a2a=EV($.fafa,z,Z);if((W.has("catalog")||W.has("ard"))&&$.fafa){let V=Xx($.fafa,z,Z);if(W.has("catalog"))G.catalog=V;if(W.has("ard")){let K=AV($.fafa);G.ard=V.map((H)=>({...H,...K}))}let q=TV($.fafa);if(q)G.catalogHost=q}return Gx(G),G}function Gx($){if(!$.block)return;let Z=JSON.stringify($.block),z=[];if($.mcp){let Q=$.mcp._meta;z.push(JSON.stringify(Q["one.faf/context"]))}if($.registry?._meta){let Q=$.registry._meta["io.modelcontextprotocol.registry/publisher-provided"];z.push(JSON.stringify(Q["one.faf/context"]))}for(let Q of z)if(Q!==Z)throw Error("context block drifted across card targets — one projector, one block");if($.a2a){let Q=$.a2a.capabilities.extensions?.find((Y)=>Y.uri===r2);if(!Q)throw Error("A2A card has no FAF context extension, but a project.faf was given");let X=Q.params,J=$.block;if(X.provenance?.faf!==J.faf||X.provenance?.mediaType!==J.mediaType)throw Error("A2A extension provenance drifted from the context block — one context, every door")}}function Oz($){let Z;try{Z=JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return!1}let Q=(typeof Z==="object"&&Z!==null?Z.capabilities:void 0)?.extensions;return Array.isArray(Q)&&Q.some((X)=>typeof X==="object"&&X!==null&&X.uri===r2)}function Vx($){return w4($)||FZ($)||Oz($)}function Nz($,Z,z,Q={}){return E0(z??y4($),y4($)),H2($,`${JSON.stringify(Z,null,2)}
383
- `,{root:z??y4($),format:"json",hasMark:Q.owns??Vx,mark:Q.mark??"FAF context-block (a faf card mark)",force:Q.force}).result}function xV($){if(!$)return;let Z=$.split(",").map((Q)=>Q.trim().toLowerCase()).filter(Boolean),z=Z.filter((Q)=>!Bz.includes(Q));if(z.length)throw Error(`unknown card target: ${z.join(", ")} (use ${Bz.join(",")})`);return Z}l();function Hx($){try{return Kx($),!0}catch{return!1}}function Bx($){try{let z=JSON.parse($.replace(/^\uFEFF/,""))?._meta?.[X1]?.["one.faf/context"]?.generated;return typeof z==="string"?z:void 0}catch{return}}function bV($={}){let Z=$.faf?Iz($.faf):m();if(!Z||!qx(Z))console.error(`Error: project.faf not found
381
+ Run 'faf init' to create one.`),process.exit(2);let z=$.output?Hx(process.cwd(),$.output):process.cwd();if($.output)E0(z);let Q=a(Z),X=i5(z,Z),J=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.llms&&!$.conductor&&!$.html&&!$.card,Y=0,U=(G)=>{if(!Bx(G))Y++};if(J||$.agents)U(()=>g4(z,"AGENTS.md",()=>QV(z,Hz(z,Q),X)));if(J||$.cursor)U(()=>g4(z,".cursorrules",()=>XV(z,Q,X),["# faf:start","# faf:end"]));if(J||$.gemini)U(()=>g4(z,"GEMINI.md",()=>JV(z,Hz(z,Q),X)));if(J||$.copilot)U(()=>g4(z,".github/copilot-instructions.md",()=>UV(z,Q,X)));if($.grok)U(()=>{let G=GV(z,Q);console.log(` .grok/config.toml (${G})`)});if($.llms)U(()=>g4(z,"llms.txt",()=>KV(z,Q)));if(J||$.html)U(()=>{let G=o(Z,()=>M0(l(Z)));RZ(z,Q,G,Z,{force:$.force}),console.log(" project.html")});let W=Q.app_type==="server-card"||Q.project?.type==="server-card";if($.card||J&&W)U(()=>{let G=kV(z,Q,{},{force:$.force});console.log(` ${G.replace(`${z}/`,"")}`)});if(console.log(`${A("exported")} ${M(`from ${Z}`)}`),Y>0)process.exit(1)}import{existsSync as _x,lstatSync as Px}from"fs";import{dirname as cV,resolve as Fz}from"path";import{existsSync as vV}from"fs";import{basename as Mx,dirname as h4,join as gV}from"path";import{deprecate as Lx}from"node:util";var Iz=["a2a","mcp","registry","catalog","ard"];function bZ($){return S0(W0(n(h4($),Mx($))))}function hV($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let Q of Z){let X=gV($,Q);if(vV(X))return X}let z=h4($);if(z!==$)for(let Q of Z){let X=gV(z,Q);if(vV(X))return X}return null}function fV($,Z,z={}){if(W1($,z).length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");return TV($,{doorUrl:z.doorUrl,extensions:Z?[IV($,Z,z)]:[]})}var Li=Lx(fV,"faf-cli: generateA2ACard is deprecated, use buildA2ACard","FAF0003");function Dx($,Z={},z={}){return SV($,["a2a","server_card"],{now:z.now??Z.generated??new Date().toISOString(),a2aCardUrl:z.a2aCardUrl,doorUrl:z.doorUrl})}var Ox=["url","type","updatedAt"];function Nx($,Z,z){let Q=[];try{let X=JSON.parse($.replace(/^\uFEFF/,"")).entries;Q=Array.isArray(X)?X:[]}catch{return Z}return Z.map((X)=>{let J=Q.find((U)=>U&&typeof U==="object"&&U.identifier===X.identifier);if(!J)return X;let Y=J.url===X.url&&J.type===X.type;return{...X,updatedAt:Y?J.updatedAt??X.updatedAt:z}})}function Tz($,Z,z,Q=new Date().toISOString()){if($===null){let Y={specVersion:"1.0",...z?{host:z}:{},entries:Z};return{text:`${JSON.stringify(Y,null,2)}
382
+ `,changed:!0}}let X=iG($,"entries",Nx($,Z,Q),{id:"identifier",update:Ox});if(!z||Ix(X.text))return X;let J=o1(X.text,{host:z},{"":{host:["specVersion"]}});return{text:J.text,changed:X.changed||J.changed}}function Ix($){try{let Z=JSON.parse($);return Object.prototype.hasOwnProperty.call(Z,"host")}catch{return!0}}var kZ="no mcp endpoint in agent.fafa";function Az($){return $!==void 0&&!Oz($)}var uV="project.faf type is not an MCP server";function Tx($){let Z=$.project?.type??$.app_type;return typeof Z==="string"&&Z.trim()!==""?Z.trim():void 0}function Cz($,Z){if($===void 0||Z!==void 0)return!1;let z=Tx($);return z!==void 0&&!/^mcp/i.test(z)}function f4($,Z={}){return[...W1($,Z).length>0?["a2a"]:[],...t1($).length>0?["mcp"]:[],...k4($)?["registry"]:[],"catalog","ard"]}function vZ($){let Z=$.opts??{},z=$.faf,Q=$.fafa,X=Az(Q),J=$.targets?.filter((V)=>V==="mcp"||V==="registry")??[];if(X&&J.length)throw Error(`${J.join(", ")}: ${kZ} — these cards describe an MCP server.`);let Y=Cz(z,Q),U=(z?Iz:Q?f4(Q,Z):[]).filter((V)=>!(X||Y)||V!=="mcp"&&V!=="registry"),W=new Set($.targets?.length?$.targets:U),G={};if(z)G.block=e2(z,Z);if(W.has("mcp"))if(Q&&t1(Q).length>0)G.mcp=jV(Q,z,Z);else if(z)G.mcp=wZ(z,Z);else throw Error("A Server Card needs an MCP endpoint at an http(s) URL in the .fafa, or a project.faf.");if(W.has("registry"))if(Q&&k4(Q))G.registry={...RV(Q),...z?{_meta:y4(z,Z)}:{}};else if(z){let V=Nz(z);G.registry={name:yV(z),...V?{title:V}:{},_meta:y4(z,Z)}}else throw Error("A registry entry needs a package or a remote MCP URL in the .fafa, or a project.faf.");if(W.has("a2a")||W.has("catalog")||W.has("ard")){if(!$.fafa){if($.targets?.some((V)=>V==="a2a"||V==="catalog"||V==="ard"))throw Error("A2A/catalog/ARD require a .fafa (agent.fafa). Will not invent an agent.")}}if(W.has("a2a")&&$.fafa)if(W1($.fafa,Z).length===0){if($.targets?.includes("a2a"))throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.")}else G.a2a=fV($.fafa,z,Z);if((W.has("catalog")||W.has("ard"))&&$.fafa){let V=Dx($.fafa,z,Z);if(W.has("catalog"))G.catalog=V;if(W.has("ard")){let K=wV($.fafa);G.ard=V.map((L)=>({...L,...K}))}let q=EV($.fafa);if(q)G.catalogHost=q}return Ax(G),G}function Ax($){if(!$.block)return;let Z=JSON.stringify($.block),z=[];if($.mcp){let Q=$.mcp._meta;z.push(JSON.stringify(Q["one.faf/context"]))}if($.registry?._meta){let Q=$.registry._meta["io.modelcontextprotocol.registry/publisher-provided"];z.push(JSON.stringify(Q["one.faf/context"]))}for(let Q of z)if(Q!==Z)throw Error("context block drifted across card targets — one projector, one block");if($.a2a){let Q=$.a2a.capabilities.extensions?.find((Y)=>Y.uri===t2);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 _z($){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===t2)}function Cx($){return v4($)||xZ($)||_z($)}function Pz($,Z,z,Q={}){return E0(z??h4($),h4($)),H2($,`${JSON.stringify(Z,null,2)}
383
+ `,{root:z??h4($),format:"json",hasMark:Q.owns??Cx,mark:Q.mark??"FAF context-block (a faf card mark)",force:Q.force}).result}function mV($){if(!$)return;let Z=$.split(",").map((Q)=>Q.trim().toLowerCase()).filter(Boolean),z=Z.filter((Q)=>!Iz.includes(Q));if(z.length)throw Error(`unknown card target: ${z.join(", ")} (use ${Iz.join(",")})`);return Z}i();function Fx($){try{return Px($),!0}catch{return!1}}function Rx($){try{let z=JSON.parse($.replace(/^\uFEFF/,""))?._meta?.[U1]?.["one.faf/context"]?.generated;return typeof z==="string"?z:void 0}catch{return}}function pV($={}){let Z=$.faf?Fz($.faf):c();if(!Z||!_x(Z))console.error(`Error: project.faf not found
384
384
 
385
- Run 'faf init' to create one.`),process.exit(2);let z=t(Z),Q=Iz($.in??"./server.json"),X=$.in?yV(Q):process.cwd();if(!Hx(Q))console.error(`Error: ${Q} not found.
385
+ Run 'faf init' to create one.`),process.exit(2);let z=a(Z),Q=Fz($.in??"./server.json"),X=$.in?cV(Q):process.cwd();if(!Fx(Q))console.error(`Error: ${Q} not found.
386
386
 
387
387
  'faf server-card' patches the identity into an existing registry server.json;
388
- it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=i(X,Q),Y=G0(J),U=$.generated??Bx(Y)??new Date().toISOString(),W=wZ({faf:z,targets:["registry"],opts:{fafPointer:"./project.faf",now:U}}),G=W.registry.name,V=W.registry.title,q;try{q=jZ(Y,{name:G,title:V,version:$.setVersion,meta:W.registry._meta})}catch(L){if(!(L instanceof m0))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 K=Iz($.out??Q),H=V??"(none in project.faf — the file's own kept)";if(K===Q){if(q.changed)o(J,q.text,{root:X,expect:Y})}else V2(K),H2(K,q.text,{root:$.out?yV(K):process.cwd(),format:"json",hasMark:FZ,mark:"faf identity (`_meta` publisher-provided `one.faf/context`)",force:$.force});console.error(`${A("✓")} ${K} — name=${G} title=${H} ${M(q.changed||K!==Q?"(identity emitted from faf-cli)":"(unchanged)")}`)}import{existsSync as kV,lstatSync as Mx}from"fs";import{dirname as vV,join as r1,resolve as Tz}from"path";l();function Lx($){try{let Z=JSON.parse($).name;return typeof Z==="string"&&Z!==""?Z:null}catch{return null}}function xZ($){try{return Mx($),!0}catch{return!1}}var k2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)?$:void 0;function gV($){return(Array.isArray($.entries)?$.entries.map(k2):[]).find((z)=>z?.type==="application/vnd.fafa+yaml"&&/^urn:air:[^:]+:agent:/.test(String(z?.identifier)))?.updatedAt}var Dx=[{target:"registry",file:["server.json"],stamp:($)=>k2(k2(k2($._meta)?.[X1])?.["one.faf/context"])?.generated},{target:"mcp",file:["server-card"],stamp:($)=>k2(k2($._meta)?.["one.faf/context"])?.generated},{target:"a2a",file:[".well-known","agent-card.json"],stamp:($)=>{let Z=k2($.capabilities)?.extensions,z=Array.isArray(Z)?Z.map(k2).find((Q)=>Q?.uri===r2):void 0;return k2(z?.params)?.generated}},{target:"catalog",file:[".well-known","ai-catalog.json"],stamp:gV},{target:"ard",file:[".well-known","ard.json"],stamp:gV}];function Ox($,Z){for(let{target:z,file:Q,stamp:X}of Dx){let J=r1($,...Q);if(Z?.length&&!Z.includes(z)||!xZ(J))continue;try{let Y=k2(JSON.parse(G0(i($,J)).replace(/^\uFEFF/,""))),U=Y?X(Y):void 0;if(typeof U==="string")return U}catch{}}return}function Nx($,Z,z){let Q=Z?.filter((J)=>J==="mcp"||J==="registry")??[];if(Q.length)console.error(`Error: --target ${Q.join(",")}: ${EZ} — these cards describe an MCP server.`),process.exit(2);let X=Boolean($.metadata?.cards?.packages?.length);if(!Z?.length&&(z||X))console.error(M(`skipped MCP Server Card and registry server.json: ${EZ}`))}function yZ($={}){let Z=$.dir?Tz($.dir):process.cwd(),z;try{z=xV($.target)}catch(L){console.error(`Error: ${L.message}`),process.exit(2)}let Q=$.fafa?Tz($.fafa):SV(Z),X=Q&&kV(Q)?SZ(Q):void 0,J=$.faf?Tz($.faf):m(Z),Y=Boolean(J&&kV(J));if(X&&Lz(X))Nx(X,z,Y);if(!Y){if(!X)console.error(`Error: no agent.fafa or project.faf here
388
+ it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=n(X,Q),Y=W0(J),U=$.generated??Rx(Y)??new Date().toISOString(),W=vZ({faf:z,targets:["registry"],opts:{fafPointer:"./project.faf",now:U}}),G=W.registry.name,V=W.registry.title,q;try{q=yZ(Y,{name:G,title:V,version:$.setVersion,meta:W.registry._meta})}catch(B){if(!(B instanceof u0))throw B;console.error(`faf: ${Q}: ${B.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 K=Fz($.out??Q),L=V??"(none in project.faf — the file's own kept)";if(K===Q){if(q.changed)s(J,q.text,{root:X,expect:Y})}else V2(K),H2(K,q.text,{root:$.out?cV(K):process.cwd(),format:"json",hasMark:xZ,mark:"faf identity (`_meta` publisher-provided `one.faf/context`)",force:$.force});console.error(`${A("✓")} ${K} — name=${G} title=${L} ${M(q.changed||K!==Q?"(identity emitted from faf-cli)":"(unchanged)")}`)}import{existsSync as lV,lstatSync as jx}from"fs";import{dirname as dV,join as e1,resolve as Rz}from"path";i();function Sx($){try{let Z=JSON.parse($).name;return typeof Z==="string"&&Z!==""?Z:null}catch{return null}}function gZ($){try{return jx($),!0}catch{return!1}}var g2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)?$:void 0;function iV($){return(Array.isArray($.entries)?$.entries.map(g2):[]).find((z)=>z?.type==="application/vnd.fafa+yaml"&&/^urn:air:[^:]+:agent:/.test(String(z?.identifier)))?.updatedAt}var Ex=[{target:"registry",file:["server.json"],stamp:($)=>g2(g2(g2($._meta)?.[U1])?.["one.faf/context"])?.generated},{target:"mcp",file:["server-card"],stamp:($)=>g2(g2($._meta)?.["one.faf/context"])?.generated},{target:"a2a",file:[".well-known","agent-card.json"],stamp:($)=>{let Z=g2($.capabilities)?.extensions,z=Array.isArray(Z)?Z.map(g2).find((Q)=>Q?.uri===t2):void 0;return g2(z?.params)?.generated}},{target:"catalog",file:[".well-known","ai-catalog.json"],stamp:iV},{target:"ard",file:[".well-known","ard.json"],stamp:iV}];function wx($,Z){for(let{target:z,file:Q,stamp:X}of Ex){let J=e1($,...Q);if(Z?.length&&!Z.includes(z)||!gZ(J))continue;try{let Y=g2(JSON.parse(W0(n($,J)).replace(/^\uFEFF/,""))),U=Y?X(Y):void 0;if(typeof U==="string")return U}catch{}}return}function xx($,Z,z){let Q=Z?.filter((J)=>J==="mcp"||J==="registry")??[];if(Q.length)console.error(`Error: --target ${Q.join(",")}: ${kZ} — these cards describe an MCP server.`),process.exit(2);let X=Boolean($.metadata?.cards?.packages?.length);if(!Z?.length&&(z||X))console.error(M(`skipped MCP Server Card and registry server.json: ${kZ}`))}function hZ($={}){let Z=$.dir?Rz($.dir):process.cwd(),z;try{z=mV($.target)}catch(B){console.error(`Error: ${B.message}`),process.exit(2)}let Q=$.fafa?Rz($.fafa):hV(Z),X=Q&&lV(Q)?bZ(Q):void 0,J=$.faf?Rz($.faf):c(Z),Y=Boolean(J&&lV(J));if(X&&Az(X))xx(X,z,Y);if(!Y){if(!X)console.error(`Error: no agent.fafa or project.faf here
389
389
 
390
390
  Cards start from an agent.fafa: faf card init
391
- For project.faf: faf init`),process.exit(2);let L=b4(X,{doorUrl:$.doorUrl});if(z?.some((B)=>(B==="mcp"||B==="registry")&&!L.includes(B))){let B=`
392
- With only an agent.fafa: faf cards --target ${L.join(",")}`;console.error(`Error: project.faf not found
391
+ For project.faf: faf init`),process.exit(2);let B=f4(X,{doorUrl:$.doorUrl});if(z?.some((H)=>(H==="mcp"||H==="registry")&&!B.includes(H))){let H=`
392
+ With only an agent.fafa: faf cards --target ${B.join(",")}`;console.error(`Error: project.faf not found
393
393
 
394
- Run 'faf init' to create one.${B}`),process.exit(2)}}let U=Y?t(J):void 0,W=!z?.length&&Dz(U,X);if(W)console.error(M(`skipped MCP Server Card and registry server.json: ${wV}`)),console.error(M(" for its business card: faf card init · an MCP server after all: faf cards --target mcp"));let G;try{G=wZ({faf:U,fafa:X,targets:z,opts:{a2aCardUrl:$.a2aUrl,doorUrl:$.doorUrl,fafPointer:$.fafPointer,now:Ox(Z,z)??new Date().toISOString()}})}catch(L){console.error(`Error: ${L.message}`),process.exit(2)}if($.check){process.stdout.write(`${JSON.stringify(G,null,2)}
395
- `);return}let V=[],q=$.force===!0,K=0,H=(L,B,D="its own keys")=>{try{V.push({out:L,changed:B()})}catch(N){if(N instanceof m0)console.error(`faf: ${L}: ${N.message} — faf cannot change only ${D}, so it left the file unchanged.`);else if(m1(N))console.error(c1(N,!0));else throw N;K++}};if(G.a2a){let L=r1(Z,".well-known","agent-card.json");H(L,()=>Nz(L,G.a2a,Z,{owns:Oz,mark:`faf render hash or FAF context extension (${r2})`,force:q})!=="unchanged")}if(G.mcp){let L=r1(Z,"server-card");H(L,()=>Nz(L,G.mcp,Z,{owns:w4,mark:'faf render hash or FAF context-block (`_meta["one.faf/context"]`)',force:q})!=="unchanged")}if(G.catalog){let L=r1(Z,".well-known","ai-catalog.json"),B=G.catalog;H(L,()=>{E0(Z,vV(L));let D=i(Z,L),N=xZ(L)?G0(D):null,_=Mz(N,B,G.catalogHost);if(_.changed)o(D,_.text,{root:Z,expect:N});return _.changed},"its own rows")}if(G.ard){let L=r1(Z,".well-known","ard.json"),B=G.ard;if(H(L,()=>{E0(Z,vV(L));let D=i(Z,L),N=xZ(L)?G0(D):null,_=Mz(N,B,G.catalogHost);if(_.changed)o(D,_.text,{root:Z,expect:N});return _.changed},"its own rows"),!B.some((D)=>D.representativeQueries?.length))console.error(`${M("note")} ${L}: no representativeQueries — registries build their search index from these, so the entries are a valid catalog but will not be found. Add 2-5 to the .fafa as metadata.cards.examples.`)}if(G.registry){let L=r1(Z,"server.json");if(xZ(L)){let B=G.registry;H(L,()=>{let D=i(Z,L),N=G0(D),_=Lx(N),E=X!==void 0&&E4(X);if(!q&&E&&_&&_!==B.name)throw new v("not-owned",D,`${L} is published as "${_}" and the .fafa gives "${B.name}" — faf left the name as it is, because a rename moves the next registry publish to another namespace. Use --force to rename it.`);let P=jZ(N,{name:B.name,title:B.title,meta:B._meta});if(P.changed)o(D,P.text,{root:Z,expect:N});return P.changed},"its identity keys")}else if(z?.includes("registry"))console.error(`Error: ${L} not found.
394
+ Run 'faf init' to create one.${H}`),process.exit(2)}}let U=Y?a(J):void 0,W=!z?.length&&Cz(U,X);if(W)console.error(M(`skipped MCP Server Card and registry server.json: ${uV}`)),console.error(M(" for its business card: faf card init · an MCP server after all: faf cards --target mcp"));let G;try{G=vZ({faf:U,fafa:X,targets:z,opts:{a2aCardUrl:$.a2aUrl,doorUrl:$.doorUrl,fafPointer:$.fafPointer,now:wx(Z,z)??new Date().toISOString()}})}catch(B){console.error(`Error: ${B.message}`),process.exit(2)}if($.check){process.stdout.write(`${JSON.stringify(G,null,2)}
395
+ `);return}let V=[],q=$.force===!0,K=0,L=(B,H,D="its own keys")=>{try{V.push({out:B,changed:H()})}catch(N){if(N instanceof u0)console.error(`faf: ${B}: ${N.message} — faf cannot change only ${D}, so it left the file unchanged.`);else if(i1(N))console.error(n1(N,!0));else throw N;K++}};if(G.a2a){let B=e1(Z,".well-known","agent-card.json");L(B,()=>Pz(B,G.a2a,Z,{owns:_z,mark:`faf render hash or FAF context extension (${t2})`,force:q})!=="unchanged")}if(G.mcp){let B=e1(Z,"server-card");L(B,()=>Pz(B,G.mcp,Z,{owns:v4,mark:'faf render hash or FAF context-block (`_meta["one.faf/context"]`)',force:q})!=="unchanged")}if(G.catalog){let B=e1(Z,".well-known","ai-catalog.json"),H=G.catalog;L(B,()=>{E0(Z,dV(B));let D=n(Z,B),N=gZ(B)?W0(D):null,_=Tz(N,H,G.catalogHost);if(_.changed)s(D,_.text,{root:Z,expect:N});return _.changed},"its own rows")}if(G.ard){let B=e1(Z,".well-known","ard.json"),H=G.ard;if(L(B,()=>{E0(Z,dV(B));let D=n(Z,B),N=gZ(B)?W0(D):null,_=Tz(N,H,G.catalogHost);if(_.changed)s(D,_.text,{root:Z,expect:N});return _.changed},"its own rows"),!H.some((D)=>D.representativeQueries?.length))console.error(`${M("note")} ${B}: no representativeQueries — registries build their search index from these, so the entries are a valid catalog but will not be found. Add 2-5 to the .fafa as metadata.cards.examples.`)}if(G.registry){let B=e1(Z,"server.json");if(gZ(B)){let H=G.registry;L(B,()=>{let D=n(Z,B),N=W0(D),_=Sx(N),E=X!==void 0&&k4(X);if(!q&&E&&_&&_!==H.name)throw new k("not-owned",D,`${B} is published as "${_}" and the .fafa gives "${H.name}" — faf left the name as it is, because a rename moves the next registry publish to another namespace. Use --force to rename it.`);let j=yZ(N,{name:H.name,title:H.title,meta:H._meta});if(j.changed)s(D,j.text,{root:Z,expect:N});return j.changed},"its identity keys")}else if(z?.includes("registry"))console.error(`Error: ${B} not found.
396
396
 
397
- Registry target patches an existing server.json. Seed one first.`),process.exit(2)}if(V.length===0&&K===0){if(W)return;console.error(`${A("faf cards")} ${M("nothing to write — need .fafa for A2A/catalog/ARD; server.json for registry")}`);return}for(let{out:L,changed:B}of V)console.error(`${A("✓")} ${L}${B?"":` ${M("(unchanged)")}`}`);if(!Y)console.error(M("BETTER: cards from your agent.fafa. BEST: add your project.faf (faf init) for FAF context on every card."));if(K>0)process.exit(1)}import{existsSync as hV,readFileSync as Ix}from"fs";import{join as uV,resolve as fV}from"path";import{createInterface as Tx}from"readline";l();var Ax=["a2a","mcp"],Cx={a2a:"A2A card",mcp:"MCP Server Card",registry:"registry server.json",catalog:"AI Catalog",ard:"ARD"};function mV($){return $.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"")}function _x($){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 Rx($){try{let Z=JSON.parse(Ix(uV($,"package.json"),"utf-8")).version;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}catch{return}}var cV={npm:"npm",pypi:"pypi",crates:"cargo"},Px=new RegExp(`^(${Object.keys(cV).join("|")}):`,"i");function pV($){let Z=$.indexOf(":");if(Z<0)return{registryType:"npm",identifier:$.trim()};let z=$.slice(0,Z).trim().toLowerCase(),Q=cV[z];if(!Q)throw Error(`Package "${$}": registry "${z}" is not one faf knows — npm:<name> (the default), pypi:<name> or crates:<name>.`);return{registryType:Q,identifier:$.slice(Z+1).trim()}}function lV($,Z,z){if(Z.includes(":")&&!Px.test(Z))$.endpoints=[{protocol:z,url:Z}];else $.packages=[pV(Z)]}function t0($){return($??"").trim()}function Fx($){let Z=t0($.name),z={display_name:Z,handle:t0($.shortName)||mV(Z),domain:t0($.domain),description:t0($.description),version:t0($.setVersion),skills:($.skill??[]).map(_x).filter((Q)=>Q.name),example_requests:($.example??[]).map(t0).filter(Boolean)};if(t0($.homepage))z.homepage=t0($.homepage);if($.url)lV(z,t0($.url),t0($.protocol).toLowerCase()||"a2a");if($.package)z.packages=[pV(t0($.package))];if(t0($.kind)){if(!$.package)throw Error("--kind says what a --package is: give --package too.");z.package_kind=t0($.kind).toLowerCase()}return z}function dV($){return async(Z,z)=>(await $(z?`${Z} ${M(`(${z})`)}: `:`${Z}: `)).trim()||z||""}async function iV($,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 jx($,Z){let z=dV(Z),Q=await z("Where it runs — a URL people call, or a package (npm name, pypi:name or crates:name)");if(!Q)return;let X="a2a";if(/^https?:\/\//i.test(Q)){let J=(await z("Protocol at that URL — a2a or mcp","a2a")).toLowerCase();X=Ax.includes(J)?J:"a2a"}if(lV($,Q,X),$.packages?.length&&!$.package_kind)for(;;){let J=(await z(`What it is — ${RZ.join(", ")}`,"mcp")).toLowerCase();if(RZ.includes(J)){$.package_kind=J;break}}}async function Sx($){let Z=[];for(;;){let[z]=await iV($,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 Ex($,Z,z){let Q={...$},X=dV(Z);if(Q.display_name||=await X("Name — what people see, e.g. Weather Agent"),Q.handle||=await X("Short name — lowercase, no spaces",mV(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",Rx(z)??"0.1.0"),!Q.endpoints?.length&&!Q.packages?.length)await jx(Q,Z);if(!Q.skills?.length)Q.skills=await Sx(Z);if(!Q.example_requests?.length)Q.example_requests=await iV(Z,"A question people ask it — search finds it by these (2-5)","Another (Enter to finish)",5);return Q}function wx($){if(!$.skills?.length)throw Error("Missing answer: what it can do (at least one capability)");return MV(BV($))}function xx($){return Boolean($.name&&$.domain&&$.description&&$.setVersion&&($.url||$.package)&&$.skill?.length)}function yx($){if($)return{ask:$,close:()=>{}};if(!process.stdin.isTTY)return{close:()=>{}};let Z=Tx({input:process.stdin,output:process.stdout});return{ask:(z)=>new Promise((Q)=>Z.question(z,Q)),close:()=>Z.close()}}async function nV($={},Z){let z=fV($.dir??process.cwd()),Q=fV(z,$.out??"agent.fafa");if(hV(Q)&&!$.force)console.error(`Error: ${Q} already exists — edit it, or use --force to replace it.`),process.exit(2);let X;try{X=Fx($)}catch(Y){console.error(`Error: ${Y.message}`),process.exit(2)}let J=xx($)?{close:()=>{}}:yx(Z);try{if(J.ask){if(!Z)console.log(`${A("card init")} ${M("— seven answers, one agent.fafa")}
398
- `);X=await Ex(X,J.ask,z)}let Y;try{Y=wx(X)}catch(G){console.error(`Error: ${G.message}`),process.exit(2)}if(o(Q,Y,{root:z,...$.force?{}:{expect:null}}),console.log(`${A("✓")} ${Q}`),(X.example_requests??[]).length<2)console.error(`${M("note")} add 2-5 questions people ask it (metadata.cards.examples) — search finds it by these.`);let U=b4(SZ(Q)).filter((G)=>G!=="registry"||hV(uV(z,"server.json"))),W=U.map((G)=>Cx[G]).join(", ");if(J.ask){let G=(await J.ask(`Write your ${W} now? ${M("(Y/n)")} `)).trim().toLowerCase();if(G===""||G.startsWith("y")){yZ({dir:z,fafa:Q,target:U.join(",")});return}}if(console.log(M(` next: faf cards --target ${U.join(",")}`)),!m(z))console.log(M(" BEST: add your project.faf (faf init) for FAF context on every card."))}finally{J.close()}}import{join as bx}from"path";l();function kx($){if(process.env.CI)return!1;try{return import("open").then(({default:Z})=>Z($)).catch(()=>{return}),!0}catch{return!1}}function rV($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
397
+ Registry target patches an existing server.json. Seed one first.`),process.exit(2)}if(V.length===0&&K===0){if(W)return;console.error(`${A("faf cards")} ${M("nothing to write — need .fafa for A2A/catalog/ARD; server.json for registry")}`);return}for(let{out:B,changed:H}of V)console.error(`${A("✓")} ${B}${H?"":` ${M("(unchanged)")}`}`);if(!Y)console.error(M("BETTER: cards from your agent.fafa. BEST: add your project.faf (faf init) for FAF context on every card."));if(K>0)process.exit(1)}import{existsSync as nV,readFileSync as yx}from"fs";import{join as sV,resolve as rV}from"path";import{createInterface as bx}from"readline";i();var kx=["a2a","mcp"],vx={a2a:"A2A card",mcp:"MCP Server Card",registry:"registry server.json",catalog:"AI Catalog",ard:"ARD"};function oV($){return $.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"")}function gx($){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 hx($){try{let Z=JSON.parse(yx(sV($,"package.json"),"utf-8")).version;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}catch{return}}var aV={npm:"npm",pypi:"pypi",crates:"cargo"},fx=new RegExp(`^(${Object.keys(aV).join("|")}):`,"i");function tV($){let Z=$.indexOf(":");if(Z<0)return{registryType:"npm",identifier:$.trim()};let z=$.slice(0,Z).trim().toLowerCase(),Q=aV[z];if(!Q)throw Error(`Package "${$}": registry "${z}" is not one faf knows — npm:<name> (the default), pypi:<name> or crates:<name>.`);return{registryType:Q,identifier:$.slice(Z+1).trim()}}function eV($,Z,z){if(Z.includes(":")&&!fx.test(Z))$.endpoints=[{protocol:z,url:Z}];else $.packages=[tV(Z)]}function t0($){return($??"").trim()}function ux($){let Z=t0($.name),z={display_name:Z,handle:t0($.shortName)||oV(Z),domain:t0($.domain),description:t0($.description),version:t0($.setVersion),skills:($.skill??[]).map(gx).filter((Q)=>Q.name),example_requests:($.example??[]).map(t0).filter(Boolean)};if(t0($.homepage))z.homepage=t0($.homepage);if($.url)eV(z,t0($.url),t0($.protocol).toLowerCase()||"a2a");if($.package)z.packages=[tV(t0($.package))];if(t0($.kind)){if(!$.package)throw Error("--kind says what a --package is: give --package too.");z.package_kind=t0($.kind).toLowerCase()}return z}function $q($){return async(Z,z)=>(await $(z?`${Z} ${M(`(${z})`)}: `:`${Z}: `)).trim()||z||""}async function Zq($,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 mx($,Z){let z=$q(Z),Q=await z("Where it runs — a URL people call, or a package (npm name, pypi:name or crates:name)");if(!Q)return;let X="a2a";if(/^https?:\/\//i.test(Q)){let J=(await z("Protocol at that URL — a2a or mcp","a2a")).toLowerCase();X=kx.includes(J)?J:"a2a"}if(eV($,Q,X),$.packages?.length&&!$.package_kind)for(;;){let J=(await z(`What it is — ${EZ.join(", ")}`,"mcp")).toLowerCase();if(EZ.includes(J)){$.package_kind=J;break}}}async function cx($){let Z=[];for(;;){let[z]=await Zq($,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 px($,Z,z){let Q={...$},X=$q(Z);if(Q.display_name||=await X("Name — what people see, e.g. Weather Agent"),Q.handle||=await X("Short name — lowercase, no spaces",oV(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",hx(z)??"0.1.0"),!Q.endpoints?.length&&!Q.packages?.length)await mx(Q,Z);if(!Q.skills?.length)Q.skills=await cx(Z);if(!Q.example_requests?.length)Q.example_requests=await Zq(Z,"A question people ask it — search finds it by these (2-5)","Another (Enter to finish)",5);return Q}function lx($){if(!$.skills?.length)throw Error("Missing answer: what it can do (at least one capability)");return _V(CV($))}function dx($){return Boolean($.name&&$.domain&&$.description&&$.setVersion&&($.url||$.package)&&$.skill?.length)}function ix($){if($)return{ask:$,close:()=>{}};if(!process.stdin.isTTY)return{close:()=>{}};let Z=bx({input:process.stdin,output:process.stdout});return{ask:(z)=>new Promise((Q)=>Z.question(z,Q)),close:()=>Z.close()}}async function zq($={},Z){let z=rV($.dir??process.cwd()),Q=rV(z,$.out??"agent.fafa");if(nV(Q)&&!$.force)console.error(`Error: ${Q} already exists — edit it, or use --force to replace it.`),process.exit(2);let X;try{X=ux($)}catch(Y){console.error(`Error: ${Y.message}`),process.exit(2)}let J=dx($)?{close:()=>{}}:ix(Z);try{if(J.ask){if(!Z)console.log(`${A("card init")} ${M("— seven answers, one agent.fafa")}
398
+ `);X=await px(X,J.ask,z)}let Y;try{Y=lx(X)}catch(G){console.error(`Error: ${G.message}`),process.exit(2)}if(s(Q,Y,{root:z,...$.force?{}:{expect:null}}),console.log(`${A("✓")} ${Q}`),(X.example_requests??[]).length<2)console.error(`${M("note")} add 2-5 questions people ask it (metadata.cards.examples) — search finds it by these.`);let U=f4(bZ(Q)).filter((G)=>G!=="registry"||nV(sV(z,"server.json"))),W=U.map((G)=>vx[G]).join(", ");if(J.ask){let G=(await J.ask(`Write your ${W} now? ${M("(Y/n)")} `)).trim().toLowerCase();if(G===""||G.startsWith("y")){hZ({dir:z,fafa:Q,target:U.join(",")});return}}if(console.log(M(` next: faf cards --target ${U.join(",")}`)),!c(z))console.log(M(" BEST: add your project.faf (faf init) for FAF context on every card."))}finally{J.close()}}import{join as nx}from"path";i();function rx($){if(process.env.CI)return!1;try{return import("open").then(({default:Z})=>Z($)).catch(()=>{return}),!0}catch{return!1}}function Qq($={}){let Z=c();if(!Z)console.error(`Error: project.faf not found
399
399
 
400
- Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=t(Z),X=a(Z,()=>D0(p(Z)));AZ(z,Q,X,Z,{force:$.force});let J=bx(z,"project.html"),Y=kx(J);console.log(" project.html"),console.log(Y?`${A("opened")} ${M("in your browser")}`:`${A("rendered")} ${M(`file://${J}`)}`)}import{existsSync as vx}from"fs";import{join as Az,relative as gx,resolve as hx}from"path";import{execFileSync as tV}from"child_process";function sV($){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 oV($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function aV($,Z={}){let z=f1($);if(Z.repoUrl&&z.project&&!W2($)?.name&&z.project.name===$.split("/").pop())z.project.name=oV(Z.repoUrl);return z}l();function fx($){let Z;try{Z=tV("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=Az($,Q.slice(X+1)),Y=f0(J);if(Y===null)continue;try{if(w5(J,{root:$,expect:Y}))z++}catch{}}return z}function ux($,Z,z){return["clone","-c","core.symlinks=false","--depth","1",...z?["--branch",z]:[],"--",$,Z]}function mx($,Z=process.cwd()){if($.stdout)return{outputPath:null};let z=$.output?hx(Z,$.output):Az(Z,"project.faf");if(vx(z)&&!$.force)throw Error(`${z} already exists — refusing to overwrite your context.
401
- `+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:z}}function eV($,Z={},z=process.cwd()){let Q;try{Q=sV($)}catch(U){console.error(`Error: ${U.message}
400
+ Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=a(Z),X=o(Z,()=>M0(l(Z)));RZ(z,Q,X,Z,{force:$.force});let J=nx(z,"project.html"),Y=rx(J);console.log(" project.html"),console.log(Y?`${A("opened")} ${M("in your browser")}`:`${A("rendered")} ${M(`file://${J}`)}`)}import{existsSync as sx}from"fs";import{join as jz,relative as ox,resolve as ax}from"path";import{execFileSync as Uq}from"child_process";function Xq($){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 Jq($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function Yq($,Z={}){let z=l1($);if(Z.repoUrl&&z.project&&!W2($)?.name&&z.project.name===$.split("/").pop())z.project.name=Jq(Z.repoUrl);return z}i();function tx($){let Z;try{Z=Uq("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=jz($,Q.slice(X+1)),Y=f0(J);if(Y===null)continue;try{if(v5(J,{root:$,expect:Y}))z++}catch{}}return z}function ex($,Z,z){return["clone","-c","core.symlinks=false","--depth","1",...z?["--branch",z]:[],"--",$,Z]}function $y($,Z=process.cwd()){if($.stdout)return{outputPath:null};let z=$.output?ax(Z,$.output):jz(Z,"project.faf");if(sx(z)&&!$.force)throw Error(`${z} already exists — refusing to overwrite your context.
401
+ `+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:z}}function Wq($,Z={},z=process.cwd()){let Q;try{Q=Xq($)}catch(U){console.error(`Error: ${U.message}
402
402
 
403
- Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let X;try{X=mx(Z,z)}catch(U){console.error(`Error: ${U.message}`),process.exit(1);return}V2(X.outputPath===null?void 0:Z.output);let J=x5("faf-git-"),Y=Az(J,"repo");try{console.error(M(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{tV("git",ux(Q,Y,Z.ref),{stdio:"pipe"})}catch(q){let H=(q?.stderr?.toString()??"").trim().split(`
404
- `).slice(-2).join(" ").trim()||"git clone failed",L=Z.ref?`
403
+ Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let X;try{X=$y(Z,z)}catch(U){console.error(`Error: ${U.message}`),process.exit(1);return}V2(X.outputPath===null?void 0:Z.output);let J=g5("faf-git-"),Y=jz(J,"repo");try{console.error(M(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{Uq("git",ex(Q,Y,Z.ref),{stdio:"pipe"})}catch(q){let L=(q?.stderr?.toString()??"").trim().split(`
404
+ `).slice(-2).join(" ").trim()||"git clone failed",B=Z.ref?`
405
405
 
406
406
  (does the branch/tag '${Z.ref}' exist?)`:"";console.error(`Error: could not clone ${$}
407
407
 
408
- ${H}${L}`),process.exit(1)}fx(Y);let U=aV(Y,{repoUrl:Q});if(X.outputPath===null){process.stdout.write(X3(U));return}let W;if(b0(X.outputPath,U,{replace:Z.force===!0,onReplacedBackup:(q)=>{W=q}}),console.log(`${A("created")} ${X.outputPath}`),W){let q=gx(z,W)||W;console.log(M(` kept the previous file at ${q}`))}let G=p(X.outputPath),V=a(X.outputPath,()=>k0(F0(G)));w0(V,X.outputPath),console.log(M(cx(Object.keys(A4(Y)).length)))}finally{y5(J)}}function cx($){if($===0)return"The goal and six W's are empty: fill them with 'faf go' in a clone.";let[Z,z,Q]=$===1?["suggestion","waits","it"]:["suggestions","wait","them"];return`The goal and six W's are empty: ${$} ${Z} ${z} in the repo. Run 'faf go' in a clone to confirm ${Q}.`}import{execFileSync as v2}from"child_process";import{readFileSync as px,existsSync as lx}from"fs";import{dirname as dx,resolve as ix}from"path";var s1=($)=>String($).trim(),nx="slotignored",$q=($)=>U0($)||typeof $==="string"&&$.trim().toLowerCase()===nx;function rx($,Z){let z=[],Q=0,X=0;for(let J of J0){let Y=t$($,J),U=t$(Z,J),W=!$q(Y),G=!$q(U);if(W)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(!W&&G)z.push({...q,kind:"added",to:s1(U)});else if(W&&!G)z.push({...q,kind:"removed",from:s1(Y)});else if(W&&G&&s1(Y)!==s1(U))z.push({...q,kind:"changed",from:s1(Y),to:s1(U)})}return{changes:z,filledBase:Q,filledTarget:X}}function Zq($){if(!$.trim())return 0;try{return D0($).score??0}catch{return 0}}function zq($){if(!$.trim())return{};try{return U2($)??{}}catch{return{}}}function vZ($,Z){let{changes:z,filledBase:Q,filledTarget:X}=rx(zq($),zq(Z)),J=Zq($),Y=Zq(Z);return{changes:z,scoreBase:J,scoreTarget:Y,scoreDelta:Y-J,filledBase:Q,filledTarget:X}}var sx={added:"+",removed:"-",changed:"~"},Qq=($)=>$>0?`+${$}`:`${$}`,bZ=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function Jq($,Z,z){let Q=[],X=C2(M6($.scoreBase)),J=C2(M6($.scoreTarget));if(Q.push(`project.faf ${Z} → ${z}`),Q.push(`Score: ${$.scoreBase}% ${X} → ${$.scoreTarget}% ${J} (${Qq($.scoreDelta)})`),Q.push(""),$.changes.length===0)Q.push(" (no slot changes)");else{let Y="";for(let U of $.changes){if(U.category!==Y)Q.push(` ${U.category}`),Y=U.category;let W=sx[U.kind],G=U.label.padEnd(16);if(U.kind==="changed")Q.push(` ${W} ${G} ${bZ(U.from)} → ${bZ(U.to)}`);else if(U.kind==="added")Q.push(` ${W} ${G} ${bZ(U.to)} (added)`);else Q.push(` ${W} ${G} ${bZ(U.from)} (removed)`)}}return Q.push(""),Q.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${Qq($.filledTarget-$.filledBase)})`),Q.join(`
409
- `)}function ox($,Z){try{return v2("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function k4($,Z){if(!ox($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function o1($,Z,z){try{return v2("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function Yq($){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"&&lx(J)?px(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=vZ(z($[1]),z($[4]));console.log(Jq(X,Q($[1],$[2]),Q($[4],$[5])))}catch(z){console.log(`${Z} — faf diff unavailable (${z instanceof Error?z.message:"error"})`)}}var kZ="*.faf diff=faf";function Cz($){let[Z,...z]=$.trim().split(/\s+/);try{return v2(Z,z,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function Uq($){try{return v2("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}catch{throw console.error("Error: not a git repository."),process.exit(2),Error("unreachable")}}var e0="faf-cli diff-driver";function Wq($,Z,z){try{return v2("git",["config","--null",...Z],{cwd:$,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch(Q){if(Q.status===1)return"";let X=String(Q.stderr??"").trim().split(`
410
- `)[0]||"git config failed";throw Error(`git cannot read ${z} (${X})`,{cause:Q})}}function _z($,Z=!1){return Wq($,[...Z?["--local"]:[],"--get-all","diff.faf.command"],"diff.faf.command").split("\x00").slice(0,-1)}function ax($){let z=Wq($,["--get-regexp","^diff\\.faf\\."],"the diff.faf settings").split("\x00").slice(0,-1).map((Q)=>Q.split(`
411
- `)[0]);return[...new Set(z.filter((Q)=>Q!=="diff.faf.command"))]}var Gq=($)=>$.map((Z)=>JSON.stringify(Z)).join(", ");function tx($){let Z=i($,".gitattributes"),z=T6(Z),Q=z??"";if(Q.split(`
412
- `).some((Y)=>Y.trim()===kZ)){console.log(`• .gitattributes already opts in (${kZ})`);return}let X=Q.includes(`\r
408
+ ${L}${B}`),process.exit(1)}tx(Y);let U=Yq(Y,{repoUrl:Q});if(X.outputPath===null){process.stdout.write(V3(U));return}let W;if(k0(X.outputPath,U,{replace:Z.force===!0,onReplacedBackup:(q)=>{W=q}}),console.log(`${A("created")} ${X.outputPath}`),W){let q=ox(z,W)||W;console.log(M(` kept the previous file at ${q}`))}let G=l(X.outputPath),V=o(X.outputPath,()=>v0(P0(G)));w0(V,X.outputPath),console.log(M(Zy(Object.keys(P4(Y)).length)))}finally{h5(J)}}function Zy($){if($===0)return"The goal and six W's are empty: fill them with 'faf go' in a clone.";let[Z,z,Q]=$===1?["suggestion","waits","it"]:["suggestions","wait","them"];return`The goal and six W's are empty: ${$} ${Z} ${z} in the repo. Run 'faf go' in a clone to confirm ${Q}.`}import{execFileSync as h2}from"child_process";import{readFileSync as zy,existsSync as Qy}from"fs";import{dirname as Xy,resolve as Jy}from"path";var $$=($)=>String($).trim(),Yy="slotignored",Gq=($)=>J0($)||typeof $==="string"&&$.trim().toLowerCase()===Yy;function Uy($,Z){let z=[],Q=0,X=0;for(let J of X0){let Y=Q4($,J),U=Q4(Z,J),W=!Gq(Y),G=!Gq(U);if(W)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(!W&&G)z.push({...q,kind:"added",to:$$(U)});else if(W&&!G)z.push({...q,kind:"removed",from:$$(Y)});else if(W&&G&&$$(Y)!==$$(U))z.push({...q,kind:"changed",from:$$(Y),to:$$(U)})}return{changes:z,filledBase:Q,filledTarget:X}}function Vq($){if(!$.trim())return 0;try{return M0($).score??0}catch{return 0}}function qq($){if(!$.trim())return{};try{return U2($)??{}}catch{return{}}}function mZ($,Z){let{changes:z,filledBase:Q,filledTarget:X}=Uy(qq($),qq(Z)),J=Vq($),Y=Vq(Z);return{changes:z,scoreBase:J,scoreTarget:Y,scoreDelta:Y-J,filledBase:Q,filledTarget:X}}var Wy={added:"+",removed:"-",changed:"~"},Kq=($)=>$>0?`+${$}`:`${$}`,fZ=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function Bq($,Z,z){let Q=[],X=C2(N6($.scoreBase)),J=C2(N6($.scoreTarget));if(Q.push(`project.faf ${Z} → ${z}`),Q.push(`Score: ${$.scoreBase}% ${X} → ${$.scoreTarget}% ${J} (${Kq($.scoreDelta)})`),Q.push(""),$.changes.length===0)Q.push(" (no slot changes)");else{let Y="";for(let U of $.changes){if(U.category!==Y)Q.push(` ${U.category}`),Y=U.category;let W=Wy[U.kind],G=U.label.padEnd(16);if(U.kind==="changed")Q.push(` ${W} ${G} ${fZ(U.from)} → ${fZ(U.to)}`);else if(U.kind==="added")Q.push(` ${W} ${G} ${fZ(U.to)} (added)`);else Q.push(` ${W} ${G} ${fZ(U.from)} (removed)`)}}return Q.push(""),Q.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${Kq($.filledTarget-$.filledBase)})`),Q.join(`
409
+ `)}function Gy($,Z){try{return h2("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function u4($,Z){if(!Gy($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function Z$($,Z,z){try{return h2("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function Mq($){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"&&Qy(J)?zy(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=mZ(z($[1]),z($[4]));console.log(Bq(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 Sz($){let[Z,...z]=$.trim().split(/\s+/);try{return h2(Z,z,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function Lq($){try{return h2("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 e0="faf-cli diff-driver";function Dq($,Z,z){try{return h2("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(`
410
+ `)[0]||"git config failed";throw Error(`git cannot read ${z} (${X})`,{cause:Q})}}function Ez($,Z=!1){return Dq($,[...Z?["--local"]:[],"--get-all","diff.faf.command"],"diff.faf.command").split("\x00").slice(0,-1)}function Vy($){let z=Dq($,["--get-regexp","^diff\\.faf\\."],"the diff.faf settings").split("\x00").slice(0,-1).map((Q)=>Q.split(`
411
+ `)[0]);return[...new Set(z.filter((Q)=>Q!=="diff.faf.command"))]}var Oq=($)=>$.map((Z)=>JSON.stringify(Z)).join(", ");function qy($){let Z=n($,".gitattributes"),z=P6(Z),Q=z??"";if(Q.split(`
412
+ `).some((Y)=>Y.trim()===uZ)){console.log(`• .gitattributes already opts in (${uZ})`);return}let X=Q.includes(`\r
413
413
  `)?`\r
414
414
  `:`
415
415
  `,J=`${Q}${Q&&!Q.endsWith(`
416
- `)?X:""}${kZ}${X}`;o(Z,J,{root:$,expect:z}),console.log(`✅ .gitattributes ${kZ}`)}function ex($){let Z=Uq($),z;try{z=_z($)}catch(J){return console.error(`faf: ${J.message} — faf left your git config unchanged.`),!1}let Q=z.length===1&&z[0]===e0;if(z.length>0&&!Q)return console.error(`faf: diff.faf.command is already set to ${Gq(z)}, not faf's driver (${e0}) — faf left your git config and .gitattributes unchanged.`),!1;let X;try{X=ax($)}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(tx(Z),Q)console.log(`• git config already set (diff.faf.command = ${e0})`);else v2("git",["config","diff.faf.command",e0],{cwd:$}),console.log(`✅ git config diff.faf.command = ${e0}`);if(console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!Cz(e0))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 $y='[diff "faf"]',Zy=` command = ${e0}`,Vq=($)=>/\r(?!\n)/.test($),zy=($)=>(/\\+$/.exec(q2($))?.[0].length??0)%2===1;function Qy($){if(Vq($))return null;let Z=Z1($),z=Z.map((V,q)=>q>0&&zy(Z[q-1])),Q=Z.map((V,q)=>!z[q]&&q2(V).trimStart().startsWith("[")),X=[],J=-1;if(Z.forEach((V,q)=>{if(Q[q])J=q2(V)===$y?q:-1;else if(J>=0&&!z[q]&&q2(V)===Zy)X.push({at:q,head:J})}),X.length!==1)return null;let{at:Y,head:U}=X[0],W=Y+1;while(W<Z.length&&!Q[W])W++;if(Z.slice(U+1,W).some((V,q)=>U+1+q!==Y&&q2(V).trim()!==""))return null;return Z.filter((V,q)=>q!==U&&q!==Y).join("")}function Xq($,Z){try{return v2("git",["config","--file","-","--null","--list"],{cwd:$,input:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).split("\x00").slice(0,-1)}catch{return null}}function Xy($,Z,z){let Q=Xq($,Z),X=Xq($,z);if(Q===null||X===null)return!1;let J=`diff.faf.command
417
- ${e0}`,Y=Q.indexOf(J);if(Y<0||Q.lastIndexOf(J)!==Y)return!1;let U=[...Q.slice(0,Y),...Q.slice(Y+1)];return U.length===X.length&&U.every((W,G)=>W===X[G])}function Jy($){let Z=_z($,!0);if(Z.length!==1||Z[0]!==e0)return`diff.faf.command = ${e0} is set outside this repo's own config (your global or system git config) — faf left it unchanged.`;let z=ix($,v2("git",["rev-parse","--git-path","config"],{cwd:$,encoding:"utf-8"}).trim()),Q=dx(z);try{let X=i(Q,z,{allowGitConfig:!0}),J=G0(X);if(Vq(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=Qy(J);if(Y===null||!Xy($,J,Y))return`diff.faf.command in ${X} is not in the section faf writes (a [diff "faf"] line and a tab-indented "command = ${e0}" line, with nothing else in the section or on either line) — faf left your git config unchanged.`;return o(X,Y,{root:Q,allowGitConfig:!0,expect:J}),null}catch(X){if(X instanceof v||X instanceof c2)return X.message;throw X}}function Yy($){Uq($);let Z;try{Z=_z($)}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]!==e0)return console.error(`faf: diff.faf.command is ${Gq(Z)}, not faf's driver (${e0}) — faf left your git config unchanged.`),!1;let z;try{z=Jy($)}catch(Q){z=`${Q.message.split(`
418
- `)[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 qq($,Z={},z=process.cwd()){if(Z.installDriver){if(!ex(z))process.exit(1);return}if(Z.uninstallDriver){if(!Yy(z))process.exit(1);return}let Q=m(z);if(!Q)console.error(`Error: project.faf not found
416
+ `)?X:""}${uZ}${X}`;s(Z,J,{root:$,expect:z}),console.log(`✅ .gitattributes ${uZ}`)}function Ky($){let Z=Lq($),z;try{z=Ez($)}catch(J){return console.error(`faf: ${J.message} — faf left your git config unchanged.`),!1}let Q=z.length===1&&z[0]===e0;if(z.length>0&&!Q)return console.error(`faf: diff.faf.command is already set to ${Oq(z)}, not faf's driver (${e0}) — faf left your git config and .gitattributes unchanged.`),!1;let X;try{X=Vy($)}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(qy(Z),Q)console.log(`• git config already set (diff.faf.command = ${e0})`);else h2("git",["config","diff.faf.command",e0],{cwd:$}),console.log(`✅ git config diff.faf.command = ${e0}`);if(console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!Sz(e0))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 Hy='[diff "faf"]',By=` command = ${e0}`,Nq=($)=>/\r(?!\n)/.test($),My=($)=>(/\\+$/.exec(q2($))?.[0].length??0)%2===1;function Ly($){if(Nq($))return null;let Z=X1($),z=Z.map((V,q)=>q>0&&My(Z[q-1])),Q=Z.map((V,q)=>!z[q]&&q2(V).trimStart().startsWith("[")),X=[],J=-1;if(Z.forEach((V,q)=>{if(Q[q])J=q2(V)===Hy?q:-1;else if(J>=0&&!z[q]&&q2(V)===By)X.push({at:q,head:J})}),X.length!==1)return null;let{at:Y,head:U}=X[0],W=Y+1;while(W<Z.length&&!Q[W])W++;if(Z.slice(U+1,W).some((V,q)=>U+1+q!==Y&&q2(V).trim()!==""))return null;return Z.filter((V,q)=>q!==U&&q!==Y).join("")}function Hq($,Z){try{return h2("git",["config","--file","-","--null","--list"],{cwd:$,input:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).split("\x00").slice(0,-1)}catch{return null}}function Dy($,Z,z){let Q=Hq($,Z),X=Hq($,z);if(Q===null||X===null)return!1;let J=`diff.faf.command
417
+ ${e0}`,Y=Q.indexOf(J);if(Y<0||Q.lastIndexOf(J)!==Y)return!1;let U=[...Q.slice(0,Y),...Q.slice(Y+1)];return U.length===X.length&&U.every((W,G)=>W===X[G])}function Oy($){let Z=Ez($,!0);if(Z.length!==1||Z[0]!==e0)return`diff.faf.command = ${e0} is set outside this repo's own config (your global or system git config) — faf left it unchanged.`;let z=Jy($,h2("git",["rev-parse","--git-path","config"],{cwd:$,encoding:"utf-8"}).trim()),Q=Xy(z);try{let X=n(Q,z,{allowGitConfig:!0}),J=W0(X);if(Nq(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=Ly(J);if(Y===null||!Dy($,J,Y))return`diff.faf.command in ${X} is not in the section faf writes (a [diff "faf"] line and a tab-indented "command = ${e0}" line, with nothing else in the section or on either line) — faf left your git config unchanged.`;return s(X,Y,{root:Q,allowGitConfig:!0,expect:J}),null}catch(X){if(X instanceof k||X instanceof d2)return X.message;throw X}}function Ny($){Lq($);let Z;try{Z=Ez($)}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]!==e0)return console.error(`faf: diff.faf.command is ${Oq(Z)}, not faf's driver (${e0}) — faf left your git config unchanged.`),!1;let z;try{z=Oy($)}catch(Q){z=`${Q.message.split(`
418
+ `)[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 Iq($,Z={},z=process.cwd()){if(Z.installDriver){if(!Ky(z))process.exit(1);return}if(Z.uninstallDriver){if(!Ny(z))process.exit(1);return}let Q=c(z);if(!Q)console.error(`Error: project.faf not found
419
419
 
420
- Run 'faf init' to create one.`),process.exit(2);let X;try{X=v2("git",["rev-parse","--show-toplevel"],{cwd:z,encoding:"utf-8"}).trim()}catch{console.error("Error: not a git repository — faf diff compares .faf versions across git history."),process.exit(2);return}let J=y1(Q,z),Y,U,W,G;if(!$)Y="HEAD",U="(working tree)",W=o1("HEAD",J,z),G=p(Q);else if($.includes("...")){let[q,K]=$.split("...");k4(q,z),k4(K,z);let H;try{H=v2("git",["merge-base",q,K],{cwd:z,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${q}' and '${K}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=H.slice(0,7),U=K,W=o1(H,J,z),G=o1(K,J,z)}else if($.includes("..")){let[q,K]=$.split("..");k4(q,z),k4(K,z),Y=q,U=K,W=o1(q,J,z),G=o1(K,J,z)}else k4($,z),Y=$,U="(working tree)",W=o1($,J,z),G=p(Q);let V=vZ(W,G);if(Z.json)console.log(JSON.stringify({base:Y,target:U,...V},null,2));else console.log(Jq(V,Y,U))}import{execFileSync as Rz}from"child_process";function Uy($){if(!$.trim())return 0;try{return D0($).score??0}catch{return 0}}var Wy=($)=>$>0?`+${$}`:`${$}`;function Gy($){let Z=$.map((z)=>({...z,score:Uy(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 Vy($,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?" ·":Wy(Q.delta).padStart(4);z.push(` ${X} ${J} ${Q.date} ${Q.hex} ${C2(M6(Q.score))} ${Q.subject}`)}return z.join(`
421
- `)}function qy($,Z,z){try{return Rz("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function Kq($={},Z=process.cwd()){let z=m(Z);if(!z)console.error(`Error: project.faf not found
420
+ Run 'faf init' to create one.`),process.exit(2);let X;try{X=h2("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=h1(Q,z),Y,U,W,G;if(!$)Y="HEAD",U="(working tree)",W=Z$("HEAD",J,z),G=l(Q);else if($.includes("...")){let[q,K]=$.split("...");u4(q,z),u4(K,z);let L;try{L=h2("git",["merge-base",q,K],{cwd:z,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${q}' and '${K}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=L.slice(0,7),U=K,W=Z$(L,J,z),G=Z$(K,J,z)}else if($.includes("..")){let[q,K]=$.split("..");u4(q,z),u4(K,z),Y=q,U=K,W=Z$(q,J,z),G=Z$(K,J,z)}else u4($,z),Y=$,U="(working tree)",W=Z$($,J,z),G=l(Q);let V=mZ(W,G);if(Z.json)console.log(JSON.stringify({base:Y,target:U,...V},null,2));else console.log(Bq(V,Y,U))}import{execFileSync as wz}from"child_process";function Iy($){if(!$.trim())return 0;try{return M0($).score??0}catch{return 0}}var Ty=($)=>$>0?`+${$}`:`${$}`;function Ay($){let Z=$.map((z)=>({...z,score:Iy(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 Cy($,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?" ·":Ty(Q.delta).padStart(4);z.push(` ${X} ${J} ${Q.date} ${Q.hex} ${C2(N6(Q.score))} ${Q.subject}`)}return z.join(`
421
+ `)}function _y($,Z,z){try{return wz("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function Tq($={},Z=process.cwd()){let z=c(Z);if(!z)console.error(`Error: project.faf not found
422
422
 
423
- Run 'faf init' to create one.`),process.exit(2);let Q;try{Q=Rz("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=y1(z,Z),J=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=Rz("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",X],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let U=Y.split(`
424
- `).filter(Boolean).map((H)=>{let[L,B,D]=H.split("\x1F");return{hex:L,date:B,subject:D??""}}),W=J>0?Math.min(U.length,J+1):U.length,G=U.slice(0,W).map((H)=>({...H,raw:qy(H.hex,X,Z)})),V=Gy(G),q=J>0?V.slice(0,J):V;if($.reverse)q=[...q].reverse();let K=U.length;if($.json)console.log(JSON.stringify({file:X,total:K,count:q.length,entries:q},null,2));else{let H=Vy(q,X.split("/").pop()??"project.faf");if(J>0&&K>q.length)H+=`
423
+ Run 'faf init' to create one.`),process.exit(2);let Q;try{Q=wz("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=h1(z,Z),J=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=wz("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",X],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let U=Y.split(`
424
+ `).filter(Boolean).map((L)=>{let[B,H,D]=L.split("\x1F");return{hex:B,date:H,subject:D??""}}),W=J>0?Math.min(U.length,J+1):U.length,G=U.slice(0,W).map((L)=>({...L,raw:_y(L.hex,X,Z)})),V=Ay(G),q=J>0?V.slice(0,J):V;if($.reverse)q=[...q].reverse();let K=U.length;if($.json)console.log(JSON.stringify({file:X,total:K,count:q.length,entries:q},null,2));else{let L=Cy(q,X.split("/").pop()??"project.faf");if(J>0&&K>q.length)L+=`
425
425
 
426
- … showing ${q.length} of ${K} commits — \`faf log --all\` for the full timeline.`;console.log(H)}}import{execFileSync as v4}from"child_process";import{existsSync as Fz,readFileSync as Ky,realpathSync as Hq,statSync as Lq}from"fs";import{resolve as Dq,dirname as jz,relative as Hy,isAbsolute as By,sep as My}from"path";var Sz="# >>> faf >>>",Oq="# <<< faf <<<",Pz=`#!/bin/sh
427
- `,Bq="faf-cli hooks-run",Ly=($)=>$>0?`+${$}`:`${$}`;function Nq($){return v4("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function Mq($,Z){try{return v4("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function Iq($,Z){try{return v4("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function Ez($){let Z=v4("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return Dq($,Z)}function Dy($,Z){let z=v4("git",["rev-parse","--git-common-dir"],{cwd:$,encoding:"utf-8"}).trim(),Q=Hq.native(Dq($,z)),X=Hq.native(Z),J=Hy(Q,X);return{out:J===".."||J.startsWith(`..${My}`)||By(J),real:X}}function Tq($){let Z=[],z=[],Q=0;for(let X of $.split(/(?<=\n)/)){let J=X.replace(/\n$/,"").replace(/\r$/,"");if(J===Sz)Z.push(Q);if(J===Oq)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 Oy($,Z){if(!Z)return 493;let z=Lq($).mode&511;return z|(z&292)>>2}function Aq($){try{let Z=i(jz($),$,{allowGitHooks:!0});return{real:Z,text:T6(Z)}}catch(Z){if(Z instanceof v)return`${Z.message} faf left the hook as it is.`;throw Z}}function Cq($,Z,z,Q){try{return o($,Z,{root:jz($),allowGitHooks:!0,expect:z,mode:Q}),null}catch(X){if(X instanceof v||X instanceof c2)return X.message;throw X}}var _q="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 Rq($={},Z=process.cwd()){try{let z;try{z=Nq(Z)}catch{return}let Q=m(Z);if(!Q)return;let X=y1(Q,Z),J=Mq(`:${X}`,Z);if(J===null)return;let Y=Mq(`HEAD:${X}`,Z)??"",U=vZ(Y,J),W=`${U.scoreBase}% → ${U.scoreTarget}% (${Ly(U.scoreDelta)})`;if(U.scoreDelta<0){if(console.error(`⚠ faf: context regressed ${W} — ${U.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 ${W}`)}catch(z){console.error(`faf hooks: skipped (${z instanceof Error?z.message:"error"})`)}}function Ny($,Z){let z=$.trim().split(/\s+/)[0],Q=Z?`${$} --strict || exit 1`:`${$} || true`;return[Sz,`if command -v ${z} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${Q}`,"fi",Oq,""].join(`
428
- `)}function Iy($,Z={}){let z;try{z=Nq($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let Q=Iq("core.hooksPath",$);if(Q){let L=Z.runnerCmd??Bq;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=Ez($),J=Z.runnerCmd??Bq;if(!Cz(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=Ny(J,!!Z.strict),U=jz(X);if(!Fz(U))return console.error(`Error: ${U} does not exist — faf does not create folders inside .git. Create it (mkdir -p) and re-run.`),!1;let W=Aq(X);if(typeof W==="string")return console.error(`Error: ${W}`),!1;let{real:G,text:V}=W,q=V===null?null:Tq(V);if(q==="broken")return console.error(`Error: ${X} ${_q}`),!1;let K;if(V===null)K=`${Pz}${Y}`;else if(q)K=V.slice(0,q.start)+Y+V.slice(q.end);else{let L=Dy($,U);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=`${Pz}${Y}${V}`;else K=V.endsWith(`
426
+ … showing ${q.length} of ${K} commits — \`faf log --all\` for the full timeline.`;console.log(L)}}import{execFileSync as m4}from"child_process";import{existsSync as yz,readFileSync as Py,realpathSync as Aq,statSync as Pq}from"fs";import{resolve as Fq,dirname as bz,relative as Fy,isAbsolute as Ry,sep as jy}from"path";var kz="# >>> faf >>>",Rq="# <<< faf <<<",xz=`#!/bin/sh
427
+ `,Cq="faf-cli hooks-run",Sy=($)=>$>0?`+${$}`:`${$}`;function jq($){return m4("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function _q($,Z){try{return m4("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function Sq($,Z){try{return m4("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function vz($){let Z=m4("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return Fq($,Z)}function Ey($,Z){let z=m4("git",["rev-parse","--git-common-dir"],{cwd:$,encoding:"utf-8"}).trim(),Q=Aq.native(Fq($,z)),X=Aq.native(Z),J=Fy(Q,X);return{out:J===".."||J.startsWith(`..${jy}`)||Ry(J),real:X}}function Eq($){let Z=[],z=[],Q=0;for(let X of $.split(/(?<=\n)/)){let J=X.replace(/\n$/,"").replace(/\r$/,"");if(J===kz)Z.push(Q);if(J===Rq)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 wy($,Z){if(!Z)return 493;let z=Pq($).mode&511;return z|(z&292)>>2}function wq($){try{let Z=n(bz($),$,{allowGitHooks:!0});return{real:Z,text:P6(Z)}}catch(Z){if(Z instanceof k)return`${Z.message} faf left the hook as it is.`;throw Z}}function xq($,Z,z,Q){try{return s($,Z,{root:bz($),allowGitHooks:!0,expect:z,mode:Q}),null}catch(X){if(X instanceof k||X instanceof d2)return X.message;throw X}}var yq="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 bq($={},Z=process.cwd()){try{let z;try{z=jq(Z)}catch{return}let Q=c(Z);if(!Q)return;let X=h1(Q,Z),J=_q(`:${X}`,Z);if(J===null)return;let Y=_q(`HEAD:${X}`,Z)??"",U=mZ(Y,J),W=`${U.scoreBase}% → ${U.scoreTarget}% (${Sy(U.scoreDelta)})`;if(U.scoreDelta<0){if(console.error(`⚠ faf: context regressed ${W} — ${U.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 ${W}`)}catch(z){console.error(`faf hooks: skipped (${z instanceof Error?z.message:"error"})`)}}function xy($,Z){let z=$.trim().split(/\s+/)[0],Q=Z?`${$} --strict || exit 1`:`${$} || true`;return[kz,`if command -v ${z} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${Q}`,"fi",Rq,""].join(`
428
+ `)}function yy($,Z={}){let z;try{z=jq($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let Q=Sq("core.hooksPath",$);if(Q){let B=Z.runnerCmd??Cq;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(` ${B}${Z.strict?" --strict":""}`),!1}let X=vz($),J=Z.runnerCmd??Cq;if(!Sz(J)){let B=J.trim().split(/\s+/)[0];if(Z.strict)return console.error(`Error: \`${B}\` 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(`⚠ \`${B}\` on PATH doesn't support \`hooks-run\` yet (needs faf-cli ≥ 7.0) — the hook no-ops until you upgrade.`)}let Y=xy(J,!!Z.strict),U=bz(X);if(!yz(U))return console.error(`Error: ${U} does not exist — faf does not create folders inside .git. Create it (mkdir -p) and re-run.`),!1;let W=wq(X);if(typeof W==="string")return console.error(`Error: ${W}`),!1;let{real:G,text:V}=W,q=V===null?null:Eq(V);if(q==="broken")return console.error(`Error: ${X} ${yq}`),!1;let K;if(V===null)K=`${xz}${Y}`;else if(q)K=V.slice(0,q.start)+Y+V.slice(q.end);else{let B=Ey($,U);if(B.out)return console.error(`Error: ${X} is in a hooks folder outside this repo (${B.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=`${xz}${Y}${V}`;else K=V.endsWith(`
429
429
  `)?`${V}
430
430
  ${Y}`:`${V}
431
431
 
432
- ${Y}`}let H=Cq(X,K,V,Oy(G,V!==null));if(H)return console.error(`Error: ${H}`),!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 Ty($,Z){if($===Pz&&Z.trim()==="")return"";return $.endsWith(`
432
+ ${Y}`}let L=xq(X,K,V,wy(G,V!==null));if(L)return console.error(`Error: ${L}`),!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 by($,Z){if($===xz&&Z.trim()==="")return"";return $.endsWith(`
433
433
 
434
- `)&&$.slice(0,-1).trim()!==""?$.slice(0,-1):$}function Ay($){let Z;try{Z=Ez($)}catch{return console.error("Error: not a git repository."),!1}if(!Fz(Z))return console.log("• no pre-commit hook to clean."),!0;let z=Aq(Z);if(typeof z==="string")return console.error(`Error: ${z}`),!1;let{real:Q,text:X}=z,J=X===null?null:Tq(X);if(J==="broken")return console.error(`Error: ${Z} ${_q}`),!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),U=Cq(Z,Ty(X.slice(0,J.start),Y)+Y,X,Lq(Q).mode&511);if(U)return console.error(`Error: ${U}`),!1;return console.log("✅ faf pre-commit block removed (other hook content preserved)."),!0}function Cy($){let Z;try{Z=Ez($)}catch{console.error("Error: not a git repository.");return}let z=Iq("core.hooksPath",$),Q=Fz(Z)?Ky(Z,"utf-8"):"",X=Q.includes(Sz),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 Pq($={}){let Z=process.cwd();if($.install){if(!Iy(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!Ay(Z))process.exit(2);return}Cy(Z)}l();function Fq($={}){Ry()}function Ry(){let $=wz();console.log(`${A(C("faf"))} v${$.version}`),console.log(M(`kernel ${uU()} IANA application/vnd.faf+yaml`))}var g4=[{name:"HTML",extensions:[".html",".htm"],category:"web"},{name:"CSS",extensions:[".css"],category:"web"},{name:"JavaScript",extensions:[".js",".mjs",".cjs"],category:"web"},{name:"TypeScript",extensions:[".ts",".tsx",".mts",".cts"],category:"web"},{name:"JSX",extensions:[".jsx"],category:"web"},{name:"Vue",extensions:[".vue"],category:"web"},{name:"Svelte",extensions:[".svelte"],category:"web"},{name:"Astro",extensions:[".astro"],category:"web"},{name:"JSON",extensions:[".json"],category:"data"},{name:"YAML",extensions:[".yml",".yaml"],category:"data"},{name:"TOML",extensions:[".toml"],category:"data"},{name:"XML",extensions:[".xml"],category:"data"},{name:"CSV",extensions:[".csv"],category:"data"},{name:"INI",extensions:[".ini",".cfg"],category:"config"},{name:"Env",extensions:[".env"],category:"config"},{name:"Dockerfile",extensions:["Dockerfile"],category:"config"},{name:"Rust",extensions:[".rs"],category:"systems"},{name:"Go",extensions:[".go"],category:"systems"},{name:"C",extensions:[".c",".h"],category:"systems"},{name:"C++",extensions:[".cpp",".cc",".hpp"],category:"systems"},{name:"Zig",extensions:[".zig"],category:"systems"},{name:"Python",extensions:[".py"],category:"scripting"},{name:"Ruby",extensions:[".rb"],category:"scripting"},{name:"Shell",extensions:[".sh",".bash",".zsh"],category:"scripting"},{name:"Lua",extensions:[".lua"],category:"scripting"},{name:"Java",extensions:[".java"],category:"jvm"},{name:"Kotlin",extensions:[".kt",".kts"],category:"jvm"},{name:"Scala",extensions:[".scala"],category:"jvm"},{name:"C#",extensions:[".cs"],category:"dotnet"},{name:"F#",extensions:[".fs"],category:"dotnet"},{name:"Swift",extensions:[".swift"],category:"systems"},{name:"Dart",extensions:[".dart"],category:"mobile"},{name:"Markdown",extensions:[".md",".mdx"],category:"docs"},{name:"LaTeX",extensions:[".tex"],category:"docs"},{name:"reStructuredText",extensions:[".rst"],category:"docs"},{name:"FAF",extensions:[".faf"],category:"faf"},{name:"FAFb",extensions:[".fafb"],category:"faf"},{name:"FAFm",extensions:[".fafm"],category:"faf"}];l();function jq(){console.log(`${A("formats")} ${M("— supported file types")}
435
- `);let $=new Map;for(let Z of g4){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(` ${g4.length} formats across ${$.size} categories`))}l();function Sq(){let $=0;try{$=zU("faf-git-")}catch{}if($>0)console.log(`${A("cleared")} ${$} cached director${$===1?"y":"ies"}`);else console.log(M("nothing to clear"))}function Eq($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
434
+ `)&&$.slice(0,-1).trim()!==""?$.slice(0,-1):$}function ky($){let Z;try{Z=vz($)}catch{return console.error("Error: not a git repository."),!1}if(!yz(Z))return console.log("• no pre-commit hook to clean."),!0;let z=wq(Z);if(typeof z==="string")return console.error(`Error: ${z}`),!1;let{real:Q,text:X}=z,J=X===null?null:Eq(X);if(J==="broken")return console.error(`Error: ${Z} ${yq}`),!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),U=xq(Z,by(X.slice(0,J.start),Y)+Y,X,Pq(Q).mode&511);if(U)return console.error(`Error: ${U}`),!1;return console.log("✅ faf pre-commit block removed (other hook content preserved)."),!0}function vy($){let Z;try{Z=vz($)}catch{console.error("Error: not a git repository.");return}let z=Sq("core.hooksPath",$),Q=yz(Z)?Py(Z,"utf-8"):"",X=Q.includes(kz),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 kq($={}){let Z=process.cwd();if($.install){if(!yy(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!ky(Z))process.exit(2);return}vy(Z)}i();function vq($={}){hy()}function hy(){let $=gz();console.log(`${A(C("faf"))} v${$.version}`),console.log(M(`kernel ${nU()} IANA application/vnd.faf+yaml`))}var c4=[{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 gq(){console.log(`${A("formats")} ${M("— supported file types")}
435
+ `);let $=new Map;for(let Z of c4){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(` ${c4.length} formats across ${$.size} categories`))}i();function hq(){let $=0;try{$=UU("faf-git-")}catch{}if($>0)console.log(`${A("cleared")} ${$} cached director${$===1?"y":"ies"}`);else console.log(M("nothing to clear"))}function fq($={}){let Z=c();if(!Z)console.error(`Error: project.faf not found
436
436
 
437
- Run 'faf init' to create one.`),process.exit(2);if($.json){let z=t(Z);console.log(JSON.stringify(z,null,2))}else{let z=p(Z);console.log(z)}}l();function wq(){let $=m();if(!$)console.error(`Error: project.faf not found
437
+ Run 'faf init' to create one.`),process.exit(2);if($.json){let z=a(Z);console.log(JSON.stringify(z,null,2))}else{let z=l(Z);console.log(z)}}i();function uq(){let $=c();if(!$)console.error(`Error: project.faf not found
438
438
 
439
- Run 'faf init' to create one.`),process.exit(2);let Z=t($),z=[];for(let Q of J0){let[X,J]=Q.path.split("."),U=Z[X]?.[J];if(U0(U)||U==="slotignored")continue;z.push(`${Q.path}: ${U}`)}if(z.length===0){console.log(M("no populated slots"));return}console.log(z.join(`
440
- `))}import{existsSync as Py,statSync as xq}from"fs";import{dirname as Fy,join as jy}from"path";var Sy=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"],Ey=1000;function yq($,Z=Fy($)){let z=xq($).mtimeMs,Q=Sy.map((X)=>{let J=jy(Z,X);if(!Py(J))return{file:X,exists:!1,mtime_ms:null,status:"missing",delta_ms:null};let Y=xq(J).mtimeMs,U=Y-z,W;if(Math.abs(U)<Ey)W="in-sync";else if(U>0)W="newer";else W="older";return{file:X,exists:!0,mtime_ms:Y,status:W,delta_ms:U}});return{source:$,source_mtime_ms:z,targets:Q,drifted:Q.filter((X)=>X.status==="newer"||X.status==="older").length,in_sync:Q.filter((X)=>X.status==="in-sync").length,missing:Q.filter((X)=>X.status==="missing").length}}l();function kq($={}){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
439
+ Run 'faf init' to create one.`),process.exit(2);let Z=a($),z=[];for(let Q of X0){let[X,J]=Q.path.split("."),U=Z[X]?.[J];if(J0(U)||U==="slotignored")continue;z.push(`${Q.path}: ${U}`)}if(z.length===0){console.log(M("no populated slots"));return}console.log(z.join(`
440
+ `))}import{existsSync as fy,statSync as mq}from"fs";import{dirname as uy,join as my}from"path";var cy=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"],py=1000;function cq($,Z=uy($)){let z=mq($).mtimeMs,Q=cy.map((X)=>{let J=my(Z,X);if(!fy(J))return{file:X,exists:!1,mtime_ms:null,status:"missing",delta_ms:null};let Y=mq(J).mtimeMs,U=Y-z,W;if(Math.abs(U)<py)W="in-sync";else if(U>0)W="newer";else W="older";return{file:X,exists:!0,mtime_ms:Y,status:W,delta_ms:U}});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 lq($={}){let Z=c();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
441
441
 
442
- Run 'faf init' to create one.`);process.exit(2)}let z=yq(Z,process.cwd());if($.json){let Q=t(Z),X={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",...z};console.log(JSON.stringify(X,null,2));return}wy(z)}function wy($){console.log(`${A("drift")} ${M("— context file sync status")}
443
- `),console.log(` ${C(".faf")} ${M(bq($.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(bq(Z.mtime_ms));if(Z.status==="in-sync")console.log(` ${A("●")} ${Z.file} ${M("in sync")}`);else if(Z.status==="newer")console.log(` ${C("!")} ${Z.file} ${C("newer")} ${z}`);else console.log(` ${M("○")} ${Z.file} ${M("older")} ${z}`)}if($.drifted>0)console.log(M(`
444
- run ${C("'faf sync'")} to resolve drift`))}function bq($){let Z=Date.now()-$,z=Math.floor(Z/1000);if(z<60)return`${z}s ago`;let Q=Math.floor(z/60);if(Q<60)return`${Q}m ago`;let X=Math.floor(Q/60);if(X<24)return`${X}h ago`;return`${Math.floor(X/24)}d ago`}import{dirname as xy}from"path";l();function vq($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
442
+ Run 'faf init' to create one.`);process.exit(2)}let z=cq(Z,process.cwd());if($.json){let Q=a(Z),X={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",...z};console.log(JSON.stringify(X,null,2));return}ly(z)}function ly($){console.log(`${A("drift")} ${M("— context file sync status")}
443
+ `),console.log(` ${C(".faf")} ${M(pq($.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(pq(Z.mtime_ms));if(Z.status==="in-sync")console.log(` ${A("●")} ${Z.file} ${M("in sync")}`);else if(Z.status==="newer")console.log(` ${C("!")} ${Z.file} ${C("newer")} ${z}`);else console.log(` ${M("○")} ${Z.file} ${M("older")} ${z}`)}if($.drifted>0)console.log(M(`
444
+ run ${C("'faf sync'")} to resolve drift`))}function pq($){let Z=Date.now()-$,z=Math.floor(Z/1000);if(z<60)return`${z}s ago`;let Q=Math.floor(z/60);if(Q<60)return`${Q}m ago`;let X=Math.floor(Q/60);if(X<24)return`${X}h ago`;return`${Math.floor(X/24)}d ago`}import{dirname as dy}from"path";i();function dq($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
445
445
 
446
- Example: faf edit project.name "My Project"`),process.exit(1);let z=m();if(!z)console.error(`Error: project.faf not found
446
+ Example: faf edit project.name "My Project"`),process.exit(1);let z=c();if(!z)console.error(`Error: project.faf not found
447
447
 
448
- Run 'faf init' to create one.`),process.exit(2);let Q=t(z);if($.split(".").length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let J=I4(Q,$);if(J)console.error(`Error: ${T4($,J)}`),process.exit(1);qZ(Q,$,Z);let Y=[];if(b0(z,Q,{onAliasKept:(U)=>Y.push(y2(U))}),Y.length>0){for(let U of Y)console.error(`Error: ${U}. Change the value its anchor holds, or replace the alias by hand.`);process.exit(1)}console.log(`${A("updated")} ${$} ${M("→")} ${Z}`),yy(z,$)}function yy($,Z){let z=new o0(xy($));if(!z.exists())return;let Q;try{Q=k0(F0(p($))).score}catch{return}z.recordGrowth(Q,[`faf edit ${Z}`]),I6(z)}l();var h4=k1;function gq($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
448
+ Run 'faf init' to create one.`),process.exit(2);let Q=a(z);if($.split(".").length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let J=C4(Q,$);if(J)console.error(`Error: ${_4($,J)}`),process.exit(1);LZ(Q,$,Z);let Y=[];if(k0(z,Q,{onAliasKept:(U)=>Y.push(b2(U))}),Y.length>0){for(let U of Y)console.error(`Error: ${U}. Change the value its anchor holds, or replace the alias by hand.`);process.exit(1)}console.log(`${A("updated")} ${$} ${M("→")} ${Z}`),iy(z,$)}function iy($,Z){let z=new s0(dy($));if(!z.exists())return;let Q;try{Q=v0(P0(l($))).score}catch{return}z.recordGrowth(Q,[`faf edit ${Z}`]),_6(z)}i();var p4=u1;function iq($={}){let Z=c();if(!Z)console.error(`Error: project.faf not found
449
449
 
450
- Run 'faf init' to create one.`),process.exit(2);let z=t(Z),Q=z.faf_version??"unknown";if(Q===h4){console.log(`${A("◆")} migrate already at v${h4}`);return}if(z.faf_version=h4,!z.project)z.project={};if(!z.stack)z.stack={};if(!z.human_context)z.human_context={};if(!z.monorepo)z.monorepo={};if($.dryRun){console.log(`${A("◆")} migrate ${M("(dry run)")} v${Q} → v${h4}`),console.log(M(` would update ${Z}`));return}b0(Z,z,{onAliasKept:(X)=>console.log(M(` ${y2(X)}`))}),console.log(`${A("◆")} migrate v${Q} → v${h4}`),console.log(M(` updated ${Z}`))}l();function hq($){if($==="features")ky();else if($==="activate")vy();else by()}function by(){let $=P4();if(console.log(`${A("pro")} ${M("— FAF Pro status")}
451
- `),console.log(` Status: ${$?P0(C("PRO")):C("Free")}`),console.log(""),!$)console.log(M(" Upgrade: faf pro activate"))}function ky(){console.log(`${A("pro")} ${M("— Pro features")}
452
- `);let $=[["tri-sync",".faf → CLAUDE.md + Claude Code's MEMORY.md (faf's block only)"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,z]of $)console.log(` ${A("◆")} ${C(Z)} ${M("—")} ${z}`);console.log("")}function vy(){console.log(`${A("pro")} ${M("— activate")}
453
- `),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 gy}from"zlib";l();function fq($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
450
+ Run 'faf init' to create one.`),process.exit(2);let z=a(Z),Q=z.faf_version??"unknown";if(Q===p4){console.log(`${A("◆")} 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(`${A("◆")} migrate ${M("(dry run)")} v${Q} → v${p4}`),console.log(M(` would update ${Z}`));return}k0(Z,z,{onAliasKept:(X)=>console.log(M(` ${b2(X)}`))}),console.log(`${A("◆")} migrate v${Q} → v${p4}`),console.log(M(` updated ${Z}`))}i();function nq($){if($==="features")ry();else if($==="activate")sy();else ny()}function ny(){let $=w4();if(console.log(`${A("pro")} ${M("— FAF Pro status")}
451
+ `),console.log(` Status: ${$?_0(C("PRO")):C("Free")}`),console.log(""),!$)console.log(M(" Upgrade: faf pro activate"))}function ry(){console.log(`${A("pro")} ${M("— Pro features")}
452
+ `);let $=[["tri-sync",".faf → CLAUDE.md + Claude Code's MEMORY.md (faf's block only)"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,z]of $)console.log(` ${A("◆")} ${C(Z)} ${M("—")} ${z}`);console.log("")}function sy(){console.log(`${A("pro")} ${M("— activate")}
453
+ `),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 oy}from"zlib";i();function rq($={}){let Z=c();if(!Z)console.error(`Error: project.faf not found
454
454
 
455
- Run 'faf init' to create one.`),process.exit(2);let z=p(Z),X=gy(Buffer.from(z)).toString("base64url");if($.raw){console.log(X);return}let J=`https://faf.one/share?d=${X}`;if(console.log(`${A("◆")} share ${M(Z)}
456
- `),console.log(` ${J}`),$.copy)try{let{execSync:Y}=p0("child_process"),U=process.platform;if(U==="darwin")Y("pbcopy",{input:J});else if(U==="linux")Y("xclip -selection clipboard",{input:J});console.log(M(`
455
+ Run 'faf init' to create one.`),process.exit(2);let z=l(Z),X=oy(Buffer.from(z)).toString("base64url");if($.raw){console.log(X);return}let J=`https://faf.one/share?d=${X}`;if(console.log(`${A("◆")} share ${M(Z)}
456
+ `),console.log(` ${J}`),$.copy)try{let{execSync:Y}=c0("child_process"),U=process.platform;if(U==="darwin")Y("pbcopy",{input:J});else if(U==="linux")Y("xclip -selection clipboard",{input:J});console.log(M(`
457
457
  copied to clipboard`))}catch{console.log(M(`
458
- copy failed — install xclip or pbcopy`))}}import{join as hy}from"path";l();function uq(){let $=x5("faf-demo-");console.log(`${A("demo")} ${M("— FAF in action")}
458
+ copy failed — install xclip or pbcopy`))}}import{join as ay}from"path";i();function sq(){let $=g5("faf-demo-");console.log(`${A("demo")} ${M("— FAF in action")}
459
459
  `);let Z=`faf_version: 2.5.0
460
460
  project:
461
461
  name: acme-app
@@ -494,20 +494,20 @@ human_context:
494
494
  where: Cloud (Vercel + AWS)
495
495
  when: "2026"
496
496
  how: Edits sync live over WebSockets; Postgres holds each document
497
- `,z=hy($,"project.faf");o(z,Z,{root:$,expect:null}),console.log(` ${C("1.")} Created sample project.faf`),console.log(M(` ${z}
498
- `)),console.log(` ${C("2.")} Scoring...`);let Q=a(z,()=>k0(F0(p(z))));console.log(""),w0(Q,"project.faf",!0),y5($),console.log(`
499
- ${M(' Demo complete. Run "faf init" in your project to get started.')}`)}l();function mq($,Z={}){if(!$)console.error("Usage: faf search <keyword>"),process.exit(2);let z=$.toLowerCase(),Q=!Z.slots&&!Z.formats,X=0;if(Q||Z.slots){let J=J0.filter((Y)=>Y.path.toLowerCase().includes(z)||Y.description.toLowerCase().includes(z)||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${A("slots")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
500
- `);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=g4.filter((Y)=>Y.name.toLowerCase().includes(z)||Y.extensions.some((U)=>U.toLowerCase().includes(z))||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${A("formats")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
501
- `);for(let Y of J)console.log(` ${C(Y.name)} ${M(Y.extensions.join(", "))} ${M(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(X===0)console.log(M(` No results for "${$}"`))}import{spawnSync as ey}from"child_process";import{existsSync as $b,readdirSync as vz,readFileSync as rq}from"fs";import{dirname as Zb,join as c4,resolve as zb}from"path";l();import{spawnSync as cq}from"child_process";import{readFileSync as fy,statSync as uy}from"fs";import{join as my}from"path";l();var gZ=($)=>typeof $==="number"&&Number.isFinite($)?$:null,f4=($)=>typeof $==="string"&&$!==""?$:null,xz=($)=>Array.isArray($)?$.filter((Z)=>typeof Z==="string"):[];function cy($){if(typeof $!=="object"||$===null)return;let Z=$;return{names:xz(Z.names),truncated:Z.truncated===!0,hash:f4(Z.hash),newly_skipped:xz(Z.newly_skipped),no_longer_skipped:xz(Z.no_longer_skipped)}}function py($){if(typeof $!=="object"||$===null)return null;let Z=$,z=Z.timestamp instanceof Date?Z.timestamp.toISOString():f4(Z.timestamp);if(!z)return null;let Q=typeof Z.tests==="object"&&Z.tests!==null?Z.tests:{};return{timestamp:z,result:f4(Z.result)??"UNKNOWN",passed:gZ(Q.passed),failed:gZ(Q.failed),skipped:gZ(Q.skipped),total:gZ(Q.total),trigger:f4(Z.trigger),skipped_tests:cy(Z.skipped_tests)}}var ly=/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/,pq=($)=>Date.parse(ly.test($)?`${$.replace(" ","T")}Z`:$);function dy($){let Z=h0($),Q=(Array.isArray(Z?.test_history)?Z.test_history:[]).map(py).filter((J)=>J!==null),X=(J)=>pq(J.timestamp);return Q.sort((J,Y)=>(Number.isNaN(X(Y))?-1/0:X(Y))-(Number.isNaN(X(J))?-1/0:X(J))||Y.timestamp.localeCompare(J.timestamp)),{project:f4(Z?.project),receipts:Q}}function iy($,Z){let z=Z?[Z]:["origin/taf-receipts","taf-receipts"];for(let X of z){let J=cq("git",["show","--end-of-options",`${X}:.taf`],{cwd:$,encoding:"utf-8",maxBuffer:67108864,env:{...process.env,GIT_NO_LAZY_FETCH:"1"}});if(J.status===0&&typeof J.stdout==="string")return{text:J.stdout,source:X}}let Q=my($,".taf");if(!Z&&uy(Q,{throwIfNoEntry:!1})?.isFile())return{text:fy(Q,"utf-8"),source:".taf"};return null}function ny($,Z){for(let z of Z?[Z]:["origin/taf-receipts","taf-receipts"]){let Q=cq("git",["ls-tree","--name-only","--end-of-options",z,"--",".taf"],{cwd:$,encoding:"utf-8",env:{...process.env,GIT_NO_LAZY_FETCH:"1"}});if(Q.status===0&&Q.stdout.trim()===".taf")return z}return null}var ry=($)=>{let Z=pq($);if(/^\d{4}-\d{2}-\d{2}$/.test($)||Number.isNaN(Z))return $;return new Date(Z).toISOString().replace("T"," ").slice(0,16)},sy=($)=>{if($.passed===null||$.total===null)return"—";let Z=$.skipped_tests?.newly_skipped.length??0,z=[$.failed?`${$.failed} failed`:"",$.skipped?`${$.skipped} skipped`:"",Z?`+${Z} newly skipped`:""].filter(Boolean).join(", ");return`${$.passed}/${$.total}${z?` ${z}`:""}`};function oy($){let Z=$===void 0?10:Number($);if(!Number.isInteger(Z)||Z<1)console.error(`${C("×")} --limit takes a whole number, 1 or more.`),process.exit(1);return Z}function ay($,Z){if(Z?.startsWith("-"))console.error(`${C("×")} --ref takes a git ref, not an option: ${Z}`),process.exit(1);let z=iy($,Z);if(!z){let Q=ny($,Z);if(Q)console.error(`${C("×")} ${Q} is here, its .taf is not (a partial clone). Get it once: git show ${Q}:.taf > /dev/null`),process.exit(1);let X=Z?`${Z}:.taf`:"origin/taf-receipts, taf-receipts or ./.taf";console.error(`${C("×")} No receipts found (looked in ${X}). Fetch them: git fetch origin taf-receipts`),process.exit(1)}try{return{source:z.source,...dy(z.text)}}catch(Q){console.error(`${C("×")} ${z.source}: the .taf is not YAML faf can read (${Q.message.split(`
502
- `)[0]})`),process.exit(1)}}function ty($,Z,z,Q){let X=Z?` — ${Z}`:"";if(console.log(`${A("TAF receipts")}${X} ${M(`· ${z} on ${$} · times in UTC`)}`),Q.length===0){console.log(M(" no receipts yet"));return}for(let Y of Q)console.log(` ${ry(Y.timestamp)} ${Y.result.padEnd(8)} ${sy(Y)}`);let J=new Map;for(let Y of Q)J.set(Y.result,(J.get(Y.result)??0)+1);if(console.log(M(` last ${Q.length}: ${[...J].map(([Y,U])=>`${U} ${Y}`).join(" · ")}`)),$.startsWith("origin/"))console.log(M(" as of your last fetch (git fetch origin taf-receipts)"))}function lq($={}){let Z=oy($.limit),{source:z,project:Q,receipts:X}=ay(process.cwd(),$.ref),J=X.slice(0,Z);if($.json){console.log(JSON.stringify({source:z,project:Q,total:X.length,receipts:J},null,2));return}ty(z,Q,X.length,J)}function Qb($){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 Xb="Wolfe-Jam/faf-taf-git@v2.6.0";function sq($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;let z=$??"";if($===""||!Object.hasOwn(dq,z))console.error(`${C("×")} Unknown: faf taf ${z}. Use ${C("faf taf setup")} or ${C("faf taf receipts")}.`),process.exit(1);Yb(z,Z),dq[z](Z)}var Jb={setup:["write"],receipts:["limit","json","ref"],"":["output","force"]},dq={setup:($)=>fb($),receipts:($)=>lq($),"":($)=>ub($)};function Yb($,Z){let z=Object.keys(Z).filter((X)=>Z[X]!==void 0&&!Jb[$].includes(X));if(z.length===0)return;let Q=z.map((X)=>`--${X}`).join(", ");console.error(M(`note: ${Q} ${z.length===1?"does":"do"} nothing with faf taf${$?` ${$}`:""} (ignored)`))}function Ub($){if(I($,"bun.lockb")||I($,"bun.lock"))return"bun";if(I($,"pnpm-lock.yaml"))return"pnpm";if(I($,"yarn.lock"))return"yarn";return"npm"}function Wb($){try{let Z=JSON.parse(rq(c4($,"package.json"),"utf-8"));return Z&&typeof Z==="object"&&!Array.isArray(Z)?Z:{}}catch{return{}}}var yz=($,Z)=>new RegExp(`(^|[\\s;&|(])${Z}(?![\\w-])`).test($),Gb=/^\s*(?:npm run|pnpm(?: run)?|yarn(?: run)?|bun run)\s+([\w:.-]+)\s*$/;function oq($){let Z=$.test;for(let z=0;z<3&&typeof Z==="string";z++){let Q=Gb.exec(Z)?.[1];if(!Q)break;if(Z=$[Q],typeof Z!=="string")return null}return typeof Z==="string"?Z:void 0}function iq($,Z){let z=$.scripts&&typeof $.scripts==="object"?$.scripts:{},Q=oq(z);if(Q===null){let X={...$.devDependencies,...$.dependencies};return"jest"in X||"vitest"in X}if(Q===void 0)return!1;return yz(Q,"jest")||yz(Q,"vitest")||Z==="bun"&&yz(Q,"bun test")}function Vb($){let Z=$.packageManager,z=$.devEngines?.packageManager;return typeof Z==="string"&&Z.startsWith("pnpm@")||z?.name==="pnpm"&&typeof z.version==="string"&&z.version!==""?" - uses: pnpm/action-setup@v6":` - uses: pnpm/action-setup@v6
497
+ `,z=ay($,"project.faf");s(z,Z,{root:$,expect:null}),console.log(` ${C("1.")} Created sample project.faf`),console.log(M(` ${z}
498
+ `)),console.log(` ${C("2.")} Scoring...`);let Q=o(z,()=>v0(P0(l(z))));console.log(""),w0(Q,"project.faf",!0),h5($),console.log(`
499
+ ${M(' Demo complete. Run "faf init" in your project to get started.')}`)}i();function oq($,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(`${A("slots")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
500
+ `);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=c4.filter((Y)=>Y.name.toLowerCase().includes(z)||Y.extensions.some((U)=>U.toLowerCase().includes(z))||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${A("formats")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
501
+ `);for(let Y of J)console.log(` ${C(Y.name)} ${M(Y.extensions.join(", "))} ${M(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(X===0)console.log(M(` No results for "${$}"`))}import{spawnSync as Kb}from"child_process";import{existsSync as Hb,readdirSync as cz,readFileSync as QK}from"fs";import{dirname as Bb,join as n4,resolve as Mb}from"path";i();import{spawnSync as aq}from"child_process";import{readFileSync as ty,statSync as ey}from"fs";import{join as $b}from"path";i();var cZ=($)=>typeof $==="number"&&Number.isFinite($)?$:null,l4=($)=>typeof $==="string"&&$!==""?$:null,hz=($)=>Array.isArray($)?$.filter((Z)=>typeof Z==="string"):[];function Zb($){if(typeof $!=="object"||$===null)return;let Z=$;return{names:hz(Z.names),truncated:Z.truncated===!0,hash:l4(Z.hash),newly_skipped:hz(Z.newly_skipped),no_longer_skipped:hz(Z.no_longer_skipped)}}function zb($){if(typeof $!=="object"||$===null)return null;let Z=$,z=Z.timestamp instanceof Date?Z.timestamp.toISOString():l4(Z.timestamp);if(!z)return null;let Q=typeof Z.tests==="object"&&Z.tests!==null?Z.tests:{};return{timestamp:z,result:l4(Z.result)??"UNKNOWN",passed:cZ(Q.passed),failed:cZ(Q.failed),skipped:cZ(Q.skipped),total:cZ(Q.total),trigger:l4(Z.trigger),skipped_tests:Zb(Z.skipped_tests)}}var Qb=/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/,tq=($)=>Date.parse(Qb.test($)?`${$.replace(" ","T")}Z`:$);function Xb($){let Z=S0($),Q=(Array.isArray(Z?.test_history)?Z.test_history:[]).map(zb).filter((J)=>J!==null),X=(J)=>tq(J.timestamp);return Q.sort((J,Y)=>(Number.isNaN(X(Y))?-1/0:X(Y))-(Number.isNaN(X(J))?-1/0:X(J))||Y.timestamp.localeCompare(J.timestamp)),{project:l4(Z?.project),receipts:Q}}function Jb($,Z){let z=Z?[Z]:["origin/taf-receipts","taf-receipts"];for(let X of z){let J=aq("git",["show","--end-of-options",`${X}:.taf`],{cwd:$,encoding:"utf-8",maxBuffer:67108864,env:{...process.env,GIT_NO_LAZY_FETCH:"1"}});if(J.status===0&&typeof J.stdout==="string")return{text:J.stdout,source:X}}let Q=$b($,".taf");if(!Z&&ey(Q,{throwIfNoEntry:!1})?.isFile())return{text:ty(Q,"utf-8"),source:".taf"};return null}function Yb($,Z){for(let z of Z?[Z]:["origin/taf-receipts","taf-receipts"]){let Q=aq("git",["ls-tree","--name-only","--end-of-options",z,"--",".taf"],{cwd:$,encoding:"utf-8",env:{...process.env,GIT_NO_LAZY_FETCH:"1"}});if(Q.status===0&&Q.stdout.trim()===".taf")return z}return null}var Ub=($)=>{let Z=tq($);if(/^\d{4}-\d{2}-\d{2}$/.test($)||Number.isNaN(Z))return $;return new Date(Z).toISOString().replace("T"," ").slice(0,16)},Wb=($)=>{if($.passed===null||$.total===null)return"—";let Z=$.skipped_tests?.newly_skipped.length??0,z=[$.failed?`${$.failed} failed`:"",$.skipped?`${$.skipped} skipped`:"",Z?`+${Z} newly skipped`:""].filter(Boolean).join(", ");return`${$.passed}/${$.total}${z?` ${z}`:""}`};function Gb($){let Z=$===void 0?10:Number($);if(!Number.isInteger(Z)||Z<1)console.error(`${C("×")} --limit takes a whole number, 1 or more.`),process.exit(1);return Z}function Vb($,Z){if(Z?.startsWith("-"))console.error(`${C("×")} --ref takes a git ref, not an option: ${Z}`),process.exit(1);let z=Jb($,Z);if(!z){let Q=Yb($,Z);if(Q)console.error(`${C("×")} ${Q} is here, its .taf is not (a partial clone). Get it once: git show ${Q}:.taf > /dev/null`),process.exit(1);let X=Z?`${Z}:.taf`:"origin/taf-receipts, taf-receipts or ./.taf";console.error(`${C("×")} No receipts found (looked in ${X}). Fetch them: git fetch origin taf-receipts`),process.exit(1)}try{return{source:z.source,...Xb(z.text)}}catch(Q){console.error(`${C("×")} ${z.source}: the .taf is not YAML faf can read (${Q.message.split(`
502
+ `)[0]})`),process.exit(1)}}function qb($,Z,z,Q){let X=Z?` — ${Z}`:"";if(console.log(`${A("TAF receipts")}${X} ${M(`· ${z} on ${$} · times in UTC`)}`),Q.length===0){console.log(M(" no receipts yet"));return}for(let Y of Q)console.log(` ${Ub(Y.timestamp)} ${Y.result.padEnd(8)} ${Wb(Y)}`);let J=new Map;for(let Y of Q)J.set(Y.result,(J.get(Y.result)??0)+1);if(console.log(M(` last ${Q.length}: ${[...J].map(([Y,U])=>`${U} ${Y}`).join(" · ")}`)),$.startsWith("origin/"))console.log(M(" as of your last fetch (git fetch origin taf-receipts)"))}function eq($={}){let Z=Gb($.limit),{source:z,project:Q,receipts:X}=Vb(process.cwd(),$.ref),J=X.slice(0,Z);if($.json){console.log(JSON.stringify({source:z,project:Q,total:X.length,receipts:J},null,2));return}qb(z,Q,X.length,J)}function Lb($){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 Db="v2.7.0",Ob=`Wolfe-Jam/faf-taf-git/.github/workflows/receipt.yml@${Db}`,XK="taf-test-output";function JK($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;let z=$??"";if($===""||!Object.hasOwn($K,z))console.error(`${C("×")} Unknown: faf taf ${z}. Use ${C("faf taf setup")} or ${C("faf taf receipts")}.`),process.exit(1);Ib(z,Z),$K[z](Z)}var Nb={setup:["write"],receipts:["limit","json","ref"],"":["output","force"]},$K={setup:($)=>Zk($),receipts:($)=>eq($),"":($)=>zk($)};function Ib($,Z){let z=Object.keys(Z).filter((X)=>Z[X]!==void 0&&!Nb[$].includes(X));if(z.length===0)return;let Q=z.map((X)=>`--${X}`).join(", ");console.error(M(`note: ${Q} ${z.length===1?"does":"do"} nothing with faf taf${$?` ${$}`:""} (ignored)`))}function Tb($){if(I($,"bun.lockb")||I($,"bun.lock"))return"bun";if(I($,"pnpm-lock.yaml"))return"pnpm";if(I($,"yarn.lock"))return"yarn";return"npm"}function Ab($){try{let Z=JSON.parse(QK(n4($,"package.json"),"utf-8"));return Z&&typeof Z==="object"&&!Array.isArray(Z)?Z:{}}catch{return{}}}var fz=($,Z)=>new RegExp(`(^|[\\s;&|(])${Z}(?![\\w-])`).test($),Cb=/^\s*(?:npm run|pnpm(?: run)?|yarn(?: run)?|bun run)\s+([\w:.-]+)\s*$/;function YK($){let Z=$.test;for(let z=0;z<3&&typeof Z==="string";z++){let Q=Cb.exec(Z)?.[1];if(!Q)break;if(Z=$[Q],typeof Z!=="string")return null}return typeof Z==="string"?Z:void 0}function ZK($,Z){let z=$.scripts&&typeof $.scripts==="object"?$.scripts:{},Q=YK(z);if(Q===null){let X={...$.devDependencies,...$.dependencies};return"jest"in X||"vitest"in X}if(Q===void 0)return!1;return fz(Q,"jest")||fz(Q,"vitest")||Z==="bun"&&fz(Q,"bun test")}function _b($){let Z=$.packageManager,z=$.devEngines?.packageManager;return typeof Z==="string"&&Z.startsWith("pnpm@")||z?.name==="pnpm"&&typeof z.version==="string"&&z.version!==""?" - uses: pnpm/action-setup@v6":` - uses: pnpm/action-setup@v6
503
503
  with:
504
- version: 10`}var aq={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: actions/setup-node@v7
504
+ version: 10`}var UK={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: actions/setup-node@v7
505
505
  with:
506
506
  node-version: '24.x'`,install:"pnpm install --frozen-lockfile",test:"pnpm test"},yarn:{setup:` - uses: actions/setup-node@v7
507
507
  with:
508
508
  node-version: '24.x'`,install:"yarn install --frozen-lockfile",test:"yarn test"},npm:{setup:` - uses: actions/setup-node@v7
509
509
  with:
510
- node-version: '24.x'`,install:"npm ci",test:"npm test"}},qb=["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"],tq=/\.(?:sln|slnx|csproj|fsproj)$/i;function Kb($){let Z;try{Z=vz($)}catch{return!1}return Z.some((z)=>tq.test(z)&&I($,z))}function Hb($){if(I($,"go.mod"))return"go";if(I($,"Cargo.toml"))return"rust";if(I($,"pom.xml"))return"maven";if(qb.some((Z)=>I($,Z)))return"gradle";if(Kb($))return"dotnet";if(["pyproject.toml","setup.py","setup.cfg","requirements.txt","pytest.ini"].some((Z)=>I($,Z)))return"python";return null}var Bb=["test","tests","dev"],bz=String.raw`["']?([\w.-]+)["']?`;function hZ($,Z){let z=Z.split(".").map((Y)=>Y.replace(/-/g,"\\-")).join(String.raw`\s*\.\s*`),Q=new RegExp(String.raw`^\[\s*${z}\s*\][ \t]*(?:#[^\r\n]*)?\r?$`,"m").exec($);if(!Q)return null;let X=$.slice(Q.index+Q[0].length),J=X.search(/^[ \t]*\[/m);return J===-1?X:X.slice(0,J)}var kz=($)=>{let Z=new Set($);return Bb.find((z)=>Z.has(z))??null},eq=($)=>[...$.matchAll(new RegExp(String.raw`^\s*${bz}\s*=`,"gm"))].map((Z)=>Z[1]);function Mb($){let Z=hZ($,"project.optional-dependencies");if(Z!==null)return kz(eq(Z));let z=hZ($,"project")??"",X=[...(/^\s*optional-dependencies\s*=\s*\{([^}\r\n]*)\}/m.exec(z)?.[1]??"").matchAll(new RegExp(String.raw`(?:^|,)\s*${bz}\s*=`,"g"))].map((Y)=>Y[1]),J=[...z.matchAll(new RegExp(String.raw`^\s*optional-dependencies\s*\.\s*${bz}\s*=`,"gm"))].map((Y)=>Y[1]);return kz([...X,...J])}function Lb($){if(!I($,"pyproject.toml"))return{extra:null,group:null};let Z;try{Z=rq(c4($,"pyproject.toml"),"utf-8")}catch{return{extra:null,group:null}}let z=hZ(Z,"dependency-groups");return{extra:Mb(Z),group:z===null?null:kz(eq(z))}}function Db($){let{extra:Z,group:z}=Lb($),Q=["poetry.lock","uv.lock","pdm.lock"].find((Y)=>I($,Y)),X=Q?` # ${Q} found: install your dev dependencies with that tool here, before pytest.
510
+ node-version: '24.x'`,install:"npm ci",test:"npm test"}},Pb=["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"],WK=/\.(?:sln|slnx|csproj|fsproj)$/i;function Fb($){let Z;try{Z=cz($)}catch{return!1}return Z.some((z)=>WK.test(z)&&I($,z))}function Rb($){if(I($,"go.mod"))return"go";if(I($,"Cargo.toml"))return"rust";if(I($,"pom.xml"))return"maven";if(Pb.some((Z)=>I($,Z)))return"gradle";if(Fb($))return"dotnet";if(["pyproject.toml","setup.py","setup.cfg","requirements.txt","pytest.ini"].some((Z)=>I($,Z)))return"python";return null}var jb=["test","tests","dev"],uz=String.raw`["']?([\w.-]+)["']?`;function pZ($,Z){let z=Z.split(".").map((Y)=>Y.replace(/-/g,"\\-")).join(String.raw`\s*\.\s*`),Q=new RegExp(String.raw`^\[\s*${z}\s*\][ \t]*(?:#[^\r\n]*)?\r?$`,"m").exec($);if(!Q)return null;let X=$.slice(Q.index+Q[0].length),J=X.search(/^[ \t]*\[/m);return J===-1?X:X.slice(0,J)}var mz=($)=>{let Z=new Set($);return jb.find((z)=>Z.has(z))??null},GK=($)=>[...$.matchAll(new RegExp(String.raw`^\s*${uz}\s*=`,"gm"))].map((Z)=>Z[1]);function Sb($){let Z=pZ($,"project.optional-dependencies");if(Z!==null)return mz(GK(Z));let z=pZ($,"project")??"",X=[...(/^\s*optional-dependencies\s*=\s*\{([^}\r\n]*)\}/m.exec(z)?.[1]??"").matchAll(new RegExp(String.raw`(?:^|,)\s*${uz}\s*=`,"g"))].map((Y)=>Y[1]),J=[...z.matchAll(new RegExp(String.raw`^\s*optional-dependencies\s*\.\s*${uz}\s*=`,"gm"))].map((Y)=>Y[1]);return mz([...X,...J])}function Eb($){if(!I($,"pyproject.toml"))return{extra:null,group:null};let Z;try{Z=QK(n4($,"pyproject.toml"),"utf-8")}catch{return{extra:null,group:null}}let z=pZ(Z,"dependency-groups");return{extra:Sb(Z),group:z===null?null:mz(GK(z))}}function wb($){let{extra:Z,group:z}=Eb($),Q=["poetry.lock","uv.lock","pdm.lock"].find((Y)=>I($,Y)),X=Q?` # ${Q} found: install your dev dependencies with that tool here, before pytest.
511
511
  `:"",J=z?`
512
512
  pip install --group ${z}`:"";return` - uses: actions/setup-python@v7
513
513
  with:
@@ -515,25 +515,25 @@ ${M(' Demo complete. Run "faf init" in your project to get started.')}`)}l();fu
515
515
  ${X} - run: |
516
516
  python -m pip install --upgrade pip pytest
517
517
  if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
518
- if [ -f pyproject.toml ] || [ -f setup.py ]; then pip install -e ${Z?`".[${Z}]"`:"."}; fi${J}`}var Ob="cargo-nextest@0.9.151",u4=".config/nextest.toml",Nb=($)=>{let Z=hZ($,"profile.ci.junit");return Z!==null&&/^\s*path\s*=/m.test(Z)};function Ib($){let Z=g($,u4),z=Z!==null&&!Nb(Z)?` # ${u4} has no [profile.ci.junit]: add one with path = "junit.xml", or there is no report to read.
518
+ if [ -f pyproject.toml ] || [ -f setup.py ]; then pip install -e ${Z?`".[${Z}]"`:"."}; fi${J}`}var xb="cargo-nextest@0.9.151",d4=".config/nextest.toml",yb=($)=>{let Z=pZ($,"profile.ci.junit");return Z!==null&&/^\s*path\s*=/m.test(Z)};function bb($){let Z=g($,d4),z=Z!==null&&!yb(Z)?` # ${d4} has no [profile.ci.junit]: add one with path = "junit.xml", or there is no report to read.
519
519
  `:"";return` - uses: dtolnay/rust-toolchain@stable
520
520
  - uses: taiki-e/install-action@v2
521
521
  with:
522
- tool: ${Ob}
522
+ tool: ${xb}
523
523
  ${z} - name: Configure the nextest JUnit report
524
- # Only when the repo has no ${u4}: yours is never overwritten.
524
+ # Only when the repo has no ${d4}: yours is never overwritten.
525
525
  run: |
526
- if [ ! -e ${u4} ]; then
526
+ if [ ! -e ${d4} ]; then
527
527
  mkdir -p .config
528
- printf '[profile.ci.junit]\\npath = "junit.xml"\\n' > ${u4}
529
- fi`}var $K=($)=>` - uses: actions/setup-java@v6
528
+ printf '[profile.ci.junit]\\npath = "junit.xml"\\n' > ${d4}
529
+ fi`}var VK=($)=>` - uses: actions/setup-java@v6
530
530
  with:
531
531
  distribution: temurin
532
532
  java-version: '21' # your project's Java version${$?`
533
- cache: ${$}`:""}`,Tb=($)=>/<modules\s*>/.test(g($,"pom.xml")??""),Ab=($)=>["settings.gradle","settings.gradle.kts"].some((Z)=>/^\s*include\b/m.test(g($,Z)??"")),nq=($,Z)=>Z?`find . -path '*/${$}/TEST-*.xml' -exec cat {} + > report.xml`:`cat ${$}/TEST-*.xml > report.xml`,Cb="9.8.2";function _b($){let Z=I($,"gradlew");return`${$K()}
533
+ cache: ${$}`:""}`,kb=($)=>/<modules\s*>/.test(g($,"pom.xml")??""),vb=($)=>["settings.gradle","settings.gradle.kts"].some((Z)=>/^\s*include\b/m.test(g($,Z)??"")),zK=($,Z)=>Z?`find . -path '*/${$}/TEST-*.xml' -exec cat {} + > report.xml`:`cat ${$}/TEST-*.xml > report.xml`,gb="9.8.2";function hb($){let Z=I($,"gradlew");return`${VK()}
534
534
  - uses: gradle/actions/setup-gradle@v6${Z?"":`
535
535
  with:
536
- gradle-version: '${Cb}' # no gradlew in the repo`}`}var Rb="8.1.0";function ZK($,Z="",z=0){if(z>6)return[];let Q;try{Q=vz(c4($,Z),{withFileTypes:!0})}catch{return[]}let X=[];for(let J of Q){let Y=Z?`${Z}/${J.name}`:J.name;if(J.isDirectory()){if(!/^(?:\.|bin$|obj$|node_modules$)/.test(J.name))X.push(...ZK($,Y,z+1))}else if(/\.(?:csproj|fsproj)$|^Directory\.Build\.props$/i.test(J.name))X.push(Y)}return X}function Pb($){let Z=new Set;for(let z of ZK($)){let Q=g($,z)??"";for(let X of Q.matchAll(/<TargetFrameworks?>([^<]*)<\/TargetFrameworks?>/g))for(let J of X[1].split(";")){let Y=/^\s*net(\d+\.\d+)/.exec(J)?.[1];if(Y)Z.add(`${Y}.x`)}}return[...Z].sort((z,Q)=>parseFloat(z)-parseFloat(Q))}function Fb($){let Z=Pb($),z=I($,"global.json"),Q=[];if(Z.length===1)Q.push(`dotnet-version: '${Z[0]}'`);if(Z.length>1)Q.push(`dotnet-version: |
536
+ gradle-version: '${gb}' # no gradlew in the repo`}`}var fb="8.1.0";function qK($,Z="",z=0){if(z>6)return[];let Q;try{Q=cz(n4($,Z),{withFileTypes:!0})}catch{return[]}let X=[];for(let J of Q){let Y=Z?`${Z}/${J.name}`:J.name;if(J.isDirectory()){if(!/^(?:\.|bin$|obj$|node_modules$)/.test(J.name))X.push(...qK($,Y,z+1))}else if(/\.(?:csproj|fsproj)$|^Directory\.Build\.props$/i.test(J.name))X.push(Y)}return X}function ub($){let Z=new Set;for(let z of qK($)){let Q=g($,z)??"";for(let X of Q.matchAll(/<TargetFrameworks?>([^<]*)<\/TargetFrameworks?>/g))for(let J of X[1].split(";")){let Y=/^\s*net(\d+\.\d+)/.exec(J)?.[1];if(Y)Z.add(`${Y}.x`)}}return[...Z].sort((z,Q)=>parseFloat(z)-parseFloat(Q))}function mb($){let Z=ub($),z=I($,"global.json"),Q=[];if(Z.length===1)Q.push(`dotnet-version: '${Z[0]}'`);if(Z.length>1)Q.push(`dotnet-version: |
537
537
  ${Z.map((X)=>` ${X}`).join(`
538
538
  `)}`);if(z)Q.push("global-json-file: global.json");if(!Q.length)Q.push("dotnet-version: '10.0.x' # your SDK version (or add a global.json)");return` - uses: actions/setup-dotnet@v6
539
539
  with:
@@ -543,122 +543,133 @@ ${Z.map((X)=>` ${X}`).join(`
543
543
  # In CI only: your project files are not changed in the repo.
544
544
  run: |
545
545
  grep -rlE --include='*.csproj' --include='*.fsproj' 'Microsoft\\.NET\\.Test\\.Sdk|<IsTestProject>[[:space:]]*true' . | while read -r p; do
546
- grep -q 'JunitXml.TestLogger' "$p" || dotnet add "$p" package JunitXml.TestLogger --version ${Rb}
547
- done`}function jb($){let Z;try{Z=vz($)}catch{return""}let z=Z.filter((X)=>tq.test(X)&&I($,X)).sort();if(z.length<=1)return"";let Q=z.find((X)=>/\.slnx?$/i.test(X))??z[0];return/^[\w.+-]+$/.test(Q)?` ${Q}`:` '${Q.replace(/'/g,"'\\''")}'`}var Sb={python:{setup:Db,test:()=>"pytest --junitxml=report.xml",report:"report.xml"},go:{setup:()=>` - uses: actions/setup-go@v7
546
+ grep -q 'JunitXml.TestLogger' "$p" || dotnet add "$p" package JunitXml.TestLogger --version ${fb}
547
+ done`}function cb($){let Z;try{Z=cz($)}catch{return""}let z=Z.filter((X)=>WK.test(X)&&I($,X)).sort();if(z.length<=1)return"";let Q=z.find((X)=>/\.slnx?$/i.test(X))??z[0];return/^[\w.+-]+$/.test(Q)?` ${Q}`:` '${Q.replace(/'/g,"'\\''")}'`}var pb={python:{setup:wb,test:()=>"pytest --junitxml=report.xml",report:"report.xml"},go:{setup:()=>` - uses: actions/setup-go@v7
548
548
  with:
549
549
  go-version-file: go.mod
550
- - run: GOTOOLCHAIN=auto go install gotest.tools/gotestsum@v1.13.0`,test:()=>"gotestsum --junitfile report.xml -- ./...",report:"report.xml"},rust:{setup:Ib,test:()=>"cargo nextest run --profile ci --workspace --no-fail-fast",report:"target/nextest/ci/junit.xml"},maven:{setup:()=>$K("maven"),test:($)=>`${I($,"mvnw")?"./mvnw":"mvn"} -B --fail-at-end test`,join:($)=>nq("target/surefire-reports",Tb($)),report:"report.xml"},gradle:{setup:_b,test:($)=>`${I($,"gradlew")?"./gradlew":"gradle"} test --continue`,join:($)=>nq("build/test-results/test",Ab($)),report:"report.xml"},dotnet:{setup:Fb,test:($)=>`dotnet test${jb($)} --logger "junit;LogFilePath=$GITHUB_WORKSPACE/junit-reports/{assembly}.{framework}.xml"`,join:()=>"cat junit-reports/*.xml > report.xml",report:"report.xml"}},Eb=($)=>` - name: Join the reports into one file
550
+ - run: GOTOOLCHAIN=auto go install gotest.tools/gotestsum@v1.13.0`,test:()=>"gotestsum --junitfile report.xml -- ./...",report:"report.xml"},rust:{setup:bb,test:()=>"cargo nextest run --profile ci --workspace --no-fail-fast",report:"target/nextest/ci/junit.xml"},maven:{setup:()=>VK("maven"),test:($)=>`${I($,"mvnw")?"./mvnw":"mvn"} -B --fail-at-end test`,join:($)=>zK("target/surefire-reports",kb($)),report:"report.xml"},gradle:{setup:hb,test:($)=>`${I($,"gradlew")?"./gradlew":"gradle"} test --continue`,join:($)=>zK("build/test-results/test",vb($)),report:"report.xml"},dotnet:{setup:mb,test:($)=>`dotnet test${cb($)} --logger "junit;LogFilePath=$GITHUB_WORKSPACE/junit-reports/{assembly}.{framework}.xml"`,join:()=>"cat junit-reports/*.xml > report.xml",report:"report.xml"}},lb=($)=>` - name: Join the reports into one file
551
551
  # One file per test class or assembly; one alone can read PASSED for a run that failed.
552
+ if: \${{ !cancelled() }}
552
553
  run: ${$}
553
- `,m4=($)=>` - name: Run tests
554
+ `,i4=($)=>` - name: Run tests
554
555
  id: tests
555
- continue-on-error: true # keep going, so a failed run still gets a receipt
556
556
  run: |
557
557
  set -o pipefail
558
558
  ${$}
559
- `,wb=/^\s*node\s+--test(?![\w-])[^;&|]*$/,xb=/^\s*mocha(?![\w-])[^;&|]*$/,yb=/--(?:test-)?reporter\b/;function bb($,Z){let z=$.scripts&&typeof $.scripts==="object"?$.scripts:{},Q=oq(z);if(typeof Q!=="string"||yb.test(Q))return null;let X=aq[Z].test;if(wb.test(Q))return`NODE_OPTIONS="--test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=report.xml" ${X}`;if(typeof z.test==="string"&&xb.test(z.test))return`${X}${Z==="npm"?" --":""} --reporter xunit --reporter-option output=report.xml`;return null}function kb($){let Z=Ub($),z=Wb($),Q=aq[Z],X=Z==="pnpm"?`${Vb(z)}
560
- ${Q.setup}`:Q.setup,J=iq(z,Z)?null:bb(z,Z);if(J)return{body:`${X}
559
+ `,db=/^\s*node\s+--test(?![\w-])[^;&|]*$/,ib=/^\s*mocha(?![\w-])[^;&|]*$/,nb=/--(?:test-)?reporter\b/;function rb($,Z){let z=$.scripts&&typeof $.scripts==="object"?$.scripts:{},Q=YK(z);if(typeof Q!=="string"||nb.test(Q))return null;let X=UK[Z].test;if(db.test(Q))return`NODE_OPTIONS="--test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=report.xml" ${X}`;if(typeof z.test==="string"&&ib.test(z.test))return`${X}${Z==="npm"?" --":""} --reporter xunit --reporter-option output=report.xml`;return null}function sb($){let Z=Tb($),z=Ab($),Q=UK[Z],X=Z==="pnpm"?`${_b(z)}
560
+ ${Q.setup}`:Q.setup,J=ZK(z,Z)?null:rb(z,Z);if(J)return{body:`${X}
561
561
  - run: ${Q.install}
562
562
  # Your test command, with a JUnit report added (faf-taf-git reads it).
563
563
  ${J.includes("xunit")?` # mocha writes only the report: failure details are in report.xml.
564
- `:""}${m4(J)}`,report:"report.xml"};let Y=iq(z,Z)?m4(`${Q.test} 2>&1 | tee test-output.txt`):` # TODO: faf-taf-git reads Jest, Vitest and Bun output, or JUnit XML
564
+ `:""}${i4(J)}`,report:"report.xml"};let Y=ZK(z,Z)?i4(`${Q.test} 2>&1 | tee test-output.txt`):` # TODO: faf-taf-git reads Jest, Vitest and Bun output, or JUnit XML
565
565
  # (node --test: --test-reporter=junit; mocha: --reporter xunit).
566
566
  # Run your tests so they write one of those, and point test-output-file at it.
567
- ${m4(`echo "TODO: your test command" 2>&1 | tee test-output.txt # e.g. ${Q.test} 2>&1 | tee test-output.txt`)}`;return{body:`${X}
567
+ ${i4(`echo "TODO: your test command" 2>&1 | tee test-output.txt # e.g. ${Q.test} 2>&1 | tee test-output.txt`)}`;return{body:`${X}
568
568
  - run: ${Q.install}
569
- ${Y}`,report:"test-output.txt"}}function vb($){let Z=(J)=>{let Y=ey("git",J,{cwd:$,encoding:"utf-8"});return Y.status===0?Y.stdout.trim():""},z=Z(["symbolic-ref","--short","refs/remotes/origin/HEAD"]).replace(/^origin\//,"");if(z)return{name:z};for(let J of["main","master"])if(Z(["rev-parse","--verify","--quiet",`refs/remotes/origin/${J}`]))return{name:J};let Q=Z(["for-each-ref","--format=%(refname:lstrip=3)","refs/remotes/origin/"]).split(`
570
- `).filter((J)=>J&&J!=="HEAD");if(Q.length===1)return{name:Q[0]};let X=Z(["branch","--show-current"]);if(X)return{name:X,guess:"origin/HEAD is not set, so this is the current branch"};return{name:"main",guess:"no branch found"}}var gb=($)=>/^[\w./-]+$/.test($)?$:`'${$.replace(/[*?+[\]!]/g,"\\$&")}'`;function hb($,Z){let z=`name: TAF Receipts
569
+ ${Y}`,report:"test-output.txt"}}function ob($){let Z=(J)=>{let Y=Kb("git",J,{cwd:$,encoding:"utf-8"});return Y.status===0?Y.stdout.trim():""},z=Z(["symbolic-ref","--short","refs/remotes/origin/HEAD"]).replace(/^origin\//,"");if(z)return{name:z};for(let J of["main","master"])if(Z(["rev-parse","--verify","--quiet",`refs/remotes/origin/${J}`]))return{name:J};let Q=Z(["for-each-ref","--format=%(refname:lstrip=3)","refs/remotes/origin/"]).split(`
570
+ `).filter((J)=>J&&J!=="HEAD");if(Q.length===1)return{name:Q[0]};let X=Z(["branch","--show-current"]);if(X)return{name:X,guess:"origin/HEAD is not set, so this is the current branch"};return{name:"main",guess:"no branch found"}}var ab=($)=>/^[\w./-]+$/.test($)?$:`'${$.replace(/[*?+[\]!]/g,"\\$&")}'`;function tb($,Z){let z=`github.ref == 'refs/heads/${Z}' && github.event_name != 'pull_request'`,Q=`name: TAF Receipts
571
571
  # Prints a Test Receipt (.taf) for every run on ${Z}: proof over time.
572
572
  # Written by \`faf taf setup\`. Docs: https://github.com/Wolfe-Jam/faf-taf-git
573
573
  on:
574
574
  push:
575
- branches: [${gb(Z)}]
575
+ branches: [${ab(Z)}]
576
576
  pull_request:
577
577
  workflow_dispatch:
578
578
 
579
579
  jobs:
580
- taf:
580
+ test:
581
581
  runs-on: ubuntu-latest
582
582
  permissions:
583
- contents: write # lets the action save receipts
583
+ contents: read # the tests never run with write access
584
584
  steps:
585
585
  - uses: actions/checkout@v7
586
- `,Q,X="test-output.txt",J=I($,"package.json")?null:Hb($);if(I($,"package.json"))({body:Q,report:X}=kb($));else if(J){let U=Sb[J];X=U.report,Q=`${U.setup($)}
587
- ${m4(U.test($))}${U.join?Eb(U.join($)):""}`}else Q=` # TODO: set up your toolchain, then run your tests writing output to test-output.txt
588
- ${m4('echo "TODO: your test command" 2>&1 | tee test-output.txt # or any runner that writes JUnit XML')}`;let Y=` - name: Print the receipt
589
- if: github.ref == 'refs/heads/${Z}' && github.event_name != 'pull_request'
590
- uses: ${Xb}
586
+ `,X,J="test-output.txt",Y=I($,"package.json")?null:Rb($);if(I($,"package.json"))({body:X,report:J}=sb($));else if(Y){let U=pb[Y];J=U.report,X=`${U.setup($)}
587
+ ${i4(U.test($))}${U.join?lb(U.join($)):""}`}else X=` # TODO: set up your toolchain, then run your tests writing output to test-output.txt
588
+ ${i4('echo "TODO: your test command" 2>&1 | tee test-output.txt # or any runner that writes JUnit XML')}`;return Q+X+eb(Z,z,J)+$k(z,J)}function eb($,Z,z){return` - name: Upload the test output
589
+ # ${$} only, and after a red run too: the receipt job records it.
590
+ if: \${{ !cancelled() && ${Z} }}
591
+ uses: actions/upload-artifact@v7
591
592
  with:
592
- test-output-file: ${X}
593
- target-branch: taf-receipts
594
- - name: Fail the job if the tests failed
595
- if: steps.tests.outcome == 'failure'
596
- run: exit 1
597
- `;return z+Q+Y}function fb($){let Z=process.cwd(),z=vb(Z),Q=!/['\n\r]/.test(z.name),X=Q?z.name:"main",J=hb(Z,X),Y=Q?z.guess:`"${z.name}" can't go in the workflow`,U=Y?M(` Records ${X} (${Y}). Check \`branches:\` before you commit.`):"",W=c4(Z,".github","workflows","taf.yml");if($.write){if($b(W)){console.error(`${C("×")} .github/workflows/taf.yml already exists — not overwriting.`),console.error(M(" Add the faf-taf-git step to your existing workflow, or remove taf.yml and re-run.")),process.exitCode=1;return}if(E0(Z,c4(".github","workflows")),o(W,J,{root:Z,expect:null}),console.log(`${A("◆")} taf wrote .github/workflows/taf.yml`),console.log(M(" commit + push → your first Test Receipt prints to the taf-receipts branch.")),U)console.log(U);return}if(console.log(`${A("TAF setup")} ${M("— Test Receipt Printer: proof over time")}
593
+ name: ${XK}
594
+ path: ${z}
595
+ overwrite: true # "Re-run failed jobs" uploads it again
596
+ `}function $k($,Z){let z=Z.split("/").pop();return`
597
+ receipt:
598
+ needs: test
599
+ # Runs when the tests failed too, so a red run gets a FAILED receipt.
600
+ if: \${{ !cancelled() && ${$} }}
601
+ permissions:
602
+ contents: write # this job, and only this job, saves receipts
603
+ uses: ${Ob}
604
+ with:
605
+ artifact-name: ${XK}
606
+ test-output-file: ${z}
607
+ test-result: \${{ needs.test.result }}
608
+ `}function Zk($){let Z=process.cwd(),z=ob(Z),Q=!/['\n\r]/.test(z.name),X=Q?z.name:"main",J=tb(Z,X),Y=Q?z.guess:`"${z.name}" can't go in the workflow`,U=Y?M(` Records ${X} (${Y}). Check \`branches:\` before you commit.`):"",W=n4(Z,".github","workflows","taf.yml");if($.write){if(Hb(W)){console.error(`${C("×")} .github/workflows/taf.yml already exists — not overwriting.`),console.error(M(" Add the test upload and the receipt job to your existing workflow, or remove taf.yml and re-run.")),process.exitCode=1;return}if(E0(Z,n4(".github","workflows")),s(W,J,{root:Z,expect:null}),console.log(`${A("◆")} taf wrote .github/workflows/taf.yml`),console.log(M(" commit + push → your first Test Receipt prints to the taf-receipts branch.")),U)console.log(U);return}if(console.log(`${A("TAF setup")} ${M("— Test Receipt Printer: proof over time")}
598
609
  `),console.log(M("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(J),U)console.log(`${U}
599
- `);console.log(M(`Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run on ${X}, red runs included.`))}function ub($){console.error(M("note: `faf taf` (score snapshot) is deprecated — use `faf score --json`. (`faf taf setup` wires the Receipt Printer; `faf taf receipts` shows the receipts.)"));let Z=m();if(!Z)console.error(`Error: project.faf not found
610
+ `);console.log(M(`Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run on ${X}, red runs included.`))}function zk($){console.error(M("note: `faf taf` (score snapshot) is deprecated — use `faf score --json`. (`faf taf setup` wires the Receipt Printer; `faf taf receipts` shows the receipts.)"));let Z=c();if(!Z)console.error(`Error: project.faf not found
600
611
 
601
- Run 'faf init' to create one.`),process.exit(2);let z=t(Z),Q=p(Z),X=a(Z,()=>D0(Q)),J={taf_version:"1.0.0",generated:new Date().toISOString(),source:Z,project:z.project?.name??"unknown",faf_version:z.faf_version??"unknown",score:X.score,tier:X.tier.name,populated:X.populated,active:X.active,total:X.total,slots:X.slots},Y=JSON.stringify(J,null,2);if($.output)V2($.output),H2($.output,Y,{root:Zb(zb($.output)),format:"json",hasMark:Qb,mark:"TAF snapshot (`taf_version`)",force:$.force}),console.log(`${A("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as WK,emitKeypressEvents as nb}from"readline";import{dirname as rb,join as GK}from"path";var zK=new Intl.Segmenter(void 0,{granularity:"grapheme"});function QK($){let Z=-1;for(let{index:z}of zK.segment($))Z=z;return Z<0?$:$.slice(0,Z)}function mb($){return $>=4352&&$<=4447||$>=11904&&$<=12350||$>=12353&&$<=13311||$>=13312&&$<=19903||$>=19968&&$<=40959||$>=40960&&$<=42191||$>=44032&&$<=55203||$>=63744&&$<=64255||$>=65072&&$<=65103||$>=65280&&$<=65376||$>=65504&&$<=65510||$>=131072&&$<=262141}var cb=/\p{Emoji_Presentation}|\uFE0F/u,pb=/^[\p{M}\p{Cf}]+$/u;function lb($){if(cb.test($))return 2;let Z=$.codePointAt(0)??0;if(Z<32||pb.test($))return 0;return mb(Z)?2:1}function XK($){let Z=$.replace(/\u001b\[[0-9;]*m/g,""),z=0;for(let{segment:Q}of zK.segment(Z))z+=lb(Q);return z}function gz($){return $.replace(/[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g,"")}function YK($,Z=""){return{buffer:"",suggestion:$.trim(),help:Z.trim()}}function db($){let Z=gz($.buffer).trim();if(Z.toLowerCase()==="quit")return{kind:"quit"};if(Z.toLowerCase()==="skip")return{kind:"skip"};if(Z)return{kind:"value",value:Z};if($.suggestion)return{kind:"value",value:gz($.suggestion)};return{kind:"skip"}}function ib($){let Z=$.sequence??"";if($.ctrl||$.meta||!Z)return!1;return[...Z].every((z)=>z.charCodeAt(0)>=32&&z.charCodeAt(0)!==127)}var JK={tab:($)=>$.buffer===""&&$.suggestion?{...$,buffer:$.suggestion}:$,backspace:($)=>({...$,buffer:QK($.buffer)}),escape:($)=>({...$,buffer:""})};function UK($,Z){if(Z.ctrl&&(Z.name==="c"||Z.name==="d"))return{state:$,done:{kind:"quit"}};if(Z.name==="return"||Z.name==="enter")return{state:$,done:db($)};let z=Z.name&&Object.hasOwn(JK,Z.name)?JK[Z.name]:void 0;if(z)return{state:z($)};if(ib(Z))return{state:{...$,buffer:$.buffer+Z.sequence}};return{state:$}}function hz($,Z){if($.buffer!=="")return $.buffer;if($.suggestion)return Z.gray(`${$.suggestion} (suggested · Tab to edit · Enter to confirm)`);return $.help?Z.gray(`‹${$.help}›`):""}l();var fZ=".faf-session.json";function fz($){if($===null)return null;let Z=new TextDecoder().decode($);try{let z=JSON.parse(Z);if((typeof z==="object"&&z!==null&&!Array.isArray(z)?Object.keys(z).sort().join(","):"")!=="fafPath,slotIndex"||typeof z.slotIndex!=="number"||typeof z.fafPath!=="string")return null;return JSON.stringify({slotIndex:z.slotIndex,fafPath:z.fafPath})===Z?{slotIndex:z.slotIndex,fafPath:z.fafPath}:null}catch{return null}}function VK($){try{return f0(i($,fZ))}catch(Z){if(!(Z instanceof v))throw Z;return console.error(M(` ${fZ}: ${Z.message}`)),null}}function sb($,Z){try{return x2(GK($,fZ),JSON.stringify(Z),{root:$,owns:(z)=>fz(z)!==null,mark:"faf go session"}),!0}catch(z){return console.error(M(` session not saved: ${z instanceof Error?z.message:String(z)}`)),!1}}function ob($){let Z=VK($);if(fz(Z)===null||Z===null)return;try{w5(GK($,fZ),{root:$,expect:Z})}catch(z){if(!(z instanceof v))throw z}}function ab($,Z){let z=new Map;for(let X of Z){let J=I4($,X);if(J&&!z.has(J.at))z.set(J.at,T4(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 tb($,Z){let z=p2(Z)?` ${M(`now '${String(Z).trim()}' — Enter keeps it`)}`:"";return` ${C(`#${$.index}`)} ${MZ($.path)} ${M(`(${$.path})`)}${z}: `}async function qK($={}){u1(process.cwd(),"faf go");let Z=m();if(!Z)console.error(`Error: project.faf not found
612
+ Run 'faf init' to create one.`),process.exit(2);let z=a(Z),Q=l(Z),X=o(Z,()=>M0(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)V2($.output),H2($.output,Y,{root:Bb(Mb($.output)),format:"json",hasMark:Lb,mark:"TAF snapshot (`taf_version`)",force:$.force}),console.log(`${A("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as OK,emitKeypressEvents as Gk}from"readline";import{dirname as Vk,join as NK}from"path";var KK=new Intl.Segmenter(void 0,{granularity:"grapheme"});function HK($){let Z=-1;for(let{index:z}of KK.segment($))Z=z;return Z<0?$:$.slice(0,Z)}function Qk($){return $>=4352&&$<=4447||$>=11904&&$<=12350||$>=12353&&$<=13311||$>=13312&&$<=19903||$>=19968&&$<=40959||$>=40960&&$<=42191||$>=44032&&$<=55203||$>=63744&&$<=64255||$>=65072&&$<=65103||$>=65280&&$<=65376||$>=65504&&$<=65510||$>=131072&&$<=262141}var Xk=/\p{Emoji_Presentation}|\uFE0F/u,Jk=/^[\p{M}\p{Cf}]+$/u;function Yk($){if(Xk.test($))return 2;let Z=$.codePointAt(0)??0;if(Z<32||Jk.test($))return 0;return Qk(Z)?2:1}function BK($){let Z=$.replace(/\u001b\[[0-9;]*m/g,""),z=0;for(let{segment:Q}of KK.segment(Z))z+=Yk(Q);return z}function pz($){return $.replace(/[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g,"")}function LK($,Z=""){return{buffer:"",suggestion:$.trim(),help:Z.trim()}}function Uk($){let Z=pz($.buffer).trim();if(Z.toLowerCase()==="quit")return{kind:"quit"};if(Z.toLowerCase()==="skip")return{kind:"skip"};if(Z)return{kind:"value",value:Z};if($.suggestion)return{kind:"value",value:pz($.suggestion)};return{kind:"skip"}}function Wk($){let Z=$.sequence??"";if($.ctrl||$.meta||!Z)return!1;return[...Z].every((z)=>z.charCodeAt(0)>=32&&z.charCodeAt(0)!==127)}var MK={tab:($)=>$.buffer===""&&$.suggestion?{...$,buffer:$.suggestion}:$,backspace:($)=>({...$,buffer:HK($.buffer)}),escape:($)=>({...$,buffer:""})};function DK($,Z){if(Z.ctrl&&(Z.name==="c"||Z.name==="d"))return{state:$,done:{kind:"quit"}};if(Z.name==="return"||Z.name==="enter")return{state:$,done:Uk($)};let z=Z.name&&Object.hasOwn(MK,Z.name)?MK[Z.name]:void 0;if(z)return{state:z($)};if(Wk(Z))return{state:{...$,buffer:$.buffer+Z.sequence}};return{state:$}}function lz($,Z){if($.buffer!=="")return $.buffer;if($.suggestion)return Z.gray(`${$.suggestion} (suggested · Tab to edit · Enter to confirm)`);return $.help?Z.gray(`‹${$.help}›`):""}i();var lZ=".faf-session.json";function dz($){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 IK($){try{return f0(n($,lZ))}catch(Z){if(!(Z instanceof k))throw Z;return console.error(M(` ${lZ}: ${Z.message}`)),null}}function qk($,Z){try{return y2(NK($,lZ),JSON.stringify(Z),{root:$,owns:(z)=>dz(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 Kk($){let Z=IK($);if(dz(Z)===null||Z===null)return;try{v5(NK($,lZ),{root:$,expect:Z})}catch(z){if(!(z instanceof k))throw z}}function Hk($,Z){let z=new Map;for(let X of Z){let J=C4($,X);if(J&&!z.has(J.at))z.set(J.at,_4(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 Bk($,Z){let z=i2(Z)?` ${M(`now '${String(Z).trim()}' — Enter keeps it`)}`:"";return` ${C(`#${$.index}`)} ${IZ($.path)} ${M(`(${$.path})`)}${z}: `}async function TK($={}){d1(process.cwd(),"faf go");let Z=c();if(!Z)console.error(`Error: project.faf not found
602
613
 
603
- Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=0;if($.resume){let B=fz(VK(z));if(B)Q=B.slotIndex,console.log(M(` resuming from slot #${Q+1}`))}let X=t(Z),J=a(Z,()=>k0(F0(p(Z)))),Y=J0.filter((B)=>{let D=N4(X,B.path);return U0(D)&&D!==e$});if(ab(X,Y.map((B)=>B.path)),Y.length===0){console.log(`${A("◆")} go all slots populated — ✪ Trophy`),w0(J,Z);return}console.log(`${A("go")} ${M("— guided interview to ✪ Trophy")}`);let U=Y.length===1?"slot":"slots";console.log(M(` ${Y.length} ${U} from Trophy. Enter a value, "skip" to skip, or "quit" to stop.
604
- `));let W=Boolean(process.stdin.isTTY&&process.stdout.isTTY),G=W?A4(z,X):{},V=W?Xk():Zk(),q=0,K=!1,H=Y.slice(Q);for(let B=0;B<H.length;B++){let D=H[B],N=N4(X,D.path),_=$k(D.path,N,G),E=G[D.path]?.source;if(_?.suggestion&&E)console.log(M(` suggested from ${E}`));let P=await V.ask(tb(D,N),_);if(P.kind==="quit"){if(K=!0,sb(z,{slotIndex:Q+B,fafPath:Z}))console.log(M(`
605
- session saved. Resume with: faf go --resume`));break}if(P.kind==="skip")continue;qZ(X,D.path,P.value),q++}if(V.close(),q>0)b0(Z,X,{onAliasKept:(B)=>console.log(M(` ${y2(B)}`))}),console.log(`
606
- ${A("◆")} go filled ${q} slot${q===1?"":"s"}`);let L=a(Z,()=>k0(F0(p(Z))));if(w0(L,Z),q>0)eb(Z,L.score,q);if(!K)ob(z)}function eb($,Z,z){let Q=new o0(rb($));if(!Q.exists())return;Q.recordGrowth(Z,[`faf go — filled ${z} slot${z===1?"":"s"}`]),I6(Q)}function $k($,Z,z){if(!k3($)||p2(Z))return null;return{suggestion:z[$]?.value??"",help:WG($)}}function KK($){let Z=$.trim();if(Z.toLowerCase()==="quit")return{kind:"quit"};if(Z===""||Z.toLowerCase()==="skip")return{kind:"skip"};return{kind:"value",value:Z}}function Zk(){let $=WK({input:process.stdin,terminal:!1}),Z=[],z=[],Q=!1;return $.on("line",(X)=>{let J=z.shift();if(J)J(X);else Z.push(X)}),$.on("close",()=>{Q=!0;for(let X of z.splice(0))X(null)}),{ask:(X)=>new Promise((J)=>{process.stdout.write(X);let Y=(U)=>{process.stdout.write(`
607
- `),J(U===null?{kind:"skip"}:KK(U))};if(Z.length>0)Y(Z.shift());else if(Q)Y(null);else z.push(Y)}),close:()=>$.close()}}function zk($,Z){return new Promise((z)=>{let Q=WK({input:process.stdin,output:process.stdout,terminal:!0,history:[...Z],historySize:100}),X=!1,J=(Y)=>{if(X)return;X=!0,Q.close(),process.stdin.pause(),z(Y)};Q.on("SIGINT",()=>{process.stdout.write(`
608
- `),J({kind:"quit"})}),Q.on("close",()=>J({kind:"quit"})),Q.question($,(Y)=>{if(Y.trim())Z.unshift(Y);J(KK(Y))})})}function Qk($,Z){return Math.max(1,Math.ceil(XK($)/Z))}function Xk(){nb(process.stdin);let $=process.stdout,Z=1,z=[],Q=(X,J)=>{if(Z>1)$.write(`\x1B[${Z-1}A`);$.write(`\r\x1B[J${X}${J}`),Z=Qk(X+J,$.columns||80)};return{ask:(X,J)=>J===null?zk(X,z):new Promise((Y)=>{let U=YK(J.suggestion,J.help);Z=1,Q(X,hz(U,{gray:M})),process.stdin.setRawMode(!0),process.stdin.resume();let W=(G,V)=>{let q=UK(U,V??{sequence:G});if(U=q.state,q.done){process.stdin.off("keypress",W),process.stdin.setRawMode(!1),process.stdin.pause();let K=q.done.kind==="value"?q.done.value:M(q.done.kind);Q(X,K),$.write(`
609
- `),Y(q.done);return}Q(X,hz(U,{gray:M}))};process.stdin.on("keypress",W)}),close:()=>{}}}l();var Zv="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 KH($){if($==="analyze")await Qv();else if($==="enhance")console.error(Zv),process.exit(1);else console.log(`${A("ai")} ${M("— ask Claude for suggestions about project.faf")}
610
- `),console.log(` ${C("faf ai analyze")} ${M("— get improvement suggestions")}`),console.log(""),console.log(M(" Requires ANTHROPIC_API_KEY environment variable."))}async function zv(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
614
+ Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=0;if($.resume){let H=dz(IK(z));if(H)Q=H.slotIndex,console.log(M(` resuming from slot #${Q+1}`))}let X=a(Z),J=o(Z,()=>v0(P0(l(Z)))),Y=X0.filter((H)=>{let D=A4(X,H.path);return J0(D)&&D!==X4});if(Hk(X,Y.map((H)=>H.path)),Y.length===0){console.log(`${A("◆")} go all slots populated — ✪ Trophy`),w0(J,Z);return}console.log(`${A("go")} ${M("— guided interview to ✪ Trophy")}`);let U=Y.length===1?"slot":"slots";console.log(M(` ${Y.length} ${U} from Trophy. Enter a value, "skip" to skip, or "quit" to stop.
615
+ `));let W=Boolean(process.stdin.isTTY&&process.stdout.isTTY),G=W?P4(z,X):{},V=W?Ik():Dk(),q=0,K=!1,L=Y.slice(Q);for(let H=0;H<L.length;H++){let D=L[H],N=A4(X,D.path),_=Lk(D.path,N,G),E=G[D.path]?.source;if(_?.suggestion&&E)console.log(M(` suggested from ${E}`));let j=await V.ask(Bk(D,N),_);if(j.kind==="quit"){if(K=!0,qk(z,{slotIndex:Q+H,fafPath:Z}))console.log(M(`
616
+ session saved. Resume with: faf go --resume`));break}if(j.kind==="skip")continue;LZ(X,D.path,j.value),q++}if(V.close(),q>0)k0(Z,X,{onAliasKept:(H)=>console.log(M(` ${b2(H)}`))}),console.log(`
617
+ ${A("◆")} go filled ${q} slot${q===1?"":"s"}`);let B=o(Z,()=>v0(P0(l(Z))));if(w0(B,Z),q>0)Mk(Z,B.score,q);if(!K)Kk(z)}function Mk($,Z,z){let Q=new s0(Vk($));if(!Q.exists())return;Q.recordGrowth(Z,[`faf go — filled ${z} slot${z===1?"":"s"}`]),_6(Q)}function Lk($,Z,z){if(!m3($)||i2(Z))return null;return{suggestion:z[$]?.value??"",help:MG($)}}function AK($){let Z=$.trim();if(Z.toLowerCase()==="quit")return{kind:"quit"};if(Z===""||Z.toLowerCase()==="skip")return{kind:"skip"};return{kind:"value",value:Z}}function Dk(){let $=OK({input:process.stdin,terminal:!1}),Z=[],z=[],Q=!1;return $.on("line",(X)=>{let J=z.shift();if(J)J(X);else Z.push(X)}),$.on("close",()=>{Q=!0;for(let X of z.splice(0))X(null)}),{ask:(X)=>new Promise((J)=>{process.stdout.write(X);let Y=(U)=>{process.stdout.write(`
618
+ `),J(U===null?{kind:"skip"}:AK(U))};if(Z.length>0)Y(Z.shift());else if(Q)Y(null);else z.push(Y)}),close:()=>$.close()}}function Ok($,Z){return new Promise((z)=>{let Q=OK({input:process.stdin,output:process.stdout,terminal:!0,history:[...Z],historySize:100}),X=!1,J=(Y)=>{if(X)return;X=!0,Q.close(),process.stdin.pause(),z(Y)};Q.on("SIGINT",()=>{process.stdout.write(`
619
+ `),J({kind:"quit"})}),Q.on("close",()=>J({kind:"quit"})),Q.question($,(Y)=>{if(Y.trim())Z.unshift(Y);J(AK(Y))})})}function Nk($,Z){return Math.max(1,Math.ceil(BK($)/Z))}function Ik(){Gk(process.stdin);let $=process.stdout,Z=1,z=[],Q=(X,J)=>{if(Z>1)$.write(`\x1B[${Z-1}A`);$.write(`\r\x1B[J${X}${J}`),Z=Nk(X+J,$.columns||80)};return{ask:(X,J)=>J===null?Ok(X,z):new Promise((Y)=>{let U=LK(J.suggestion,J.help);Z=1,Q(X,lz(U,{gray:M})),process.stdin.setRawMode(!0),process.stdin.resume();let W=(G,V)=>{let q=DK(U,V??{sequence:G});if(U=q.state,q.done){process.stdin.off("keypress",W),process.stdin.setRawMode(!1),process.stdin.pause();let K=q.done.kind==="value"?q.done.value:M(q.done.kind);Q(X,K),$.write(`
620
+ `),Y(q.done);return}Q(X,lz(U,{gray:M}))};process.stdin.on("keypress",W)}),close:()=>{}}}i();var Dv="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 AH($){if($==="analyze")await Nv();else if($==="enhance")console.error(Dv),process.exit(1);else console.log(`${A("ai")} ${M("— ask Claude for suggestions about project.faf")}
621
+ `),console.log(` ${C("faf ai analyze")} ${M("— get improvement suggestions")}`),console.log(""),console.log(M(" Requires ANTHROPIC_API_KEY environment variable."))}async function Ov(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
611
622
 
612
- export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (qH(),VH));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
623
+ export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (TH(),IH));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
613
624
 
614
- npm install @anthropic-ai/sdk`),process.exit(2)}}async function Qv(){let $=m();if(!$)console.error(`Error: project.faf not found
625
+ npm install @anthropic-ai/sdk`),process.exit(2)}}async function Nv(){let $=c();if(!$)console.error(`Error: project.faf not found
615
626
 
616
- Run 'faf init' to create one.`),process.exit(2);let Z=p($);console.log(`${A("ai")} analyze ${M("getting suggestions...")}`);let z=await zv(),Q;try{Q=await z.messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:`Analyze this .faf project context file and provide 3-5 specific suggestions for improvement. Focus on completeness, accuracy, and best practices.
627
+ Run 'faf init' to create one.`),process.exit(2);let Z=l($);console.log(`${A("ai")} analyze ${M("getting suggestions...")}`);let z=await Ov(),Q;try{Q=await z.messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:`Analyze this .faf project context file and provide 3-5 specific suggestions for improvement. Focus on completeness, accuracy, and best practices.
617
628
 
618
629
  ${Z}
619
630
 
620
- Be concise. One line per suggestion.`}]})}catch(X){console.error(`Error: the Anthropic API call failed (${X instanceof Error?X.message:String(X)}). Nothing was written.`),process.exit(1)}console.log(""),console.log(Q.content[0].text)}import{existsSync as $X,readFileSync as ZX,readdirSync as Xv}from"fs";import{join as HH}from"path";l();function BH($,Z){if($==="import")Jv(Z);else if($==="export")Yv();else console.log(`${A("conductor")} ${M("— conductor integration")}
621
- `),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 Jv($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!$X($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:k1,project:{}},z;if($X($)&&$.endsWith(".json")){let J=JSON.parse(ZX($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)z=J.description;if(J.language)Z.project.main_language=J.language}else if($X($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let J=h0(ZX($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)z=J.description;if(J.language)Z.project.main_language=J.language}else try{let J=Xv($);for(let Y of J){let U=HH($,Y);if(Y.endsWith(".json"))try{let W=JSON.parse(ZX(U,"utf-8"));if(W.name&&!Z.project.name)Z.project.name=W.name;if(W.description&&!z)z=W.description}catch{}}}catch{console.error(`Error: could not read directory: ${$}`),process.exit(2)}let Q=process.cwd(),X=m(Q);if(X){let J=t(X);if(!J.project)J.project={};if(Z.project.name&&!J.project.name)J.project.name=Z.project.name;if(Z.project.main_language&&!J.project.main_language)J.project.main_language=Z.project.main_language;b0(X,J,{onAliasKept:(Y)=>console.log(M(` ${y2(Y)}`))}),console.log(`${A("◆")} conductor import merged into ${X}`)}else{let J=HH(Q,"project.faf");b0(J,Z),console.log(`${A("◆")} conductor import created ${J}`)}if(z)console.log(M(` The config's description was not written: the goal is yours to fill: 'faf go', or 'faf edit project.goal "<goal>"'.
622
- It said: ${z}`))}function Yv(){let $=m();if(!$)console.error(`Error: project.faf not found
631
+ Be concise. One line per suggestion.`}]})}catch(X){console.error(`Error: the Anthropic API call failed (${X instanceof Error?X.message:String(X)}). Nothing was written.`),process.exit(1)}console.log(""),console.log(Q.content[0].text)}import{existsSync as YX,readFileSync as UX,readdirSync as Iv}from"fs";import{join as CH}from"path";i();function _H($,Z){if($==="import")Tv(Z);else if($==="export")Av();else console.log(`${A("conductor")} ${M("— conductor integration")}
632
+ `),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 Tv($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!YX($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:u1,project:{}},z;if(YX($)&&$.endsWith(".json")){let J=JSON.parse(UX($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)z=J.description;if(J.language)Z.project.main_language=J.language}else if(YX($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let J=S0(UX($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)z=J.description;if(J.language)Z.project.main_language=J.language}else try{let J=Iv($);for(let Y of J){let U=CH($,Y);if(Y.endsWith(".json"))try{let W=JSON.parse(UX(U,"utf-8"));if(W.name&&!Z.project.name)Z.project.name=W.name;if(W.description&&!z)z=W.description}catch{}}}catch{console.error(`Error: could not read directory: ${$}`),process.exit(2)}let Q=process.cwd(),X=c(Q);if(X){let J=a(X);if(!J.project)J.project={};if(Z.project.name&&!J.project.name)J.project.name=Z.project.name;if(Z.project.main_language&&!J.project.main_language)J.project.main_language=Z.project.main_language;k0(X,J,{onAliasKept:(Y)=>console.log(M(` ${b2(Y)}`))}),console.log(`${A("◆")} conductor import merged into ${X}`)}else{let J=CH(Q,"project.faf");k0(J,Z),console.log(`${A("◆")} conductor import created ${J}`)}if(z)console.log(M(` The config's description was not written: the goal is yours to fill: 'faf go', or 'faf edit project.goal "<goal>"'.
633
+ It said: ${z}`))}function Av(){let $=c();if(!$)console.error(`Error: project.faf not found
623
634
 
624
- Run 'faf init' to create one.`),process.exit(2);let Z=t($),z={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(z,null,2))}l();import{readdirSync as Uv,readFileSync as Wv,existsSync as Gv}from"fs";import{join as Vv}from"path";var qv=["BRAKE","ENGINE","AERO","TYRE","PIT"],Kv=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function Hv($){let Z=$.match(Kv);if(!Z)return null;return Z[1].toUpperCase()}function Bv($){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 Mv($,Z,z){let Q=Z;for(let X=0;X<4;X++){while(Q<$.length&&/\s/.test($[Q]))Q++;let J=$[Q];if(J==="'"||J==='"'||J==="`"){let U=Q+1;while(U<$.length&&$[U]!==J){if($[U]==="\\")U++;else if(J!=="`"&&$[U]===`
625
- `)return null;U++}return U<$.length?{name:$.slice(Q+1,U),end:U}:null}if(!z)return null;let Y=Lv($,Q-1);if(Y<0)return null;Q=Y+1;while(Q<$.length&&/\s/.test($[Q]))Q++;if($[Q]!=="(")return null;Q++}return null}function Lv($,Z){let z=0;for(let Q=Z;Q<$.length;Q++){let X=$[Q];if(X==="'"||X==='"'||X==="`"){for(Q++;Q<$.length&&$[Q]!==X;Q++)if($[Q]==="\\")Q++}else if(X==="(")z++;else if(X===")"&&--z===0)return Q}return-1}function Dv($,Z){let z=[];switch(Z){case"typescript":{let Q=[],X=/\b(describe|test|it)((?:\.[A-Za-z]+)*)\s*\(/g,J;while((J=X.exec($))!==null){let V=Mv($,J.index+J[0].length,J[2]!=="");if(V)Q.push({idx:V.end,type:J[1]==="describe"?"describe":"test",name:V.name})}let Y=[],U=0,W=null,G=0;for(let V=0;V<$.length;V++){while(G<Q.length&&Q[G].idx===V){let K=Q[G];if(K.type==="describe")W=K.name;else{let H=Y.map((B)=>B.name),L=H.length>0?`${H.join(" > ")} > ${K.name}`:K.name;z.push(L)}G++}let q=$[V];if(q==="{"){if(U++,W!==null&&/(?:=>|\))\s*$/.test($.slice(Math.max(0,V-40),V)))Y.push({name:W,openDepth:U}),W=null}else if(q==="}"){U--;while(Y.length>0&&U<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 Ov=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage","fixtures","__fixtures__"]);function MH($,Z=[]){let z;try{z=Uv($,{withFileTypes:!0})}catch{return Z}for(let Q of z){if(Ov.has(Q.name))continue;if(Q.name.startsWith(".")&&Q.name!==".")continue;let X=Vv($,Q.name);if(Q.isDirectory())MH(X,Z);else if(Q.isFile())Z.push(X)}return Z}function Nv($){let Z=[];if(!Gv($))return Z;let z=MH($);for(let Q of z){let X=Q.split("/").pop()??"",J=Bv(X);if(!J.ok||!J.lang)continue;let Y;try{Y=Wv(Q,"utf-8")}catch{continue}if(J.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(J.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let U=Dv(Y,J.lang),W=Q.replace(`${$}/`,"");for(let G of U)Z.push({file:W,language:J.lang,testName:G,tier:Hv(G)})}return Z}function Iv($){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 Tv($){if(console.log(`${A(C("faf wjttc"))} ${M("— vendor-neutral test audit")}`),console.log(""),console.log(` Files scanned: ${C(String($.filesScanned))}`),console.log(` Tests found: ${C(String($.totalTests))}`),console.log(""),$.totalTests===0){console.log(M(" no tests found"));return}console.log(M(" Tiers:"));for(let Z of qv){let z=$.byTier[Z],Q=(z/$.totalTests*100).toFixed(0),X=Z==="BRAKE"?P0("●"):Z==="ENGINE"?A("●"):Z==="AERO"?M("●"):Z==="TYRE"?A("◐"):M("○");console.log(` ${X} ${Z.padEnd(7)} ${C(String(z).padStart(4))} ${M(`(${Q}%)`)}`)}if($.untiered>0){let Z=($.untiered/$.totalTests*100).toFixed(0);console.log(` ${M("○")} ${"untiered".padEnd(7)} ${C(String($.untiered).padStart(4))} ${M(`(${Z}%)`)}`)}if($.untiered>0&&$.untieredExamples.length>0){console.log(""),console.log(M(` Untiered examples (first ${$.untieredExamples.length}):`));for(let Z of $.untieredExamples)console.log(` ${M("·")} ${Z}`)}if(Object.keys($.byLanguage).length>1){console.log(""),console.log(M(" Languages:"));for(let[Z,z]of Object.entries($.byLanguage))console.log(` ${M("·")} ${Z.padEnd(12)} ${C(String(z))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(P0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function LH($={}){let Z=$.path??"tests",z=Nv(Z),Q=Iv(z);if($.json)console.log(JSON.stringify(Q,null,2));else Tv(Q);if($.strict&&Q.untiered>0)process.exit(1)}import{createHash as NH}from"crypto";import{readFileSync as Av,existsSync as Cv}from"fs";import{join as _v,dirname as Rv}from"path";l();var DH="faf-bench/1",Pv={"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 stage is it at, and since when?","human_context.how":"How does it work?"};function Fv($,Z){return Pv[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var jv=[["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"]],w8=new Map;jv.forEach(($,Z)=>$.forEach((z)=>w8.set(z,Z)));var Sv=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function zX($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function OH($){return zX($).split(" ").filter((Z)=>Z&&!Sv.has(Z))}function Ev($,Z){let z=zX($),Q=zX(Z);if(!z||!Q)return!1;if(z===Q)return!0;let X=w8.get(z);if(X!==void 0&&w8.get(Q)===X)return!0;let J=OH($);if(J.length===0)return!1;let Y=new Set(OH(Z));return J.every((U)=>{if(Y.has(U))return!0;let W=w8.get(U);return W!==void 0&&[...Y].some((G)=>w8.get(G)===W)})}function wv($){let Z=D0($),z=h0($),Q=[],X={},J=0;for(let W of J0){if(Z.slots[W.path]!=="populated")continue;let G=t$(z,W);if(typeof G!=="string")continue;let V=G.trim();if(!V||p9.has(V.toLowerCase()))continue;J+=1,Q.push({n:J,path:W.path,question:Fv(W.path,W.description)}),X[J]=V}let Y=JSON.stringify({v:DH,q:Q.map((W)=>[W.path,W.question])}),U=NH("sha256").update(Y).digest("hex").slice(0,12);return{version:DH,qsetHash:U,questions:Q,answers:X}}function xv($,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()!==""&&Ev($.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 IH=".faf-bench.json";function TH($){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)}
626
- `===Z}catch{return!1}}function yv($){let Z=f0(i($,IH));if(Z===null||!TH(Z))return{state:null,bytes:Z};return{state:JSON.parse(Z.toString("utf-8")),bytes:Z}}function bv($,Z,z){x2(_v($,IH),`${JSON.stringify(Z,null,2)}
627
- `,{root:$,owns:TH,mark:"faf bench state (2-space JSON with version, qsetHash and protocol)",expect:z})}function QX($,Z){let z=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:z,hash:NH("sha256").update(z).digest("hex")}}var B7=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function kv($,Z){let{cold:z,faf:Q}=$;console.log(`
635
+ Run 'faf init' to create one.`),process.exit(2);let Z=a($),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 Cv,readFileSync as _v,existsSync as Pv}from"fs";import{join as Fv}from"path";var Rv=["BRAKE","ENGINE","AERO","TYRE","PIT"],jv=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function Sv($){let Z=$.match(jv);if(!Z)return null;return Z[1].toUpperCase()}function Ev($){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 wv($,Z,z){let Q=Z;for(let X=0;X<4;X++){while(Q<$.length&&/\s/.test($[Q]))Q++;let J=$[Q];if(J==="'"||J==='"'||J==="`"){let U=Q+1;while(U<$.length&&$[U]!==J){if($[U]==="\\")U++;else if(J!=="`"&&$[U]===`
636
+ `)return null;U++}return U<$.length?{name:$.slice(Q+1,U),end:U}:null}if(!z)return null;let Y=xv($,Q-1);if(Y<0)return null;Q=Y+1;while(Q<$.length&&/\s/.test($[Q]))Q++;if($[Q]!=="(")return null;Q++}return null}function xv($,Z){let z=0;for(let Q=Z;Q<$.length;Q++){let X=$[Q];if(X==="'"||X==='"'||X==="`"){for(Q++;Q<$.length&&$[Q]!==X;Q++)if($[Q]==="\\")Q++}else if(X==="(")z++;else if(X===")"&&--z===0)return Q}return-1}function yv($,Z){let z=[];switch(Z){case"typescript":{let Q=[],X=/\b(describe|test|it)((?:\.[A-Za-z]+)*)\s*\(/g,J;while((J=X.exec($))!==null){let V=wv($,J.index+J[0].length,J[2]!=="");if(V)Q.push({idx:V.end,type:J[1]==="describe"?"describe":"test",name:V.name})}let Y=[],U=0,W=null,G=0;for(let V=0;V<$.length;V++){while(G<Q.length&&Q[G].idx===V){let K=Q[G];if(K.type==="describe")W=K.name;else{let L=Y.map((H)=>H.name),B=L.length>0?`${L.join(" > ")} > ${K.name}`:K.name;z.push(B)}G++}let q=$[V];if(q==="{"){if(U++,W!==null&&/(?:=>|\))\s*$/.test($.slice(Math.max(0,V-40),V)))Y.push({name:W,openDepth:U}),W=null}else if(q==="}"){U--;while(Y.length>0&&U<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 bv=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage","fixtures","__fixtures__"]);function PH($,Z=[]){let z;try{z=Cv($,{withFileTypes:!0})}catch{return Z}for(let Q of z){if(bv.has(Q.name))continue;if(Q.name.startsWith(".")&&Q.name!==".")continue;let X=Fv($,Q.name);if(Q.isDirectory())PH(X,Z);else if(Q.isFile())Z.push(X)}return Z}function kv($){let Z=[];if(!Pv($))return Z;let z=PH($);for(let Q of z){let X=Q.split("/").pop()??"",J=Ev(X);if(!J.ok||!J.lang)continue;let Y;try{Y=_v(Q,"utf-8")}catch{continue}if(J.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(J.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let U=yv(Y,J.lang),W=Q.replace(`${$}/`,"");for(let G of U)Z.push({file:W,language:J.lang,testName:G,tier:Sv(G)})}return Z}function vv($){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 gv($){if(console.log(`${A(C("faf wjttc"))} ${M("— vendor-neutral test audit")}`),console.log(""),console.log(` Files scanned: ${C(String($.filesScanned))}`),console.log(` Tests found: ${C(String($.totalTests))}`),console.log(""),$.totalTests===0){console.log(M(" no tests found"));return}console.log(M(" Tiers:"));for(let Z of Rv){let z=$.byTier[Z],Q=(z/$.totalTests*100).toFixed(0),X=Z==="BRAKE"?_0("●"):Z==="ENGINE"?A("●"):Z==="AERO"?M("●"):Z==="TYRE"?A("◐"):M("○");console.log(` ${X} ${Z.padEnd(7)} ${C(String(z).padStart(4))} ${M(`(${Q}%)`)}`)}if($.untiered>0){let Z=($.untiered/$.totalTests*100).toFixed(0);console.log(` ${M("○")} ${"untiered".padEnd(7)} ${C(String($.untiered).padStart(4))} ${M(`(${Z}%)`)}`)}if($.untiered>0&&$.untieredExamples.length>0){console.log(""),console.log(M(` Untiered examples (first ${$.untieredExamples.length}):`));for(let Z of $.untieredExamples)console.log(` ${M("·")} ${Z}`)}if(Object.keys($.byLanguage).length>1){console.log(""),console.log(M(" Languages:"));for(let[Z,z]of Object.entries($.byLanguage))console.log(` ${M("·")} ${Z.padEnd(12)} ${C(String(z))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(_0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function FH($={}){let Z=$.path??"tests",z=kv(Z),Q=vv(z);if($.json)console.log(JSON.stringify(Q,null,2));else gv(Q);if($.strict&&Q.untiered>0)process.exit(1)}import{createHash as SH}from"crypto";import{readFileSync as hv,existsSync as fv}from"fs";import{join as uv,dirname as mv}from"path";i();var RH="faf-bench/1",cv={"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 stage is it at, and since when?","human_context.how":"How does it work?"};function pv($,Z){return cv[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var lv=[["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"]],v8=new Map;lv.forEach(($,Z)=>$.forEach((z)=>v8.set(z,Z)));var dv=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function WX($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function jH($){return WX($).split(" ").filter((Z)=>Z&&!dv.has(Z))}function iv($,Z){let z=WX($),Q=WX(Z);if(!z||!Q)return!1;if(z===Q)return!0;let X=v8.get(z);if(X!==void 0&&v8.get(Q)===X)return!0;let J=jH($);if(J.length===0)return!1;let Y=new Set(jH(Z));return J.every((U)=>{if(Y.has(U))return!0;let W=v8.get(U);return W!==void 0&&[...Y].some((G)=>v8.get(G)===W)})}function nv($){let Z=M0($),z=S0($),Q=[],X={},J=0;for(let W of X0){if(Z.slots[W.path]!=="populated")continue;let G=Q4(z,W);if(typeof G!=="string")continue;let V=G.trim();if(!V||r9.has(V.toLowerCase()))continue;J+=1,Q.push({n:J,path:W.path,question:pv(W.path,W.description)}),X[J]=V}let Y=JSON.stringify({v:RH,q:Q.map((W)=>[W.path,W.question])}),U=SH("sha256").update(Y).digest("hex").slice(0,12);return{version:RH,qsetHash:U,questions:Q,answers:X}}function rv($,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()!==""&&iv($.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 EH=".faf-bench.json";function wH($){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)}
637
+ `===Z}catch{return!1}}function sv($){let Z=f0(n($,EH));if(Z===null||!wH(Z))return{state:null,bytes:Z};return{state:JSON.parse(Z.toString("utf-8")),bytes:Z}}function ov($,Z,z){y2(uv($,EH),`${JSON.stringify(Z,null,2)}
638
+ `,{root:$,owns:wH,mark:"faf bench state (2-space JSON with version, qsetHash and protocol)",expect:z})}function GX($,Z){let z=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:z,hash:SH("sha256").update(z).digest("hex")}}var N7=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function av($,Z){let{cold:z,faf:Q}=$;console.log(`
628
639
  ${C(`faf bench — ${Z}`)}
629
- `),console.log(` ${M("without context")} ${A("with .faf")}`),console.log(`answers ${z.score}/${z.total} ${C(`${Q.score}/${Q.total}`)}`),console.log(`tokens ${B7(z.tokens)} ${B7(Q.tokens)}`);let X=z.total-z.score;if(X>0)console.log(`
630
- ${M(`The ${X} missing answer${X===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(M("Structured context closes the gap."));let J=QX($,Z);console.log(`
631
- ${P0("✪ BENCH RECEIPT")}`),console.log(M(` qset: ${$.qsetHash} protocol: ${$.protocol} model: ${Q.model??z.model??"unreported"}`)),console.log(M(` cold ${z.score}/${z.total} · faf ${Q.score}/${Q.total} · sha256: ${J.hash.slice(0,16)}…`))}function vv($,Z){let z=$.cold,Q=z.total-z.score;if(console.log(`
632
- ${C(`faf bench — ${Z}`)} ${P0("Trouble ahead, expensive trouble.")}
633
- `),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 ${B7(z.tokens)} ${M("— re-derivation burn, paid again EVERY session")}`);if(Q>0)console.log(`
640
+ `),console.log(` ${M("without context")} ${A("with .faf")}`),console.log(`answers ${z.score}/${z.total} ${C(`${Q.score}/${Q.total}`)}`),console.log(`tokens ${N7(z.tokens)} ${N7(Q.tokens)}`);let X=z.total-z.score;if(X>0)console.log(`
641
+ ${M(`The ${X} missing answer${X===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(M("Structured context closes the gap."));let J=GX($,Z);console.log(`
642
+ ${_0("✪ 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 tv($,Z){let z=$.cold,Q=z.total-z.score;if(console.log(`
643
+ ${C(`faf bench — ${Z}`)} ${_0("Trouble ahead, expensive trouble.")}
644
+ `),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 ${N7(z.tokens)} ${M("— re-derivation burn, paid again EVERY session")}`);if(Q>0)console.log(`
634
645
  ${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(`
635
- ${A("→ faf init && faf bench")} ${M("(close the gap, get the receipt)")}`)}var gv="https://mcpaas.live/bench/submit";async function hv($,Z){try{let z=await fetch(Z,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)});console.log(M(z.ok?` ✪ submitted to ${Z}`:` submit failed (${z.status})`))}catch{console.log(M(" submit skipped (endpoint unreachable)"))}}function AH($,Z,z={}){let Q=z.file??m();if(!Q)console.error(`Error: project.faf not found
646
+ ${A("→ faf init && faf bench")} ${M("(close the gap, get the receipt)")}`)}var ev="https://mcpaas.live/bench/submit";async function $g($,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 xH($,Z,z={}){let Q=z.file??c();if(!Q)console.error(`Error: project.faf not found
636
647
 
637
- Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let X=p(Q);U2(X,Q);let J=a(Q,()=>wv(X)),Y=Rv(Q),U=h0(X)?.project?.name??Y.split("/").pop();if(J.questions.length===0)console.error("Error: no populated slots to derive questions from.\n\n Run `faf go` to fill the .faf first."),process.exit(2);if($==="questions"){if(z.json){console.log(JSON.stringify({version:J.version,qsetHash:J.qsetHash,questions:J.questions.map(({n:W,question:G})=>({n:W,question:G}))},null,2));return}console.log(`
648
+ Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let X=l(Q);U2(X,Q);let J=o(Q,()=>nv(X)),Y=mv(Q),U=S0(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:W,question:G})=>({n:W,question:G}))},null,2));return}console.log(`
638
649
  ${C(`faf bench — ${J.questions.length} questions`)} ${M(`qset ${J.qsetHash}`)}
639
650
  `);for(let W of J.questions)console.log(` ${String(W.n).padStart(2)}. ${W.question}`);console.log(`
640
- ${M('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!Cv(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let W=JSON.parse(Av(Z,"utf-8")),G=W.answers??W,V=xv(J,G),q={score:V.correct,total:V.total,...z.tokens?{tokens:parseInt(z.tokens,10)}:{},...z.model?{model:z.model}:{}},{state:K,bytes:H}=yv(Y),L=K&&K.qsetHash===J.qsetHash?K:{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(bv(Y,L,H),z.json){let B=QX(L,U);console.log(JSON.stringify({...L,receipt:B.hash,perQuestion:V.perQuestion},null,2));return}if(L.cold&&L.faf)kv(L,U);if(z.submit&&L.cold&&L.faf){let{cold:B,faf:D}=L,N=QX(L,U);hv({date:new Date().toISOString().slice(0,10),model:D.model??B.model??z.model??"unreported",repo:U,qset:L.qsetHash,cold:`${B.score}/${B.total}`,faf:`${D.score}/${D.total}`,sha256:N.hash.slice(0,16)},z.endpoint??gv)}else if(L.cold)vv(L,U);else console.log(`
641
- ${C(`faf bench — ${U}`)} ${A("with .faf")}: ${C(`${q.score}/${q.total}`)} ${M(`tokens ${B7(q.tokens)}`)}`),console.log(M("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
651
+ ${M('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!fv(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let W=JSON.parse(hv(Z,"utf-8")),G=W.answers??W,V=rv(J,G),q={score:V.correct,total:V.total,...z.tokens?{tokens:parseInt(z.tokens,10)}:{},...z.model?{model:z.model}:{}},{state:K,bytes:L}=sv(Y),B=K&&K.qsetHash===J.qsetHash?K:{version:J.version,qsetHash:J.qsetHash,protocol:"in-session"};if(z.cold)B.cold=q;else if(z.faf)B.faf=q;else console.error("Error: specify the run mode — --cold (no context) or --faf (after reading project.faf)."),process.exit(2);if(ov(Y,B,L),z.json){let H=GX(B,U);console.log(JSON.stringify({...B,receipt:H.hash,perQuestion:V.perQuestion},null,2));return}if(B.cold&&B.faf)av(B,U);if(z.submit&&B.cold&&B.faf){let{cold:H,faf:D}=B,N=GX(B,U);$g({date:new Date().toISOString().slice(0,10),model:D.model??H.model??z.model??"unreported",repo:U,qset:B.qsetHash,cold:`${H.score}/${H.total}`,faf:`${D.score}/${D.total}`,sha256:N.hash.slice(0,16)},z.endpoint??ev)}else if(B.cold)tv(B,U);else console.log(`
652
+ ${C(`faf bench — ${U}`)} ${A("with .faf")}: ${C(`${q.score}/${q.total}`)} ${M(`tokens ${N7(q.tokens)}`)}`),console.log(M("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
642
653
  ${C("faf bench — agent-native protocol")} ${M(`qset ${J.qsetHash} · ${J.questions.length} questions`)}
643
654
  `),console.log(`${C("COLD phase")} ${M("(fresh AI session, repo access)")}`),console.log(' 1. Instruct: "Answer these questions from the repository.'),console.log(' Do NOT read project.faf, CLAUDE.md, AGENTS.md, or any *.faf file."'),console.log(` 2. ${A("faf bench questions")} — hand them over; answers terse, saved as cold.json`),console.log(` 3. ${A("faf bench grade cold.json --cold --tokens <used> --model <name>")}
644
655
  `),console.log(`${C("FAF phase")} ${M("(same questions, context first)")}`),console.log(' 4. Instruct: "Read project.faf, then answer the same questions." → faf.json'),console.log(` 5. ${A("faf bench grade faf.json --faf --tokens <used> --model <name>")}
645
- `),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 fv}from"fs";import{dirname as uv,resolve as mv}from"path";l();function cv($){try{return fv($),!0}catch{return!1}}function pv($,Z,z,Q){let X=a(Q,()=>l5(Z));try{return x2($,X,{root:z,owns:n3,mark:r3}),{bytes:X.length,left:null}}catch(J){if(J instanceof v)return{bytes:null,left:J.message};throw J}}function lv({result:$,known:Z,drifted:z,delta:Q,prevScore:X,fafbBytes:J,fafbLeft:Y}){if(console.log(`${A("refresh")} ${M("— re-grounding on the live .faf")}
646
- `),!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 U=Q>0?"↑":"↓";console.log(` drift: ${M(`${X}%`)} ${U} ${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: ${C2($.tier)} ${C(`${$.score}%`)}`)}function CH($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
656
+ `),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 Zg}from"fs";import{dirname as zg,resolve as Qg}from"path";i();function Xg($){try{return Zg($),!0}catch{return!1}}function Jg($,Z,z,Q){let X=o(Q,()=>s5(Z));try{return y2($,X,{root:z,owns:Zz,mark:zz}),{bytes:X.length,left:null}}catch(J){if(J instanceof k)return{bytes:null,left:J.message};throw J}}function Yg({result:$,known:Z,drifted:z,delta:Q,prevScore:X,fafbBytes:J,fafbLeft:Y}){if(console.log(`${A("refresh")} ${M("— re-grounding on the live .faf")}
657
+ `),!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 U=Q>0?"↑":"↓";console.log(` drift: ${M(`${X}%`)} ${U} ${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: ${C2($.tier)} ${C(`${$.score}%`)}`)}function yH($={}){let Z=c();if(!Z)console.error(`Error: project.faf not found
647
658
 
648
- Run 'faf init' to create one.`),process.exit(2);let z=p(Z);U2(z,Z);let Q=a(Z,()=>D0(z)),X=new o0(process.cwd()),J=X.load()?X.getBirthDNADisplay():null,Y=J?J.current:null,U=!Q.unknown,W=U&&Y!==null&&Y!==void 0?Q.score-Y:0,G=U&&Y!==null&&Y!==void 0&&W!==0,V=s3(Z),q=null,K=null;if(cv(V))({bytes:q,left:K}=pv(V,z,uv(mv(Z)),Z));if($.json)console.log(JSON.stringify({reGrounded:U,score:Q.score,...U?{}:{unknown:!0},tier:Q.tier,baseline:Y,delta:W,drifted:G,fafb:q!==null&&q!==void 0?{reCompiled:!0,bytes:q}:{reCompiled:!1,...K!==null?{left:K}:{}},journey:X.getJourney()||null},null,2));else lv({result:Q,known:U,drifted:G,delta:W,prevScore:Y,fafbBytes:q,fafbLeft:K});if(!U)return;if(X.exists())X.recordGrowth(Q.score,["refresh — re-grounded"]),I6(X);else X.birth(Q.score)}l();import{existsSync as gH,lstatSync as Ug}from"fs";import{resolve as y8}from"path";var _H=["ephemeral","standard","high","critical"],L1=Object.fromEntries(_H.map(($,Z)=>[$,Z])),XX=new Set(["user","feedback","project","reference"]),JX=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),YX=new Set(["facts","sessions","preferences","custom"]),UX={low:"ephemeral",medium:"standard"};import{existsSync as dv}from"fs";import{dirname as EH,resolve as wH}from"path";function A$(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function H0($){return $===null||$===void 0}function iv($){if(Array.isArray($))return`a list (${$.length} item${$.length===1?"":"s"})`;if(H0($))return"empty";if(typeof $==="string")return`a string (${JSON.stringify($.length>40?`${$.slice(0,40)}…`:$)})`;return`a ${typeof $}`}var T$=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function nv($){let Z=wH($),z=i(EH(Z),Z,{read:!0});return{real:z,text:G0(z)}}function RH($,Z,z,Q){let X=wH($),J=i(EH(X),X),Y=z!==void 0&&z.real===J;if(Y&&z.text===Z)return J;let U;try{U=f0(J)}catch{U=void 0}if(U&&U.equals(Buffer.from(Z,"utf-8")))return J;if(!Y&&!Q&&U)throw new v("changed",X,`${X} already exists — not written; pass { replace: true } (faf memory convert --force) to replace it`,{onWrite:!0});let W=Y?z.text:Q?U:null;return o($,Z,W===void 0?{}:{expect:W})}function x8($){if(H0($))return"standard";if(UX[$])return UX[$];if($ in L1)return $;return"standard"}var rv=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function WX($){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(!rv.has(Q))z[Q]=X;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:x8(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 I$($){if(H0($.id)&&H0($.type)&&$.tags.length===0&&$.links.length===0&&H0($.timestamp)&&H0($.source)&&Object.keys($.extra).length===0&&$.priority==="standard")return $.text;let z={text:$.text};if(!H0($.id))z.id=$.id;if(!H0($.type))z.type=$.type;if(z.priority=$.priority,$.tags.length)z.tags=$.tags;if($.links.length)z.links=$.links;if(!H0($.timestamp))z.timestamp=$.timestamp;if(!H0($.source))z.source=$.source;return Object.assign(z,$.extra),z}function PH($){let Z=$;return T$($)&&typeof Z.text==="string"&&Array.isArray(Z.tags)&&Array.isArray(Z.links)&&T$(Z.extra)&&typeof Z.priority==="string"?Z:WX($)}function sv($){if(typeof $==="string"||T$($)&&"text"in $)return WX($);return null}var FH=["profile","namepoint","created","last_etched","retention"];class c0{namepoint;profile;retention;created;last_etched;_facts;_byId;_index;_sessions;_preferences;_custom;_extra;_memoryExtra;_version;_origin;_factAt=new WeakMap;_indexDerived=!0;_indexAtRecord=[];constructor($,Z={}){this.namepoint=$,this.profile=Z.profile??"knowledge",this.retention=Z.retention??"forever",this.created=Z.created??A$(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.map(PH):[],this._byId=new Map,this._facts.forEach((z,Q)=>{if(!H0(z.id))this._byId.set(z.id,Q)}),this._index=Z.index?Z.index.slice():[],this._sessions=Z.sessions?structuredClone(Z.sessions):[],this._preferences=Z.preferences?{...Z.preferences}:{},this._custom=Z.custom?{...Z.custom}:{},this._extra=Z.extra?{...Z.extra}:{},this._memoryExtra=Z.memoryExtra?{...Z.memoryExtra}:{},this._indexDerived=Z.index===void 0||M0(this._index,this.derivedIndex()),this._indexAtRecord=this._index.slice()}get facts(){return this._facts}get index(){return this._index}get sessions(){return this._sessions}get preferences(){return this._preferences}get custom(){return this._custom}get extra(){return this._extra}get memoryExtra(){return this._memoryExtra}static load($){if(!dv($))throw Error(`soul file not found: ${$}`);let{real:Z,text:z}=nv($);return c0.fromText(z,$,Z)}static fromText($,Z,z){let Q=r9($,Z).toJS();if(!T$(Q))throw Error(`soul is not a YAML mapping: ${Z} is ${iv(Q)}`);let X=new xH,J=X.pick("memory",Q.memory,$0)??{},Y=new c0(String(Q.namepoint??Z.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(Q.profile??"voice"),retention:String(Q.retention??"forever"),created:Q.created??null,...X.modelled(Q,J)});return(X.pick("memory.facts",J.facts,Array.isArray)??[]).forEach((U,W)=>{let G=sv(U);if(G)Y.adopt(G,W)}),Y.last_etched=String(Q.last_etched??Y.created),Y._version=H0(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($),!H0($.id))this._byId.set($.id,this._facts.length-1);this._factAt.set($,Z)}static fromFile($){return c0.load($)}toDoc(){let $={facts:this._facts.map(I$),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[z,Q]of Object.entries(this._memoryExtra))if(!YX.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(!JX.has(z))Z[z]=structuredClone(Q);return Z}toYaml(){return m6(this.toDoc(),{lineWidth:100})}derivedIndex($=80){return this._facts.map((Z)=>`${Z.id??"?"} — ${String(Z.text).slice(0,$)}`)}indexIsDerived($=80){return!this._origin?.residual.has("index")&&M0(this._index,this.derivedIndex($))}rebuildIndex($=80){return this._index=this.derivedIndex($),this._indexDerived=!0,this._indexAtRecord=this._index.slice(),this._index}save($,Z={}){let z=Z.reindex??(this._indexDerived&&M0(this._index,this._indexAtRecord));if(z)this.rebuildIndex();let Q=Z.replace===!0,X=this._origin;if(!X){let W=this.toYaml(),G=RH($,W,void 0,Q);return this.settle($,W,new Map(this._facts.map((V,q)=>[V,q])),G),$}let J=new Map,{text:Y}=g5(X.text,(W)=>{J=this.applyTo(W,X,z)},$),U=RH($,Y,X.real===void 0?void 0:{real:X.real,text:X.text},Q);return this.settle($,Y,J,U),$}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(I$(Z)))}return{top:Object.fromEntries(FH.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 FH)if(Q.top[Y]!==X.top[Y])$.set(Y,X.top[Y]);if(!M0(Q.index,X.index)){if(Z.residual.has("index")&&!z)c0.refuse(Z,"index","replace it");f5($,["index"],Z.residual.has("index")?void 0:Q.index,X.index,J)}for(let Y of SH(Q.extra,X.extra))f5($,[Y],Q.extra[Y],X.extra[Y],J);return this.applyMemory($,Z,Q,X),this.applyFacts($,Z)}applyMemory($,Z,z,Q){let X=[["sessions",z.sessions,Q.sessions],["preferences",z.preferences,Q.preferences],["custom",z.custom,Q.custom],...SH(z.memoryExtra,Q.memoryExtra).map((J)=>[J,z.memoryExtra[J],Q.memoryExtra[J]])];for(let[J,Y,U]of X){if(M0(Y,U))continue;if(Z.residual.has("memory"))c0.refuse(Z,"memory",`change memory.${J}`);if(Z.residual.has(`memory.${J}`))c0.refuse(Z,`memory.${J}`,"replace it");f5($,["memory",J],Y,U,Z.path)}}sortFacts($){let Z=[],z=[];for(let Q of this._facts){let X=this._factAt.get(Q);if(X===void 0){z.push(Q);continue}if(z.length>0||Z.length>0&&X<=Z[Z.length-1][1])throw Error(`${$.path}: the facts were reordered — faf keeps the order soul.fafm has. Nothing written.`);Z.push([Q,X])}return{kept:Z,added:z}}applyFacts($,Z){let{kept:z,added:Q}=this.sortFacts(Z),X=new Set(z.map(([,G])=>G)),J=[...Z.base.facts.keys()].filter((G)=>!X.has(G)).sort((G,V)=>V-G),Y=z.filter(([G,V])=>!M0(Z.base.facts.get(V),I$(G))),U=new Map(z);if(Q.length===0&&J.length===0&&Y.length===0)return U;for(let G of["memory","memory.facts"])if(Z.residual.has(G))c0.refuse(Z,G,"add facts to it");let W=PU($,["memory","facts"],Z.path);for(let[G,V]of Y)W.items[V]=av($,W.items[V],Z.base.facts.get(V),I$(G));for(let G of J)W.items.splice(G,1);for(let[G,V]of z)U.set(G,V-J.filter((q)=>q<V).length);for(let G of Q)U.set(G,W.items.length),W.items.push($.createNode(I$(G)));return U}add($){let Z=PH($);if(!H0(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),!H0(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=H0(Z.id)?null:this.getFact(Z.id);if(z)return this.add(ov(z,$,Z));return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:x8(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:A$(),source:Z.source??null,extra:{}})}recall($,Z={}){let z=T$($)?{...$,...Z}:Z,Q=T$($)?$.query:$,X=L1[x8(z.minPriority??"ephemeral")]??0,J=typeof Q==="string"?Q.toLowerCase():"",Y=new Set(z.tags??[]),U=[];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(!H0(z.type)&&G.type!==z.type)return;if((L1[G.priority]??1)<X)return;U.push([V,G])}),U.sort((G,V)=>{let q=L1[G[1].priority]??1,K=L1[V[1].priority]??1;if(K!==q)return K-q;let H=G[1].timestamp??"",L=V[1].timestamp??"";if(L!==H)return L<H?-1:L>H?1:0;return V[0]-G[0]});let W=U.map(([,G])=>G);if(!H0(z.limit))return W.slice(0,z.limit);return W}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(!H0(z.id))this._byId.set(z.id,Q)}),!0}}function ov($,Z,z){let Q=(X,J)=>H0(X)?J:X;return{...$,text:Z,type:Q(z.type,$.type),priority:H0(z.priority)?$.priority:x8(z.priority),tags:Q(z.tags,$.tags).slice(),links:Q(z.links,$.links).slice(),source:Q(z.source,$.source),timestamp:A$(),extra:{...$.extra}}}class xH{residual=new Map;pick($,Z,z){if(H0(Z))return;if(z(Z))return Z;this.residual.set($,p6(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:jH($,JX),memoryExtra:jH(Z,YX)}}}function jH($,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 av($,Z,z,Q){if(!B0(Z))return X4($,Z,z,Q);let X=(J)=>typeof J==="string"?{text:J}:J;return X4($,Z,X(z),X(Q))}import{readdirSync as tv,readFileSync as ev,statSync as yH,existsSync as $g}from"fs";import{join as Zg,basename as bH,resolve as zg}from"path";var kH=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),Qg=/\[\[([^\]]+)\]\]/g;function Xg($){let Z=yH($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function Jg($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let z=h0(Z[1]);if(!z||typeof z!=="object")return{fm:null,body:Z.slice(2).join("---").trim()};return{fm:z,body:Z.slice(2).join("---").trim()}}catch{return{fm:null,body:$}}}function Yg($,Z,z){if(!z.name)return null;let Q=z.metadata&&typeof z.metadata==="object"?z.metadata:{},X=Q.type;if(typeof X!=="string"||!XX.has(X))return null;let J=String(z.name).trim(),U=(z.description!==void 0&&z.description!==null&&String(z.description).trim()?String(z.description).trim():"")||J,W={};if(Q.originSessionId)W.provenance=[`session:${Q.originSessionId}`];let G=[...new Set([...Z.matchAll(Qg)].map((V)=>V[1]))].sort();return{text:U,id:J,type:X,priority:"standard",tags:[],links:G,timestamp:Xg($),source:`claude-code memory: ${bH($)}`,extra:W}}function GX($,Z={}){let z=zg($);if(!$g(z))throw Error(`Claude memory directory not found: ${z}`);if(!yH(z).isDirectory())throw Error(`Claude memory path is not a directory: ${z}`);let Q=Z.skip??kH,X=Z.namepoint??`@claude-code:${bH(z)}`,J=[],Y=tv(z).filter((q)=>q.endsWith(".md")).sort();for(let q of Y){if(Q.has(q))continue;let K=Zg(z,q),H;try{H=ev(K,"utf-8")}catch{continue}let{fm:L,body:B}=Jg(H);if(!L)continue;let D=Yg(K,B,L);if(D)J.push(D)}let U=J.map((q)=>q.timestamp).filter(Boolean),W=U.length?U.reduce((q,K)=>q<K?q:K):A$(),G=U.length?U.reduce((q,K)=>q>K?q:K):W,V=new c0(X,{profile:"knowledge",facts:J,created:W});return V.last_etched=G,V.rebuildIndex(),V}function Wg($){try{return Ug($),!0}catch{return!1}}function VX(){return y8(process.cwd(),"soul.fafm")}function qX($){let Z=y8($??VX());if(!gH(Z))console.error(`Error: soul file not found: ${Z}
659
+ Run 'faf init' to create one.`),process.exit(2);let z=l(Z);U2(z,Z);let Q=o(Z,()=>M0(z)),X=new s0(process.cwd()),J=X.load()?X.getBirthDNADisplay():null,Y=J?J.current:null,U=!Q.unknown,W=U&&Y!==null&&Y!==void 0?Q.score-Y:0,G=U&&Y!==null&&Y!==void 0&&W!==0,V=Qz(Z),q=null,K=null;if(Xg(V))({bytes:q,left:K}=Jg(V,z,zg(Qg(Z)),Z));if($.json)console.log(JSON.stringify({reGrounded:U,score:Q.score,...U?{}:{unknown:!0},tier:Q.tier,baseline:Y,delta:W,drifted:G,fafb:q!==null&&q!==void 0?{reCompiled:!0,bytes:q}:{reCompiled:!1,...K!==null?{left:K}:{}},journey:X.getJourney()||null},null,2));else Yg({result:Q,known:U,drifted:G,delta:W,prevScore:Y,fafbBytes:q,fafbLeft:K});if(!U)return;if(X.exists())X.recordGrowth(Q.score,["refresh — re-grounded"]),_6(X);else X.birth(Q.score)}i();import{existsSync as nH,lstatSync as Cg}from"fs";import{resolve as h8}from"path";var bH=["ephemeral","standard","high","critical"],N1=Object.fromEntries(bH.map(($,Z)=>[$,Z])),VX=new Set(["user","feedback","project","reference"]),qX=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),KX=new Set(["facts","sessions","preferences","custom"]),HX={low:"ephemeral",medium:"standard"};import{existsSync as Ug}from"fs";import{dirname as uH,resolve as mH}from"path";function R$(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function q0($){return $===null||$===void 0}function Wg($){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 F$=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function Gg($){let Z=mH($),z=n(uH(Z),Z,{read:!0});return{real:z,text:W0(z)}}function kH($,Z,z,Q){let X=mH($),J=n(uH(X),X),Y=z!==void 0&&z.real===J;if(Y&&z.text===Z)return J;let U;try{U=f0(J)}catch{U=void 0}if(U&&U.equals(Buffer.from(Z,"utf-8")))return J;if(!Y&&!Q&&U)throw new k("changed",X,`${X} already exists — not written; pass { replace: true } (faf memory convert --force) to replace it`,{onWrite:!0});let W=Y?z.text:Q?U:null;return s($,Z,W===void 0?{}:{expect:W})}function g8($){if(q0($))return"standard";if(HX[$])return HX[$];if($ in N1)return $;return"standard"}var Vg=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function BX($){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(!Vg.has(Q))z[Q]=X;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:g8(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 P$($){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 vH($){let Z=$;return F$($)&&typeof Z.text==="string"&&Array.isArray(Z.tags)&&Array.isArray(Z.links)&&F$(Z.extra)&&typeof Z.priority==="string"?Z:BX($)}function qg($){if(typeof $==="string"||F$($)&&"text"in $)return BX($);return null}var gH=["profile","namepoint","created","last_etched","retention"];class m0{namepoint;profile;retention;created;last_etched;_facts;_byId;_index;_sessions;_preferences;_custom;_extra;_memoryExtra;_version;_origin;_factAt=new WeakMap;_indexDerived=!0;_indexAtRecord=[];constructor($,Z={}){this.namepoint=$,this.profile=Z.profile??"knowledge",this.retention=Z.retention??"forever",this.created=Z.created??R$(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.map(vH):[],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||H0(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(!Ug($))throw Error(`soul file not found: ${$}`);let{real:Z,text:z}=Gg($);return m0.fromText(z,$,Z)}static fromText($,Z,z){let Q=e9($,Z).toJS();if(!F$(Q))throw Error(`soul is not a YAML mapping: ${Z} is ${Wg(Q)}`);let X=new cH,J=X.pick("memory",Q.memory,e)??{},Y=new m0(String(Q.namepoint??Z.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(Q.profile??"voice"),retention:String(Q.retention??"forever"),created:Q.created??null,...X.modelled(Q,J)});return(X.pick("memory.facts",J.facts,Array.isArray)??[]).forEach((U,W)=>{let G=qg(U);if(G)Y.adopt(G,W)}),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 m0.load($)}toDoc(){let $={facts:this._facts.map(P$),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[z,Q]of Object.entries(this._memoryExtra))if(!KX.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(!qX.has(z))Z[z]=structuredClone(Q);return Z}toYaml(){return l6(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")&&H0(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&&H0(this._index,this._indexAtRecord));if(z)this.rebuildIndex();let Q=Z.replace===!0,X=this._origin;if(!X){let W=this.toYaml(),G=kH($,W,void 0,Q);return this.settle($,W,new Map(this._facts.map((V,q)=>[V,q])),G),$}let J=new Map,{text:Y}=c5(X.text,(W)=>{J=this.applyTo(W,X,z)},$),U=kH($,Y,X.real===void 0?void 0:{real:X.real,text:X.text},Q);return this.settle($,Y,J,U),$}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(P$(Z)))}return{top:Object.fromEntries(gH.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 gH)if(Q.top[Y]!==X.top[Y])$.set(Y,X.top[Y]);if(!H0(Q.index,X.index)){if(Z.residual.has("index")&&!z)m0.refuse(Z,"index","replace it");l5($,["index"],Z.residual.has("index")?void 0:Q.index,X.index,J)}for(let Y of fH(Q.extra,X.extra))l5($,[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],...fH(z.memoryExtra,Q.memoryExtra).map((J)=>[J,z.memoryExtra[J],Q.memoryExtra[J]])];for(let[J,Y,U]of X){if(H0(Y,U))continue;if(Z.residual.has("memory"))m0.refuse(Z,"memory",`change memory.${J}`);if(Z.residual.has(`memory.${J}`))m0.refuse(Z,`memory.${J}`,"replace it");l5($,["memory",J],Y,U,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])=>!H0(Z.base.facts.get(V),P$(G))),U=new Map(z);if(Q.length===0&&J.length===0&&Y.length===0)return U;for(let G of["memory","memory.facts"])if(Z.residual.has(G))m0.refuse(Z,G,"add facts to it");let W=wU($,["memory","facts"],Z.path);for(let[G,V]of Y)W.items[V]=Hg($,W.items[V],Z.base.facts.get(V),P$(G));for(let G of J)W.items.splice(G,1);for(let[G,V]of z)U.set(G,V-J.filter((q)=>q<V).length);for(let G of Q)U.set(G,W.items.length),W.items.push($.createNode(P$(G)));return U}add($){let Z=vH($);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(Kg(z,$,Z));return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:g8(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:R$(),source:Z.source??null,extra:{}})}recall($,Z={}){let z=F$($)?{...$,...Z}:Z,Q=F$($)?$.query:$,X=N1[g8(z.minPriority??"ephemeral")]??0,J=typeof Q==="string"?Q.toLowerCase():"",Y=new Set(z.tags??[]),U=[];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((N1[G.priority]??1)<X)return;U.push([V,G])}),U.sort((G,V)=>{let q=N1[G[1].priority]??1,K=N1[V[1].priority]??1;if(K!==q)return K-q;let L=G[1].timestamp??"",B=V[1].timestamp??"";if(B!==L)return B<L?-1:B>L?1:0;return V[0]-G[0]});let W=U.map(([,G])=>G);if(!q0(z.limit))return W.slice(0,z.limit);return W}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 Kg($,Z,z){let Q=(X,J)=>q0(X)?J:X;return{...$,text:Z,type:Q(z.type,$.type),priority:q0(z.priority)?$.priority:g8(z.priority),tags:Q(z.tags,$.tags).slice(),links:Q(z.links,$.links).slice(),source:Q(z.source,$.source),timestamp:R$(),extra:{...$.extra}}}class cH{residual=new Map;pick($,Z,z){if(q0(Z))return;if(z(Z))return Z;this.residual.set($,i6(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:hH($,qX),memoryExtra:hH(Z,KX)}}}function hH($,Z){let z={};for(let[Q,X]of Object.entries($))if(!Z.has(Q))z[Q]=structuredClone(X);return z}function fH($,Z){return[...new Set([...Object.keys($),...Object.keys(Z)])]}function Hg($,Z,z,Q){if(!K0(Z))return G4($,Z,z,Q);let X=(J)=>typeof J==="string"?{text:J}:J;return G4($,Z,X(z),X(Q))}import{readdirSync as Bg,readFileSync as Mg,statSync as pH,existsSync as Lg}from"fs";import{join as Dg,basename as lH,resolve as Og}from"path";var dH=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),Ng=/\[\[([^\]]+)\]\]/g;function Ig($){let Z=pH($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function Tg($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let z=S0(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 Ag($,Z,z){if(!z.name)return null;let Q=z.metadata&&typeof z.metadata==="object"?z.metadata:{},X=Q.type;if(typeof X!=="string"||!VX.has(X))return null;let J=String(z.name).trim(),U=(z.description!==void 0&&z.description!==null&&String(z.description).trim()?String(z.description).trim():"")||J,W={};if(Q.originSessionId)W.provenance=[`session:${Q.originSessionId}`];let G=[...new Set([...Z.matchAll(Ng)].map((V)=>V[1]))].sort();return{text:U,id:J,type:X,priority:"standard",tags:[],links:G,timestamp:Ig($),source:`claude-code memory: ${lH($)}`,extra:W}}function MX($,Z={}){let z=Og($);if(!Lg(z))throw Error(`Claude memory directory not found: ${z}`);if(!pH(z).isDirectory())throw Error(`Claude memory path is not a directory: ${z}`);let Q=Z.skip??dH,X=Z.namepoint??`@claude-code:${lH(z)}`,J=[],Y=Bg(z).filter((q)=>q.endsWith(".md")).sort();for(let q of Y){if(Q.has(q))continue;let K=Dg(z,q),L;try{L=Mg(K,"utf-8")}catch{continue}let{fm:B,body:H}=Tg(L);if(!B)continue;let D=Ag(K,H,B);if(D)J.push(D)}let U=J.map((q)=>q.timestamp).filter(Boolean),W=U.length?U.reduce((q,K)=>q<K?q:K):R$(),G=U.length?U.reduce((q,K)=>q>K?q:K):W,V=new m0(X,{profile:"knowledge",facts:J,created:W});return V.last_etched=G,V.rebuildIndex(),V}function _g($){try{return Cg($),!0}catch{return!1}}function LX(){return h8(process.cwd(),"soul.fafm")}function DX($){let Z=h8($??LX());if(!nH(Z))console.error(`Error: soul file not found: ${Z}
649
660
 
650
- Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return c0.load(Z)}function Gg($,Z){if(!$)console.error(`Error: directory required
661
+ Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return m0.load(Z)}function Pg($,Z){if(!$)console.error(`Error: directory required
651
662
 
652
- faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let z=y8($),Q=y8(Z.output??VX());if(Wg(Q)&&!Z.force)console.error(`${Z.output??"soul.fafm"} already exists. Use ${C("--force")} to overwrite.`),process.exit(1);try{let X=GX(z,{namepoint:Z.namepoint});X.toFile(Q,{replace:Z.force===!0}),console.log(`${A("memory convert")} ${M("—")} ${X.facts.length} facts → ${Q}`),console.log(M(` namepoint ${X.namepoint} profile ${X.profile} index ${X.index.length}`))}catch(X){console.error(`Error: ${X instanceof Error?X.message:X}`),process.exit(1)}}function Vg($){let Z=qX($.file);if($.json){console.log(JSON.stringify(Z.facts.map((z)=>({id:z.id,text:z.text,type:z.type,priority:z.priority,tags:z.tags})),null,2));return}console.log(`${A("memory ls")} ${M(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
653
- `);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 qg($,Z){let z=qX(Z.file),Q=Z.tag?Z.tag.split(",").map((Y)=>Y.trim()):void 0,X=Z.limit!==void 0&&Z.limit!==null?parseInt(Z.limit,10):void 0,J=z.recall($??null,{tags:Q,type:Z.type,minPriority:Z.priority,limit:Number.isFinite(X)?X:null});if(Z.json){console.log(JSON.stringify(J.map((Y)=>({id:Y.id,text:Y.text,priority:Y.priority})),null,2));return}console.log(`${A("memory recall")} ${M(`— ${J.length} hit(s)`)}${$?M(` for "${$}"`):""}
654
- `);for(let Y of J)console.log(` ${Y.id?C(Y.id):M("?")} ${Y.text}`)}function Kg($,Z){if(!$)console.error(`Error: text required
663
+ faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let z=h8($),Q=h8(Z.output??LX());if(_g(Q)&&!Z.force)console.error(`${Z.output??"soul.fafm"} already exists. Use ${C("--force")} to overwrite.`),process.exit(1);try{let X=MX(z,{namepoint:Z.namepoint});X.toFile(Q,{replace:Z.force===!0}),console.log(`${A("memory convert")} ${M("—")} ${X.facts.length} facts → ${Q}`),console.log(M(` namepoint ${X.namepoint} profile ${X.profile} index ${X.index.length}`))}catch(X){console.error(`Error: ${X instanceof Error?X.message:X}`),process.exit(1)}}function Fg($){let Z=DX($.file);if($.json){console.log(JSON.stringify(Z.facts.map((z)=>({id:z.id,text:z.text,type:z.type,priority:z.priority,tags:z.tags})),null,2));return}console.log(`${A("memory ls")} ${M(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
664
+ `);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 Rg($,Z){let z=DX(Z.file),Q=Z.tag?Z.tag.split(",").map((Y)=>Y.trim()):void 0,X=Z.limit!==void 0&&Z.limit!==null?parseInt(Z.limit,10):void 0,J=z.recall($??null,{tags:Q,type:Z.type,minPriority:Z.priority,limit:Number.isFinite(X)?X:null});if(Z.json){console.log(JSON.stringify(J.map((Y)=>({id:Y.id,text:Y.text,priority:Y.priority})),null,2));return}console.log(`${A("memory recall")} ${M(`— ${J.length} hit(s)`)}${$?M(` for "${$}"`):""}
665
+ `);for(let Y of J)console.log(` ${Y.id?C(Y.id):M("?")} ${Y.text}`)}function jg($,Z){if(!$)console.error(`Error: text required
655
666
 
656
- faf memory etch "a durable fact" [--id slug]`),process.exit(2);let z=y8(Z.file??VX()),Q=gH(z)?c0.load(z):new c0(Z.namepoint??"@local",{profile:"knowledge"}),X=Q.indexIsDerived(),J=Q.etch($,{id:Z.id,type:Z.type,priority:Z.priority});Q.toFile(z,{reindex:X}),console.log(`${A("memory etch")} ${M("—")} ${J.id??"(no-id)"} → ${z}`)}function Hg($){let Z=qX($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${A("memory show")} ${M(`— ${Z.namepoint}`)}
667
+ faf memory etch "a durable fact" [--id slug]`),process.exit(2);let z=h8(Z.file??LX()),Q=nH(z)?m0.load(z):new m0(Z.namepoint??"@local",{profile:"knowledge"}),X=Q.indexIsDerived(),J=Q.etch($,{id:Z.id,type:Z.type,priority:Z.priority});Q.toFile(z,{reindex:X}),console.log(`${A("memory etch")} ${M("—")} ${J.id??"(no-id)"} → ${z}`)}function Sg($){let Z=DX($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${A("memory show")} ${M(`— ${Z.namepoint}`)}
657
668
  `),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(`
658
- ${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 hH($,Z,z={}){if(Z&&typeof Z==="object")z=Z,Z=void 0;switch($){case"convert":Gg(Z,z);break;case"ls":case"list":Vg(z);break;case"recall":qg(Z,z);break;case"etch":Kg(Z,z);break;case"show":Hg(z);break;case void 0:case"help":vH();break;default:console.error(`Unknown memory subcommand: ${$}`),vH(),process.exit(2)}}function vH(){console.log(`${A("faf memory")} ${M("— .fafm soul ops (knowledge profile)")}
669
+ ${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 rH($,Z,z={}){if(Z&&typeof Z==="object")z=Z,Z=void 0;switch($){case"convert":Pg(Z,z);break;case"ls":case"list":Fg(z);break;case"recall":Rg(Z,z);break;case"etch":jg(Z,z);break;case"show":Sg(z);break;case void 0:case"help":iH();break;default:console.error(`Unknown memory subcommand: ${$}`),iH(),process.exit(2)}}function iH(){console.log(`${A("faf memory")} ${M("— .fafm soul ops (knowledge profile)")}
659
670
  `),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
660
- `),console.log(M(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json · --force")),console.log(M(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}l();var{version:KX}=wz(),Bg=console.error.bind(console);console.error=(...$)=>Bg(...$.map((Z)=>typeof Z==="string"?Y3(Z):Z));var f=new xX;f.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(KX,"-v, --version");f.command("init").description("Create .faf from your project").addOption(new _7("--yolo").hideHelp()).addOption(new _7("--quick").hideHelp()).option("--new","Replace project.faf with a fresh one; .faf-dna is kept as it is").option("--force","Same as --new: replace project.faf; .faf-dna is kept (a birth certificate is written once)").option("--output <path>","Output path").action(($)=>g3($));f.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").option("--json","Output the lineage as JSON").option("--verify","Check the birth certificate against the commit that first added .faf-dna (exit 0 same, 1 changed, 2 cannot check)").action(($)=>YG($));f.command("auto").description("Fill the tech slots from the repo, then score").action(()=>HZ());f.command("loop").description("Drive to 100% — source what we can, then ask only the human").option("-r, --rounds <n>","max auto rounds before stopping","5").action(($)=>VG($));f.command("go").description("Confirm the goal and six W's, suggested in gray, then fill the rest").option("--resume","Resume previous session").action(($)=>qK($));f.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>i5($,Z));f.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key; grade saves .faf-bench.json)").option("--json","Output as JSON").option("--cold","Grade as the without-context run").option("--faf","Grade as the with-context run").option("--tokens <n>","Tokens used in the run (reported by the agent)").option("--model <name>","Model that answered (reported)").option("--file <path>","Path to project.faf (default: discovered)").option("--submit","Submit the full-pair receipt to the public bench ledger (mcpaas.live; --endpoint to change)").option("--endpoint <url>","Override the submit endpoint").action(($,Z,z)=>AH($,Z,z));f.command("show").description("Render project.faf → project.html and open it").option("--force","Replace a project.html faf cannot prove it rendered (edited since, or not faf's)").action(($)=>rV($));f.command("sync").description(".faf → CLAUDE.md — one way; writes faf's block only; Pro also updates Claude Code's MEMORY.md").option("--watch","Watch for changes").action(($)=>wG($));f.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").option("--force","Replace an output file that is not a .fafb faf compiled").action(($,Z)=>vG($,Z));f.command("decompile <file>").description("Decompile .fafb to JSON (prints; --output writes a file)").option("--output <path>","Output path").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a faf decompile)").action(($,Z)=>nG($,Z));f.command("git <url>").description("Instant scored context from any GitHub repo (any branch/tag with --ref) — shallow-clones to a temp dir, writes ./project.faf (--stdout to print)").option("--ref <ref>","Clone at a specific branch or tag (versioned context)").option("--output <path>","Write to a custom path (default: ./project.faf)").option("--force","Overwrite an existing project.faf").option("--stdout","Print the .faf to stdout instead of writing a file").action(($,Z)=>eV($,Z));f.command("diff [range]").description("Semantic context diff between two .faf versions (slot deltas + score). git ranges: <ref>, A..B, A...B").option("--json","Emit the delta as structured JSON").option("--install-driver","Wire faf diff into native git — `git diff` renders .faf score+slot deltas").option("--uninstall-driver","Remove the native-git diff driver").action(($,Z)=>qq($,Z));f.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>Yq($??[]));f.command("log").description("Score timeline across git history — the .faf score at every commit that touched it").option("-n, --limit <n>","Max commits to show (default 20)").option("--all","Show every commit, no cap").option("--reverse","Oldest-first instead of newest-first").option("--json","Emit the timeline as structured JSON").action(($)=>Kq($));f.command("hooks").description("Pre-commit context guard — scores staged .faf vs HEAD, warns (or --strict blocks) on regression").option("--install","Install the pre-commit hook").option("--uninstall","Remove the faf hook block (preserves other hooks)").option("--strict","With --install: block the commit on a score regression (default: warn only)").action(($)=>Pq($));f.command("hooks-run",{hidden:!0}).description("Internal: the pre-commit context guard the git hook invokes").option("--strict","Exit non-zero on a score regression").action(($)=>{Rq($);let Z=()=>process.exit(0);setTimeout(Z,2000).unref(),process.stdout.write("",()=>process.stderr.write("",Z))});f.command("export").description("Write agent files from .faf — bare: AGENTS.md, .cursorrules, GEMINI.md, Copilot instructions, project.html").option("--agents","Author AGENTS.md").option("--cursor","Author .cursorrules").option("--gemini","Author GEMINI.md").option("--copilot","Author .github/copilot-instructions.md (GitHub Copilot)").option("--grok","Wire grok-faf-mcp into .grok/config.toml (opt-in; never on --all)").option("--llms","Author llms.txt (llmstxt.org view of authored 6Ws — opt-in)").option("--conductor","Author conductor config").option("--html","Author project.html (visual render of project.faf)").option("--card","Author MCP Server Card (./server-card) with the FAF context-block").option("--all","Author all formats").option("--output <path>","Write exported files to this directory instead of the current one").option("--force","Replace a project.html or Server Card faf cannot prove it wrote (edited since, or not faf's)").action(($)=>U1($));f.command("server-card").description("Emit the registry server.json identity (name + title + _meta) from project.faf — the cross-language server-card emitter; patches an existing file").option("--in <path>","Existing server.json to patch (default: ./server.json)").option("--out <path>","Output path (default: same as --in)").option("--faf <path>","project.faf path (default: auto-discover)").option("--set-version <version>","Set the version field (default: preserve existing). NOTE: not --version, which is the global CLI-version flag").option("--generated <iso>","Override the _meta generated stamp (default: preserve existing)").option("--check","Print to stdout, do not write (diff/verify — the idempotency-test hook)").option("--force","With --out: replace a file faf cannot prove it wrote (edited since, or no faf identity)").action(($)=>bV($));f.command("cards").description("Write the cards your files allow. BETTER: an agent.fafa → A2A card, MCP Server Card, registry, AI Catalog, ARD (as its endpoints allow). BEST: + project.faf → the same cards with FAF context. An agent.fafa with no mcp endpoint gets no MCP Server Card or registry server.json; nor does a project.faf alone whose type is not mcp, unless asked for with --target (--check prints, writes nothing)").option("--target <list>","Comma list: a2a,mcp,registry,catalog,ard (default: whatever inputs allow)").option("--faf <path>","project.faf path (default: auto-discover)").option("--fafa <path>","agent.fafa path (default: auto-discover)").option("--dir <path>","Working directory (default: cwd)").option("--a2a-url <url>","Public URL of the A2A card (catalog row)").option("--door-url <url>","A2A door when .fafa has no a2a endpoint").option("--faf-pointer <url>","Absolute .faf pointer for served cards (default: ./project.faf)").option("--check","Print projected cards to stdout, do not write").option("--force","Replace a card file faf cannot prove it wrote (edited since, or not faf's)").action(($)=>yZ($));var fH=($,Z=[])=>[...Z,$],Mg=f.command("card").description("One card at a time");Mg.command("init").description("Write an agent.fafa from seven answers: name, short name, domain, what it does, version, where it runs, what it can do").option("--name <name>",'Name people see, e.g. "Weather Agent"').option("--short-name <handle>","Short name, lowercase (default: from --name)").option("--domain <domain>","Domain it is published under, e.g. example.com").option("--description <text>","What it does, one sentence").option("--set-version <version>","Its version. NOTE: not --version, which is the global CLI-version flag").option("--url <url>","Where it runs: a live endpoint people call over http(s). For something people install (a CLI, a library, a stdio MCP server), use --package").option("--protocol <protocol>","Protocol at --url: a2a or mcp (default: a2a)").option("--package <name>","Where it runs: a package people install. A bare name is npm; or npm:<name>, pypi:<name>, crates:<name>").option("--kind <kind>","What --package is: mcp (an MCP server, the default), cli or library. Only mcp gets MCP cards").option("--homepage <url>","Its homepage, an http(s) URL (default: https://<domain>)").option("--skill <skill>",'What it can do, "Name: description" (repeatable)',fH).option("--example <question>","A question people ask it; search finds it by these (repeatable, 2-5)",fH).option("--dir <path>","Working directory (default: cwd)").option("--out <path>","Output path (default: ./agent.fafa)").option("--force","Replace an existing agent.fafa").action(($)=>nV($));f.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--verbose","Show slot breakdown").action(($,Z)=>Xz($,Z));f.command("info").description("Show version and system info").option("--version","Show version").action(($)=>Fq($));f.command("formats").description("Show supported formats").action(()=>jq());f.command("clear").description("Delete faf's cached clones (faf-git-* temp dirs)").action(()=>Sq());f.command("convert").description("Print .faf as YAML or JSON (writes nothing)").option("--json","Output as JSON").action(($)=>Eq($));f.command("context").description("Author context output").action(()=>wq());f.command("refresh").description("Re-ground on the live .faf — re-score, measure drift vs the DNA baseline, keep .fafb current").option("--json","Output as JSON").action(($)=>CH($));f.command("drift").description("Check context drift").option("--json","Emit the drift report as structured JSON").action(($)=>kq($));f.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>vq($,Z));f.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>gq($));f.command("pro [subcommand]").description("Pro features & licensing (activate opens faf.one/pro)").action(($)=>hq($));f.command("share").description("Print a faf.one share link for .faf (built locally — nothing is sent)").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>fq($));f.command("demo").description("Demo walkthrough").action(()=>uq());f.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>mq($,Z));f.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` prints the CI receipt workflow (--write creates it); `faf taf receipts` shows them; bare snapshot deprecated → faf score --json").option("--limit <n>","taf receipts: how many to show (default 10)").option("--json","taf receipts: output as JSON").option("--ref <ref>","taf receipts: git ref to read .taf from (default origin/taf-receipts)").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a TAF snapshot)").action(($,Z)=>sq($,Z));f.command("ai [subcommand]").description("Ask Claude for suggestions about project.faf (analyze) — sends it to the Anthropic API, writes nothing").action(($)=>KH($));f.command("conductor [subcommand] [path]").description("Conductor config — import <path> merges into .faf; export prints it").action(($,Z)=>BH($,Z));f.command("wjttc").description("Audit test suite for WJTTC tier coverage (vendor-neutral)").option("--path <path>","Test directory (default: tests)").option("--strict","Exit non-zero if any tests are untiered").option("--json","Output as JSON for CI consumption").action(($)=>LH($));f.command("memory [subcommand] [arg]").description(".fafm soul ops — convert Claude memory, etch, recall, ls, show (etch and convert write soul.fafm)").option("-f, --file <path>","Soul file (default: ./soul.fafm)").option("-o, --output <path>","Output path (convert)").option("--namepoint <handle>","Namepoint for new/converted soul").option("--id <id>","Fact id (etch)").option("--type <type>","Fact type filter / etch type").option("--tag <tags>","Comma-separated tags (recall)").option("--priority <level>","Min priority floor (recall) or etch priority").option("--limit <n>","Max recall hits").option("--json","JSON output").option("--force","Overwrite an existing soul.fafm (convert)").action(($,Z,z)=>hH($,Z,z));f.command("status",{hidden:!0}).action(()=>i5(void 0,{status:!0}));f.command("agents",{hidden:!0}).action(()=>U1({agents:!0}));f.command("cursor",{hidden:!0}).action(()=>U1({cursor:!0}));f.command("gemini",{hidden:!0}).action(()=>U1({gemini:!0}));f.command("grok",{hidden:!0}).action(()=>U1({grok:!0}));f.command("llms",{hidden:!0}).action(()=>U1({llms:!0}));f.command("validate [file]",{hidden:!0}).action(($)=>Xz($));f.command("yolo",{hidden:!0}).action(()=>g3());if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:z,colorOn:Q}=await Promise.resolve().then(() => (l(),gU)),X=process.cwd().replace(process.env.HOME??"","~");if(!Q())console.log(`${z($("faf"))} ${Z(`v${KX}`)} ${Z("Nelly Never Forgets")}`);else{console.log(""),console.log(`\x1B[48;2;29;29;29m ${"\x1B[38;2;150;150;150m"}▄${"\x1B[48;2;150;150;150m"}███████${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▄${"\x1B[0m"}`),console.log(`\x1B[48;2;29;29;29m \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}█${"\x1B[38;2;29;29;29m"}█${"\x1B[38;2;150;150;150m"}███████${"\x1B[0m"} ${z($("faf"))} ${Z(`v${KX}`)}`);let V="\x1B[38;2;39;174;96m";console.log(`\x1B[48;2;29;29;29m${"\x1B[38;2;150;150;150m"}▀${"\x1B[48;2;150;150;150m"}${"\x1B[38;2;29;29;29m"}▀${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[0m ${Z("Nelly Never Forgets")}`),console.log(`${V}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`)}console.log(`${Z(` ${X}`)}`),console.log("");try{await i5(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${z("faf --help")} ${Z("for commands")}`)})();else f.addHelpText("after",["","Git-native (The GIT Version):"," faf diff [range] semantic context diff + score delta (A..B, A...B)"," faf diff --install-driver make native `git diff` render .faf deltas"," faf log score timeline across history (Proof-Over-Time)"," faf hooks --install pre-commit guard against context regression"," faf git <url> [--ref] instant scored context from any repo, any branch/tag","",' "FAF is to Context what Git is to Versions."',"","What touches what:"," read-only score check dna context drift log convert search share, diff (no --install-driver)"," sends data ai analyze (Anthropic API) · bench --submit (mcpaas.live)"," every command https://docs.faf.one/side-effects",""].join(`
661
- `)),f.parseAsync(process.argv).catch(($)=>{if(!m1($))throw $;console.error(c1($,Lg())),process.exit(1)});function Lg(){let $=process.argv[2];return f.commands.find((z)=>z.name()===$||z.aliases().includes($))?.options.some((z)=>z.long==="--force")??!1}
671
+ `),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"))}i();var{version:OX}=gz(),Eg=console.error.bind(console);console.error=(...$)=>Eg(...$.map((Z)=>typeof Z==="string"?K3(Z):Z));var m=new gX;m.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(OX,"-v, --version");m.command("init").description("Create .faf from your project").addOption(new S7("--yolo").hideHelp()).addOption(new S7("--quick").hideHelp()).option("--new","Replace project.faf with a fresh one; .faf-dna is kept as it is").option("--force","Same as --new: replace project.faf; .faf-dna is kept (a birth certificate is written once)").option("--output <path>","Output path").action(($)=>p3($));m.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").option("--json","Output the lineage as JSON").option("--verify","Check the birth certificate against the commit that first added .faf-dna (exit 0 same, 1 changed, 2 cannot check)").action(($)=>HG($));m.command("auto").description("Fill the tech slots from the repo, then score").action(()=>OZ());m.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(($)=>DG($));m.command("go").description("Confirm the goal and six W's, suggested in gray, then fill the rest").option("--resume","Resume previous session").action(($)=>TK($));m.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)=>a5($,Z));m.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)=>xH($,Z,z));m.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(($)=>Qq($));m.command("sync").description(".faf → CLAUDE.md — one way; writes faf's block only; Pro also updates Claude Code's MEMORY.md").option("--watch","Watch for changes").action(($)=>hG($));m.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)=>pG($,Z));m.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)=>$V($,Z));m.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)=>Wq($,Z));m.command("diff [range]").description("Semantic context diff between two .faf versions (slot deltas + score). git ranges: <ref>, A..B, A...B").option("--json","Emit the delta as structured JSON").option("--install-driver","Wire faf diff into native git — `git diff` renders .faf score+slot deltas").option("--uninstall-driver","Remove the native-git diff driver").action(($,Z)=>Iq($,Z));m.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>Mq($??[]));m.command("log").description("Score timeline across git history — the .faf score at every commit that touched it").option("-n, --limit <n>","Max commits to show (default 20)").option("--all","Show every commit, no cap").option("--reverse","Oldest-first instead of newest-first").option("--json","Emit the timeline as structured JSON").action(($)=>Tq($));m.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(($)=>kq($));m.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(($)=>{bq($);let Z=()=>process.exit(0);setTimeout(Z,2000).unref(),process.stdout.write("",()=>process.stderr.write("",Z))});m.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(($)=>V1($));m.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(($)=>pV($));m.command("cards").description("Write the cards your files allow. BETTER: an agent.fafa → A2A card, MCP Server Card, registry, AI Catalog, ARD (as its endpoints allow). BEST: + project.faf → the same cards with FAF context. An agent.fafa with no mcp endpoint gets no MCP Server Card or registry server.json; nor does a project.faf alone whose type is not mcp, unless asked for with --target (--check prints, writes nothing)").option("--target <list>","Comma list: a2a,mcp,registry,catalog,ard (default: whatever inputs allow)").option("--faf <path>","project.faf path (default: auto-discover)").option("--fafa <path>","agent.fafa path (default: auto-discover)").option("--dir <path>","Working directory (default: cwd)").option("--a2a-url <url>","Public URL of the A2A card (catalog row)").option("--door-url <url>","A2A door when .fafa has no a2a endpoint").option("--faf-pointer <url>","Absolute .faf pointer for served cards (default: ./project.faf)").option("--check","Print projected cards to stdout, do not write").option("--force","Replace a card file faf cannot prove it wrote (edited since, or not faf's)").action(($)=>hZ($));var sH=($,Z=[])=>[...Z,$],wg=m.command("card").description("One card at a time");wg.command("init").description("Write an agent.fafa from seven answers: name, short name, domain, what it does, version, where it runs, what it can do").option("--name <name>",'Name people see, e.g. "Weather Agent"').option("--short-name <handle>","Short name, lowercase (default: from --name)").option("--domain <domain>","Domain it is published under, e.g. example.com").option("--description <text>","What it does, one sentence").option("--set-version <version>","Its version. NOTE: not --version, which is the global CLI-version flag").option("--url <url>","Where it runs: a live endpoint people call over http(s). For something people install (a CLI, a library, a stdio MCP server), use --package").option("--protocol <protocol>","Protocol at --url: a2a or mcp (default: a2a)").option("--package <name>","Where it runs: a package people install. A bare name is npm; or npm:<name>, pypi:<name>, crates:<name>").option("--kind <kind>","What --package is: mcp (an MCP server, the default), cli or library. Only mcp gets MCP cards").option("--homepage <url>","Its homepage, an http(s) URL (default: https://<domain>)").option("--skill <skill>",'What it can do, "Name: description" (repeatable)',sH).option("--example <question>","A question people ask it; search finds it by these (repeatable, 2-5)",sH).option("--dir <path>","Working directory (default: cwd)").option("--out <path>","Output path (default: ./agent.fafa)").option("--force","Replace an existing agent.fafa").action(($)=>zq($));m.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--verbose","Show slot breakdown").action(($,Z)=>Kz($,Z));m.command("info").description("Show version and system info").option("--version","Show version").action(($)=>vq($));m.command("formats").description("Show supported formats").action(()=>gq());m.command("clear").description("Delete faf's cached clones (faf-git-* temp dirs)").action(()=>hq());m.command("convert").description("Print .faf as YAML or JSON (writes nothing)").option("--json","Output as JSON").action(($)=>fq($));m.command("context").description("Author context output").action(()=>uq());m.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(($)=>yH($));m.command("drift").description("Check context drift").option("--json","Emit the drift report as structured JSON").action(($)=>lq($));m.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>dq($,Z));m.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>iq($));m.command("pro [subcommand]").description("Pro features & licensing (activate opens faf.one/pro)").action(($)=>nq($));m.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(($)=>rq($));m.command("demo").description("Demo walkthrough").action(()=>sq());m.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>oq($,Z));m.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` prints the CI receipt workflow (--write creates it); `faf taf receipts` shows them; bare snapshot deprecated → faf score --json").option("--limit <n>","taf receipts: how many to show (default 10)").option("--json","taf receipts: output as JSON").option("--ref <ref>","taf receipts: git ref to read .taf from (default origin/taf-receipts)").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a TAF snapshot)").action(($,Z)=>JK($,Z));m.command("ai [subcommand]").description("Ask Claude for suggestions about project.faf (analyze) — sends it to the Anthropic API, writes nothing").action(($)=>AH($));m.command("conductor [subcommand] [path]").description("Conductor config — import <path> merges into .faf; export prints it").action(($,Z)=>_H($,Z));m.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(($)=>FH($));m.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)=>rH($,Z,z));m.command("status",{hidden:!0}).action(()=>a5(void 0,{status:!0}));m.command("agents",{hidden:!0}).action(()=>V1({agents:!0}));m.command("cursor",{hidden:!0}).action(()=>V1({cursor:!0}));m.command("gemini",{hidden:!0}).action(()=>V1({gemini:!0}));m.command("grok",{hidden:!0}).action(()=>V1({grok:!0}));m.command("llms",{hidden:!0}).action(()=>V1({llms:!0}));m.command("validate [file]",{hidden:!0}).action(($)=>Kz($));m.command("yolo",{hidden:!0}).action(()=>p3());if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:z,colorOn:Q}=await Promise.resolve().then(() => (i(),lU)),X=process.cwd().replace(process.env.HOME??"","~");if(!Q())console.log(`${z($("faf"))} ${Z(`v${OX}`)} ${Z("Nelly Never Forgets")}`);else{console.log(""),console.log(`\x1B[48;2;29;29;29m ${"\x1B[38;2;150;150;150m"}▄${"\x1B[48;2;150;150;150m"}███████${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▄${"\x1B[0m"}`),console.log(`\x1B[48;2;29;29;29m \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}█${"\x1B[38;2;29;29;29m"}█${"\x1B[38;2;150;150;150m"}███████${"\x1B[0m"} ${z($("faf"))} ${Z(`v${OX}`)}`);let V="\x1B[38;2;39;174;96m";console.log(`\x1B[48;2;29;29;29m${"\x1B[38;2;150;150;150m"}▀${"\x1B[48;2;150;150;150m"}${"\x1B[38;2;29;29;29m"}▀${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[0m ${Z("Nelly Never Forgets")}`),console.log(`${V}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`)}console.log(`${Z(` ${X}`)}`),console.log("");try{await a5(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${z("faf --help")} ${Z("for commands")}`)})();else m.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(`
672
+ `)),m.parseAsync(process.argv).catch(($)=>{if(!i1($))throw $;console.error(n1($,xg())),process.exit(1)});function xg(){let $=process.argv[2];return m.commands.find((z)=>z.name()===$||z.aliases().includes($))?.options.some((z)=>z.long==="--force")??!1}
662
673
 
663
- //# debugId=BAF4CDF3B247822A64756E2164756E21
674
+ //# debugId=83955078416BC2B864756E2164756E21
664
675
  //# sourceMappingURL=cli.js.map