faf 7.15.0 → 7.16.2

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 iH}from"node:module";var vH=Object.create;var{getPrototypeOf:gH,defineProperty:bZ,getOwnPropertyNames:hH}=Object;var fH=Object.prototype.hasOwnProperty;function uH($){return this[$]}var mH,cH,pH=($,Z,z)=>{var Q=$!=null&&typeof $==="object";if(Q){var X=Z?mH??=new WeakMap:cH??=new WeakMap,J=X.get($);if(J)return J}z=$!=null?vH(gH($)):{};let Y=Z||!$||!$.__esModule?bZ(z,"default",{value:$,enumerable:!0}):z;for(let W of hH($))if(!fH.call(Y,W))bZ(Y,W,{get:uH.bind($,W),enumerable:!0});if(Q)X.set($,Y);return Y};var P=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var lH=($)=>$;function dH($,Z){this[$]=lH.bind(null,Z)}var LQ=($,Z)=>{for(var z in Z)bZ($,z,{get:Z[z],enumerable:!0,configurable:!0,set:dH.bind(Z,z)})};var v=($,Z)=>()=>($&&(Z=$($=0)),Z);var d0=iH(import.meta.url);var H1=P((nH)=>{class vZ 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 NQ extends vZ{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}nH.CommanderError=vZ;nH.InvalidArgumentError=NQ});var B8=P((tH)=>{var{InvalidArgumentError:oH}=H1();class OQ{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 oH(`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 aH($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}tH.Argument=OQ;tH.humanReadableArgName=aH});var gZ=P((zq)=>{var{humanReadableArgName:Zq}=B8();class DQ{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)=>Zq(z)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(Z?" "+Z:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,Z){return Z.visibleCommands($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleSubcommandTerm(Z.subcommandTerm(Q))))},0)}longestOptionTermLength($,Z){return Z.visibleOptions($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(Q))))},0)}longestGlobalOptionTermLength($,Z){return Z.visibleGlobalOptions($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(Q))))},0)}longestArgumentTermLength($,Z){return Z.visibleArguments($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleArgumentTerm(Z.argumentTerm(Q))))},0)}commandUsage($){let Z=$._name;if($._aliases[0])Z=Z+"|"+$._aliases[0];let z="";for(let Q=$.parent;Q;Q=Q.parent)z=Q.name()+" "+z;return z+Z+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((z)=>JSON.stringify(z)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)Z.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)Z.push(`env: ${$.envVar}`);if(Z.length>0){let z=`(${Z.join(", ")})`;if($.description)return`${$.description} ${z}`;return z}return $.description}argumentDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((z)=>JSON.stringify(z)).join(", ")}`);if($.defaultValue!==void 0)Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(Z.length>0){let z=`(${Z.join(", ")})`;if($.description)return`${$.description} ${z}`;return z}return $.description}formatItemList($,Z,z){if(Z.length===0)return[];return[z.styleTitle($),...Z,""]}groupItems($,Z,z){let Q=new Map;return $.forEach((X)=>{let J=z(X);if(!Q.has(J))Q.set(J,[])}),Z.forEach((X)=>{let J=z(X);if(!Q.has(J))Q.set(J,[]);Q.get(J).push(X)}),Q}formatHelp($,Z){let z=Z.padWidth($,Z),Q=Z.helpWidth??80;function X(V,H){return Z.formatItem(V,z,H,Z)}let J=[`${Z.styleTitle("Usage:")} ${Z.styleUsage(Z.commandUsage($))}`,""],Y=Z.commandDescription($);if(Y.length>0)J=J.concat([Z.boxWrap(Z.styleCommandDescription(Y),Q),""]);let W=Z.visibleArguments($).map((V)=>{return X(Z.styleArgumentTerm(Z.argumentTerm(V)),Z.styleArgumentDescription(Z.argumentDescription(V)))});if(J=J.concat(this.formatItemList("Arguments:",W,Z)),this.groupItems($.options,Z.visibleOptions($),(V)=>V.helpGroupHeading??"Options:").forEach((V,H)=>{let q=V.map((K)=>{return X(Z.styleOptionTerm(Z.optionTerm(K)),Z.styleOptionDescription(Z.optionDescription(K)))});J=J.concat(this.formatItemList(H,q,Z))}),Z.showGlobalOptions){let V=Z.visibleGlobalOptions($).map((H)=>{return X(Z.styleOptionTerm(Z.optionTerm(H)),Z.styleOptionDescription(Z.optionDescription(H)))});J=J.concat(this.formatItemList("Global Options:",V,Z))}return this.groupItems($.commands,Z.visibleCommands($),(V)=>V.helpGroup()||"Commands:").forEach((V,H)=>{let q=V.map((K)=>{return X(Z.styleSubcommandTerm(Z.subcommandTerm(K)),Z.styleSubcommandDescription(Z.subcommandDescription(K)))});J=J.concat(this.formatItemList(H,q,Z))}),J.join(`
3
- `)}displayWidth($){return IQ($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((Z)=>{if(Z==="[options]")return this.styleOptionText(Z);if(Z==="[command]")return this.styleSubcommandText(Z);if(Z[0]==="["||Z[0]==="<")return this.styleArgumentText(Z);return this.styleCommandText(Z)}).join(" ")}styleCommandDescription($){return this.styleDescriptionText($)}styleOptionDescription($){return this.styleDescriptionText($)}styleSubcommandDescription($){return this.styleDescriptionText($)}styleArgumentDescription($){return this.styleDescriptionText($)}styleDescriptionText($){return $}styleOptionTerm($){return this.styleOptionText($)}styleSubcommandTerm($){return $.split(" ").map((Z)=>{if(Z==="[options]")return this.styleOptionText(Z);if(Z[0]==="["||Z[0]==="<")return this.styleArgumentText(Z);return this.styleSubcommandText(Z)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,Z){return Math.max(Z.longestOptionTermLength($,Z),Z.longestGlobalOptionTermLength($,Z),Z.longestSubcommandTermLength($,Z),Z.longestArgumentTermLength($,Z))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,Z,z,Q){let J=" ".repeat(2);if(!z)return J+$;let Y=$.padEnd(Z+$.length-Q.displayWidth($)),W=2,G=(this.helpWidth??80)-Z-W-2,V;if(G<this.minWidthToWrap||Q.preformatted(z))V=z;else V=Q.boxWrap(z,G).replace(/\n/g,`
2
+ import{createRequire as eq}from"node:module";var pq=Object.create;var{getPrototypeOf:lq,defineProperty:hZ,getOwnPropertyNames:dq}=Object;var iq=Object.prototype.hasOwnProperty;function nq($){return this[$]}var rq,sq,oq=($,Z,z)=>{var Q=$!=null&&typeof $==="object";if(Q){var X=Z?rq??=new WeakMap:sq??=new WeakMap,J=X.get($);if(J)return J}z=$!=null?pq(lq($)):{};let Y=Z||!$||!$.__esModule?hZ(z,"default",{value:$,enumerable:!0}):z;for(let W of dq($))if(!iq.call(Y,W))hZ(Y,W,{get:nq.bind($,W),enumerable:!0});if(Q)X.set($,Y);return Y};var P=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var aq=($)=>$;function tq($,Z){this[$]=aq.bind(null,Z)}var DQ=($,Z)=>{for(var z in Z)hZ($,z,{get:Z[z],enumerable:!0,configurable:!0,set:tq.bind(Z,z)})};var v=($,Z)=>()=>($&&(Z=$($=0)),Z);var d0=eq(import.meta.url);var B1=P(($H)=>{class fZ 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 IQ extends fZ{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}$H.CommanderError=fZ;$H.InvalidArgumentError=IQ});var N8=P((JH)=>{var{InvalidArgumentError:QH}=B1();class TQ{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 QH(`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 XH($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}JH.Argument=TQ;JH.humanReadableArgName=XH});var uZ=P((GH)=>{var{humanReadableArgName:UH}=N8();class AQ{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)=>UH(z)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(Z?" "+Z:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,Z){return Z.visibleCommands($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleSubcommandTerm(Z.subcommandTerm(Q))))},0)}longestOptionTermLength($,Z){return Z.visibleOptions($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(Q))))},0)}longestGlobalOptionTermLength($,Z){return Z.visibleGlobalOptions($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(Q))))},0)}longestArgumentTermLength($,Z){return Z.visibleArguments($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleArgumentTerm(Z.argumentTerm(Q))))},0)}commandUsage($){let Z=$._name;if($._aliases[0])Z=Z+"|"+$._aliases[0];let z="";for(let Q=$.parent;Q;Q=Q.parent)z=Q.name()+" "+z;return z+Z+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((z)=>JSON.stringify(z)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)Z.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)Z.push(`env: ${$.envVar}`);if(Z.length>0){let z=`(${Z.join(", ")})`;if($.description)return`${$.description} ${z}`;return z}return $.description}argumentDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((z)=>JSON.stringify(z)).join(", ")}`);if($.defaultValue!==void 0)Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(Z.length>0){let z=`(${Z.join(", ")})`;if($.description)return`${$.description} ${z}`;return z}return $.description}formatItemList($,Z,z){if(Z.length===0)return[];return[z.styleTitle($),...Z,""]}groupItems($,Z,z){let Q=new Map;return $.forEach((X)=>{let J=z(X);if(!Q.has(J))Q.set(J,[])}),Z.forEach((X)=>{let J=z(X);if(!Q.has(J))Q.set(J,[]);Q.get(J).push(X)}),Q}formatHelp($,Z){let z=Z.padWidth($,Z),Q=Z.helpWidth??80;function X(V,q){return Z.formatItem(V,z,q,Z)}let J=[`${Z.styleTitle("Usage:")} ${Z.styleUsage(Z.commandUsage($))}`,""],Y=Z.commandDescription($);if(Y.length>0)J=J.concat([Z.boxWrap(Z.styleCommandDescription(Y),Q),""]);let W=Z.visibleArguments($).map((V)=>{return X(Z.styleArgumentTerm(Z.argumentTerm(V)),Z.styleArgumentDescription(Z.argumentDescription(V)))});if(J=J.concat(this.formatItemList("Arguments:",W,Z)),this.groupItems($.options,Z.visibleOptions($),(V)=>V.helpGroupHeading??"Options:").forEach((V,q)=>{let H=V.map((K)=>{return X(Z.styleOptionTerm(Z.optionTerm(K)),Z.styleOptionDescription(Z.optionDescription(K)))});J=J.concat(this.formatItemList(q,H,Z))}),Z.showGlobalOptions){let V=Z.visibleGlobalOptions($).map((q)=>{return X(Z.styleOptionTerm(Z.optionTerm(q)),Z.styleOptionDescription(Z.optionDescription(q)))});J=J.concat(this.formatItemList("Global Options:",V,Z))}return this.groupItems($.commands,Z.visibleCommands($),(V)=>V.helpGroup()||"Commands:").forEach((V,q)=>{let H=V.map((K)=>{return X(Z.styleSubcommandTerm(Z.subcommandTerm(K)),Z.styleSubcommandDescription(Z.subcommandDescription(K)))});J=J.concat(this.formatItemList(q,H,Z))}),J.join(`
3
+ `)}displayWidth($){return CQ($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((Z)=>{if(Z==="[options]")return this.styleOptionText(Z);if(Z==="[command]")return this.styleSubcommandText(Z);if(Z[0]==="["||Z[0]==="<")return this.styleArgumentText(Z);return this.styleCommandText(Z)}).join(" ")}styleCommandDescription($){return this.styleDescriptionText($)}styleOptionDescription($){return this.styleDescriptionText($)}styleSubcommandDescription($){return this.styleDescriptionText($)}styleArgumentDescription($){return this.styleDescriptionText($)}styleDescriptionText($){return $}styleOptionTerm($){return this.styleOptionText($)}styleSubcommandTerm($){return $.split(" ").map((Z)=>{if(Z==="[options]")return this.styleOptionText(Z);if(Z[0]==="["||Z[0]==="<")return this.styleArgumentText(Z);return this.styleSubcommandText(Z)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,Z){return Math.max(Z.longestOptionTermLength($,Z),Z.longestGlobalOptionTermLength($,Z),Z.longestSubcommandTermLength($,Z),Z.longestArgumentTermLength($,Z))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,Z,z,Q){let J=" ".repeat(2);if(!z)return J+$;let Y=$.padEnd(Z+$.length-Q.displayWidth($)),W=2,G=(this.helpWidth??80)-Z-W-2,V;if(G<this.minWidthToWrap||Q.preformatted(z))V=z;else V=Q.boxWrap(z,G).replace(/\n/g,`
4
4
  `+" ".repeat(Z+W));return J+Y+" ".repeat(W)+V.replace(/\n/g,`
5
- ${J}`)}boxWrap($,Z){if(Z<this.minWidthToWrap)return $;let z=$.split(/\r\n|\n/),Q=/[\s]*[^\s]+/g,X=[];return z.forEach((J)=>{let Y=J.match(Q);if(Y===null){X.push("");return}let W=[Y.shift()],U=this.displayWidth(W[0]);Y.forEach((G)=>{let V=this.displayWidth(G);if(U+V<=Z){W.push(G),U+=V;return}X.push(W.join(""));let H=G.trimStart();W=[H],U=this.displayWidth(H)}),X.push(W.join(""))}),X.join(`
6
- `)}}function IQ($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}zq.Help=DQ;zq.stripColor=IQ});var hZ=P((Wq)=>{var{InvalidArgumentError:Jq}=H1();class AQ{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let z=Yq($);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 Jq(`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 TQ(this.name().replace(/^no-/,""));return TQ(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class CQ{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 TQ($){return $.split("-").reduce((Z,z)=>{return Z+z[0].toUpperCase()+z.slice(1)})}function Yq($){let Z,z,Q=/^-[^-]$/,X=/^--[^-]/,J=$.split(/[ |,]+/).concat("guard");if(Q.test(J[0]))Z=J.shift();if(X.test(J[0]))z=J.shift();if(!Z&&Q.test(J[0]))Z=J.shift();if(!Z&&X.test(J[0]))Z=z,z=J.shift();if(J[0].startsWith("-")){let Y=J[0],W=`option creation failed due to '${Y}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${W}
5
+ ${J}`)}boxWrap($,Z){if(Z<this.minWidthToWrap)return $;let z=$.split(/\r\n|\n/),Q=/[\s]*[^\s]+/g,X=[];return z.forEach((J)=>{let Y=J.match(Q);if(Y===null){X.push("");return}let W=[Y.shift()],U=this.displayWidth(W[0]);Y.forEach((G)=>{let V=this.displayWidth(G);if(U+V<=Z){W.push(G),U+=V;return}X.push(W.join(""));let q=G.trimStart();W=[q],U=this.displayWidth(q)}),X.push(W.join(""))}),X.join(`
6
+ `)}}function CQ($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}GH.Help=AQ;GH.stripColor=CQ});var mZ=P((BH)=>{var{InvalidArgumentError:HH}=B1();class RQ{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let z=KH($);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 HH(`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 _Q(this.name().replace(/^no-/,""));return _Q(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class FQ{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 _Q($){return $.split("-").reduce((Z,z)=>{return Z+z[0].toUpperCase()+z.slice(1)})}function KH($){let Z,z,Q=/^-[^-]$/,X=/^--[^-]/,J=$.split(/[ |,]+/).concat("guard");if(Q.test(J[0]))Z=J.shift();if(X.test(J[0]))z=J.shift();if(!Z&&Q.test(J[0]))Z=J.shift();if(!Z&&X.test(J[0]))Z=z,z=J.shift();if(J[0].startsWith("-")){let Y=J[0],W=`option creation failed due to '${Y}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${W}
7
7
  - a short flag is a single dash and a single character
8
8
  - either use a single dash and a single character (for a short flag)
9
9
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(Q.test(Y))throw Error(`${W}
10
10
  - too many short flags`);if(X.test(Y))throw Error(`${W}
11
11
  - too many long flags`);throw Error(`${W}
12
- - unrecognised flag format`)}if(Z===void 0&&z===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:Z,longFlag:z}}Wq.Option=AQ;Wq.DualOptions=CQ});var _Q=P((qq)=>{function Vq($,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 Hq($,Z){if(!Z||Z.length===0)return"";Z=Array.from(new Set(Z));let z=$.startsWith("--");if(z)$=$.slice(2),Z=Z.map((Y)=>Y.slice(2));let Q=[],X=3,J=0.4;if(Z.forEach((Y)=>{if(Y.length<=1)return;let W=Vq($,Y),U=Math.max($.length,Y.length);if((U-W)/U>J){if(W<X)X=W,Q=[Y];else if(W===X)Q.push(Y)}}),Q.sort((Y,W)=>Y.localeCompare(W)),z)Q=Q.map((Y)=>`--${Y}`);if(Q.length>1)return`
12
+ - unrecognised flag format`)}if(Z===void 0&&z===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:Z,longFlag:z}}BH.Option=RQ;BH.DualOptions=FQ});var PQ=P((DH)=>{function NH($,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 OH($,Z){if(!Z||Z.length===0)return"";Z=Array.from(new Set(Z));let z=$.startsWith("--");if(z)$=$.slice(2),Z=Z.map((Y)=>Y.slice(2));let Q=[],X=3,J=0.4;if(Z.forEach((Y)=>{if(Y.length<=1)return;let W=NH($,Y),U=Math.max($.length,Y.length);if((U-W)/U>J){if(W<X)X=W,Q=[Y];else if(W===X)Q.push(Y)}}),Q.sort((Y,W)=>Y.localeCompare(W)),z)Q=Q.map((Y)=>`--${Y}`);if(Q.length>1)return`
13
13
  (Did you mean one of ${Q.join(", ")}?)`;if(Q.length===1)return`
14
- (Did you mean ${Q[0]}?)`;return""}qq.suggestSimilar=Hq});var SQ=P((Iq)=>{var Bq=d0("node:events").EventEmitter,fZ=d0("node:child_process"),E2=d0("node:path"),M8=d0("node:fs"),e=d0("node:process"),{Argument:Mq,humanReadableArgName:Lq}=B8(),{CommanderError:uZ}=H1(),{Help:Nq,stripColor:Oq}=gZ(),{Option:RQ,DualOptions:Dq}=hZ(),{suggestSimilar:FQ}=_Q();class cZ extends Bq{constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(Z)=>e.stdout.write(Z),writeErr:(Z)=>e.stderr.write(Z),outputError:(Z,z)=>z(Z),getOutHelpWidth:()=>e.stdout.isTTY?e.stdout.columns:void 0,getErrHelpWidth:()=>e.stderr.isTTY?e.stderr.columns:void 0,getOutHasColors:()=>mZ()??(e.stdout.isTTY&&e.stdout.hasColors?.()),getErrHasColors:()=>mZ()??(e.stderr.isTTY&&e.stderr.hasColors?.()),stripColor:(Z)=>Oq(Z)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._helpOption=$._helpOption,this._helpCommand=$._helpCommand,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let Z=this;Z;Z=Z.parent)$.push(Z);return $}command($,Z,z){let Q=Z,X=z;if(typeof Q==="object"&&Q!==null)X=Q,Q=null;X=X||{};let[,J,Y]=$.match(/([^ ]+) *(.*)/),W=this.createCommand(J);if(Q)W.description(Q),W._executableHandler=!0;if(X.isDefault)this._defaultCommandName=W._name;if(W._hidden=!!(X.noHelp||X.hidden),W._executableFile=X.executableFile||null,Y)W.arguments(Y);if(this._registerCommand(W),W.parent=this,W.copyInheritedSettings(this),Q)return this;return W}createCommand($){return new cZ($)}createHelp(){return Object.assign(new Nq,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 Mq($,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 uZ($,Z,z));e.exit($)}action($){let Z=(z)=>{let Q=this.registeredArguments.length,X=z.slice(0,Q);if(this._storeOptionsAsProperties)X[Q]=this;else X[Q]=this.opts();return X.push(this),$.apply(this,X)};return this._actionHandler=Z,this}createOption($,Z){return new RQ($,Z)}_callParseArg($,Z,z,Q){try{return $.parseArg(Z,z)}catch(X){if(X.code==="commander.invalidArgument"){let J=`${Q} ${X.message}`;this.error(J,{exitCode:X.exitCode,code:X.code})}throw X}}_registerOption($){let Z=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(Z){let z=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${z}'
17
- - already used by option '${Z.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let Z=(Q)=>{return[Q.name()].concat(Q.aliases())},z=Z($).find((Q)=>this._findCommand(Q));if(z){let Q=Z(this._findCommand(z)).join("|"),X=Z($).join("|");throw Error(`cannot add command '${X}' as already have command '${Q}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let Z=$.name(),z=$.attributeName();if($.negate){let X=$.long.replace(/^--no-/,"--");if(!this._findOption(X))this.setOptionValueWithSource(z,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(z,$.defaultValue,"default");let Q=(X,J,Y)=>{if(X==null&&$.presetArg!==void 0)X=$.presetArg;let W=this.getOptionValue(z);if(X!==null&&$.parseArg)X=this._callParseArg($,X,W,J);else if(X!==null&&$.variadic)X=$._collectValue(X,W);if(X==null)if($.negate)X=!1;else if($.isBoolean()||$.optional)X=!0;else X="";this.setOptionValueWithSource(z,X,Y)};if(this.on("option:"+Z,(X)=>{let J=`error: option '${$.flags}' argument '${X}' is invalid.`;Q(X,J,"cli")}),$.envVar)this.on("optionEnv:"+Z,(X)=>{let J=`error: option '${$.flags}' value '${X}' from env '${$.envVar}' is invalid.`;Q(X,J,"env")});return this}_optionEx($,Z,z,Q,X){if(typeof Z==="object"&&Z instanceof RQ)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let J=this.createOption(Z,z);if(J.makeOptionMandatory(!!$.mandatory),typeof Q==="function")J.default(X).argParser(Q);else if(Q instanceof RegExp){let Y=Q;Q=(W,U)=>{let G=Y.exec(W);return G?G[0]:U},J.default(X).argParser(Q)}else J.default(Q);return this.addOption(J)}option($,Z,z,Q){return this._optionEx({},$,Z,z,Q)}requiredOption($,Z,z,Q){return this._optionEx({mandatory:!0},$,Z,z,Q)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,Z){return this.setOptionValueWithSource($,Z,void 0)}setOptionValueWithSource($,Z,z){if(this._storeOptionsAsProperties)this[$]=Z;else this._optionValues[$]=Z;return this._optionValueSources[$]=z,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let Z;return this._getCommandAndAncestors().forEach((z)=>{if(z.getOptionValueSource($)!==void 0)Z=z.getOptionValueSource($)}),Z}_prepareUserArgs($,Z){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(Z=Z||{},$===void 0&&Z.from===void 0){if(e.versions?.electron)Z.from="electron";let Q=e.execArgv??[];if(Q.includes("-e")||Q.includes("--eval")||Q.includes("-p")||Q.includes("--print"))Z.from="eval"}if($===void 0)$=e.argv;this.rawArgs=$.slice();let z;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],z=$.slice(2);break;case"electron":if(e.defaultApp)this._scriptPath=$[1],z=$.slice(2);else z=$.slice(1);break;case"user":z=$.slice(0);break;case"eval":z=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${Z.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",z}parse($,Z){this._prepareForParse();let z=this._prepareUserArgs($,Z);return this._parseCommand([],z),this}async parseAsync($,Z){this._prepareForParse();let z=this._prepareUserArgs($,Z);return await this._parseCommand([],z),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
18
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,Z,z){if(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
14
+ (Did you mean ${Q[0]}?)`;return""}DH.suggestSimilar=OH});var wQ=P((PH)=>{var TH=d0("node:events").EventEmitter,cZ=d0("node:child_process"),E2=d0("node:path"),O8=d0("node:fs"),e=d0("node:process"),{Argument:AH,humanReadableArgName:CH}=N8(),{CommanderError:pZ}=B1(),{Help:_H,stripColor:RH}=uZ(),{Option:SQ,DualOptions:FH}=mZ(),{suggestSimilar:EQ}=PQ();class dZ extends TH{constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(Z)=>e.stdout.write(Z),writeErr:(Z)=>e.stderr.write(Z),outputError:(Z,z)=>z(Z),getOutHelpWidth:()=>e.stdout.isTTY?e.stdout.columns:void 0,getErrHelpWidth:()=>e.stderr.isTTY?e.stderr.columns:void 0,getOutHasColors:()=>lZ()??(e.stdout.isTTY&&e.stdout.hasColors?.()),getErrHasColors:()=>lZ()??(e.stderr.isTTY&&e.stderr.hasColors?.()),stripColor:(Z)=>RH(Z)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._helpOption=$._helpOption,this._helpCommand=$._helpCommand,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let Z=this;Z;Z=Z.parent)$.push(Z);return $}command($,Z,z){let Q=Z,X=z;if(typeof Q==="object"&&Q!==null)X=Q,Q=null;X=X||{};let[,J,Y]=$.match(/([^ ]+) *(.*)/),W=this.createCommand(J);if(Q)W.description(Q),W._executableHandler=!0;if(X.isDefault)this._defaultCommandName=W._name;if(W._hidden=!!(X.noHelp||X.hidden),W._executableFile=X.executableFile||null,Y)W.arguments(Y);if(this._registerCommand(W),W.parent=this,W.copyInheritedSettings(this),Q)return this;return W}createCommand($){return new dZ($)}createHelp(){return Object.assign(new _H,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 AH($,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 pZ($,Z,z));e.exit($)}action($){let Z=(z)=>{let Q=this.registeredArguments.length,X=z.slice(0,Q);if(this._storeOptionsAsProperties)X[Q]=this;else X[Q]=this.opts();return X.push(this),$.apply(this,X)};return this._actionHandler=Z,this}createOption($,Z){return new SQ($,Z)}_callParseArg($,Z,z,Q){try{return $.parseArg(Z,z)}catch(X){if(X.code==="commander.invalidArgument"){let J=`${Q} ${X.message}`;this.error(J,{exitCode:X.exitCode,code:X.code})}throw X}}_registerOption($){let Z=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(Z){let z=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${z}'
17
+ - already used by option '${Z.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let Z=(Q)=>{return[Q.name()].concat(Q.aliases())},z=Z($).find((Q)=>this._findCommand(Q));if(z){let Q=Z(this._findCommand(z)).join("|"),X=Z($).join("|");throw Error(`cannot add command '${X}' as already have command '${Q}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let Z=$.name(),z=$.attributeName();if($.negate){let X=$.long.replace(/^--no-/,"--");if(!this._findOption(X))this.setOptionValueWithSource(z,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(z,$.defaultValue,"default");let Q=(X,J,Y)=>{if(X==null&&$.presetArg!==void 0)X=$.presetArg;let W=this.getOptionValue(z);if(X!==null&&$.parseArg)X=this._callParseArg($,X,W,J);else if(X!==null&&$.variadic)X=$._collectValue(X,W);if(X==null)if($.negate)X=!1;else if($.isBoolean()||$.optional)X=!0;else X="";this.setOptionValueWithSource(z,X,Y)};if(this.on("option:"+Z,(X)=>{let J=`error: option '${$.flags}' argument '${X}' is invalid.`;Q(X,J,"cli")}),$.envVar)this.on("optionEnv:"+Z,(X)=>{let J=`error: option '${$.flags}' value '${X}' from env '${$.envVar}' is invalid.`;Q(X,J,"env")});return this}_optionEx($,Z,z,Q,X){if(typeof Z==="object"&&Z instanceof SQ)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let J=this.createOption(Z,z);if(J.makeOptionMandatory(!!$.mandatory),typeof Q==="function")J.default(X).argParser(Q);else if(Q instanceof RegExp){let Y=Q;Q=(W,U)=>{let G=Y.exec(W);return G?G[0]:U},J.default(X).argParser(Q)}else J.default(Q);return this.addOption(J)}option($,Z,z,Q){return this._optionEx({},$,Z,z,Q)}requiredOption($,Z,z,Q){return this._optionEx({mandatory:!0},$,Z,z,Q)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,Z){return this.setOptionValueWithSource($,Z,void 0)}setOptionValueWithSource($,Z,z){if(this._storeOptionsAsProperties)this[$]=Z;else this._optionValues[$]=Z;return this._optionValueSources[$]=z,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let Z;return this._getCommandAndAncestors().forEach((z)=>{if(z.getOptionValueSource($)!==void 0)Z=z.getOptionValueSource($)}),Z}_prepareUserArgs($,Z){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(Z=Z||{},$===void 0&&Z.from===void 0){if(e.versions?.electron)Z.from="electron";let Q=e.execArgv??[];if(Q.includes("-e")||Q.includes("--eval")||Q.includes("-p")||Q.includes("--print"))Z.from="eval"}if($===void 0)$=e.argv;this.rawArgs=$.slice();let z;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],z=$.slice(2);break;case"electron":if(e.defaultApp)this._scriptPath=$[1],z=$.slice(2);else z=$.slice(1);break;case"user":z=$.slice(0);break;case"eval":z=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${Z.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",z}parse($,Z){this._prepareForParse();let z=this._prepareUserArgs($,Z);return this._parseCommand([],z),this}async parseAsync($,Z){this._prepareForParse();let z=this._prepareUserArgs($,Z);return await this._parseCommand([],z),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
18
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,Z,z){if(O8.existsSync($))return;let Q=Z?`searched for local subcommand relative to directory '${Z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",X=`'${$}' does not exist
19
19
  - if '${z}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
20
20
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
21
- - ${Q}`;throw Error(X)}_executeSubCommand($,Z){Z=Z.slice();let z=!1,Q=[".js",".ts",".tsx",".mjs",".cjs"];function X(G,V){let H=E2.resolve(G,V);if(M8.existsSync(H))return H;if(Q.includes(E2.extname(V)))return;let q=Q.find((K)=>M8.existsSync(`${H}${K}`));if(q)return`${H}${q}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let G;try{G=M8.realpathSync(this._scriptPath)}catch{G=this._scriptPath}Y=E2.resolve(E2.dirname(G),Y)}if(Y){let G=X(Y,J);if(!G&&!$._executableFile&&this._scriptPath){let V=E2.basename(this._scriptPath,E2.extname(this._scriptPath));if(V!==this._name)G=X(Y,`${V}-${$._name}`)}J=G||J}z=Q.includes(E2.extname(J));let W;if(e.platform!=="win32")if(z)Z.unshift(J),Z=PQ(e.execArgv).concat(Z),W=fZ.spawn(e.argv[0],Z,{stdio:"inherit"});else W=fZ.spawn(J,Z,{stdio:"inherit"});else this._checkForMissingExecutable(J,Y,$._name),Z.unshift(J),Z=PQ(e.execArgv).concat(Z),W=fZ.spawn(e.execPath,Z,{stdio:"inherit"});if(!W.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((V)=>{e.on(V,()=>{if(W.killed===!1&&W.exitCode===null)W.kill(V)})});let U=this._exitCallback;W.on("close",(G)=>{if(G=G??1,!U)e.exit(G);else U(new uZ(G,"commander.executeSubCommandAsync","(close)"))}),W.on("error",(G)=>{if(G.code==="ENOENT")this._checkForMissingExecutable(J,Y,$._name);else if(G.code==="EACCES")throw Error(`'${J}' not executable`);if(!U)e.exit(1);else{let V=new uZ(1,"commander.executeSubCommandAsync","(error)");V.nestedError=G,U(V)}}),this.runningCommand=W}_dispatchSubcommand($,Z,z){let Q=this._findCommand($);if(!Q)this.help({error:!0});Q._prepareForParse();let X;return X=this._chainOrCallSubCommandHook(X,Q,"preSubcommand"),X=this._chainOrCall(X,()=>{if(Q._executableHandler)this._executeSubCommand(Q,Z.concat(z));else return Q._parseCommand(Z,z)}),X}_dispatchHelpCommand($){if(!$)this.help();let Z=this._findCommand($);if(Z&&!Z._executableHandler)Z.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,Z)=>{if($.required&&this.args[Z]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(z,Q,X)=>{let J=Q;if(Q!==null&&z.parseArg){let Y=`error: command-argument value '${Q}' is invalid for argument '${z.name()}'.`;J=this._callParseArg(z,Q,X,Y)}return J};this._checkNumberOfArguments();let Z=[];this.registeredArguments.forEach((z,Q)=>{let X=z.defaultValue;if(z.variadic){if(Q<this.args.length){if(X=this.args.slice(Q),z.parseArg)X=X.reduce((J,Y)=>{return $(z,Y,J)},z.defaultValue)}else if(X===void 0)X=[]}else if(Q<this.args.length){if(X=this.args[Q],z.parseArg)X=$(z,X,z.defaultValue)}Z[Q]=X}),this.processedArgs=Z}_chainOrCall($,Z){if($?.then&&typeof $.then==="function")return $.then(()=>Z());return Z()}_chainOrCallHooks($,Z){let z=$,Q=[];if(this._getCommandAndAncestors().reverse().filter((X)=>X._lifeCycleHooks[Z]!==void 0).forEach((X)=>{X._lifeCycleHooks[Z].forEach((J)=>{Q.push({hookedCommand:X,callback:J})})}),Z==="postAction")Q.reverse();return Q.forEach((X)=>{z=this._chainOrCall(z,()=>{return X.callback(X.hookedCommand,this)})}),z}_chainOrCallSubCommandHook($,Z,z){let Q=$;if(this._lifeCycleHooks[z]!==void 0)this._lifeCycleHooks[z].forEach((X)=>{Q=this._chainOrCall(Q,()=>{return X(this,Z)})});return Q}_parseCommand($,Z){let z=this.parseOptions(Z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(z.operands),Z=z.unknown,this.args=$.concat(Z),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),Z);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(Z),this._dispatchSubcommand(this._defaultCommandName,$,Z);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(z.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Q=()=>{if(z.unknown.length>0)this.unknownOption(z.unknown[0])},X=`command:${this.name()}`;if(this._actionHandler){Q(),this._processArguments();let J;if(J=this._chainOrCallHooks(J,"preAction"),J=this._chainOrCall(J,()=>this._actionHandler(this.processedArgs)),this.parent)J=this._chainOrCall(J,()=>{this.parent.emit(X,$,Z)});return J=this._chainOrCallHooks(J,"postAction"),J}if(this.parent?.listenerCount(X))Q(),this._processArguments(),this.parent.emit(X,$,Z);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,Z);if(this.listenerCount("command:*"))this.emit("command:*",$,Z);else if(this.commands.length)this.unknownCommand();else Q(),this._processArguments()}else if(this.commands.length)Q(),this.help({error:!0});else Q(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((Z)=>Z._name===$||Z._aliases.includes($))}_findOption($){return this.options.find((Z)=>Z.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((Z)=>{if(Z.mandatory&&$.getOptionValue(Z.attributeName())===void 0)$.missingMandatoryOptionValue(Z)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((z)=>{let Q=z.attributeName();if(this.getOptionValue(Q)===void 0)return!1;return this.getOptionValueSource(Q)!=="default"});$.filter((z)=>z.conflictsWith.length>0).forEach((z)=>{let Q=$.find((X)=>z.conflictsWith.includes(X.attributeName()));if(Q)this._conflictingOption(z,Q)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let Z=[],z=[],Q=Z;function X(G){return G.length>1&&G[0]==="-"}let J=(G)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(G))return!1;return!this._getCommandAndAncestors().some((V)=>V.options.map((H)=>H.short).some((H)=>/^-\d$/.test(H)))},Y=null,W=null,U=0;while(U<$.length||W){let G=W??$[U++];if(W=null,G==="--"){if(Q===z)Q.push(G);Q.push(...$.slice(U));break}if(Y&&(!X(G)||J(G))){this.emit(`option:${Y.name()}`,G);continue}if(Y=null,X(G)){let V=this._findOption(G);if(V){if(V.required){let H=$[U++];if(H===void 0)this.optionMissingArgument(V);this.emit(`option:${V.name()}`,H)}else if(V.optional){let H=null;if(U<$.length&&(!X($[U])||J($[U])))H=$[U++];this.emit(`option:${V.name()}`,H)}else this.emit(`option:${V.name()}`);Y=V.variadic?V:null;continue}}if(G.length>2&&G[0]==="-"&&G[1]!=="-"){let V=this._findOption(`-${G[1]}`);if(V){if(V.required||V.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${V.name()}`,G.slice(2));else this.emit(`option:${V.name()}`),W=`-${G.slice(2)}`;continue}}if(/^--[^=]+=/.test(G)){let V=G.indexOf("="),H=this._findOption(G.slice(0,V));if(H&&(H.required||H.optional)){this.emit(`option:${H.name()}`,G.slice(V+1));continue}}if(Q===Z&&X(G)&&!(this.commands.length===0&&J(G)))Q=z;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&z.length===0){if(this._findCommand(G)){Z.push(G),z.push(...$.slice(U));break}else if(this._getHelpCommand()&&G===this._getHelpCommand().name()){Z.push(G,...$.slice(U));break}else if(this._defaultCommandName){z.push(G,...$.slice(U));break}}if(this._passThroughOptions){Q.push(G,...$.slice(U));break}Q.push(G)}return{operands:Z,unknown:z}}opts(){if(this._storeOptionsAsProperties){let $={},Z=this.options.length;for(let z=0;z<Z;z++){let Q=this.options[z].attributeName();$[Q]=Q===this._versionOptionName?this._version:this[Q]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,Z)=>Object.assign($,Z.opts()),{})}error($,Z){if(this._outputConfiguration.outputError(`${$}
21
+ - ${Q}`;throw Error(X)}_executeSubCommand($,Z){Z=Z.slice();let z=!1,Q=[".js",".ts",".tsx",".mjs",".cjs"];function X(G,V){let q=E2.resolve(G,V);if(O8.existsSync(q))return q;if(Q.includes(E2.extname(V)))return;let H=Q.find((K)=>O8.existsSync(`${q}${K}`));if(H)return`${q}${H}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let G;try{G=O8.realpathSync(this._scriptPath)}catch{G=this._scriptPath}Y=E2.resolve(E2.dirname(G),Y)}if(Y){let G=X(Y,J);if(!G&&!$._executableFile&&this._scriptPath){let V=E2.basename(this._scriptPath,E2.extname(this._scriptPath));if(V!==this._name)G=X(Y,`${V}-${$._name}`)}J=G||J}z=Q.includes(E2.extname(J));let W;if(e.platform!=="win32")if(z)Z.unshift(J),Z=jQ(e.execArgv).concat(Z),W=cZ.spawn(e.argv[0],Z,{stdio:"inherit"});else W=cZ.spawn(J,Z,{stdio:"inherit"});else this._checkForMissingExecutable(J,Y,$._name),Z.unshift(J),Z=jQ(e.execArgv).concat(Z),W=cZ.spawn(e.execPath,Z,{stdio:"inherit"});if(!W.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((V)=>{e.on(V,()=>{if(W.killed===!1&&W.exitCode===null)W.kill(V)})});let U=this._exitCallback;W.on("close",(G)=>{if(G=G??1,!U)e.exit(G);else U(new pZ(G,"commander.executeSubCommandAsync","(close)"))}),W.on("error",(G)=>{if(G.code==="ENOENT")this._checkForMissingExecutable(J,Y,$._name);else if(G.code==="EACCES")throw Error(`'${J}' not executable`);if(!U)e.exit(1);else{let V=new pZ(1,"commander.executeSubCommandAsync","(error)");V.nestedError=G,U(V)}}),this.runningCommand=W}_dispatchSubcommand($,Z,z){let Q=this._findCommand($);if(!Q)this.help({error:!0});Q._prepareForParse();let X;return X=this._chainOrCallSubCommandHook(X,Q,"preSubcommand"),X=this._chainOrCall(X,()=>{if(Q._executableHandler)this._executeSubCommand(Q,Z.concat(z));else return Q._parseCommand(Z,z)}),X}_dispatchHelpCommand($){if(!$)this.help();let Z=this._findCommand($);if(Z&&!Z._executableHandler)Z.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,Z)=>{if($.required&&this.args[Z]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(z,Q,X)=>{let J=Q;if(Q!==null&&z.parseArg){let Y=`error: command-argument value '${Q}' is invalid for argument '${z.name()}'.`;J=this._callParseArg(z,Q,X,Y)}return J};this._checkNumberOfArguments();let Z=[];this.registeredArguments.forEach((z,Q)=>{let X=z.defaultValue;if(z.variadic){if(Q<this.args.length){if(X=this.args.slice(Q),z.parseArg)X=X.reduce((J,Y)=>{return $(z,Y,J)},z.defaultValue)}else if(X===void 0)X=[]}else if(Q<this.args.length){if(X=this.args[Q],z.parseArg)X=$(z,X,z.defaultValue)}Z[Q]=X}),this.processedArgs=Z}_chainOrCall($,Z){if($?.then&&typeof $.then==="function")return $.then(()=>Z());return Z()}_chainOrCallHooks($,Z){let z=$,Q=[];if(this._getCommandAndAncestors().reverse().filter((X)=>X._lifeCycleHooks[Z]!==void 0).forEach((X)=>{X._lifeCycleHooks[Z].forEach((J)=>{Q.push({hookedCommand:X,callback:J})})}),Z==="postAction")Q.reverse();return Q.forEach((X)=>{z=this._chainOrCall(z,()=>{return X.callback(X.hookedCommand,this)})}),z}_chainOrCallSubCommandHook($,Z,z){let Q=$;if(this._lifeCycleHooks[z]!==void 0)this._lifeCycleHooks[z].forEach((X)=>{Q=this._chainOrCall(Q,()=>{return X(this,Z)})});return Q}_parseCommand($,Z){let z=this.parseOptions(Z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(z.operands),Z=z.unknown,this.args=$.concat(Z),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),Z);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(Z),this._dispatchSubcommand(this._defaultCommandName,$,Z);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(z.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Q=()=>{if(z.unknown.length>0)this.unknownOption(z.unknown[0])},X=`command:${this.name()}`;if(this._actionHandler){Q(),this._processArguments();let J;if(J=this._chainOrCallHooks(J,"preAction"),J=this._chainOrCall(J,()=>this._actionHandler(this.processedArgs)),this.parent)J=this._chainOrCall(J,()=>{this.parent.emit(X,$,Z)});return J=this._chainOrCallHooks(J,"postAction"),J}if(this.parent?.listenerCount(X))Q(),this._processArguments(),this.parent.emit(X,$,Z);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,Z);if(this.listenerCount("command:*"))this.emit("command:*",$,Z);else if(this.commands.length)this.unknownCommand();else Q(),this._processArguments()}else if(this.commands.length)Q(),this.help({error:!0});else Q(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((Z)=>Z._name===$||Z._aliases.includes($))}_findOption($){return this.options.find((Z)=>Z.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((Z)=>{if(Z.mandatory&&$.getOptionValue(Z.attributeName())===void 0)$.missingMandatoryOptionValue(Z)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((z)=>{let Q=z.attributeName();if(this.getOptionValue(Q)===void 0)return!1;return this.getOptionValueSource(Q)!=="default"});$.filter((z)=>z.conflictsWith.length>0).forEach((z)=>{let Q=$.find((X)=>z.conflictsWith.includes(X.attributeName()));if(Q)this._conflictingOption(z,Q)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let Z=[],z=[],Q=Z;function X(G){return G.length>1&&G[0]==="-"}let J=(G)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(G))return!1;return!this._getCommandAndAncestors().some((V)=>V.options.map((q)=>q.short).some((q)=>/^-\d$/.test(q)))},Y=null,W=null,U=0;while(U<$.length||W){let G=W??$[U++];if(W=null,G==="--"){if(Q===z)Q.push(G);Q.push(...$.slice(U));break}if(Y&&(!X(G)||J(G))){this.emit(`option:${Y.name()}`,G);continue}if(Y=null,X(G)){let V=this._findOption(G);if(V){if(V.required){let q=$[U++];if(q===void 0)this.optionMissingArgument(V);this.emit(`option:${V.name()}`,q)}else if(V.optional){let q=null;if(U<$.length&&(!X($[U])||J($[U])))q=$[U++];this.emit(`option:${V.name()}`,q)}else this.emit(`option:${V.name()}`);Y=V.variadic?V:null;continue}}if(G.length>2&&G[0]==="-"&&G[1]!=="-"){let V=this._findOption(`-${G[1]}`);if(V){if(V.required||V.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${V.name()}`,G.slice(2));else this.emit(`option:${V.name()}`),W=`-${G.slice(2)}`;continue}}if(/^--[^=]+=/.test(G)){let V=G.indexOf("="),q=this._findOption(G.slice(0,V));if(q&&(q.required||q.optional)){this.emit(`option:${q.name()}`,G.slice(V+1));continue}}if(Q===Z&&X(G)&&!(this.commands.length===0&&J(G)))Q=z;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&z.length===0){if(this._findCommand(G)){Z.push(G),z.push(...$.slice(U));break}else if(this._getHelpCommand()&&G===this._getHelpCommand().name()){Z.push(G,...$.slice(U));break}else if(this._defaultCommandName){z.push(G,...$.slice(U));break}}if(this._passThroughOptions){Q.push(G,...$.slice(U));break}Q.push(G)}return{operands:Z,unknown:z}}opts(){if(this._storeOptionsAsProperties){let $={},Z=this.options.length;for(let z=0;z<Z;z++){let Q=this.options[z].attributeName();$[Q]=Q===this._versionOptionName?this._version:this[Q]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,Z)=>Object.assign($,Z.opts()),{})}error($,Z){if(this._outputConfiguration.outputError(`${$}
22
22
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
23
23
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
24
- `),this.outputHelp({error:!0});let z=Z||{},Q=z.exitCode||1,X=z.code||"commander.error";this._exit(Q,X,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in e.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,e.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new Dq(this.options),Z=(z)=>{return this.getOptionValue(z)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(z))};this.options.filter((z)=>z.implied!==void 0&&Z(z.attributeName())&&$.valueFromOption(this.getOptionValue(z.attributeName()),z)).forEach((z)=>{Object.keys(z.implied).filter((Q)=>!Z(Q)).forEach((Q)=>{this.setOptionValueWithSource(Q,z.implied[Q],"implied")})})}missingArgument($){let Z=`error: missing required argument '${$}'`;this.error(Z,{code:"commander.missingArgument"})}optionMissingArgument($){let Z=`error: option '${$.flags}' argument missing`;this.error(Z,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let Z=`error: required option '${$.flags}' not specified`;this.error(Z,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,Z){let z=(J)=>{let Y=J.attributeName(),W=this.getOptionValue(Y),U=this.options.find((V)=>V.negate&&Y===V.attributeName()),G=this.options.find((V)=>!V.negate&&Y===V.attributeName());if(U&&(U.presetArg===void 0&&W===!1||U.presetArg!==void 0&&W===U.presetArg))return U;return G||J},Q=(J)=>{let Y=z(J),W=Y.attributeName();if(this.getOptionValueSource(W)==="env")return`environment variable '${Y.envVar}'`;return`option '${Y.flags}'`},X=`error: ${Q($)} cannot be used with ${Q(Z)}`;this.error(X,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let Z="";if($.startsWith("--")&&this._showSuggestionAfterError){let Q=[],X=this;do{let J=X.createHelp().visibleOptions(X).filter((Y)=>Y.long).map((Y)=>Y.long);Q=Q.concat(J),X=X.parent}while(X&&!X._enablePositionalOptions);Z=FQ($,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=FQ($,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 Lq(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=E2.basename($,E2.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let Z=this.createHelp(),z=this._getOutputContext($);Z.prepareContext({error:z.error,helpWidth:z.helpWidth,outputHasColors:z.hasColors});let Q=Z.formatHelp(this,Z);if(z.hasColors)return Q;return this._outputConfiguration.stripColor(Q)}_getOutputContext($){$=$||{};let Z=!!$.error,z,Q,X;if(Z)z=(Y)=>this._outputConfiguration.writeErr(Y),Q=this._outputConfiguration.getErrHasColors(),X=this._outputConfiguration.getErrHelpWidth();else z=(Y)=>this._outputConfiguration.writeOut(Y),Q=this._outputConfiguration.getOutHasColors(),X=this._outputConfiguration.getOutHelpWidth();return{error:Z,write:(Y)=>{if(!Q)Y=this._outputConfiguration.stripColor(Y);return z(Y)},hasColors:Q,helpWidth:X}}outputHelp($){let Z;if(typeof $==="function")Z=$,$=void 0;let z=this._getOutputContext($),Q={error:z.error,write:z.write,command:this};this._getCommandAndAncestors().reverse().forEach((J)=>J.emit("beforeAllHelp",Q)),this.emit("beforeHelp",Q);let X=this.helpInformation({error:z.error});if(Z){if(X=Z(X),typeof X!=="string"&&!Buffer.isBuffer(X))throw Error("outputHelp callback must return a string or a Buffer")}if(z.write(X),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",Q),this._getCommandAndAncestors().forEach((J)=>J.emit("afterAllHelp",Q))}helpOption($,Z){if(typeof $==="boolean"){if($){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption($??"-h, --help",Z??"display help for command"),$||Z)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let Z=Number(e.exitCode??0);if(Z===0&&$&&typeof $!=="function"&&$.error)Z=1;this._exit(Z,"commander.help","(outputHelp)")}addHelpText($,Z){let z=["beforeAll","before","after","afterAll"];if(!z.includes($))throw Error(`Unexpected value for position to addHelpText.
24
+ `),this.outputHelp({error:!0});let z=Z||{},Q=z.exitCode||1,X=z.code||"commander.error";this._exit(Q,X,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in e.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,e.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new FH(this.options),Z=(z)=>{return this.getOptionValue(z)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(z))};this.options.filter((z)=>z.implied!==void 0&&Z(z.attributeName())&&$.valueFromOption(this.getOptionValue(z.attributeName()),z)).forEach((z)=>{Object.keys(z.implied).filter((Q)=>!Z(Q)).forEach((Q)=>{this.setOptionValueWithSource(Q,z.implied[Q],"implied")})})}missingArgument($){let Z=`error: missing required argument '${$}'`;this.error(Z,{code:"commander.missingArgument"})}optionMissingArgument($){let Z=`error: option '${$.flags}' argument missing`;this.error(Z,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let Z=`error: required option '${$.flags}' not specified`;this.error(Z,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,Z){let z=(J)=>{let Y=J.attributeName(),W=this.getOptionValue(Y),U=this.options.find((V)=>V.negate&&Y===V.attributeName()),G=this.options.find((V)=>!V.negate&&Y===V.attributeName());if(U&&(U.presetArg===void 0&&W===!1||U.presetArg!==void 0&&W===U.presetArg))return U;return G||J},Q=(J)=>{let Y=z(J),W=Y.attributeName();if(this.getOptionValueSource(W)==="env")return`environment variable '${Y.envVar}'`;return`option '${Y.flags}'`},X=`error: ${Q($)} cannot be used with ${Q(Z)}`;this.error(X,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let Z="";if($.startsWith("--")&&this._showSuggestionAfterError){let Q=[],X=this;do{let J=X.createHelp().visibleOptions(X).filter((Y)=>Y.long).map((Y)=>Y.long);Q=Q.concat(J),X=X.parent}while(X&&!X._enablePositionalOptions);Z=EQ($,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=EQ($,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 CH(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=E2.basename($,E2.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let Z=this.createHelp(),z=this._getOutputContext($);Z.prepareContext({error:z.error,helpWidth:z.helpWidth,outputHasColors:z.hasColors});let Q=Z.formatHelp(this,Z);if(z.hasColors)return Q;return this._outputConfiguration.stripColor(Q)}_getOutputContext($){$=$||{};let Z=!!$.error,z,Q,X;if(Z)z=(Y)=>this._outputConfiguration.writeErr(Y),Q=this._outputConfiguration.getErrHasColors(),X=this._outputConfiguration.getErrHelpWidth();else z=(Y)=>this._outputConfiguration.writeOut(Y),Q=this._outputConfiguration.getOutHasColors(),X=this._outputConfiguration.getOutHelpWidth();return{error:Z,write:(Y)=>{if(!Q)Y=this._outputConfiguration.stripColor(Y);return z(Y)},hasColors:Q,helpWidth:X}}outputHelp($){let Z;if(typeof $==="function")Z=$,$=void 0;let z=this._getOutputContext($),Q={error:z.error,write:z.write,command:this};this._getCommandAndAncestors().reverse().forEach((J)=>J.emit("beforeAllHelp",Q)),this.emit("beforeHelp",Q);let X=this.helpInformation({error:z.error});if(Z){if(X=Z(X),typeof X!=="string"&&!Buffer.isBuffer(X))throw Error("outputHelp callback must return a string or a Buffer")}if(z.write(X),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",Q),this._getCommandAndAncestors().forEach((J)=>J.emit("afterAllHelp",Q))}helpOption($,Z){if(typeof $==="boolean"){if($){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption($??"-h, --help",Z??"display help for command"),$||Z)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let Z=Number(e.exitCode??0);if(Z===0&&$&&typeof $!=="function"&&$.error)Z=1;this._exit(Z,"commander.help","(outputHelp)")}addHelpText($,Z){let z=["beforeAll","before","after","afterAll"];if(!z.includes($))throw Error(`Unexpected value for position to addHelpText.
26
26
  Expecting one of '${z.join("', '")}'`);let Q=`${$}Help`;return this.on(Q,(X)=>{let J;if(typeof Z==="function")J=Z({error:X.error,command:X.command});else J=Z;if(J)X.write(`${J}
27
- `)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((Q)=>Z.is(Q)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function PQ($){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 mZ(){if(e.env.NO_COLOR||e.env.FORCE_COLOR==="0"||e.env.FORCE_COLOR==="false")return!1;if(e.env.FORCE_COLOR||e.env.CLICOLOR_FORCE!==void 0)return!0;return}Iq.Command=cZ;Iq.useColor=mZ});var xQ=P((Rq)=>{var{Argument:EQ}=B8(),{Command:pZ}=SQ(),{CommanderError:Cq,InvalidArgumentError:jQ}=H1(),{Help:_q}=gZ(),{Option:wQ}=hZ();Rq.program=new pZ;Rq.createCommand=($)=>new pZ($);Rq.createOption=($,Z)=>new wQ($,Z);Rq.createArgument=($,Z)=>new EQ($,Z);Rq.Command=pZ;Rq.Option=wQ;Rq.Argument=EQ;Rq.Help=_q;Rq.CommanderError=Cq;Rq.InvalidArgumentError=jQ;Rq.InvalidOptionArgumentError=jQ});var o=P((lq)=>{var lZ=Symbol.for("yaml.alias"),bQ=Symbol.for("yaml.document"),L8=Symbol.for("yaml.map"),vQ=Symbol.for("yaml.pair"),dZ=Symbol.for("yaml.scalar"),N8=Symbol.for("yaml.seq"),j2=Symbol.for("yaml.node.type"),gq=($)=>!!$&&typeof $==="object"&&$[j2]===lZ,hq=($)=>!!$&&typeof $==="object"&&$[j2]===bQ,fq=($)=>!!$&&typeof $==="object"&&$[j2]===L8,uq=($)=>!!$&&typeof $==="object"&&$[j2]===vQ,gQ=($)=>!!$&&typeof $==="object"&&$[j2]===dZ,mq=($)=>!!$&&typeof $==="object"&&$[j2]===N8;function hQ($){if($&&typeof $==="object")switch($[j2]){case L8:case N8:return!0}return!1}function cq($){if($&&typeof $==="object")switch($[j2]){case lZ:case L8:case dZ:case N8:return!0}return!1}var pq=($)=>(gQ($)||hQ($))&&!!$.anchor;lq.ALIAS=lZ;lq.DOC=bQ;lq.MAP=L8;lq.NODE_TYPE=j2;lq.PAIR=vQ;lq.SCALAR=dZ;lq.SEQ=N8;lq.hasAnchor=pq;lq.isAlias=gq;lq.isCollection=hQ;lq.isDocument=hq;lq.isMap=fq;lq.isNode=cq;lq.isPair=uq;lq.isScalar=gQ;lq.isSeq=mq});var q1=P((WK)=>{var I0=o(),f0=Symbol("break visit"),fQ=Symbol("skip children"),C2=Symbol("remove node");function O8($,Z){let z=uQ(Z);if(I0.isDocument($)){if(J$(null,$.contents,z,Object.freeze([$]))===C2)$.contents=null}else J$(null,$,z,Object.freeze([]))}O8.BREAK=f0;O8.SKIP=fQ;O8.REMOVE=C2;function J$($,Z,z,Q){let X=mQ($,Z,z,Q);if(I0.isNode(X)||I0.isPair(X))return cQ($,Q,X),J$($,X,z,Q);if(typeof X!=="symbol"){if(I0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=J$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===f0)return f0;else if(Y===C2)Z.items.splice(J,1),J-=1}}else if(I0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=J$("key",Z.key,z,Q);if(J===f0)return f0;else if(J===C2)Z.key=null;let Y=J$("value",Z.value,z,Q);if(Y===f0)return f0;else if(Y===C2)Z.value=null}}return X}async function D8($,Z){let z=uQ(Z);if(I0.isDocument($)){if(await Y$(null,$.contents,z,Object.freeze([$]))===C2)$.contents=null}else await Y$(null,$,z,Object.freeze([]))}D8.BREAK=f0;D8.SKIP=fQ;D8.REMOVE=C2;async function Y$($,Z,z,Q){let X=await mQ($,Z,z,Q);if(I0.isNode(X)||I0.isPair(X))return cQ($,Q,X),Y$($,X,z,Q);if(typeof X!=="symbol"){if(I0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=await Y$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===f0)return f0;else if(Y===C2)Z.items.splice(J,1),J-=1}}else if(I0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=await Y$("key",Z.key,z,Q);if(J===f0)return f0;else if(J===C2)Z.key=null;let Y=await Y$("value",Z.value,z,Q);if(Y===f0)return f0;else if(Y===C2)Z.value=null}}return X}function uQ($){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 mQ($,Z,z,Q){if(typeof z==="function")return z($,Z,Q);if(I0.isMap(Z))return z.Map?.($,Z,Q);if(I0.isSeq(Z))return z.Seq?.($,Z,Q);if(I0.isPair(Z))return z.Pair?.($,Z,Q);if(I0.isScalar(Z))return z.Scalar?.($,Z,Q);if(I0.isAlias(Z))return z.Alias?.($,Z,Q);return}function cQ($,Z,z){let Q=Z[Z.length-1];if(I0.isCollection(Q))Q.items[$]=z;else if(I0.isPair(Q))if($==="key")Q.key=z;else Q.value=z;else if(I0.isDocument(Q))Q.contents=z;else{let X=I0.isAlias(Q)?"alias":"scalar";throw Error(`Cannot replace node with ${X} parent`)}}WK.visit=O8;WK.visitAsync=D8});var iZ=P((KK)=>{var pQ=o(),VK=q1(),HK={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},qK=($)=>$.replace(/[!,[\]{}]/g,(Z)=>HK[Z]);class e0{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e0.defaultYaml,$),this.tags=Object.assign({},e0.defaultTags,Z)}clone(){let $=new e0(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new e0(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e0.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e0.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:e0.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e0.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+qK($.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&&pQ.isNode($.contents)){let X={};VK.visit($.contents,(J,Y)=>{if(pQ.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
- `)}}e0.defaultYaml={explicit:!1,version:"1.2"};e0.defaultTags={"!!":"tag:yaml.org,2002:"};KK.Directives=e0});var I8=P((OK)=>{var lQ=o(),MK=q1();function LK($){if(/[\x00-\x19\s,[\]{}]/.test($)){let z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(z)}return!0}function dQ($){let Z=new Set;return MK.visit($,{Value(z,Q){if(Q.anchor)Z.add(Q.anchor)}}),Z}function iQ($,Z){for(let z=1;;++z){let Q=`${$}${z}`;if(!Z.has(Q))return Q}}function NK($,Z){let z=[],Q=new Map,X=null;return{onAnchor:(J)=>{z.push(J),X??(X=dQ($));let Y=iQ(Z,X);return X.add(Y),Y},setAnchors:()=>{for(let J of z){let Y=Q.get(J);if(typeof Y==="object"&&Y.anchor&&(lQ.isScalar(Y.node)||lQ.isCollection(Y.node)))Y.node.anchor=Y.anchor;else{let W=Error("Failed to resolve repeated object (this should not happen)");throw W.source=J,W}}},sourceObjects:Q}}OK.anchorIsValid=LK;OK.anchorNames=dQ;OK.createNodeAnchors=NK;OK.findNewAnchor=iQ});var nZ=P((CK)=>{function K1($,Z,z,Q){if(Q&&typeof Q==="object")if(Array.isArray(Q))for(let X=0,J=Q.length;X<J;++X){let Y=Q[X],W=K1($,Q,String(X),Y);if(W===void 0)delete Q[X];else if(W!==Y)Q[X]=W}else if(Q instanceof Map)for(let X of Array.from(Q.keys())){let J=Q.get(X),Y=K1($,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=K1($,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=K1($,Q,X,J);if(Y===void 0)delete Q[X];else if(Y!==J)Q[X]=Y}return $.call(Z,z,Q)}CK.applyReviver=K1});var o2=P((FK)=>{var RK=o();function nQ($,Z,z){if(Array.isArray($))return $.map((Q,X)=>nQ(Q,String(X),z));if($&&typeof $.toJSON==="function"){if(!z||!RK.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 $}FK.toJS=nQ});var T8=P((jK)=>{var SK=nZ(),rQ=o(),EK=o2();class sQ{constructor($){Object.defineProperty(this,rQ.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(!rQ.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=EK.toJS(this,"",J);if(typeof Q==="function")for(let{count:W,res:U}of J.anchors.values())Q(U,W);return typeof X==="function"?SK.applyReviver(X,{"":Y},"",Y):Y}}jK.NodeBase=sQ});var B1=P((vK)=>{var xK=I8(),yK=q1(),W$=o(),kK=T8(),bK=o2();class oQ extends kK.NodeBase{constructor($){super(W$.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=[],yK.visit($,{Node:(X,J)=>{if(W$.isAlias(J)||W$.hasAnchor(J))z.push(J)}}),Z)Z.aliasResolveCache=z;let Q=void 0;for(let X of z){if(X===this)break;if(X.anchor===this.source)Q=X}return Q}toJSON($,Z){if(!Z)return{source:this.source};let{anchors:z,doc:Q,maxAliasCount:X}=Z,J=this.resolve(Q,Z);if(!J){let W=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(W)}let Y=z.get(J);if(!Y)bK.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=A8(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(xK.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 A8($,Z,z){if(W$.isAlias(Z)){let Q=Z.resolve($),X=z&&Q&&z.get(Q);return X?X.count*X.aliasCount:0}else if(W$.isCollection(Z)){let Q=0;for(let X of Z.items){let J=A8($,X,z);if(J>Q)Q=J}return Q}else if(W$.isPair(Z)){let Q=A8($,Z.key,z),X=A8($,Z.value,z);return Math.max(Q,X)}return 1}vK.Alias=oQ});var M0=P((cK)=>{var hK=o(),fK=T8(),uK=o2(),mK=($)=>!$||typeof $!=="function"&&typeof $!=="object";class _6 extends fK.NodeBase{constructor($){super(hK.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:uK.toJS(this.value,$,Z)}toString(){return String(this.value)}}_6.BLOCK_FOLDED="BLOCK_FOLDED";_6.BLOCK_LITERAL="BLOCK_LITERAL";_6.PLAIN="PLAIN";_6.QUOTE_DOUBLE="QUOTE_DOUBLE";_6.QUOTE_SINGLE="QUOTE_SINGLE";cK.Scalar=_6;cK.isScalarValue=mK});var M1=P((sK)=>{var dK=B1(),R6=o(),aQ=M0(),iK="tag:yaml.org,2002:";function nK($,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 rK($,Z,z){if(R6.isDocument($))$=$.contents;if(R6.isNode($))return $;if(R6.isPair($)){let H=z.schema[R6.MAP].createNode?.(z.schema,null,z);return H.items.push($),H}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:Q,onAnchor:X,onTagObj:J,schema:Y,sourceObjects:W}=z,U=void 0;if(Q&&$&&typeof $==="object")if(U=W.get($),U)return U.anchor??(U.anchor=X($)),new dK.Alias(U.anchor);else U={anchor:null,node:null},W.set($,U);if(Z?.startsWith("!!"))Z=iK+Z.slice(2);let G=nK($,Z,Y.tags);if(!G){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let H=new aQ.Scalar($);if(U)U.node=H;return H}G=$ instanceof Map?Y[R6.MAP]:(Symbol.iterator in Object($))?Y[R6.SEQ]:Y[R6.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 aQ.Scalar($);if(Z)V.tag=Z;else if(!G.default)V.tag=G.tag;if(U)U.node=V;return V}sK.createNode=rK});var C8=P((eK)=>{var aK=M1(),_2=o(),tK=T8();function rZ($,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 aK.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var tQ=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class eQ extends tK.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)=>_2.isNode(z)||_2.isPair(z)?z.clone($):z),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(tQ($))this.add(Z);else{let[z,...Q]=$,X=this.get(z,!0);if(_2.isCollection(X))X.addIn(Q,Z);else if(X===void 0&&this.schema)this.set(z,rZ(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(_2.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&&_2.isScalar(X)?X.value:X;else return _2.isCollection(X)?X.getIn(Q,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!_2.isPair(Z))return!1;let z=Z.value;return z==null||$&&_2.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 _2.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(_2.isCollection(X))X.setIn(Q,Z);else if(X===void 0&&this.schema)this.set(z,rZ(this.schema,Q,Z));else throw Error(`Expected YAML collection at ${z}. Remaining path: ${Q}`)}}}eK.Collection=eQ;eK.collectionFromPath=rZ;eK.isEmptyPath=tQ});var L1=P((JB)=>{var QB=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function sZ($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var XB=($,Z,z)=>$.endsWith(`
29
- `)?sZ(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 jQ($){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 lZ(){if(e.env.NO_COLOR||e.env.FORCE_COLOR==="0"||e.env.FORCE_COLOR==="false")return!1;if(e.env.FORCE_COLOR||e.env.CLICOLOR_FORCE!==void 0)return!0;return}PH.Command=dZ;PH.useColor=lZ});var bQ=P((xH)=>{var{Argument:xQ}=N8(),{Command:iZ}=wQ(),{CommanderError:jH,InvalidArgumentError:yQ}=B1(),{Help:wH}=uZ(),{Option:kQ}=mZ();xH.program=new iZ;xH.createCommand=($)=>new iZ($);xH.createOption=($,Z)=>new kQ($,Z);xH.createArgument=($,Z)=>new xQ($,Z);xH.Command=iZ;xH.Option=kQ;xH.Argument=xQ;xH.Help=wH;xH.CommanderError=jH;xH.InvalidArgumentError=yQ;xH.InvalidOptionArgumentError=yQ});var o=P((aH)=>{var nZ=Symbol.for("yaml.alias"),hQ=Symbol.for("yaml.document"),D8=Symbol.for("yaml.map"),fQ=Symbol.for("yaml.pair"),rZ=Symbol.for("yaml.scalar"),I8=Symbol.for("yaml.seq"),j2=Symbol.for("yaml.node.type"),lH=($)=>!!$&&typeof $==="object"&&$[j2]===nZ,dH=($)=>!!$&&typeof $==="object"&&$[j2]===hQ,iH=($)=>!!$&&typeof $==="object"&&$[j2]===D8,nH=($)=>!!$&&typeof $==="object"&&$[j2]===fQ,uQ=($)=>!!$&&typeof $==="object"&&$[j2]===rZ,rH=($)=>!!$&&typeof $==="object"&&$[j2]===I8;function mQ($){if($&&typeof $==="object")switch($[j2]){case D8:case I8:return!0}return!1}function sH($){if($&&typeof $==="object")switch($[j2]){case nZ:case D8:case rZ:case I8:return!0}return!1}var oH=($)=>(uQ($)||mQ($))&&!!$.anchor;aH.ALIAS=nZ;aH.DOC=hQ;aH.MAP=D8;aH.NODE_TYPE=j2;aH.PAIR=fQ;aH.SCALAR=rZ;aH.SEQ=I8;aH.hasAnchor=oH;aH.isAlias=lH;aH.isCollection=mQ;aH.isDocument=dH;aH.isMap=iH;aH.isNode=sH;aH.isPair=nH;aH.isScalar=uQ;aH.isSeq=rH});var M1=P((BK)=>{var I0=o(),f0=Symbol("break visit"),cQ=Symbol("skip children"),C2=Symbol("remove node");function T8($,Z){let z=pQ(Z);if(I0.isDocument($)){if(Y$(null,$.contents,z,Object.freeze([$]))===C2)$.contents=null}else Y$(null,$,z,Object.freeze([]))}T8.BREAK=f0;T8.SKIP=cQ;T8.REMOVE=C2;function Y$($,Z,z,Q){let X=lQ($,Z,z,Q);if(I0.isNode(X)||I0.isPair(X))return dQ($,Q,X),Y$($,X,z,Q);if(typeof X!=="symbol"){if(I0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=Y$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===f0)return f0;else if(Y===C2)Z.items.splice(J,1),J-=1}}else if(I0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=Y$("key",Z.key,z,Q);if(J===f0)return f0;else if(J===C2)Z.key=null;let Y=Y$("value",Z.value,z,Q);if(Y===f0)return f0;else if(Y===C2)Z.value=null}}return X}async function A8($,Z){let z=pQ(Z);if(I0.isDocument($)){if(await W$(null,$.contents,z,Object.freeze([$]))===C2)$.contents=null}else await W$(null,$,z,Object.freeze([]))}A8.BREAK=f0;A8.SKIP=cQ;A8.REMOVE=C2;async function W$($,Z,z,Q){let X=await lQ($,Z,z,Q);if(I0.isNode(X)||I0.isPair(X))return dQ($,Q,X),W$($,X,z,Q);if(typeof X!=="symbol"){if(I0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=await W$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===f0)return f0;else if(Y===C2)Z.items.splice(J,1),J-=1}}else if(I0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=await W$("key",Z.key,z,Q);if(J===f0)return f0;else if(J===C2)Z.key=null;let Y=await W$("value",Z.value,z,Q);if(Y===f0)return f0;else if(Y===C2)Z.value=null}}return X}function pQ($){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 lQ($,Z,z,Q){if(typeof z==="function")return z($,Z,Q);if(I0.isMap(Z))return z.Map?.($,Z,Q);if(I0.isSeq(Z))return z.Seq?.($,Z,Q);if(I0.isPair(Z))return z.Pair?.($,Z,Q);if(I0.isScalar(Z))return z.Scalar?.($,Z,Q);if(I0.isAlias(Z))return z.Alias?.($,Z,Q);return}function dQ($,Z,z){let Q=Z[Z.length-1];if(I0.isCollection(Q))Q.items[$]=z;else if(I0.isPair(Q))if($==="key")Q.key=z;else Q.value=z;else if(I0.isDocument(Q))Q.contents=z;else{let X=I0.isAlias(Q)?"alias":"scalar";throw Error(`Cannot replace node with ${X} parent`)}}BK.visit=T8;BK.visitAsync=A8});var sZ=P((IK)=>{var iQ=o(),NK=M1(),OK={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},DK=($)=>$.replace(/[!,[\]{}]/g,(Z)=>OK[Z]);class e0{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e0.defaultYaml,$),this.tags=Object.assign({},e0.defaultTags,Z)}clone(){let $=new e0(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new e0(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e0.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e0.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:e0.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e0.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+DK($.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&&iQ.isNode($.contents)){let X={};NK.visit($.contents,(J,Y)=>{if(iQ.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
+ `)}}e0.defaultYaml={explicit:!1,version:"1.2"};e0.defaultTags={"!!":"tag:yaml.org,2002:"};IK.Directives=e0});var C8=P((RK)=>{var nQ=o(),AK=M1();function CK($){if(/[\x00-\x19\s,[\]{}]/.test($)){let z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(z)}return!0}function rQ($){let Z=new Set;return AK.visit($,{Value(z,Q){if(Q.anchor)Z.add(Q.anchor)}}),Z}function sQ($,Z){for(let z=1;;++z){let Q=`${$}${z}`;if(!Z.has(Q))return Q}}function _K($,Z){let z=[],Q=new Map,X=null;return{onAnchor:(J)=>{z.push(J),X??(X=rQ($));let Y=sQ(Z,X);return X.add(Y),Y},setAnchors:()=>{for(let J of z){let Y=Q.get(J);if(typeof Y==="object"&&Y.anchor&&(nQ.isScalar(Y.node)||nQ.isCollection(Y.node)))Y.node.anchor=Y.anchor;else{let W=Error("Failed to resolve repeated object (this should not happen)");throw W.source=J,W}}},sourceObjects:Q}}RK.anchorIsValid=CK;RK.anchorNames=rQ;RK.createNodeAnchors=_K;RK.findNewAnchor=sQ});var oZ=P((jK)=>{function L1($,Z,z,Q){if(Q&&typeof Q==="object")if(Array.isArray(Q))for(let X=0,J=Q.length;X<J;++X){let Y=Q[X],W=L1($,Q,String(X),Y);if(W===void 0)delete Q[X];else if(W!==Y)Q[X]=W}else if(Q instanceof Map)for(let X of Array.from(Q.keys())){let J=Q.get(X),Y=L1($,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=L1($,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=L1($,Q,X,J);if(Y===void 0)delete Q[X];else if(Y!==J)Q[X]=Y}return $.call(Z,z,Q)}jK.applyReviver=L1});var o2=P((yK)=>{var xK=o();function oQ($,Z,z){if(Array.isArray($))return $.map((Q,X)=>oQ(Q,String(X),z));if($&&typeof $.toJSON==="function"){if(!z||!xK.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 $}yK.toJS=oQ});var _8=P((gK)=>{var bK=oZ(),aQ=o(),vK=o2();class tQ{constructor($){Object.defineProperty(this,aQ.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(!aQ.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=vK.toJS(this,"",J);if(typeof Q==="function")for(let{count:W,res:U}of J.anchors.values())Q(U,W);return typeof X==="function"?bK.applyReviver(X,{"":Y},"",Y):Y}}gK.NodeBase=tQ});var N1=P((pK)=>{var fK=C8(),uK=M1(),U$=o(),mK=_8(),cK=o2();class eQ extends mK.NodeBase{constructor($){super(U$.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=[],uK.visit($,{Node:(X,J)=>{if(U$.isAlias(J)||U$.hasAnchor(J))z.push(J)}}),Z)Z.aliasResolveCache=z;let Q=void 0;for(let X of z){if(X===this)break;if(X.anchor===this.source)Q=X}return Q}toJSON($,Z){if(!Z)return{source:this.source};let{anchors:z,doc:Q,maxAliasCount:X}=Z,J=this.resolve(Q,Z);if(!J){let W=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(W)}let Y=z.get(J);if(!Y)cK.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(fK.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(U$.isAlias(Z)){let Q=Z.resolve($),X=z&&Q&&z.get(Q);return X?X.count*X.aliasCount:0}else if(U$.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(U$.isPair(Z)){let Q=R8($,Z.key,z),X=R8($,Z.value,z);return Math.max(Q,X)}return 1}pK.Alias=eQ});var M0=P((sK)=>{var dK=o(),iK=_8(),nK=o2(),rK=($)=>!$||typeof $!=="function"&&typeof $!=="object";class R6 extends iK.NodeBase{constructor($){super(dK.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:nK.toJS(this.value,$,Z)}toString(){return String(this.value)}}R6.BLOCK_FOLDED="BLOCK_FOLDED";R6.BLOCK_LITERAL="BLOCK_LITERAL";R6.PLAIN="PLAIN";R6.QUOTE_DOUBLE="QUOTE_DOUBLE";R6.QUOTE_SINGLE="QUOTE_SINGLE";sK.Scalar=R6;sK.isScalarValue=rK});var O1=P((zB)=>{var tK=N1(),F6=o(),$X=M0(),eK="tag:yaml.org,2002:";function $B($,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 ZB($,Z,z){if(F6.isDocument($))$=$.contents;if(F6.isNode($))return $;if(F6.isPair($)){let q=z.schema[F6.MAP].createNode?.(z.schema,null,z);return q.items.push($),q}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:Q,onAnchor:X,onTagObj:J,schema:Y,sourceObjects:W}=z,U=void 0;if(Q&&$&&typeof $==="object")if(U=W.get($),U)return U.anchor??(U.anchor=X($)),new tK.Alias(U.anchor);else U={anchor:null,node:null},W.set($,U);if(Z?.startsWith("!!"))Z=eK+Z.slice(2);let G=$B($,Z,Y.tags);if(!G){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let q=new $X.Scalar($);if(U)U.node=q;return q}G=$ instanceof Map?Y[F6.MAP]:(Symbol.iterator in Object($))?Y[F6.SEQ]:Y[F6.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 $X.Scalar($);if(Z)V.tag=Z;else if(!G.default)V.tag=G.tag;if(U)U.node=V;return V}zB.createNode=ZB});var F8=P((YB)=>{var XB=O1(),_2=o(),JB=_8();function aZ($,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 XB.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var ZX=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class zX extends JB.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)=>_2.isNode(z)||_2.isPair(z)?z.clone($):z),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(ZX($))this.add(Z);else{let[z,...Q]=$,X=this.get(z,!0);if(_2.isCollection(X))X.addIn(Q,Z);else if(X===void 0&&this.schema)this.set(z,aZ(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(_2.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&&_2.isScalar(X)?X.value:X;else return _2.isCollection(X)?X.getIn(Q,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!_2.isPair(Z))return!1;let z=Z.value;return z==null||$&&_2.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 _2.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(_2.isCollection(X))X.setIn(Q,Z);else if(X===void 0&&this.schema)this.set(z,aZ(this.schema,Q,Z));else throw Error(`Expected YAML collection at ${z}. Remaining path: ${Q}`)}}}YB.Collection=zX;YB.collectionFromPath=aZ;YB.isEmptyPath=ZX});var D1=P((HB)=>{var VB=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function tZ($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var qB=($,Z,z)=>$.endsWith(`
29
+ `)?tZ(z,Z):z.includes(`
30
30
  `)?`
31
- `+sZ(z,Z):($.endsWith(" ")?"":" ")+z;JB.indentComment=sZ;JB.lineComment=XB;JB.stringifyComment=QB});var ZX=P((VB)=>{function GB($,Z,z="flow",{indentAtStart:Q,lineWidth:X=80,minContentWidth:J=20,onFold:Y,onOverflow:W}={}){if(!X||X<0)return $;if(X<J)J=0;let U=Math.max(1+J,1+X-Z.length);if($.length<=U)return $;let G=[],V={},H=X-Z.length;if(typeof Q==="number")if(Q>X-Math.max(2,J))G.push(0);else H=X-Q;let q=void 0,K=void 0,L=!1,B=-1,N=-1,T=-1;if(z==="block"){if(B=$X($,B,Z.length),B!==-1)H=B+U}for(let w;w=$[B+=1];){if(z==="quoted"&&w==="\\"){switch(N=B,$[B+1]){case"x":B+=3;break;case"u":B+=5;break;case"U":B+=9;break;default:B+=1}T=B}if(w===`
32
- `){if(z==="block")B=$X($,B,Z.length);H=B+Z.length+U,q=void 0}else{if(w===" "&&K&&K!==" "&&K!==`
31
+ `+tZ(z,Z):($.endsWith(" ")?"":" ")+z;HB.indentComment=tZ;HB.lineComment=qB;HB.stringifyComment=VB});var XX=P((NB)=>{function LB($,Z,z="flow",{indentAtStart:Q,lineWidth:X=80,minContentWidth:J=20,onFold:Y,onOverflow:W}={}){if(!X||X<0)return $;if(X<J)J=0;let U=Math.max(1+J,1+X-Z.length);if($.length<=U)return $;let G=[],V={},q=X-Z.length;if(typeof Q==="number")if(Q>X-Math.max(2,J))G.push(0);else q=X-Q;let H=void 0,K=void 0,L=!1,B=-1,N=-1,T=-1;if(z==="block"){if(B=QX($,B,Z.length),B!==-1)q=B+U}for(let w;w=$[B+=1];){if(z==="quoted"&&w==="\\"){switch(N=B,$[B+1]){case"x":B+=3;break;case"u":B+=5;break;case"U":B+=9;break;default:B+=1}T=B}if(w===`
32
+ `){if(z==="block")B=QX($,B,Z.length);q=B+Z.length+U,H=void 0}else{if(w===" "&&K&&K!==" "&&K!==`
33
33
  `&&K!=="\t"){let j=$[B+1];if(j&&j!==" "&&j!==`
34
- `&&j!=="\t")q=B}if(B>=H)if(q)G.push(q),H=q+U,q=void 0;else if(z==="quoted"){while(K===" "||K==="\t")K=w,w=$[B+=1],L=!0;let j=B>T+1?B-2:N-1;if(V[j])return $;G.push(j),V[j]=!0,H=j+U,q=void 0}else L=!0}K=w}if(L&&W)W();if(G.length===0)return $;if(Y)Y();let R=$.slice(0,G[0]);for(let w=0;w<G.length;++w){let j=G[w],y=G[w+1]||$.length;if(j===0)R=`
34
+ `&&j!=="\t")H=B}if(B>=q)if(H)G.push(H),q=H+U,H=void 0;else if(z==="quoted"){while(K===" "||K==="\t")K=w,w=$[B+=1],L=!0;let j=B>T+1?B-2:N-1;if(V[j])return $;G.push(j),V[j]=!0,q=j+U,H=void 0}else L=!0}K=w}if(L&&W)W();if(G.length===0)return $;if(Y)Y();let R=$.slice(0,G[0]);for(let w=0;w<G.length;++w){let j=G[w],y=G[w+1]||$.length;if(j===0)R=`
35
35
  ${Z}${$.slice(0,y)}`;else{if(z==="quoted"&&V[j])R+=`${$[j]}\\`;R+=`
36
- ${Z}${$.slice(j+1,y)}`}}return R}function $X($,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}VB.FOLD_BLOCK="block";VB.FOLD_FLOW="flow";VB.FOLD_QUOTED="quoted";VB.foldFlowLines=GB});var O1=P((OB)=>{var H2=M0(),a2=ZX(),R8=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),F8=($)=>/^(%|---|\.\.\.)/m.test($);function MB($,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 N1($,Z){let z=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return z;let{implicitKey:Q}=Z,X=Z.options.doubleQuotedMinMultiLineLength,J=Z.indent||(F8($)?" ":""),Y="",W=0;for(let U=0,G=z[U];G;G=z[++U]){if(G===" "&&z[U+1]==="\\"&&z[U+2]==="n")Y+=z.slice(W,U)+"\\ ",U+=1,W=U,G="\\";if(G==="\\")switch(z[U+1]){case"u":{Y+=z.slice(W,U);let V=z.substr(U+2,4);switch(V){case"0000":Y+="\\0";break;case"0007":Y+="\\a";break;case"000b":Y+="\\v";break;case"001b":Y+="\\e";break;case"0085":Y+="\\N";break;case"00a0":Y+="\\_";break;case"2028":Y+="\\L";break;case"2029":Y+="\\P";break;default:if(V.substr(0,2)==="00")Y+="\\x"+V.substr(2);else Y+=z.substr(U,6)}U+=5,W=U+1}break;case"n":if(Q||z[U+2]==='"'||z.length<X)U+=1;else{Y+=z.slice(W,U)+`
36
+ ${Z}${$.slice(j+1,y)}`}}return R}function QX($,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}NB.FOLD_BLOCK="block";NB.FOLD_FLOW="flow";NB.FOLD_QUOTED="quoted";NB.foldFlowLines=LB});var T1=P((RB)=>{var q2=M0(),a2=XX(),S8=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),E8=($)=>/^(%|---|\.\.\.)/m.test($);function AB($,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 I1($,Z){let z=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return z;let{implicitKey:Q}=Z,X=Z.options.doubleQuotedMinMultiLineLength,J=Z.indent||(E8($)?" ":""),Y="",W=0;for(let U=0,G=z[U];G;G=z[++U]){if(G===" "&&z[U+1]==="\\"&&z[U+2]==="n")Y+=z.slice(W,U)+"\\ ",U+=1,W=U,G="\\";if(G==="\\")switch(z[U+1]){case"u":{Y+=z.slice(W,U);let V=z.substr(U+2,4);switch(V){case"0000":Y+="\\0";break;case"0007":Y+="\\a";break;case"000b":Y+="\\v";break;case"001b":Y+="\\e";break;case"0085":Y+="\\N";break;case"00a0":Y+="\\_";break;case"2028":Y+="\\L";break;case"2029":Y+="\\P";break;default:if(V.substr(0,2)==="00")Y+="\\x"+V.substr(2);else Y+=z.substr(U,6)}U+=5,W=U+1}break;case"n":if(Q||z[U+2]==='"'||z.length<X)U+=1;else{Y+=z.slice(W,U)+`
39
39
 
40
40
  `;while(z[U+2]==="\\"&&z[U+3]==="n"&&z[U+4]!=='"')Y+=`
41
- `,U+=2;if(Y+=J,z[U+2]===" ")Y+="\\";U+=1,W=U+1}break;default:U+=1}}return Y=W?Y+z.slice(W):z,Q?Y:a2.foldFlowLines(Y,J,a2.FOLD_QUOTED,R8(Z,!1))}function oZ($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
42
- `)||/[ \t]\n|\n[ \t]/.test($))return N1($,Z);let z=Z.indent||(F8($)?" ":""),Q="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
43
- ${z}`)+"'";return Z.implicitKey?Q:a2.foldFlowLines(Q,z,a2.FOLD_FLOW,R8(Z,!1))}function U$($,Z){let{singleQuote:z}=Z.options,Q;if(z===!1)Q=N1;else{let X=$.includes('"'),J=$.includes("'");if(X&&!J)Q=oZ;else if(J&&!X)Q=N1;else Q=z?oZ:N1}return Q($,Z)}var aZ;try{aZ=new RegExp(`(^|(?<!
41
+ `,U+=2;if(Y+=J,z[U+2]===" ")Y+="\\";U+=1,W=U+1}break;default:U+=1}}return Y=W?Y+z.slice(W):z,Q?Y:a2.foldFlowLines(Y,J,a2.FOLD_QUOTED,S8(Z,!1))}function eZ($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
42
+ `)||/[ \t]\n|\n[ \t]/.test($))return I1($,Z);let z=Z.indent||(E8($)?" ":""),Q="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
43
+ ${z}`)+"'";return Z.implicitKey?Q:a2.foldFlowLines(Q,z,a2.FOLD_FLOW,S8(Z,!1))}function G$($,Z){let{singleQuote:z}=Z.options,Q;if(z===!1)Q=I1;else{let X=$.includes('"'),J=$.includes("'");if(X&&!J)Q=eZ;else if(J&&!X)Q=I1;else Q=z?eZ:I1}return Q($,Z)}var $7;try{$7=new RegExp(`(^|(?<!
44
44
  ))
45
45
  +(?!
46
- |$)`,"g")}catch{aZ=/\n+(?!\n|$)/g}function _8({comment:$,type:Z,value:z},Q,X,J){let{blockQuote:Y,commentString:W,lineWidth:U}=Q.options;if(!Y||/\n[\t ]+$/.test(z))return U$(z,Q);let G=Q.indent||(Q.forceBlockIndent||F8(z)?" ":""),V=Y==="literal"?!0:Y==="folded"||Z===H2.Scalar.BLOCK_FOLDED?!1:Z===H2.Scalar.BLOCK_LITERAL?!0:!MB(z,U,G.length);if(!z)return V?`|
46
+ |$)`,"g")}catch{$7=/\n+(?!\n|$)/g}function P8({comment:$,type:Z,value:z},Q,X,J){let{blockQuote:Y,commentString:W,lineWidth:U}=Q.options;if(!Y||/\n[\t ]+$/.test(z))return G$(z,Q);let G=Q.indent||(Q.forceBlockIndent||E8(z)?" ":""),V=Y==="literal"?!0:Y==="folded"||Z===q2.Scalar.BLOCK_FOLDED?!1:Z===q2.Scalar.BLOCK_LITERAL?!0:!AB(z,U,G.length);if(!z)return V?`|
47
47
  `:`>
48
- `;let H,q;for(q=z.length;q>0;--q){let y=z[q-1];if(y!==`
49
- `&&y!=="\t"&&y!==" ")break}let K=z.substring(q),L=K.indexOf(`
50
- `);if(L===-1)H="-";else if(z===K||L!==K.length-1){if(H="+",J)J()}else H="";if(K){if(z=z.slice(0,-K.length),K[K.length-1]===`
51
- `)K=K.slice(0,-1);K=K.replace(aZ,`$&${G}`)}let B=!1,N,T=-1;for(N=0;N<z.length;++N){let y=z[N];if(y===" ")B=!0;else if(y===`
52
- `)T=N;else break}let R=z.substring(0,T<N?T+1:N);if(R)z=z.substring(R.length),R=R.replace(/\n+/g,`$&${G}`);let j=(B?G?"2":"1":"")+H;if($){if(j+=" "+W($.replace(/ ?[\r\n]+/g," ")),X)X()}if(!V){let y=z.replace(/\n+/g,`
53
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${G}`),x=!1,h=R8(Q,!0);if(Y!=="folded"&&Z!==H2.Scalar.BLOCK_FOLDED)h.onOverflow=()=>{x=!0};let E=a2.foldFlowLines(`${R}${y}${K}`,G,a2.FOLD_BLOCK,h);if(!x)return`>${j}
48
+ `;let q,H;for(H=z.length;H>0;--H){let y=z[H-1];if(y!==`
49
+ `&&y!=="\t"&&y!==" ")break}let K=z.substring(H),L=K.indexOf(`
50
+ `);if(L===-1)q="-";else if(z===K||L!==K.length-1){if(q="+",J)J()}else q="";if(K){if(z=z.slice(0,-K.length),K[K.length-1]===`
51
+ `)K=K.slice(0,-1);K=K.replace($7,`$&${G}`)}let B=!1,N,T=-1;for(N=0;N<z.length;++N){let y=z[N];if(y===" ")B=!0;else if(y===`
52
+ `)T=N;else break}let R=z.substring(0,T<N?T+1:N);if(R)z=z.substring(R.length),R=R.replace(/\n+/g,`$&${G}`);let j=(B?G?"2":"1":"")+q;if($){if(j+=" "+W($.replace(/ ?[\r\n]+/g," ")),X)X()}if(!V){let y=z.replace(/\n+/g,`
53
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${G}`),x=!1,h=S8(Q,!0);if(Y!=="folded"&&Z!==q2.Scalar.BLOCK_FOLDED)h.onOverflow=()=>{x=!0};let E=a2.foldFlowLines(`${R}${y}${K}`,G,a2.FOLD_BLOCK,h);if(!x)return`>${j}
54
54
  ${G}${E}`}return z=z.replace(/\n+/g,`$&${G}`),`|${j}
55
- ${G}${R}${z}${K}`}function LB($,Z,z,Q){let{type:X,value:J}=$,{actualString:Y,implicitKey:W,indent:U,indentStep:G,inFlow:V}=Z;if(W&&J.includes(`
56
- `)||V&&/[[\]{},]/.test(J))return U$(J,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(J))return W||V||!J.includes(`
57
- `)?U$(J,Z):_8($,Z,z,Q);if(!W&&!V&&X!==H2.Scalar.PLAIN&&J.includes(`
58
- `))return _8($,Z,z,Q);if(F8(J)){if(U==="")return Z.forceBlockIndent=!0,_8($,Z,z,Q);else if(W&&U===G)return U$(J,Z)}let H=J.replace(/\n+/g,`$&
59
- ${U}`);if(Y){let q=(B)=>B.default&&B.tag!=="tag:yaml.org,2002:str"&&B.test?.test(H),{compat:K,tags:L}=Z.doc.schema;if(L.some(q)||K?.some(q))return U$(J,Z)}return W?H:a2.foldFlowLines(H,U,a2.FOLD_FLOW,R8(Z,!1))}function NB($,Z,z,Q){let{implicitKey:X,inFlow:J}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:W}=$;if(W!==H2.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))W=H2.Scalar.QUOTE_DOUBLE}let U=(V)=>{switch(V){case H2.Scalar.BLOCK_FOLDED:case H2.Scalar.BLOCK_LITERAL:return X||J?U$(Y.value,Z):_8(Y,Z,z,Q);case H2.Scalar.QUOTE_DOUBLE:return N1(Y.value,Z);case H2.Scalar.QUOTE_SINGLE:return oZ(Y.value,Z);case H2.Scalar.PLAIN:return LB(Y,Z,z,Q);default:return null}},G=U(W);if(G===null){let{defaultKeyType:V,defaultStringType:H}=Z.options,q=X&&V||H;if(G=U(q),G===null)throw Error(`Unsupported default string type ${q}`)}return G}OB.stringifyString=NB});var D1=P((PB)=>{var IB=I8(),t2=o(),TB=L1(),AB=O1();function CB($,Z){let z=Object.assign({blockQuote:!0,commentString:TB.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 _B($,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(t2.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 RB($,Z,{anchors:z,doc:Q}){if(!Q.directives)return"";let X=[],J=(t2.isScalar($)||t2.isCollection($))&&$.anchor;if(J&&IB.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 FB($,Z,z,Q){if(t2.isPair($))return $.toString(Z,z,Q);if(t2.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=t2.isNode($)?$:Z.doc.createNode($,{onTagObj:(U)=>X=U});X??(X=_B(Z.doc.schema.tags,J));let Y=RB(J,X,Z);if(Y.length>0)Z.indentAtStart=(Z.indentAtStart??0)+Y.length+1;let W=typeof X.stringify==="function"?X.stringify(J,Z,z,Q):t2.isScalar(J)?AB.stringifyString(J,Z,z,Q):J.toString(Z,z,Q);if(!Y)return W;return t2.isScalar(J)||W[0]==="{"||W[0]==="["?`${Y} ${W}`:`${Y}
60
- ${Z.indent}${W}`}PB.createStringifyContext=CB;PB.stringify=FB});var XX=P((wB)=>{var w2=o(),zX=M0(),QX=D1(),I1=L1();function jB({key:$,value:Z},z,Q,X){let{allNullValues:J,doc:Y,indent:W,indentStep:U,options:{commentString:G,indentSeq:V,simpleKeys:H}}=z,q=w2.isNode($)&&$.comment||null;if(H){if(q)throw Error("With simple keys, key nodes cannot have comments");if(w2.isCollection($)||!w2.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let K=!H&&(!$||q&&Z==null&&!z.inFlow||w2.isCollection($)||(w2.isScalar($)?$.type===zX.Scalar.BLOCK_FOLDED||$.type===zX.Scalar.BLOCK_LITERAL:typeof $==="object"));z=Object.assign({},z,{allNullValues:!1,implicitKey:!K&&(H||!J),indent:W+U});let L=!1,B=!1,N=QX.stringify($,z,()=>L=!0,()=>B=!0);if(!K&&!z.inFlow&&N.length>1024){if(H)throw Error("With simple keys, single line scalar must not span more than 1024 characters");K=!0}if(z.inFlow){if(J||Z==null){if(L&&Q)Q();return N===""?"?":K?`? ${N}`:N}}else if(J&&!H||Z==null&&K){if(N=`? ${N}`,q&&!L)N+=I1.lineComment(N,z.indent,G(q));else if(B&&X)X();return N}if(L)q=null;if(K){if(q)N+=I1.lineComment(N,z.indent,G(q));N=`? ${N}
61
- ${W}:`}else if(N=`${N}:`,q)N+=I1.lineComment(N,z.indent,G(q));let T,R,w;if(w2.isNode(Z))T=!!Z.spaceBefore,R=Z.commentBefore,w=Z.comment;else if(T=!1,R=null,w=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(z.implicitKey=!1,!K&&!q&&w2.isScalar(Z))z.indentAtStart=N.length+1;if(B=!1,!V&&U.length>=2&&!z.inFlow&&!K&&w2.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)z.indent=z.indent.substring(2);let j=!1,y=QX.stringify(Z,z,()=>j=!0,()=>B=!0),x=" ";if(q||T||R){if(x=T?`
55
+ ${G}${R}${z}${K}`}function CB($,Z,z,Q){let{type:X,value:J}=$,{actualString:Y,implicitKey:W,indent:U,indentStep:G,inFlow:V}=Z;if(W&&J.includes(`
56
+ `)||V&&/[[\]{},]/.test(J))return G$(J,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(J))return W||V||!J.includes(`
57
+ `)?G$(J,Z):P8($,Z,z,Q);if(!W&&!V&&X!==q2.Scalar.PLAIN&&J.includes(`
58
+ `))return P8($,Z,z,Q);if(E8(J)){if(U==="")return Z.forceBlockIndent=!0,P8($,Z,z,Q);else if(W&&U===G)return G$(J,Z)}let q=J.replace(/\n+/g,`$&
59
+ ${U}`);if(Y){let H=(B)=>B.default&&B.tag!=="tag:yaml.org,2002:str"&&B.test?.test(q),{compat:K,tags:L}=Z.doc.schema;if(L.some(H)||K?.some(H))return G$(J,Z)}return W?q:a2.foldFlowLines(q,U,a2.FOLD_FLOW,S8(Z,!1))}function _B($,Z,z,Q){let{implicitKey:X,inFlow:J}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:W}=$;if(W!==q2.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))W=q2.Scalar.QUOTE_DOUBLE}let U=(V)=>{switch(V){case q2.Scalar.BLOCK_FOLDED:case q2.Scalar.BLOCK_LITERAL:return X||J?G$(Y.value,Z):P8(Y,Z,z,Q);case q2.Scalar.QUOTE_DOUBLE:return I1(Y.value,Z);case q2.Scalar.QUOTE_SINGLE:return eZ(Y.value,Z);case q2.Scalar.PLAIN:return CB(Y,Z,z,Q);default:return null}},G=U(W);if(G===null){let{defaultKeyType:V,defaultStringType:q}=Z.options,H=X&&V||q;if(G=U(H),G===null)throw Error(`Unsupported default string type ${H}`)}return G}RB.stringifyString=_B});var A1=P((kB)=>{var PB=C8(),t2=o(),SB=D1(),EB=T1();function jB($,Z){let z=Object.assign({blockQuote:!0,commentString:SB.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 wB($,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(t2.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 xB($,Z,{anchors:z,doc:Q}){if(!Q.directives)return"";let X=[],J=(t2.isScalar($)||t2.isCollection($))&&$.anchor;if(J&&PB.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 yB($,Z,z,Q){if(t2.isPair($))return $.toString(Z,z,Q);if(t2.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=t2.isNode($)?$:Z.doc.createNode($,{onTagObj:(U)=>X=U});X??(X=wB(Z.doc.schema.tags,J));let Y=xB(J,X,Z);if(Y.length>0)Z.indentAtStart=(Z.indentAtStart??0)+Y.length+1;let W=typeof X.stringify==="function"?X.stringify(J,Z,z,Q):t2.isScalar(J)?EB.stringifyString(J,Z,z,Q):J.toString(Z,z,Q);if(!Y)return W;return t2.isScalar(J)||W[0]==="{"||W[0]==="["?`${Y} ${W}`:`${Y}
60
+ ${Z.indent}${W}`}kB.createStringifyContext=jB;kB.stringify=yB});var WX=P((hB)=>{var w2=o(),JX=M0(),YX=A1(),C1=D1();function gB({key:$,value:Z},z,Q,X){let{allNullValues:J,doc:Y,indent:W,indentStep:U,options:{commentString:G,indentSeq:V,simpleKeys:q}}=z,H=w2.isNode($)&&$.comment||null;if(q){if(H)throw Error("With simple keys, key nodes cannot have comments");if(w2.isCollection($)||!w2.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let K=!q&&(!$||H&&Z==null&&!z.inFlow||w2.isCollection($)||(w2.isScalar($)?$.type===JX.Scalar.BLOCK_FOLDED||$.type===JX.Scalar.BLOCK_LITERAL:typeof $==="object"));z=Object.assign({},z,{allNullValues:!1,implicitKey:!K&&(q||!J),indent:W+U});let L=!1,B=!1,N=YX.stringify($,z,()=>L=!0,()=>B=!0);if(!K&&!z.inFlow&&N.length>1024){if(q)throw Error("With simple keys, single line scalar must not span more than 1024 characters");K=!0}if(z.inFlow){if(J||Z==null){if(L&&Q)Q();return N===""?"?":K?`? ${N}`:N}}else if(J&&!q||Z==null&&K){if(N=`? ${N}`,H&&!L)N+=C1.lineComment(N,z.indent,G(H));else if(B&&X)X();return N}if(L)H=null;if(K){if(H)N+=C1.lineComment(N,z.indent,G(H));N=`? ${N}
61
+ ${W}:`}else if(N=`${N}:`,H)N+=C1.lineComment(N,z.indent,G(H));let T,R,w;if(w2.isNode(Z))T=!!Z.spaceBefore,R=Z.commentBefore,w=Z.comment;else if(T=!1,R=null,w=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(z.implicitKey=!1,!K&&!H&&w2.isScalar(Z))z.indentAtStart=N.length+1;if(B=!1,!V&&U.length>=2&&!z.inFlow&&!K&&w2.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)z.indent=z.indent.substring(2);let j=!1,y=YX.stringify(Z,z,()=>j=!0,()=>B=!0),x=" ";if(H||T||R){if(x=T?`
62
62
  `:"",R){let h=G(R);x+=`
63
- ${I1.indentComment(h,z.indent)}`}if(y===""&&!z.inFlow){if(x===`
63
+ ${C1.indentComment(h,z.indent)}`}if(y===""&&!z.inFlow){if(x===`
64
64
  `&&w)x=`
65
65
 
66
66
  `}else x+=`
67
67
  ${z.indent}`}else if(!K&&w2.isCollection(Z)){let h=y[0],E=y.indexOf(`
68
68
  `),c=E!==-1,D0=z.inFlow??Z.flow??Z.items.length===0;if(c||!D0){let b0=!1;if(c&&(h==="&"||h==="!")){let F=y.indexOf(" ");if(h==="&"&&F!==-1&&F<E&&y[F+1]==="!")F=y.indexOf(" ",F+1);if(F===-1||E<F)b0=!0}if(!b0)x=`
69
69
  ${z.indent}`}}else if(y===""||y[0]===`
70
- `)x="";if(N+=x+y,z.inFlow){if(j&&Q)Q()}else if(w&&!j)N+=I1.lineComment(N,z.indent,G(w));else if(B&&X)X();return N}wB.stringifyPair=jB});var tZ=P((bB)=>{var JX=d0("process");function yB($,...Z){if($==="debug")console.log(...Z)}function kB($,Z){if($==="debug"||$==="warn")if(typeof JX.emitWarning==="function")JX.emitWarning(Z);else console.warn(Z)}bB.debug=yB;bB.warn=kB});var j8=P((fB)=>{var E8=o(),YX=M0(),P8="<<",S8={identify:($)=>$===P8||typeof $==="symbol"&&$.description===P8,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new YX.Scalar(Symbol(P8)),{addToJSMap:WX}),stringify:()=>P8},hB=($,Z)=>(S8.identify(Z)||E8.isScalar(Z)&&(!Z.type||Z.type===YX.Scalar.PLAIN)&&S8.identify(Z.value))&&$?.doc.schema.tags.some((z)=>z.tag===S8.tag&&z.default);function WX($,Z,z){let Q=UX($,z);if(E8.isSeq(Q))for(let X of Q.items)eZ($,Z,X);else if(Array.isArray(Q))for(let X of Q)eZ($,Z,X);else eZ($,Z,Q)}function eZ($,Z,z){let Q=UX($,z);if(!E8.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 UX($,Z){return $&&E8.isAlias(Z)?Z.resolve($.doc,$):Z}fB.addMergeToJSMap=WX;fB.isMergeKey=hB;fB.merge=S8});var Z7=P((nB)=>{var pB=tZ(),GX=j8(),lB=D1(),VX=o(),$7=o2();function dB($,Z,{key:z,value:Q}){if(VX.isNode(z)&&z.addToJSMap)z.addToJSMap($,Z,Q);else if(GX.isMergeKey($,z))GX.addMergeToJSMap($,Z,Q);else{let X=$7.toJS(z,"",$);if(Z instanceof Map)Z.set(X,$7.toJS(Q,X,$));else if(Z instanceof Set)Z.add(X);else{let J=iB(z,X,$),Y=$7.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 iB($,Z,z){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(VX.isNode($)&&z?.doc){let Q=lB.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)+'..."';pB.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)}nB.addPairToJSMap=dB});var e2=P((tB)=>{var HX=M1(),sB=XX(),oB=Z7(),w8=o();function aB($,Z,z){let Q=HX.createNode($,void 0,z),X=HX.createNode(Z,void 0,z);return new x8(Q,X)}class x8{constructor($,Z=null){Object.defineProperty(this,w8.NODE_TYPE,{value:w8.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:z}=this;if(w8.isNode(Z))Z=Z.clone($);if(w8.isNode(z))z=z.clone($);return new x8(Z,z)}toJSON($,Z){let z=Z?.mapAsMap?new Map:{};return oB.addPairToJSMap(Z,z,this)}toString($,Z,z){return $?.doc?sB.stringifyPair(this,$,Z,z):JSON.stringify(this)}}tB.Pair=x8;tB.createPair=aB});var z7=P((XM)=>{var F6=o(),qX=D1(),y8=L1();function ZM($,Z,z){return(Z.inFlow??$.flow?QM:zM)($,Z,z)}function zM({comment:$,items:Z},z,{blockItemPrefix:Q,flowChars:X,itemIndent:J,onChompKeep:Y,onComment:W}){let{indent:U,options:{commentString:G}}=z,V=Object.assign({},z,{indent:J,type:null}),H=!1,q=[];for(let L=0;L<Z.length;++L){let B=Z[L],N=null;if(F6.isNode(B)){if(!H&&B.spaceBefore)q.push("");if(k8(z,q,B.commentBefore,H),B.comment)N=B.comment}else if(F6.isPair(B)){let R=F6.isNode(B.key)?B.key:null;if(R){if(!H&&R.spaceBefore)q.push("");k8(z,q,R.commentBefore,H)}}H=!1;let T=qX.stringify(B,V,()=>N=null,()=>H=!0);if(N)T+=y8.lineComment(T,J,G(N));if(H&&N)H=!1;q.push(Q+T)}let K;if(q.length===0)K=X.start+X.end;else{K=q[0];for(let L=1;L<q.length;++L){let B=q[L];K+=B?`
70
+ `)x="";if(N+=x+y,z.inFlow){if(j&&Q)Q()}else if(w&&!j)N+=C1.lineComment(N,z.indent,G(w));else if(B&&X)X();return N}hB.stringifyPair=gB});var Z7=P((cB)=>{var UX=d0("process");function uB($,...Z){if($==="debug")console.log(...Z)}function mB($,Z){if($==="debug"||$==="warn")if(typeof UX.emitWarning==="function")UX.emitWarning(Z);else console.warn(Z)}cB.debug=uB;cB.warn=mB});var y8=P((iB)=>{var x8=o(),GX=M0(),j8="<<",w8={identify:($)=>$===j8||typeof $==="symbol"&&$.description===j8,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new GX.Scalar(Symbol(j8)),{addToJSMap:VX}),stringify:()=>j8},dB=($,Z)=>(w8.identify(Z)||x8.isScalar(Z)&&(!Z.type||Z.type===GX.Scalar.PLAIN)&&w8.identify(Z.value))&&$?.doc.schema.tags.some((z)=>z.tag===w8.tag&&z.default);function VX($,Z,z){let Q=qX($,z);if(x8.isSeq(Q))for(let X of Q.items)z7($,Z,X);else if(Array.isArray(Q))for(let X of Q)z7($,Z,X);else z7($,Z,Q)}function z7($,Z,z){let Q=qX($,z);if(!x8.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 qX($,Z){return $&&x8.isAlias(Z)?Z.resolve($.doc,$):Z}iB.addMergeToJSMap=VX;iB.isMergeKey=dB;iB.merge=w8});var X7=P(($M)=>{var oB=Z7(),HX=y8(),aB=A1(),KX=o(),Q7=o2();function tB($,Z,{key:z,value:Q}){if(KX.isNode(z)&&z.addToJSMap)z.addToJSMap($,Z,Q);else if(HX.isMergeKey($,z))HX.addMergeToJSMap($,Z,Q);else{let X=Q7.toJS(z,"",$);if(Z instanceof Map)Z.set(X,Q7.toJS(Q,X,$));else if(Z instanceof Set)Z.add(X);else{let J=eB(z,X,$),Y=Q7.toJS(Q,J,$);if(J in Z)Object.defineProperty(Z,J,{value:Y,writable:!0,enumerable:!0,configurable:!0});else Z[J]=Y}}return Z}function eB($,Z,z){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(KX.isNode($)&&z?.doc){let Q=aB.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)+'..."';oB.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)}$M.addPairToJSMap=tB});var e2=P((JM)=>{var BX=O1(),zM=WX(),QM=X7(),k8=o();function XM($,Z,z){let Q=BX.createNode($,void 0,z),X=BX.createNode(Z,void 0,z);return new b8(Q,X)}class b8{constructor($,Z=null){Object.defineProperty(this,k8.NODE_TYPE,{value:k8.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:z}=this;if(k8.isNode(Z))Z=Z.clone($);if(k8.isNode(z))z=z.clone($);return new b8(Z,z)}toJSON($,Z){let z=Z?.mapAsMap?new Map:{};return QM.addPairToJSMap(Z,z,this)}toString($,Z,z){return $?.doc?zM.stringifyPair(this,$,Z,z):JSON.stringify(this)}}JM.Pair=b8;JM.createPair=XM});var J7=P((qM)=>{var P6=o(),MX=A1(),v8=D1();function UM($,Z,z){return(Z.inFlow??$.flow?VM:GM)($,Z,z)}function GM({comment:$,items:Z},z,{blockItemPrefix:Q,flowChars:X,itemIndent:J,onChompKeep:Y,onComment:W}){let{indent:U,options:{commentString:G}}=z,V=Object.assign({},z,{indent:J,type:null}),q=!1,H=[];for(let L=0;L<Z.length;++L){let B=Z[L],N=null;if(P6.isNode(B)){if(!q&&B.spaceBefore)H.push("");if(g8(z,H,B.commentBefore,q),B.comment)N=B.comment}else if(P6.isPair(B)){let R=P6.isNode(B.key)?B.key:null;if(R){if(!q&&R.spaceBefore)H.push("");g8(z,H,R.commentBefore,q)}}q=!1;let T=MX.stringify(B,V,()=>N=null,()=>q=!0);if(N)T+=v8.lineComment(T,J,G(N));if(q&&N)q=!1;H.push(Q+T)}let K;if(H.length===0)K=X.start+X.end;else{K=H[0];for(let L=1;L<H.length;++L){let B=H[L];K+=B?`
71
71
  ${U}${B}`:`
72
72
  `}}if($){if(K+=`
73
- `+y8.indentComment(G($),U),W)W()}else if(H&&Y)Y();return K}function QM({items:$},Z,{flowChars:z,itemIndent:Q}){let{indent:X,indentStep:J,flowCollectionPadding:Y,options:{commentString:W}}=Z;Q+=J;let U=Object.assign({},Z,{indent:Q,inFlow:!0,type:null}),G=!1,V=0,H=[];for(let L=0;L<$.length;++L){let B=$[L],N=null;if(F6.isNode(B)){if(B.spaceBefore)H.push("");if(k8(Z,H,B.commentBefore,!1),B.comment)N=B.comment}else if(F6.isPair(B)){let R=F6.isNode(B.key)?B.key:null;if(R){if(R.spaceBefore)H.push("");if(k8(Z,H,R.commentBefore,!1),R.comment)G=!0}let w=F6.isNode(B.value)?B.value:null;if(w){if(w.comment)N=w.comment;if(w.commentBefore)G=!0}else if(B.value==null&&R?.comment)N=R.comment}if(N)G=!0;let T=qX.stringify(B,U,()=>N=null);if(G||(G=H.length>V||T.includes(`
74
- `)),L<$.length-1)T+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)G||(G=H.reduce((R,w)=>R+w.length+2,2)+(T.length+2)>Z.options.lineWidth);if(G)T+=","}if(N)T+=y8.lineComment(T,Q,W(N));H.push(T),V=H.length}let{start:q,end:K}=z;if(H.length===0)return q+K;else{if(!G){let L=H.reduce((B,N)=>B+N.length+2,2);G=Z.options.lineWidth>0&&L>Z.options.lineWidth}if(G){let L=q;for(let B of H)L+=B?`
73
+ `+v8.indentComment(G($),U),W)W()}else if(q&&Y)Y();return K}function VM({items:$},Z,{flowChars:z,itemIndent:Q}){let{indent:X,indentStep:J,flowCollectionPadding:Y,options:{commentString:W}}=Z;Q+=J;let U=Object.assign({},Z,{indent:Q,inFlow:!0,type:null}),G=!1,V=0,q=[];for(let L=0;L<$.length;++L){let B=$[L],N=null;if(P6.isNode(B)){if(B.spaceBefore)q.push("");if(g8(Z,q,B.commentBefore,!1),B.comment)N=B.comment}else if(P6.isPair(B)){let R=P6.isNode(B.key)?B.key:null;if(R){if(R.spaceBefore)q.push("");if(g8(Z,q,R.commentBefore,!1),R.comment)G=!0}let w=P6.isNode(B.value)?B.value:null;if(w){if(w.comment)N=w.comment;if(w.commentBefore)G=!0}else if(B.value==null&&R?.comment)N=R.comment}if(N)G=!0;let T=MX.stringify(B,U,()=>N=null);if(G||(G=q.length>V||T.includes(`
74
+ `)),L<$.length-1)T+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)G||(G=q.reduce((R,w)=>R+w.length+2,2)+(T.length+2)>Z.options.lineWidth);if(G)T+=","}if(N)T+=v8.lineComment(T,Q,W(N));q.push(T),V=q.length}let{start:H,end:K}=z;if(q.length===0)return H+K;else{if(!G){let L=q.reduce((B,N)=>B+N.length+2,2);G=Z.options.lineWidth>0&&L>Z.options.lineWidth}if(G){let L=H;for(let B of q)L+=B?`
75
75
  ${J}${X}${B}`:`
76
76
  `;return`${L}
77
- ${X}${K}`}else return`${q}${Y}${H.join(" ")}${Y}${K}`}}function k8({indent:$,options:{commentString:Z}},z,Q,X){if(Q&&X)Q=Q.replace(/^\n+/,"");if(Q){let J=y8.indentComment(Z(Q),$);z.push(J.trimStart())}}XM.stringifyCollection=ZM});var Z6=P((VM)=>{var YM=z7(),WM=Z7(),UM=C8(),$6=o(),b8=e2(),GM=M0();function T1($,Z){let z=$6.isScalar(Z)?Z.value:Z;for(let Q of $)if($6.isPair(Q)){if(Q.key===Z||Q.key===z)return Q;if($6.isScalar(Q.key)&&Q.key.value===z)return Q}return}class KX extends UM.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super($6.MAP,$);this.items=[]}static from($,Z,z){let{keepUndefined:Q,replacer:X}=z,J=new this($),Y=(W,U)=>{if(typeof X==="function")U=X.call(Z,W,U);else if(Array.isArray(X)&&!X.includes(W))return;if(U!==void 0||Q)J.items.push(b8.createPair(W,U,z))};if(Z instanceof Map)for(let[W,U]of Z)Y(W,U);else if(Z&&typeof Z==="object")for(let W of Object.keys(Z))Y(W,Z[W]);if(typeof $.sortMapEntries==="function")J.items.sort($.sortMapEntries);return J}add($,Z){let z;if($6.isPair($))z=$;else if(!$||typeof $!=="object"||!("key"in $))z=new b8.Pair($,$?.value);else z=new b8.Pair($.key,$.value);let Q=T1(this.items,z.key),X=this.schema?.sortMapEntries;if(Q){if(!Z)throw Error(`Key ${z.key} already set`);if($6.isScalar(Q.value)&&GM.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=T1(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let Q=T1(this.items,$)?.value;return(!Z&&$6.isScalar(Q)?Q.value:Q)??void 0}has($){return!!T1(this.items,$)}set($,Z){this.add(new b8.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)WM.addPairToJSMap(Z,Q,X);return Q}toString($,Z,z){if(!$)return JSON.stringify(this);for(let Q of this.items)if(!$6.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 YM.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:z,onComment:Z})}}VM.YAMLMap=KX;VM.findPair=T1});var G$=P((MM)=>{var KM=o(),BX=Z6(),BM={collection:"map",default:!0,nodeClass:BX.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!KM.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,z)=>BX.YAMLMap.from($,Z,z)};MM.map=BM});var z6=P((AM)=>{var NM=M1(),OM=z7(),DM=C8(),g8=o(),IM=M0(),TM=o2();class MX extends DM.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(g8.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=v8($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let z=v8($);if(typeof z!=="number")return;let Q=this.items[z];return!Z&&g8.isScalar(Q)?Q.value:Q}has($){let Z=v8($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let z=v8($);if(typeof z!=="number")throw Error(`Expected a valid index, not ${$}.`);let Q=this.items[z];if(g8.isScalar(Q)&&IM.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(TM.toJS(X,String(Q++),Z));return z}toString($,Z,z){if(!$)return JSON.stringify(this);return OM.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:z,onComment:Z})}static from($,Z,z){let{replacer:Q}=z,X=new this($);if(Z&&Symbol.iterator in Object(Z)){let J=0;for(let Y of Z){if(typeof Q==="function"){let W=Z instanceof Set?Y:String(J++);Y=Q.call(Z,W,Y)}X.items.push(NM.createNode(Y,void 0,z))}}return X}}function v8($){let Z=g8.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}AM.YAMLSeq=MX});var V$=P((FM)=>{var _M=o(),LX=z6(),RM={collection:"seq",default:!0,nodeClass:LX.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!_M.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,z)=>LX.YAMLSeq.from($,Z,z)};FM.seq=RM});var A1=P((jM)=>{var SM=O1(),EM={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,z,Q){return Z=Object.assign({actualString:!0},Z),SM.stringifyString($,Z,z,Q)}};jM.string=EM});var h8=P((xM)=>{var NX=M0(),OX={identify:($)=>$==null,createNode:()=>new NX.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new NX.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&OX.test.test($)?$:Z.options.nullStr};xM.nullTag=OX});var Q7=P((bM)=>{var kM=M0(),DX={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new kM.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},z){if($&&DX.test.test($)){let Q=$[0]==="t"||$[0]==="T";if(Z===Q)return $}return Z?z.options.trueStr:z.options.falseStr}};bM.boolTag=DX});var H$=P((hM)=>{function gM({format:$,minFractionDigits:Z,tag:z,value:Q}){if(typeof Q==="bigint")return String(Q);let X=typeof Q==="number"?Q:Number(Q);if(!isFinite(X))return isNaN(X)?".nan":X<0?"-.inf":".inf";let J=Object.is(Q,-0)?"-0":JSON.stringify(Q);if(!$&&Z&&(!z||z==="tag:yaml.org,2002:float")&&/^-?\d/.test(J)&&!J.includes("e")){let Y=J.indexOf(".");if(Y<0)Y=J.length,J+=".";let W=Z-(J.length-Y-1);while(W-- >0)J+="0"}return J}hM.stringifyNumber=gM});var J7=P((lM)=>{var uM=M0(),X7=H$(),mM={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:X7.stringifyNumber},cM={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():X7.stringifyNumber($)}},pM={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new uM.Scalar(parseFloat($)),z=$.indexOf(".");if(z!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-z-1;return Z},stringify:X7.stringifyNumber};lM.float=pM;lM.floatExp=cM;lM.floatNaN=mM});var W7=P((aM)=>{var IX=H$(),f8=($)=>typeof $==="bigint"||Number.isInteger($),Y7=($,Z,z,{intAsBigInt:Q})=>Q?BigInt($):parseInt($.substring(Z),z);function TX($,Z,z){let{value:Q}=$;if(f8(Q)&&Q>=0)return z+Q.toString(Z);return IX.stringifyNumber($)}var rM={identify:($)=>f8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,z)=>Y7($,2,8,z),stringify:($)=>TX($,8,"0o")},sM={identify:f8,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,z)=>Y7($,0,10,z),stringify:IX.stringifyNumber},oM={identify:($)=>f8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,z)=>Y7($,2,16,z),stringify:($)=>TX($,16,"0x")};aM.int=sM;aM.intHex=oM;aM.intOct=rM});var AX=P((WL)=>{var ZL=G$(),zL=h8(),QL=V$(),XL=A1(),JL=Q7(),U7=J7(),G7=W7(),YL=[ZL.map,QL.seq,XL.string,zL.nullTag,JL.boolTag,G7.intOct,G7.int,G7.intHex,U7.floatNaN,U7.floatExp,U7.float];WL.schema=YL});var _X=P((ML)=>{var GL=M0(),VL=G$(),HL=V$();function CX($){return typeof $==="bigint"||Number.isInteger($)}var u8=({value:$})=>JSON.stringify($),qL=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:u8},{identify:($)=>$==null,createNode:()=>new GL.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:u8},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:u8},{identify:CX,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:z})=>z?BigInt($):parseInt($,10),stringify:({value:$})=>CX($)?$.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:u8}],KL={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},BL=[VL.map,HL.seq].concat(qL,KL);ML.schema=BL});var H7=P((DL)=>{var C1=d0("buffer"),V7=M0(),NL=O1(),OL={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof C1.Buffer==="function")return C1.Buffer.from($,"base64");else if(typeof atob==="function"){let z=atob($.replace(/[\n\r]/g,"")),Q=new Uint8Array(z.length);for(let X=0;X<z.length;++X)Q[X]=z.charCodeAt(X);return Q}else return Z("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:Z,value:z},Q,X,J){if(!z)return"";let Y=z,W;if(typeof C1.Buffer==="function")W=Y instanceof C1.Buffer?Y.toString("base64"):C1.Buffer.from(Y.buffer).toString("base64");else if(typeof btoa==="function"){let U="";for(let G=0;G<Y.length;++G)U+=String.fromCharCode(Y[G]);W=btoa(U)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(Z??(Z=V7.Scalar.BLOCK_LITERAL),Z!==V7.Scalar.QUOTE_DOUBLE){let U=Math.max(Q.options.lineWidth-Q.indent.length,Q.options.minContentWidth),G=Math.ceil(W.length/U),V=Array(G);for(let H=0,q=0;H<G;++H,q+=U)V[H]=W.substr(q,U);W=V.join(Z===V7.Scalar.BLOCK_LITERAL?`
78
- `:" ")}return NL.stringifyString({comment:$,type:Z,value:W},Q,X,J)}};DL.binary=OL});var c8=P((_L)=>{var m8=o(),q7=e2(),TL=M0(),AL=z6();function RX($,Z){if(m8.isSeq($))for(let z=0;z<$.items.length;++z){let Q=$.items[z];if(m8.isPair(Q))continue;else if(m8.isMap(Q)){if(Q.items.length>1)Z("Each pair must have its own sequence indicator");let X=Q.items[0]||new q7.Pair(new TL.Scalar(null));if(Q.commentBefore)X.key.commentBefore=X.key.commentBefore?`${Q.commentBefore}
77
+ ${X}${K}`}else return`${H}${Y}${q.join(" ")}${Y}${K}`}}function g8({indent:$,options:{commentString:Z}},z,Q,X){if(Q&&X)Q=Q.replace(/^\n+/,"");if(Q){let J=v8.indentComment(Z(Q),$);z.push(J.trimStart())}}qM.stringifyCollection=UM});var Z6=P((NM)=>{var KM=J7(),BM=X7(),MM=F8(),$6=o(),h8=e2(),LM=M0();function _1($,Z){let z=$6.isScalar(Z)?Z.value:Z;for(let Q of $)if($6.isPair(Q)){if(Q.key===Z||Q.key===z)return Q;if($6.isScalar(Q.key)&&Q.key.value===z)return Q}return}class LX extends MM.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super($6.MAP,$);this.items=[]}static from($,Z,z){let{keepUndefined:Q,replacer:X}=z,J=new this($),Y=(W,U)=>{if(typeof X==="function")U=X.call(Z,W,U);else if(Array.isArray(X)&&!X.includes(W))return;if(U!==void 0||Q)J.items.push(h8.createPair(W,U,z))};if(Z instanceof Map)for(let[W,U]of Z)Y(W,U);else if(Z&&typeof Z==="object")for(let W of Object.keys(Z))Y(W,Z[W]);if(typeof $.sortMapEntries==="function")J.items.sort($.sortMapEntries);return J}add($,Z){let z;if($6.isPair($))z=$;else if(!$||typeof $!=="object"||!("key"in $))z=new h8.Pair($,$?.value);else z=new h8.Pair($.key,$.value);let Q=_1(this.items,z.key),X=this.schema?.sortMapEntries;if(Q){if(!Z)throw Error(`Key ${z.key} already set`);if($6.isScalar(Q.value)&&LM.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=_1(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let Q=_1(this.items,$)?.value;return(!Z&&$6.isScalar(Q)?Q.value:Q)??void 0}has($){return!!_1(this.items,$)}set($,Z){this.add(new h8.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)BM.addPairToJSMap(Z,Q,X);return Q}toString($,Z,z){if(!$)return JSON.stringify(this);for(let Q of this.items)if(!$6.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 KM.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:z,onComment:Z})}}NM.YAMLMap=LX;NM.findPair=_1});var V$=P((AM)=>{var IM=o(),NX=Z6(),TM={collection:"map",default:!0,nodeClass:NX.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!IM.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,z)=>NX.YAMLMap.from($,Z,z)};AM.map=TM});var z6=P((EM)=>{var _M=O1(),RM=J7(),FM=F8(),u8=o(),PM=M0(),SM=o2();class OX extends FM.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(u8.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=f8($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let z=f8($);if(typeof z!=="number")return;let Q=this.items[z];return!Z&&u8.isScalar(Q)?Q.value:Q}has($){let Z=f8($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let z=f8($);if(typeof z!=="number")throw Error(`Expected a valid index, not ${$}.`);let Q=this.items[z];if(u8.isScalar(Q)&&PM.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(SM.toJS(X,String(Q++),Z));return z}toString($,Z,z){if(!$)return JSON.stringify(this);return RM.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:z,onComment:Z})}static from($,Z,z){let{replacer:Q}=z,X=new this($);if(Z&&Symbol.iterator in Object(Z)){let J=0;for(let Y of Z){if(typeof Q==="function"){let W=Z instanceof Set?Y:String(J++);Y=Q.call(Z,W,Y)}X.items.push(_M.createNode(Y,void 0,z))}}return X}}function f8($){let Z=u8.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}EM.YAMLSeq=OX});var q$=P((yM)=>{var wM=o(),DX=z6(),xM={collection:"seq",default:!0,nodeClass:DX.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!wM.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,z)=>DX.YAMLSeq.from($,Z,z)};yM.seq=xM});var R1=P((gM)=>{var bM=T1(),vM={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,z,Q){return Z=Object.assign({actualString:!0},Z),bM.stringifyString($,Z,z,Q)}};gM.string=vM});var m8=P((fM)=>{var IX=M0(),TX={identify:($)=>$==null,createNode:()=>new IX.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new IX.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&TX.test.test($)?$:Z.options.nullStr};fM.nullTag=TX});var Y7=P((cM)=>{var mM=M0(),AX={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new mM.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},z){if($&&AX.test.test($)){let Q=$[0]==="t"||$[0]==="T";if(Z===Q)return $}return Z?z.options.trueStr:z.options.falseStr}};cM.boolTag=AX});var H$=P((dM)=>{function lM({format:$,minFractionDigits:Z,tag:z,value:Q}){if(typeof Q==="bigint")return String(Q);let X=typeof Q==="number"?Q:Number(Q);if(!isFinite(X))return isNaN(X)?".nan":X<0?"-.inf":".inf";let J=Object.is(Q,-0)?"-0":JSON.stringify(Q);if(!$&&Z&&(!z||z==="tag:yaml.org,2002:float")&&/^-?\d/.test(J)&&!J.includes("e")){let Y=J.indexOf(".");if(Y<0)Y=J.length,J+=".";let W=Z-(J.length-Y-1);while(W-- >0)J+="0"}return J}dM.stringifyNumber=lM});var U7=P((aM)=>{var nM=M0(),W7=H$(),rM={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:W7.stringifyNumber},sM={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():W7.stringifyNumber($)}},oM={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new nM.Scalar(parseFloat($)),z=$.indexOf(".");if(z!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-z-1;return Z},stringify:W7.stringifyNumber};aM.float=oM;aM.floatExp=sM;aM.floatNaN=rM});var V7=P((XL)=>{var CX=H$(),c8=($)=>typeof $==="bigint"||Number.isInteger($),G7=($,Z,z,{intAsBigInt:Q})=>Q?BigInt($):parseInt($.substring(Z),z);function _X($,Z,z){let{value:Q}=$;if(c8(Q)&&Q>=0)return z+Q.toString(Z);return CX.stringifyNumber($)}var ZL={identify:($)=>c8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,z)=>G7($,2,8,z),stringify:($)=>_X($,8,"0o")},zL={identify:c8,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,z)=>G7($,0,10,z),stringify:CX.stringifyNumber},QL={identify:($)=>c8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,z)=>G7($,2,16,z),stringify:($)=>_X($,16,"0x")};XL.int=zL;XL.intHex=QL;XL.intOct=ZL});var RX=P((BL)=>{var UL=V$(),GL=m8(),VL=q$(),qL=R1(),HL=Y7(),q7=U7(),H7=V7(),KL=[UL.map,VL.seq,qL.string,GL.nullTag,HL.boolTag,H7.intOct,H7.int,H7.intHex,q7.floatNaN,q7.floatExp,q7.float];BL.schema=KL});var PX=P((AL)=>{var LL=M0(),NL=V$(),OL=q$();function FX($){return typeof $==="bigint"||Number.isInteger($)}var p8=({value:$})=>JSON.stringify($),DL=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:p8},{identify:($)=>$==null,createNode:()=>new LL.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:p8},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:p8},{identify:FX,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:z})=>z?BigInt($):parseInt($,10),stringify:({value:$})=>FX($)?$.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:p8}],IL={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},TL=[NL.map,OL.seq].concat(DL,IL);AL.schema=TL});var B7=P((FL)=>{var F1=d0("buffer"),K7=M0(),_L=T1(),RL={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof F1.Buffer==="function")return F1.Buffer.from($,"base64");else if(typeof atob==="function"){let z=atob($.replace(/[\n\r]/g,"")),Q=new Uint8Array(z.length);for(let X=0;X<z.length;++X)Q[X]=z.charCodeAt(X);return Q}else return Z("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:Z,value:z},Q,X,J){if(!z)return"";let Y=z,W;if(typeof F1.Buffer==="function")W=Y instanceof F1.Buffer?Y.toString("base64"):F1.Buffer.from(Y.buffer).toString("base64");else if(typeof btoa==="function"){let U="";for(let G=0;G<Y.length;++G)U+=String.fromCharCode(Y[G]);W=btoa(U)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(Z??(Z=K7.Scalar.BLOCK_LITERAL),Z!==K7.Scalar.QUOTE_DOUBLE){let U=Math.max(Q.options.lineWidth-Q.indent.length,Q.options.minContentWidth),G=Math.ceil(W.length/U),V=Array(G);for(let q=0,H=0;q<G;++q,H+=U)V[q]=W.substr(H,U);W=V.join(Z===K7.Scalar.BLOCK_LITERAL?`
78
+ `:" ")}return _L.stringifyString({comment:$,type:Z,value:W},Q,X,J)}};FL.binary=RL});var d8=P((wL)=>{var l8=o(),M7=e2(),SL=M0(),EL=z6();function SX($,Z){if(l8.isSeq($))for(let z=0;z<$.items.length;++z){let Q=$.items[z];if(l8.isPair(Q))continue;else if(l8.isMap(Q)){if(Q.items.length>1)Z("Each pair must have its own sequence indicator");let X=Q.items[0]||new M7.Pair(new SL.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]=m8.isPair(Q)?Q:new q7.Pair(Q)}else Z("Expected a sequence for this tag");return $}function FX($,Z,z){let{replacer:Q}=z,X=new AL.YAMLSeq($);X.tag="tag:yaml.org,2002:pairs";let J=0;if(Z&&Symbol.iterator in Object(Z))for(let Y of Z){if(typeof Q==="function")Y=Q.call(Z,String(J++),Y);let W,U;if(Array.isArray(Y))if(Y.length===2)W=Y[0],U=Y[1];else throw TypeError(`Expected [key, value] tuple: ${Y}`);else if(Y&&Y instanceof Object){let G=Object.keys(Y);if(G.length===1)W=G[0],U=Y[W];else throw TypeError(`Expected tuple with one key, not ${G.length} keys`)}else W=Y;X.items.push(q7.createPair(W,U,z))}return X}var CL={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:RX,createNode:FX};_L.createPairs=FX;_L.pairs=CL;_L.resolvePairs=RX});var B7=P((jL)=>{var PX=o(),K7=o2(),_1=Z6(),SL=z6(),SX=c8();class P6 extends SL.YAMLSeq{constructor(){super();this.add=_1.YAMLMap.prototype.add.bind(this),this.delete=_1.YAMLMap.prototype.delete.bind(this),this.get=_1.YAMLMap.prototype.get.bind(this),this.has=_1.YAMLMap.prototype.has.bind(this),this.set=_1.YAMLMap.prototype.set.bind(this),this.tag=P6.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(PX.isPair(Q))X=K7.toJS(Q.key,"",Z),J=K7.toJS(Q.value,X,Z);else X=K7.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=SX.createPairs($,Z,z),X=new this;return X.items=Q.items,X}}P6.tag="tag:yaml.org,2002:omap";var EL={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:P6,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let z=SX.resolvePairs($,Z),Q=[];for(let{key:X}of z.items)if(PX.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 P6,z)},createNode:($,Z,z)=>P6.from($,Z,z)};jL.YAMLOMap=P6;jL.omap=EL});var yX=P((yL)=>{var EX=M0();function jX({value:$,source:Z},z){if(Z&&($?wX:xX).test.test(Z))return Z;return $?z.options.trueStr:z.options.falseStr}var wX={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new EX.Scalar(!0),stringify:jX},xX={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new EX.Scalar(!1),stringify:jX};yL.falseTag=xX;yL.trueTag=wX});var kX=P((uL)=>{var vL=M0(),M7=H$(),gL={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:M7.stringifyNumber},hL={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($.replace(/_/g,"")),stringify($){let Z=Number($.value);return isFinite(Z)?Z.toExponential():M7.stringifyNumber($)}},fL={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new vL.Scalar(parseFloat($.replace(/_/g,""))),z=$.indexOf(".");if(z!==-1){let Q=$.substring(z+1).replace(/_/g,"");if(Q[Q.length-1]==="0")Z.minFractionDigits=Q.length}return Z},stringify:M7.stringifyNumber};uL.float=fL;uL.floatExp=hL;uL.floatNaN=gL});var vX=P((rL)=>{var bX=H$(),R1=($)=>typeof $==="bigint"||Number.isInteger($);function p8($,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 L7($,Z,z){let{value:Q}=$;if(R1(Q)){let X=Q.toString(Z);return Q<0?"-"+z+X.substr(1):z+X}return bX.stringifyNumber($)}var lL={identify:R1,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,z)=>p8($,2,2,z),stringify:($)=>L7($,2,"0b")},dL={identify:R1,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,z)=>p8($,1,8,z),stringify:($)=>L7($,8,"0")},iL={identify:R1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,z)=>p8($,0,10,z),stringify:bX.stringifyNumber},nL={identify:R1,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,z)=>p8($,2,16,z),stringify:($)=>L7($,16,"0x")};rL.int=iL;rL.intBin=lL;rL.intHex=nL;rL.intOct=dL});var N7=P(($N)=>{var i8=o(),l8=e2(),d8=Z6();class S6 extends d8.YAMLMap{constructor($){super($);this.tag=S6.tag}add($){let Z;if(i8.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new l8.Pair($.key,null);else Z=new l8.Pair($,null);if(!d8.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let z=d8.findPair(this.items,$);return!Z&&i8.isPair(z)?i8.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=d8.findPair(this.items,$);if(z&&!Z)this.items.splice(this.items.indexOf(z),1);else if(!z&&Z)this.items.push(new l8.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(l8.createPair(J,null,z))}return X}}S6.tag="tag:yaml.org,2002:set";var eL={collection:"map",identify:($)=>$ instanceof Set,nodeClass:S6,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,z)=>S6.from($,Z,z),resolve($,Z){if(i8.isMap($))if($.hasAllNullValues(!0))return Object.assign(new S6,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};$N.YAMLSet=S6;$N.set=eL});var D7=P((YN)=>{var QN=H$();function O7($,Z){let z=$[0],Q=z==="-"||z==="+"?$.substring(1):$,X=(Y)=>Z?BigInt(Y):Number(Y),J=Q.replace(/_/g,"").split(":").reduce((Y,W)=>Y*X(60)+X(W),X(0));return z==="-"?X(-1)*J:J}function gX($){let{value:Z}=$,z=(Y)=>Y;if(typeof Z==="bigint")z=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return QN.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 XN={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})=>O7($,z),stringify:gX},JN={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:($)=>O7($,!1),stringify:gX},hX={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(hX.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,z,Q,X,J,Y,W]=Z.map(Number),U=Z[7]?Number((Z[7]+"00").substr(1,3)):0,G=Date.UTC(z,Q-1,X,J||0,Y||0,W||0,U),V=Z[8];if(V&&V!=="Z"){let H=O7(V,!1);if(Math.abs(H)<30)H*=60;G-=60000*H}return new Date(G)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};YN.floatTime=JN;YN.intTime=XN;YN.timestamp=hX});var uX=P((IN)=>{var VN=G$(),HN=h8(),qN=V$(),KN=A1(),BN=H7(),fX=yX(),I7=kX(),n8=vX(),MN=j8(),LN=B7(),NN=c8(),ON=N7(),T7=D7(),DN=[VN.map,qN.seq,KN.string,HN.nullTag,fX.trueTag,fX.falseTag,n8.intBin,n8.intOct,n8.int,n8.intHex,I7.floatNaN,I7.floatExp,I7.float,BN.binary,MN.merge,LN.omap,NN.pairs,ON.set,T7.intTime,T7.floatTime,T7.timestamp];IN.schema=DN});var oX=P((EN)=>{var lX=G$(),AN=h8(),dX=V$(),CN=A1(),_N=Q7(),A7=J7(),C7=W7(),RN=AX(),FN=_X(),iX=H7(),F1=j8(),nX=B7(),rX=c8(),mX=uX(),sX=N7(),r8=D7(),cX=new Map([["core",RN.schema],["failsafe",[lX.map,dX.seq,CN.string]],["json",FN.schema],["yaml11",mX.schema],["yaml-1.1",mX.schema]]),pX={binary:iX.binary,bool:_N.boolTag,float:A7.float,floatExp:A7.floatExp,floatNaN:A7.floatNaN,floatTime:r8.floatTime,int:C7.int,intHex:C7.intHex,intOct:C7.intOct,intTime:r8.intTime,map:lX.map,merge:F1.merge,null:AN.nullTag,omap:nX.omap,pairs:rX.pairs,seq:dX.seq,set:sX.set,timestamp:r8.timestamp},PN={"tag:yaml.org,2002:binary":iX.binary,"tag:yaml.org,2002:merge":F1.merge,"tag:yaml.org,2002:omap":nX.omap,"tag:yaml.org,2002:pairs":rX.pairs,"tag:yaml.org,2002:set":sX.set,"tag:yaml.org,2002:timestamp":r8.timestamp};function SN($,Z,z){let Q=cX.get(Z);if(Q&&!$)return z&&!Q.includes(F1.merge)?Q.concat(F1.merge):Q.slice();let X=Q;if(!X)if(Array.isArray($))X=[];else{let J=Array.from(cX.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(F1.merge);return X.reduce((J,Y)=>{let W=typeof Y==="string"?pX[Y]:Y;if(!W){let U=JSON.stringify(Y),G=Object.keys(pX).map((V)=>JSON.stringify(V)).join(", ");throw Error(`Unknown custom tag ${U}; use one of ${G}`)}if(!J.includes(W))J.push(W);return J},[])}EN.coreKnownTags=PN;EN.getTags=SN});var F7=P((vN)=>{var _7=o(),xN=G$(),yN=V$(),kN=A1(),s8=oX(),bN=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class R7{constructor({compat:$,customTags:Z,merge:z,resolveKnownTags:Q,schema:X,sortMapEntries:J,toStringDefaults:Y}){this.compat=Array.isArray($)?s8.getTags($,"compat"):$?s8.getTags(null,$):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?s8.coreKnownTags:{},this.tags=s8.getTags(Z,this.name,z),this.toStringOptions=Y??null,Object.defineProperty(this,_7.MAP,{value:xN.map}),Object.defineProperty(this,_7.SCALAR,{value:kN.string}),Object.defineProperty(this,_7.SEQ,{value:yN.seq}),this.sortMapEntries=typeof J==="function"?J:J===!0?bN:null}clone(){let $=Object.create(R7.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}vN.Schema=R7});var aX=P((uN)=>{var hN=o(),P7=D1(),P1=L1();function fN($,Z){let z=[],Q=Z.directives===!0;if(Z.directives!==!1&&$.directives){let U=$.directives.toString($);if(U)z.push(U),Q=!0;else if($.directives.docStart)Q=!0}if(Q)z.push("---");let X=P7.createStringifyContext($,Z),{commentString:J}=X.options;if($.commentBefore){if(z.length!==1)z.unshift("");let U=J($.commentBefore);z.unshift(P1.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(hN.isNode($.contents)){if($.contents.spaceBefore&&Q)z.push("");if($.contents.commentBefore){let V=J($.contents.commentBefore);z.push(P1.indentComment(V,""))}X.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,G=P7.stringify($.contents,X,()=>W=null,U);if(W)G+=P1.lineComment(G,"",J(W));if((G[0]==="|"||G[0]===">")&&z[z.length-1]==="---")z[z.length-1]=`--- ${G}`;else z.push(G)}else z.push(P7.stringify($.contents,X));if($.directives?.docEnd)if($.comment){let U=J($.comment);if(U.includes(`
81
- `))z.push("..."),z.push(P1.indentComment(U,""));else z.push(`... ${U}`)}else z.push("...");else{let U=$.comment;if(U&&Y)U=U.replace(/^\n+/,"");if(U){if((!Y||W)&&z[z.length-1]!=="")z.push("");z.push(P1.indentComment(J(U),""))}}return z.join(`
80
+ ${J.comment}`:Q.comment}Q=X}$.items[z]=l8.isPair(Q)?Q:new M7.Pair(Q)}else Z("Expected a sequence for this tag");return $}function EX($,Z,z){let{replacer:Q}=z,X=new EL.YAMLSeq($);X.tag="tag:yaml.org,2002:pairs";let J=0;if(Z&&Symbol.iterator in Object(Z))for(let Y of Z){if(typeof Q==="function")Y=Q.call(Z,String(J++),Y);let W,U;if(Array.isArray(Y))if(Y.length===2)W=Y[0],U=Y[1];else throw TypeError(`Expected [key, value] tuple: ${Y}`);else if(Y&&Y instanceof Object){let G=Object.keys(Y);if(G.length===1)W=G[0],U=Y[W];else throw TypeError(`Expected tuple with one key, not ${G.length} keys`)}else W=Y;X.items.push(M7.createPair(W,U,z))}return X}var jL={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:SX,createNode:EX};wL.createPairs=EX;wL.pairs=jL;wL.resolvePairs=SX});var N7=P((gL)=>{var jX=o(),L7=o2(),P1=Z6(),bL=z6(),wX=d8();class S6 extends bL.YAMLSeq{constructor(){super();this.add=P1.YAMLMap.prototype.add.bind(this),this.delete=P1.YAMLMap.prototype.delete.bind(this),this.get=P1.YAMLMap.prototype.get.bind(this),this.has=P1.YAMLMap.prototype.has.bind(this),this.set=P1.YAMLMap.prototype.set.bind(this),this.tag=S6.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(jX.isPair(Q))X=L7.toJS(Q.key,"",Z),J=L7.toJS(Q.value,X,Z);else X=L7.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=wX.createPairs($,Z,z),X=new this;return X.items=Q.items,X}}S6.tag="tag:yaml.org,2002:omap";var vL={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:S6,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let z=wX.resolvePairs($,Z),Q=[];for(let{key:X}of z.items)if(jX.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 S6,z)},createNode:($,Z,z)=>S6.from($,Z,z)};gL.YAMLOMap=S6;gL.omap=vL});var vX=P((uL)=>{var xX=M0();function yX({value:$,source:Z},z){if(Z&&($?kX:bX).test.test(Z))return Z;return $?z.options.trueStr:z.options.falseStr}var kX={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new xX.Scalar(!0),stringify:yX},bX={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new xX.Scalar(!1),stringify:yX};uL.falseTag=bX;uL.trueTag=kX});var gX=P((nL)=>{var pL=M0(),O7=H$(),lL={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},dL={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($)}},iL={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new pL.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};nL.float=iL;nL.floatExp=dL;nL.floatNaN=lL});var fX=P((ZN)=>{var hX=H$(),S1=($)=>typeof $==="bigint"||Number.isInteger($);function i8($,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 D7($,Z,z){let{value:Q}=$;if(S1(Q)){let X=Q.toString(Z);return Q<0?"-"+z+X.substr(1):z+X}return hX.stringifyNumber($)}var aL={identify:S1,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,z)=>i8($,2,2,z),stringify:($)=>D7($,2,"0b")},tL={identify:S1,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,z)=>i8($,1,8,z),stringify:($)=>D7($,8,"0")},eL={identify:S1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,z)=>i8($,0,10,z),stringify:hX.stringifyNumber},$N={identify:S1,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,z)=>i8($,2,16,z),stringify:($)=>D7($,16,"0x")};ZN.int=eL;ZN.intBin=aL;ZN.intHex=$N;ZN.intOct=tL});var I7=P((WN)=>{var s8=o(),n8=e2(),r8=Z6();class E6 extends r8.YAMLMap{constructor($){super($);this.tag=E6.tag}add($){let Z;if(s8.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new n8.Pair($.key,null);else Z=new n8.Pair($,null);if(!r8.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let z=r8.findPair(this.items,$);return!Z&&s8.isPair(z)?s8.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=r8.findPair(this.items,$);if(z&&!Z)this.items.splice(this.items.indexOf(z),1);else if(!z&&Z)this.items.push(new n8.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(n8.createPair(J,null,z))}return X}}E6.tag="tag:yaml.org,2002:set";var YN={collection:"map",identify:($)=>$ instanceof Set,nodeClass:E6,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,z)=>E6.from($,Z,z),resolve($,Z){if(s8.isMap($))if($.hasAllNullValues(!0))return Object.assign(new E6,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};WN.YAMLSet=E6;WN.set=YN});var A7=P((KN)=>{var VN=H$();function T7($,Z){let z=$[0],Q=z==="-"||z==="+"?$.substring(1):$,X=(Y)=>Z?BigInt(Y):Number(Y),J=Q.replace(/_/g,"").split(":").reduce((Y,W)=>Y*X(60)+X(W),X(0));return z==="-"?X(-1)*J:J}function uX($){let{value:Z}=$,z=(Y)=>Y;if(typeof Z==="bigint")z=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return VN.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 qN={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})=>T7($,z),stringify:uX},HN={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:($)=>T7($,!1),stringify:uX},mX={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(mX.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,z,Q,X,J,Y,W]=Z.map(Number),U=Z[7]?Number((Z[7]+"00").substr(1,3)):0,G=Date.UTC(z,Q-1,X,J||0,Y||0,W||0,U),V=Z[8];if(V&&V!=="Z"){let q=T7(V,!1);if(Math.abs(q)<30)q*=60;G-=60000*q}return new Date(G)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};KN.floatTime=HN;KN.intTime=qN;KN.timestamp=mX});var pX=P((PN)=>{var NN=V$(),ON=m8(),DN=q$(),IN=R1(),TN=B7(),cX=vX(),C7=gX(),o8=fX(),AN=y8(),CN=N7(),_N=d8(),RN=I7(),_7=A7(),FN=[NN.map,DN.seq,IN.string,ON.nullTag,cX.trueTag,cX.falseTag,o8.intBin,o8.intOct,o8.int,o8.intHex,C7.floatNaN,C7.floatExp,C7.float,TN.binary,AN.merge,CN.omap,_N.pairs,RN.set,_7.intTime,_7.floatTime,_7.timestamp];PN.schema=FN});var eX=P((vN)=>{var nX=V$(),EN=m8(),rX=q$(),jN=R1(),wN=Y7(),R7=U7(),F7=V7(),xN=RX(),yN=PX(),sX=B7(),E1=y8(),oX=N7(),aX=d8(),lX=pX(),tX=I7(),a8=A7(),dX=new Map([["core",xN.schema],["failsafe",[nX.map,rX.seq,jN.string]],["json",yN.schema],["yaml11",lX.schema],["yaml-1.1",lX.schema]]),iX={binary:sX.binary,bool:wN.boolTag,float:R7.float,floatExp:R7.floatExp,floatNaN:R7.floatNaN,floatTime:a8.floatTime,int:F7.int,intHex:F7.intHex,intOct:F7.intOct,intTime:a8.intTime,map:nX.map,merge:E1.merge,null:EN.nullTag,omap:oX.omap,pairs:aX.pairs,seq:rX.seq,set:tX.set,timestamp:a8.timestamp},kN={"tag:yaml.org,2002:binary":sX.binary,"tag:yaml.org,2002:merge":E1.merge,"tag:yaml.org,2002:omap":oX.omap,"tag:yaml.org,2002:pairs":aX.pairs,"tag:yaml.org,2002:set":tX.set,"tag:yaml.org,2002:timestamp":a8.timestamp};function bN($,Z,z){let Q=dX.get(Z);if(Q&&!$)return z&&!Q.includes(E1.merge)?Q.concat(E1.merge):Q.slice();let X=Q;if(!X)if(Array.isArray($))X=[];else{let J=Array.from(dX.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(E1.merge);return X.reduce((J,Y)=>{let W=typeof Y==="string"?iX[Y]:Y;if(!W){let U=JSON.stringify(Y),G=Object.keys(iX).map((V)=>JSON.stringify(V)).join(", ");throw Error(`Unknown custom tag ${U}; use one of ${G}`)}if(!J.includes(W))J.push(W);return J},[])}vN.coreKnownTags=kN;vN.getTags=bN});var E7=P((pN)=>{var P7=o(),fN=V$(),uN=q$(),mN=R1(),t8=eX(),cN=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class S7{constructor({compat:$,customTags:Z,merge:z,resolveKnownTags:Q,schema:X,sortMapEntries:J,toStringDefaults:Y}){this.compat=Array.isArray($)?t8.getTags($,"compat"):$?t8.getTags(null,$):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?t8.coreKnownTags:{},this.tags=t8.getTags(Z,this.name,z),this.toStringOptions=Y??null,Object.defineProperty(this,P7.MAP,{value:fN.map}),Object.defineProperty(this,P7.SCALAR,{value:mN.string}),Object.defineProperty(this,P7.SEQ,{value:uN.seq}),this.sortMapEntries=typeof J==="function"?J:J===!0?cN:null}clone(){let $=Object.create(S7.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}pN.Schema=S7});var $J=P((nN)=>{var dN=o(),j7=A1(),j1=D1();function iN($,Z){let z=[],Q=Z.directives===!0;if(Z.directives!==!1&&$.directives){let U=$.directives.toString($);if(U)z.push(U),Q=!0;else if($.directives.docStart)Q=!0}if(Q)z.push("---");let X=j7.createStringifyContext($,Z),{commentString:J}=X.options;if($.commentBefore){if(z.length!==1)z.unshift("");let U=J($.commentBefore);z.unshift(j1.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(dN.isNode($.contents)){if($.contents.spaceBefore&&Q)z.push("");if($.contents.commentBefore){let V=J($.contents.commentBefore);z.push(j1.indentComment(V,""))}X.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,G=j7.stringify($.contents,X,()=>W=null,U);if(W)G+=j1.lineComment(G,"",J(W));if((G[0]==="|"||G[0]===">")&&z[z.length-1]==="---")z[z.length-1]=`--- ${G}`;else z.push(G)}else z.push(j7.stringify($.contents,X));if($.directives?.docEnd)if($.comment){let U=J($.comment);if(U.includes(`
81
+ `))z.push("..."),z.push(j1.indentComment(U,""));else z.push(`... ${U}`)}else z.push("...");else{let U=$.comment;if(U&&Y)U=U.replace(/^\n+/,"");if(U){if((!Y||W)&&z[z.length-1]!=="")z.push("");z.push(j1.indentComment(J(U),""))}}return z.join(`
82
82
  `)+`
83
- `}uN.stringifyDocument=fN});var S1=P((sN)=>{var cN=B1(),q$=C8(),$2=o(),pN=e2(),lN=o2(),dN=F7(),iN=aX(),S7=I8(),nN=nZ(),rN=M1(),E7=iZ();class j7{constructor($,Z,z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$2.NODE_TYPE,{value:$2.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 E7.Directives({version:J});this.setSchema(J,z),this.contents=$===void 0?null:this.createNode($,Q,z)}clone(){let $=Object.create(j7.prototype,{[$2.NODE_TYPE]:{value:$2.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=$2.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(K$(this.contents))this.contents.add($)}addIn($,Z){if(K$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let z=S7.anchorNames(this);$.anchor=!Z||z.has(Z)?S7.findNewAnchor(Z||"a",z):Z}return new cN.Alias($.anchor)}createNode($,Z,z){let Q=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),Q=Z;else if(Array.isArray(Z)){let B=(T)=>typeof T==="number"||T instanceof String||T instanceof Number,N=Z.filter(B).map(String);if(N.length>0)Z=Z.concat(N);Q=Z}else if(z===void 0&&Z)z=Z,Z=void 0;let{aliasDuplicateObjects:X,anchorPrefix:J,flow:Y,keepUndefined:W,onTagObj:U,tag:G}=z??{},{onAnchor:V,setAnchors:H,sourceObjects:q}=S7.createNodeAnchors(this,J||"a"),K={aliasDuplicateObjects:X??!0,keepUndefined:W??!1,onAnchor:V,onTagObj:U,replacer:Q,schema:this.schema,sourceObjects:q},L=rN.createNode($,G,K);if(Y&&$2.isCollection(L))L.flow=!0;return H(),L}createPair($,Z,z={}){let Q=this.createNode($,null,z),X=this.createNode(Z,null,z);return new pN.Pair(Q,X)}delete($){return K$(this.contents)?this.contents.delete($):!1}deleteIn($){if(q$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return K$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return $2.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(q$.isEmptyPath($))return!Z&&$2.isScalar(this.contents)?this.contents.value:this.contents;return $2.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return $2.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(q$.isEmptyPath($))return this.contents!==void 0;return $2.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=q$.collectionFromPath(this.schema,[$],Z);else if(K$(this.contents))this.contents.set($,Z)}setIn($,Z){if(q$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=q$.collectionFromPath(this.schema,Array.from($),Z);else if(K$(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 E7.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 E7.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 dN.Schema(Object.assign(z,Z));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:Z,mapAsMap:z,maxAliasCount:Q,onAnchor:X,reviver:J}={}){let Y={anchors:new Map,doc:this,keep:!$,mapAsMap:z===!0,mapKeyWarned:!1,maxAliasCount:typeof Q==="number"?Q:100},W=lN.toJS(this.contents,Z??"",Y);if(typeof X==="function")for(let{count:U,res:G}of Y.anchors.values())X(G,U);return typeof J==="function"?nN.applyReviver(J,{"":W},"",W):W}toJSON($,Z){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:Z})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let Z=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${Z}`)}return iN.stringifyDocument(this,$)}}function K$($){if($2.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}sN.Document=j7});var E1=P((tN)=>{class o8 extends Error{constructor($,Z,z,Q){super();this.name=$,this.code=z,this.message=Q,this.pos=Z}}class tX extends o8{constructor($,Z,z){super("YAMLParseError",$,Z,z)}}class eX extends o8{constructor($,Z,z){super("YAMLWarning",$,Z,z)}}var aN=($,Z)=>(z)=>{if(z.pos[0]===-1)return;z.linePos=z.pos.map((W)=>Z.linePos(W));let{line:Q,col:X}=z.linePos[0];z.message+=` at line ${Q}, column ${X}`;let J=X-1,Y=$.substring(Z.lineStarts[Q-1],Z.lineStarts[Q]).replace(/[\n\r]+$/,"");if(J>=60&&Y.length>80){let W=Math.min(J-39,Y.length-79);Y="…"+Y.substring(W),J-=W-1}if(Y.length>80)Y=Y.substring(0,79)+"…";if(Q>1&&/^ *$/.test(Y.substring(0,J))){let W=$.substring(Z.lineStarts[Q-2],Z.lineStarts[Q-1]);if(W.length>80)W=W.substring(0,79)+`…
83
+ `}nN.stringifyDocument=iN});var w1=P((zO)=>{var sN=N1(),K$=F8(),$2=o(),oN=e2(),aN=o2(),tN=E7(),eN=$J(),w7=C8(),$O=oZ(),ZO=O1(),x7=sZ();class y7{constructor($,Z,z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$2.NODE_TYPE,{value:$2.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 x7.Directives({version:J});this.setSchema(J,z),this.contents=$===void 0?null:this.createNode($,Q,z)}clone(){let $=Object.create(y7.prototype,{[$2.NODE_TYPE]:{value:$2.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=$2.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(B$(this.contents))this.contents.add($)}addIn($,Z){if(B$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let z=w7.anchorNames(this);$.anchor=!Z||z.has(Z)?w7.findNewAnchor(Z||"a",z):Z}return new sN.Alias($.anchor)}createNode($,Z,z){let Q=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),Q=Z;else if(Array.isArray(Z)){let B=(T)=>typeof T==="number"||T instanceof String||T instanceof Number,N=Z.filter(B).map(String);if(N.length>0)Z=Z.concat(N);Q=Z}else if(z===void 0&&Z)z=Z,Z=void 0;let{aliasDuplicateObjects:X,anchorPrefix:J,flow:Y,keepUndefined:W,onTagObj:U,tag:G}=z??{},{onAnchor:V,setAnchors:q,sourceObjects:H}=w7.createNodeAnchors(this,J||"a"),K={aliasDuplicateObjects:X??!0,keepUndefined:W??!1,onAnchor:V,onTagObj:U,replacer:Q,schema:this.schema,sourceObjects:H},L=ZO.createNode($,G,K);if(Y&&$2.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 oN.Pair(Q,X)}delete($){return B$(this.contents)?this.contents.delete($):!1}deleteIn($){if(K$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return B$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return $2.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(K$.isEmptyPath($))return!Z&&$2.isScalar(this.contents)?this.contents.value:this.contents;return $2.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return $2.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(K$.isEmptyPath($))return this.contents!==void 0;return $2.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=K$.collectionFromPath(this.schema,[$],Z);else if(B$(this.contents))this.contents.set($,Z)}setIn($,Z){if(K$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=K$.collectionFromPath(this.schema,Array.from($),Z);else if(B$(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 x7.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 x7.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 tN.Schema(Object.assign(z,Z));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:Z,mapAsMap:z,maxAliasCount:Q,onAnchor:X,reviver:J}={}){let Y={anchors:new Map,doc:this,keep:!$,mapAsMap:z===!0,mapKeyWarned:!1,maxAliasCount:typeof Q==="number"?Q:100},W=aN.toJS(this.contents,Z??"",Y);if(typeof X==="function")for(let{count:U,res:G}of Y.anchors.values())X(G,U);return typeof J==="function"?$O.applyReviver(J,{"":W},"",W):W}toJSON($,Z){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:Z})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let Z=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${Z}`)}return eN.stringifyDocument(this,$)}}function B$($){if($2.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}zO.Document=y7});var x1=P((JO)=>{class e8 extends Error{constructor($,Z,z,Q){super();this.name=$,this.code=z,this.message=Q,this.pos=Z}}class ZJ extends e8{constructor($,Z,z){super("YAMLParseError",$,Z,z)}}class zJ extends e8{constructor($,Z,z){super("YAMLWarning",$,Z,z)}}var XO=($,Z)=>(z)=>{if(z.pos[0]===-1)return;z.linePos=z.pos.map((W)=>Z.linePos(W));let{line:Q,col:X}=z.linePos[0];z.message+=` at line ${Q}, column ${X}`;let J=X-1,Y=$.substring(Z.lineStarts[Q-1],Z.lineStarts[Q]).replace(/[\n\r]+$/,"");if(J>=60&&Y.length>80){let W=Math.min(J-39,Y.length-79);Y="…"+Y.substring(W),J-=W-1}if(Y.length>80)Y=Y.substring(0,79)+"…";if(Q>1&&/^ *$/.test(Y.substring(0,J))){let W=$.substring(Z.lineStarts[Q-2],Z.lineStarts[Q-1]);if(W.length>80)W=W.substring(0,79)+`…
84
84
  `;Y=W+Y}if(/[^ ]/.test(Y)){let W=1,U=z.linePos[1];if(U?.line===Q&&U.col>X)W=Math.max(1,Math.min(U.col-X,80-J));let G=" ".repeat(J)+"^".repeat(W);z.message+=`:
85
85
 
86
86
  ${Y}
87
87
  ${G}
88
- `}};tN.YAMLError=o8;tN.YAMLParseError=tX;tN.YAMLWarning=eX;tN.prettifyError=aN});var j1=P((XO)=>{function QO($,{flow:Z,indicator:z,next:Q,offset:X,onError:J,parentIndent:Y,startOnNewline:W}){let U=!1,G=W,V=W,H="",q="",K=!1,L=!1,B=null,N=null,T=null,R=null,w=null,j=null,y=null;for(let E of $){if(L){if(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma")J(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(B){if(G&&E.type!=="comment"&&E.type!=="newline")J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");B=null}switch(E.type){case"space":if(!Z&&(z!=="doc-start"||Q?.type!=="flow-collection")&&E.source.includes("\t"))B=E;V=!0;break;case"comment":{if(!V)J(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let c=E.source.substring(1)||" ";if(!H)H=c;else H+=q+c;q="",G=!1;break}case"newline":if(G){if(H)H+=E.source;else if(!j||z!=="seq-item-ind")U=!0}else q+=E.source;if(G=!0,K=!0,N||T)R=E;V=!0;break;case"anchor":if(N)J(E,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(E.source.endsWith(":"))J(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);N=E,y??(y=E.offset),G=!1,V=!1,L=!0;break;case"tag":{if(T)J(E,"MULTIPLE_TAGS","A node can have at most one tag");T=E,y??(y=E.offset),G=!1,V=!1,L=!0;break}case z:if(N||T)J(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`);if(j)J(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${Z??"collection"}`);j=E,G=z==="seq-item-ind"||z==="explicit-key-ind",V=!1;break;case"comma":if(Z){if(w)J(E,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);w=E,G=!1,V=!1;break}default:J(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),G=!1,V=!1}}let x=$[$.length-1],h=x?x.offset+x.source.length:X;if(L&&Q&&Q.type!=="space"&&Q.type!=="newline"&&Q.type!=="comma"&&(Q.type!=="scalar"||Q.source!==""))J(Q.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(B&&(G&&B.indent<=Y||Q?.type==="block-map"||Q?.type==="block-seq"))J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:w,found:j,spaceBefore:U,comment:H,hasNewline:K,anchor:N,tag:T,newlineAfterProp:R,end:h,start:y??h}}XO.resolveProps=QO});var a8=P((YO)=>{function w7($){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(w7(Z.key)||w7(Z.value))return!0}return!1;default:return!0}}YO.containsNewline=w7});var x7=P((VO)=>{var UO=a8();function GO($,Z,z){if(Z?.type==="flow-collection"){let Q=Z.end[0];if(Q.indent===$&&(Q.source==="]"||Q.source==="}")&&UO.containsNewline(Z))z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}VO.flowIndentCheck=GO});var y7=P((KO)=>{var $J=o();function qO($,Z,z){let{uniqueKeys:Q}=$.options;if(Q===!1)return!1;let X=typeof Q==="function"?Q:(J,Y)=>J===Y||$J.isScalar(J)&&$J.isScalar(Y)&&J.value===Y.value;return Z.some((J)=>X(J.key,z))}KO.mapIncludes=qO});var JJ=P((DO)=>{var ZJ=e2(),MO=Z6(),zJ=j1(),LO=a8(),QJ=x7(),NO=y7(),XJ="All mapping items must start at the same column";function OO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??MO.YAMLMap)(z.schema);if(z.atRoot)z.atRoot=!1;let U=Q.offset,G=null;for(let V of Q.items){let{start:H,key:q,sep:K,value:L}=V,B=zJ.resolveProps(H,{indicator:"explicit-key-ind",next:q??K?.[0],offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0}),N=!B.found;if(N){if(q){if(q.type==="block-seq")X(U,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in q&&q.indent!==Q.indent)X(U,"BAD_INDENT",XJ)}if(!B.anchor&&!B.tag&&!K){if(G=B.end,B.comment)if(W.comment)W.comment+=`
90
- `+B.comment;else W.comment=B.comment;continue}if(B.newlineAfterProp||LO.containsNewline(q))X(q??H[H.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(B.found?.indent!==Q.indent)X(U,"BAD_INDENT",XJ);z.atKey=!0;let T=B.end,R=q?$(z,q,B,X):Z(z,T,H,null,B,X);if(z.schema.compat)QJ.flowIndentCheck(Q.indent,q,X);if(z.atKey=!1,NO.mapIncludes(z,W.items,R))X(T,"DUPLICATE_KEY","Map keys must be unique");let w=zJ.resolveProps(K??[],{indicator:"map-value-ind",next:L,offset:R.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!q||q.type==="block-scalar"});if(U=w.end,w.found){if(N){if(L?.type==="block-map"&&!w.hasNewline)X(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(z.options.strict&&B.start<w.found.offset-1024)X(R.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let j=L?$(z,L,w,X):Z(z,U,K,null,w,X);if(z.schema.compat)QJ.flowIndentCheck(Q.indent,L,X);U=j.range[2];let y=new ZJ.Pair(R,j);if(z.options.keepSourceTokens)y.srcToken=V;W.items.push(y)}else{if(N)X(R.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(w.comment)if(R.comment)R.comment+=`
91
- `+w.comment;else R.comment=w.comment;let j=new ZJ.Pair(R);if(z.options.keepSourceTokens)j.srcToken=V;W.items.push(j)}}if(G&&G<U)X(G,"IMPOSSIBLE","Map comment with trailing content");return W.range=[Q.offset,U,G??U],W}DO.resolveBlockMap=OO});var YJ=P((RO)=>{var TO=z6(),AO=j1(),CO=x7();function _O({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??TO.YAMLSeq)(z.schema);if(z.atRoot)z.atRoot=!1;if(z.atKey)z.atKey=!1;let U=Q.offset,G=null;for(let{start:V,value:H}of Q.items){let q=AO.resolveProps(V,{indicator:"seq-item-ind",next:H,offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0});if(!q.found)if(q.anchor||q.tag||H)if(H?.type==="block-seq")X(q.end,"BAD_INDENT","All sequence items must start at the same column");else X(U,"MISSING_CHAR","Sequence item without - indicator");else{if(G=q.end,q.comment)W.comment=q.comment;continue}let K=H?$(z,H,q,X):Z(z,q.end,V,null,q,X);if(z.schema.compat)CO.flowIndentCheck(Q.indent,H,X);U=K.range[2],W.items.push(K)}return W.range=[Q.offset,U,G??U],W}RO.resolveBlockSeq=_O});var B$=P((SO)=>{function PO($,Z,z,Q){let X="";if($){let J=!1,Y="";for(let W of $){let{source:U,type:G}=W;switch(G){case"space":J=!0;break;case"comment":{if(z&&!J)Q(W,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let V=U.substring(1)||" ";if(!X)X=V;else X+=Y+V;Y="";break}case"newline":if(X)Y+=U;J=!0;break;default:Q(W,"UNEXPECTED_TOKEN",`Unexpected ${G} at node end`)}Z+=U.length}}return{comment:X,offset:Z}}SO.resolveEnd=PO});var GJ=P((gO)=>{var jO=o(),wO=e2(),WJ=Z6(),xO=z6(),yO=B$(),UJ=j1(),kO=a8(),bO=y7(),k7="Block collections are not allowed within flow collections",b7=($)=>$&&($.type==="block-map"||$.type==="block-seq");function vO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let Y=Q.start.source==="{",W=Y?"flow map":"flow sequence",G=new(J?.nodeClass??(Y?WJ.YAMLMap:xO.YAMLSeq))(z.schema);G.flow=!0;let V=z.atRoot;if(V)z.atRoot=!1;if(z.atKey)z.atKey=!1;let H=Q.offset+Q.start.source.length;for(let N=0;N<Q.items.length;++N){let T=Q.items[N],{start:R,key:w,sep:j,value:y}=T,x=UJ.resolveProps(R,{flow:W,indicator:"explicit-key-ind",next:w??j?.[0],offset:H,onError:X,parentIndent:Q.indent,startOnNewline:!1});if(!x.found){if(!x.anchor&&!x.tag&&!j&&!y){if(N===0&&x.comma)X(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`);else if(N<Q.items.length-1)X(x.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${W}`);if(x.comment)if(G.comment)G.comment+=`
92
- `+x.comment;else G.comment=x.comment;H=x.end;continue}if(!Y&&z.options.strict&&kO.containsNewline(w))X(w,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(N===0){if(x.comma)X(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`)}else{if(!x.comma)X(x.start,"MISSING_CHAR",`Missing , between ${W} items`);if(x.comment){let h="";$:for(let E of R)switch(E.type){case"comma":case"space":break;case"comment":h=E.source.substring(1);break $;default:break $}if(h){let E=G.items[G.items.length-1];if(jO.isPair(E))E=E.value??E.key;if(E.comment)E.comment+=`
93
- `+h;else E.comment=h;x.comment=x.comment.substring(h.length+1)}}}if(!Y&&!j&&!x.found){let h=y?$(z,y,x,X):Z(z,x.end,j,null,x,X);if(G.items.push(h),H=h.range[2],b7(y))X(h.range,"BLOCK_IN_FLOW",k7)}else{z.atKey=!0;let h=x.end,E=w?$(z,w,x,X):Z(z,h,R,null,x,X);if(b7(w))X(E.range,"BLOCK_IN_FLOW",k7);z.atKey=!1;let c=UJ.resolveProps(j??[],{flow:W,indicator:"map-value-ind",next:y,offset:E.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!1});if(c.found){if(!Y&&!x.found&&z.options.strict){if(j)for(let F of j){if(F===c.found)break;if(F.type==="newline"){X(F,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(x.start<c.found.offset-1024)X(c.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(y)if("source"in y&&y.source?.[0]===":")X(y,"MISSING_CHAR",`Missing space after : in ${W}`);else X(c.start,"MISSING_CHAR",`Missing , or : between ${W} items`);let D0=y?$(z,y,c,X):c.found?Z(z,c.end,j,null,c,X):null;if(D0){if(b7(y))X(D0.range,"BLOCK_IN_FLOW",k7)}else if(c.comment)if(E.comment)E.comment+=`
94
- `+c.comment;else E.comment=c.comment;let b0=new wO.Pair(E,D0);if(z.options.keepSourceTokens)b0.srcToken=T;if(Y){let F=G;if(bO.mapIncludes(z,F.items,E))X(h,"DUPLICATE_KEY","Map keys must be unique");F.items.push(b0)}else{let F=new WJ.YAMLMap(z.schema);F.flow=!0,F.items.push(b0);let i=(D0??E).range;F.range=[E.range[0],i[1],i[2]],G.items.push(F)}H=D0?D0.range[2]:c.end}}let q=Y?"}":"]",[K,...L]=Q.end,B=H;if(K?.source===q)B=K.offset+K.source.length;else{let N=W[0].toUpperCase()+W.substring(1),T=V?`${N} must end with a ${q}`:`${N} in block collection must be sufficiently indented and end with a ${q}`;if(X(H,V?"MISSING_CHAR":"BAD_INDENT",T),K&&K.source.length!==1)L.unshift(K)}if(L.length>0){let N=yO.resolveEnd(L,B,z.options.strict,X);if(N.comment)if(G.comment)G.comment+=`
95
- `+N.comment;else G.comment=N.comment;G.range=[Q.offset,B,N.offset]}else G.range=[Q.offset,B,B];return G}gO.resolveFlowCollection=vO});var VJ=P((nO)=>{var fO=o(),uO=M0(),mO=Z6(),cO=z6(),pO=JJ(),lO=YJ(),dO=GJ();function v7($,Z,z,Q,X,J){let Y=z.type==="block-map"?pO.resolveBlockMap($,Z,z,Q,J):z.type==="block-seq"?lO.resolveBlockSeq($,Z,z,Q,J):dO.resolveFlowCollection($,Z,z,Q,J),W=Y.constructor;if(X==="!"||X===W.tagName)return Y.tag=W.tagName,Y;if(X)Y.tag=X;return Y}function iO($,Z,z,Q,X){let J=Q.tag,Y=!J?null:Z.directives.tagName(J.source,(q)=>X(J,"TAG_RESOLVE_FAILED",q));if(z.type==="block-seq"){let{anchor:q,newlineAfterProp:K}=Q,L=q&&J?q.offset>J.offset?q:J:q??J;if(L&&(!K||K.offset<L.offset))X(L,"MISSING_CHAR","Missing newline after block sequence props")}let W=z.type==="block-map"?"map":z.type==="block-seq"?"seq":z.start.source==="{"?"map":"seq";if(!J||!Y||Y==="!"||Y===mO.YAMLMap.tagName&&W==="map"||Y===cO.YAMLSeq.tagName&&W==="seq")return v7($,Z,z,X,Y);let U=Z.schema.tags.find((q)=>q.tag===Y&&q.collection===W);if(!U){let q=Z.schema.knownTags[Y];if(q?.collection===W)Z.schema.tags.push(Object.assign({},q,{default:!1})),U=q;else{if(q)X(J,"BAD_COLLECTION_TYPE",`${q.tag} used for ${W} collection, but expects ${q.collection??"scalar"}`,!0);else X(J,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return v7($,Z,z,X,Y)}}let G=v7($,Z,z,X,Y,U),V=U.resolve?.(G,(q)=>X(J,"TAG_RESOLVE_FAILED",q),Z.options)??G,H=fO.isNode(V)?V:new uO.Scalar(V);if(H.range=G.range,H.tag=Y,U?.format)H.format=U.format;return H}nO.composeCollection=iO});var h7=P((tO)=>{var g7=M0();function sO($,Z,z){let Q=Z.offset,X=oO(Z,$.options.strict,z);if(!X)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let J=X.mode===">"?g7.Scalar.BLOCK_FOLDED:g7.Scalar.BLOCK_LITERAL,Y=Z.source?aO(Z.source):[],W=Y.length;for(let B=Y.length-1;B>=0;--B){let N=Y[B][1];if(N===""||N==="\r")W=B;else break}if(W===0){let B=X.chomp==="+"&&Y.length>0?`
96
- `.repeat(Math.max(1,Y.length-1)):"",N=Q+X.length;if(Z.source)N+=Z.source.length;return{value:B,type:J,comment:X.comment,range:[Q,N,N]}}let U=Z.indent+X.indent,G=Z.offset+X.length,V=0;for(let B=0;B<W;++B){let[N,T]=Y[B];if(T===""||T==="\r"){if(X.indent===0&&N.length>U)U=N.length}else{if(N.length<U)z(G+N.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(X.indent===0)U=N.length;if(V=B,U===0&&!$.atRoot)z(G,"BAD_INDENT","Block scalar values in collections must be indented");break}G+=N.length+T.length+1}for(let B=Y.length-1;B>=W;--B)if(Y[B][0].length>U)W=B+1;let H="",q="",K=!1;for(let B=0;B<V;++B)H+=Y[B][0].slice(U)+`
97
- `;for(let B=V;B<W;++B){let[N,T]=Y[B];G+=N.length+T.length+1;let R=T[T.length-1]==="\r";if(R)T=T.slice(0,-1);if(T&&N.length<U){let j=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;z(G-T.length-(R?2:1),"BAD_INDENT",j),N=""}if(J===g7.Scalar.BLOCK_LITERAL)H+=q+N.slice(U)+T,q=`
98
- `;else if(N.length>U||T[0]==="\t"){if(q===" ")q=`
99
- `;else if(!K&&q===`
100
- `)q=`
101
-
102
- `;H+=q+N.slice(U)+T,q=`
103
- `,K=!0}else if(T==="")if(q===`
104
- `)H+=`
105
- `;else q=`
106
- `;else H+=q+T,q=" ",K=!1}switch(X.chomp){case"-":break;case"+":for(let B=W;B<Y.length;++B)H+=`
107
- `+Y[B][0].slice(U);if(H[H.length-1]!==`
108
- `)H+=`
109
- `;break;default:H+=`
110
- `}let L=Q+X.length+Z.source.length;return{value:H,type:J,comment:X.comment,range:[Q,L,L]}}function oO({offset:$,props:Z},z,Q){if(Z[0].type!=="block-scalar-header")return Q(Z[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:X}=Z[0],J=X[0],Y=0,W="",U=-1;for(let q=1;q<X.length;++q){let K=X[q];if(!W&&(K==="-"||K==="+"))W=K;else{let L=Number(K);if(!Y&&L)Y=L;else if(U===-1)U=$+q}}if(U!==-1)Q(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${X}`);let G=!1,V="",H=X.length;for(let q=1;q<Z.length;++q){let K=Z[q];switch(K.type){case"space":G=!0;case"newline":H+=K.source.length;break;case"comment":if(z&&!G)Q(K,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");H+=K.source.length,V=K.source.substring(1);break;case"error":Q(K,"UNEXPECTED_TOKEN",K.message),H+=K.source.length;break;default:{let L=`Unexpected token in block scalar header: ${K.type}`;Q(K,"UNEXPECTED_TOKEN",L);let B=K.source;if(B&&typeof B==="string")H+=B.length}}}return{mode:J,indent:Y,chomp:W,comment:V,length:H}}function aO($){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}tO.resolveBlockScalar=sO});var u7=P((UD)=>{var f7=M0(),$D=B$();function ZD($,Z,z){let{offset:Q,type:X,source:J,end:Y}=$,W,U,G=(q,K,L)=>z(Q+q,K,L);switch(X){case"scalar":W=f7.Scalar.PLAIN,U=zD(J,G);break;case"single-quoted-scalar":W=f7.Scalar.QUOTE_SINGLE,U=QD(J,G);break;case"double-quoted-scalar":W=f7.Scalar.QUOTE_DOUBLE,U=XD(J,G);break;default:return z($,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${X}`),{value:"",type:null,comment:"",range:[Q,Q+J.length,Q+J.length]}}let V=Q+J.length,H=$D.resolveEnd(Y,V,Z,z);return{value:U,type:W,comment:H.comment,range:[Q,V,H.offset]}}function zD($,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 HJ($)}function QD($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return HJ($.slice(1,-1)).replace(/''/g,"'")}function HJ($){let Z,z;try{Z=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
+ `}};JO.YAMLError=e8;JO.YAMLParseError=ZJ;JO.YAMLWarning=zJ;JO.prettifyError=XO});var y1=P((qO)=>{function VO($,{flow:Z,indicator:z,next:Q,offset:X,onError:J,parentIndent:Y,startOnNewline:W}){let U=!1,G=W,V=W,q="",H="",K=!1,L=!1,B=null,N=null,T=null,R=null,w=null,j=null,y=null;for(let E of $){if(L){if(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma")J(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(B){if(G&&E.type!=="comment"&&E.type!=="newline")J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");B=null}switch(E.type){case"space":if(!Z&&(z!=="doc-start"||Q?.type!=="flow-collection")&&E.source.includes("\t"))B=E;V=!0;break;case"comment":{if(!V)J(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let c=E.source.substring(1)||" ";if(!q)q=c;else q+=H+c;H="",G=!1;break}case"newline":if(G){if(q)q+=E.source;else if(!j||z!=="seq-item-ind")U=!0}else H+=E.source;if(G=!0,K=!0,N||T)R=E;V=!0;break;case"anchor":if(N)J(E,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(E.source.endsWith(":"))J(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);N=E,y??(y=E.offset),G=!1,V=!1,L=!0;break;case"tag":{if(T)J(E,"MULTIPLE_TAGS","A node can have at most one tag");T=E,y??(y=E.offset),G=!1,V=!1,L=!0;break}case z:if(N||T)J(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`);if(j)J(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${Z??"collection"}`);j=E,G=z==="seq-item-ind"||z==="explicit-key-ind",V=!1;break;case"comma":if(Z){if(w)J(E,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);w=E,G=!1,V=!1;break}default:J(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),G=!1,V=!1}}let x=$[$.length-1],h=x?x.offset+x.source.length:X;if(L&&Q&&Q.type!=="space"&&Q.type!=="newline"&&Q.type!=="comma"&&(Q.type!=="scalar"||Q.source!==""))J(Q.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(B&&(G&&B.indent<=Y||Q?.type==="block-map"||Q?.type==="block-seq"))J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:w,found:j,spaceBefore:U,comment:q,hasNewline:K,anchor:N,tag:T,newlineAfterProp:R,end:h,start:y??h}}qO.resolveProps=VO});var $5=P((KO)=>{function k7($){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(k7(Z.key)||k7(Z.value))return!0}return!1;default:return!0}}KO.containsNewline=k7});var b7=P((NO)=>{var MO=$5();function LO($,Z,z){if(Z?.type==="flow-collection"){let Q=Z.end[0];if(Q.indent===$&&(Q.source==="]"||Q.source==="}")&&MO.containsNewline(Z))z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}NO.flowIndentCheck=LO});var v7=P((IO)=>{var QJ=o();function DO($,Z,z){let{uniqueKeys:Q}=$.options;if(Q===!1)return!1;let X=typeof Q==="function"?Q:(J,Y)=>J===Y||QJ.isScalar(J)&&QJ.isScalar(Y)&&J.value===Y.value;return Z.some((J)=>X(J.key,z))}IO.mapIncludes=DO});var UJ=P((FO)=>{var XJ=e2(),AO=Z6(),JJ=y1(),CO=$5(),YJ=b7(),_O=v7(),WJ="All mapping items must start at the same column";function RO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??AO.YAMLMap)(z.schema);if(z.atRoot)z.atRoot=!1;let U=Q.offset,G=null;for(let V of Q.items){let{start:q,key:H,sep:K,value:L}=V,B=JJ.resolveProps(q,{indicator:"explicit-key-ind",next:H??K?.[0],offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0}),N=!B.found;if(N){if(H){if(H.type==="block-seq")X(U,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in H&&H.indent!==Q.indent)X(U,"BAD_INDENT",WJ)}if(!B.anchor&&!B.tag&&!K){if(G=B.end,B.comment)if(W.comment)W.comment+=`
90
+ `+B.comment;else W.comment=B.comment;continue}if(B.newlineAfterProp||CO.containsNewline(H))X(H??q[q.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(B.found?.indent!==Q.indent)X(U,"BAD_INDENT",WJ);z.atKey=!0;let T=B.end,R=H?$(z,H,B,X):Z(z,T,q,null,B,X);if(z.schema.compat)YJ.flowIndentCheck(Q.indent,H,X);if(z.atKey=!1,_O.mapIncludes(z,W.items,R))X(T,"DUPLICATE_KEY","Map keys must be unique");let w=JJ.resolveProps(K??[],{indicator:"map-value-ind",next:L,offset:R.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!H||H.type==="block-scalar"});if(U=w.end,w.found){if(N){if(L?.type==="block-map"&&!w.hasNewline)X(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(z.options.strict&&B.start<w.found.offset-1024)X(R.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let j=L?$(z,L,w,X):Z(z,U,K,null,w,X);if(z.schema.compat)YJ.flowIndentCheck(Q.indent,L,X);U=j.range[2];let y=new XJ.Pair(R,j);if(z.options.keepSourceTokens)y.srcToken=V;W.items.push(y)}else{if(N)X(R.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(w.comment)if(R.comment)R.comment+=`
91
+ `+w.comment;else R.comment=w.comment;let j=new XJ.Pair(R);if(z.options.keepSourceTokens)j.srcToken=V;W.items.push(j)}}if(G&&G<U)X(G,"IMPOSSIBLE","Map comment with trailing content");return W.range=[Q.offset,U,G??U],W}FO.resolveBlockMap=RO});var GJ=P((xO)=>{var SO=z6(),EO=y1(),jO=b7();function wO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??SO.YAMLSeq)(z.schema);if(z.atRoot)z.atRoot=!1;if(z.atKey)z.atKey=!1;let U=Q.offset,G=null;for(let{start:V,value:q}of Q.items){let H=EO.resolveProps(V,{indicator:"seq-item-ind",next:q,offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0});if(!H.found)if(H.anchor||H.tag||q)if(q?.type==="block-seq")X(H.end,"BAD_INDENT","All sequence items must start at the same column");else X(U,"MISSING_CHAR","Sequence item without - indicator");else{if(G=H.end,H.comment)W.comment=H.comment;continue}let K=q?$(z,q,H,X):Z(z,H.end,V,null,H,X);if(z.schema.compat)jO.flowIndentCheck(Q.indent,q,X);U=K.range[2],W.items.push(K)}return W.range=[Q.offset,U,G??U],W}xO.resolveBlockSeq=wO});var M$=P((bO)=>{function kO($,Z,z,Q){let X="";if($){let J=!1,Y="";for(let W of $){let{source:U,type:G}=W;switch(G){case"space":J=!0;break;case"comment":{if(z&&!J)Q(W,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let V=U.substring(1)||" ";if(!X)X=V;else X+=Y+V;Y="";break}case"newline":if(X)Y+=U;J=!0;break;default:Q(W,"UNEXPECTED_TOKEN",`Unexpected ${G} at node end`)}Z+=U.length}}return{comment:X,offset:Z}}bO.resolveEnd=kO});var HJ=P((lO)=>{var gO=o(),hO=e2(),VJ=Z6(),fO=z6(),uO=M$(),qJ=y1(),mO=$5(),cO=v7(),g7="Block collections are not allowed within flow collections",h7=($)=>$&&($.type==="block-map"||$.type==="block-seq");function pO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let Y=Q.start.source==="{",W=Y?"flow map":"flow sequence",G=new(J?.nodeClass??(Y?VJ.YAMLMap:fO.YAMLSeq))(z.schema);G.flow=!0;let V=z.atRoot;if(V)z.atRoot=!1;if(z.atKey)z.atKey=!1;let q=Q.offset+Q.start.source.length;for(let N=0;N<Q.items.length;++N){let T=Q.items[N],{start:R,key:w,sep:j,value:y}=T,x=qJ.resolveProps(R,{flow:W,indicator:"explicit-key-ind",next:w??j?.[0],offset:q,onError:X,parentIndent:Q.indent,startOnNewline:!1});if(!x.found){if(!x.anchor&&!x.tag&&!j&&!y){if(N===0&&x.comma)X(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`);else if(N<Q.items.length-1)X(x.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${W}`);if(x.comment)if(G.comment)G.comment+=`
92
+ `+x.comment;else G.comment=x.comment;q=x.end;continue}if(!Y&&z.options.strict&&mO.containsNewline(w))X(w,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(N===0){if(x.comma)X(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`)}else{if(!x.comma)X(x.start,"MISSING_CHAR",`Missing , between ${W} items`);if(x.comment){let h="";$:for(let E of R)switch(E.type){case"comma":case"space":break;case"comment":h=E.source.substring(1);break $;default:break $}if(h){let E=G.items[G.items.length-1];if(gO.isPair(E))E=E.value??E.key;if(E.comment)E.comment+=`
93
+ `+h;else E.comment=h;x.comment=x.comment.substring(h.length+1)}}}if(!Y&&!j&&!x.found){let h=y?$(z,y,x,X):Z(z,x.end,j,null,x,X);if(G.items.push(h),q=h.range[2],h7(y))X(h.range,"BLOCK_IN_FLOW",g7)}else{z.atKey=!0;let h=x.end,E=w?$(z,w,x,X):Z(z,h,R,null,x,X);if(h7(w))X(E.range,"BLOCK_IN_FLOW",g7);z.atKey=!1;let c=qJ.resolveProps(j??[],{flow:W,indicator:"map-value-ind",next:y,offset:E.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!1});if(c.found){if(!Y&&!x.found&&z.options.strict){if(j)for(let F of j){if(F===c.found)break;if(F.type==="newline"){X(F,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(x.start<c.found.offset-1024)X(c.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(y)if("source"in y&&y.source?.[0]===":")X(y,"MISSING_CHAR",`Missing space after : in ${W}`);else X(c.start,"MISSING_CHAR",`Missing , or : between ${W} items`);let D0=y?$(z,y,c,X):c.found?Z(z,c.end,j,null,c,X):null;if(D0){if(h7(y))X(D0.range,"BLOCK_IN_FLOW",g7)}else if(c.comment)if(E.comment)E.comment+=`
94
+ `+c.comment;else E.comment=c.comment;let b0=new hO.Pair(E,D0);if(z.options.keepSourceTokens)b0.srcToken=T;if(Y){let F=G;if(cO.mapIncludes(z,F.items,E))X(h,"DUPLICATE_KEY","Map keys must be unique");F.items.push(b0)}else{let F=new VJ.YAMLMap(z.schema);F.flow=!0,F.items.push(b0);let i=(D0??E).range;F.range=[E.range[0],i[1],i[2]],G.items.push(F)}q=D0?D0.range[2]:c.end}}let H=Y?"}":"]",[K,...L]=Q.end,B=q;if(K?.source===H)B=K.offset+K.source.length;else{let N=W[0].toUpperCase()+W.substring(1),T=V?`${N} must end with a ${H}`:`${N} in block collection must be sufficiently indented and end with a ${H}`;if(X(q,V?"MISSING_CHAR":"BAD_INDENT",T),K&&K.source.length!==1)L.unshift(K)}if(L.length>0){let N=uO.resolveEnd(L,B,z.options.strict,X);if(N.comment)if(G.comment)G.comment+=`
95
+ `+N.comment;else G.comment=N.comment;G.range=[Q.offset,B,N.offset]}else G.range=[Q.offset,B,B];return G}lO.resolveFlowCollection=pO});var KJ=P(($D)=>{var iO=o(),nO=M0(),rO=Z6(),sO=z6(),oO=UJ(),aO=GJ(),tO=HJ();function f7($,Z,z,Q,X,J){let Y=z.type==="block-map"?oO.resolveBlockMap($,Z,z,Q,J):z.type==="block-seq"?aO.resolveBlockSeq($,Z,z,Q,J):tO.resolveFlowCollection($,Z,z,Q,J),W=Y.constructor;if(X==="!"||X===W.tagName)return Y.tag=W.tagName,Y;if(X)Y.tag=X;return Y}function eO($,Z,z,Q,X){let J=Q.tag,Y=!J?null:Z.directives.tagName(J.source,(H)=>X(J,"TAG_RESOLVE_FAILED",H));if(z.type==="block-seq"){let{anchor:H,newlineAfterProp:K}=Q,L=H&&J?H.offset>J.offset?H:J:H??J;if(L&&(!K||K.offset<L.offset))X(L,"MISSING_CHAR","Missing newline after block sequence props")}let W=z.type==="block-map"?"map":z.type==="block-seq"?"seq":z.start.source==="{"?"map":"seq";if(!J||!Y||Y==="!"||Y===rO.YAMLMap.tagName&&W==="map"||Y===sO.YAMLSeq.tagName&&W==="seq")return f7($,Z,z,X,Y);let U=Z.schema.tags.find((H)=>H.tag===Y&&H.collection===W);if(!U){let H=Z.schema.knownTags[Y];if(H?.collection===W)Z.schema.tags.push(Object.assign({},H,{default:!1})),U=H;else{if(H)X(J,"BAD_COLLECTION_TYPE",`${H.tag} used for ${W} collection, but expects ${H.collection??"scalar"}`,!0);else X(J,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return f7($,Z,z,X,Y)}}let G=f7($,Z,z,X,Y,U),V=U.resolve?.(G,(H)=>X(J,"TAG_RESOLVE_FAILED",H),Z.options)??G,q=iO.isNode(V)?V:new nO.Scalar(V);if(q.range=G.range,q.tag=Y,U?.format)q.format=U.format;return q}$D.composeCollection=eO});var m7=P((JD)=>{var u7=M0();function zD($,Z,z){let Q=Z.offset,X=QD(Z,$.options.strict,z);if(!X)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let J=X.mode===">"?u7.Scalar.BLOCK_FOLDED:u7.Scalar.BLOCK_LITERAL,Y=Z.source?XD(Z.source):[],W=Y.length;for(let B=Y.length-1;B>=0;--B){let N=Y[B][1];if(N===""||N==="\r")W=B;else break}if(W===0){let B=X.chomp==="+"&&Y.length>0?`
96
+ `.repeat(Math.max(1,Y.length-1)):"",N=Q+X.length;if(Z.source)N+=Z.source.length;return{value:B,type:J,comment:X.comment,range:[Q,N,N]}}let U=Z.indent+X.indent,G=Z.offset+X.length,V=0;for(let B=0;B<W;++B){let[N,T]=Y[B];if(T===""||T==="\r"){if(X.indent===0&&N.length>U)U=N.length}else{if(N.length<U)z(G+N.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(X.indent===0)U=N.length;if(V=B,U===0&&!$.atRoot)z(G,"BAD_INDENT","Block scalar values in collections must be indented");break}G+=N.length+T.length+1}for(let B=Y.length-1;B>=W;--B)if(Y[B][0].length>U)W=B+1;let q="",H="",K=!1;for(let B=0;B<V;++B)q+=Y[B][0].slice(U)+`
97
+ `;for(let B=V;B<W;++B){let[N,T]=Y[B];G+=N.length+T.length+1;let R=T[T.length-1]==="\r";if(R)T=T.slice(0,-1);if(T&&N.length<U){let j=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;z(G-T.length-(R?2:1),"BAD_INDENT",j),N=""}if(J===u7.Scalar.BLOCK_LITERAL)q+=H+N.slice(U)+T,H=`
98
+ `;else if(N.length>U||T[0]==="\t"){if(H===" ")H=`
99
+ `;else if(!K&&H===`
100
+ `)H=`
101
+
102
+ `;q+=H+N.slice(U)+T,H=`
103
+ `,K=!0}else if(T==="")if(H===`
104
+ `)q+=`
105
+ `;else H=`
106
+ `;else q+=H+T,H=" ",K=!1}switch(X.chomp){case"-":break;case"+":for(let B=W;B<Y.length;++B)q+=`
107
+ `+Y[B][0].slice(U);if(q[q.length-1]!==`
108
+ `)q+=`
109
+ `;break;default:q+=`
110
+ `}let L=Q+X.length+Z.source.length;return{value:q,type:J,comment:X.comment,range:[Q,L,L]}}function QD({offset:$,props:Z},z,Q){if(Z[0].type!=="block-scalar-header")return Q(Z[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:X}=Z[0],J=X[0],Y=0,W="",U=-1;for(let H=1;H<X.length;++H){let K=X[H];if(!W&&(K==="-"||K==="+"))W=K;else{let L=Number(K);if(!Y&&L)Y=L;else if(U===-1)U=$+H}}if(U!==-1)Q(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${X}`);let G=!1,V="",q=X.length;for(let H=1;H<Z.length;++H){let K=Z[H];switch(K.type){case"space":G=!0;case"newline":q+=K.source.length;break;case"comment":if(z&&!G)Q(K,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");q+=K.source.length,V=K.source.substring(1);break;case"error":Q(K,"UNEXPECTED_TOKEN",K.message),q+=K.source.length;break;default:{let L=`Unexpected token in block scalar header: ${K.type}`;Q(K,"UNEXPECTED_TOKEN",L);let B=K.source;if(B&&typeof B==="string")q+=B.length}}}return{mode:J,indent:Y,chomp:W,comment:V,length:q}}function XD($){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}JD.resolveBlockScalar=zD});var p7=P((MD)=>{var c7=M0(),WD=M$();function UD($,Z,z){let{offset:Q,type:X,source:J,end:Y}=$,W,U,G=(H,K,L)=>z(Q+H,K,L);switch(X){case"scalar":W=c7.Scalar.PLAIN,U=GD(J,G);break;case"single-quoted-scalar":W=c7.Scalar.QUOTE_SINGLE,U=VD(J,G);break;case"double-quoted-scalar":W=c7.Scalar.QUOTE_DOUBLE,U=qD(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=WD.resolveEnd(Y,V,Z,z);return{value:U,type:W,comment:q.comment,range:[Q,V,q.offset]}}function GD($,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 BJ($)}function VD($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return BJ($.slice(1,-1)).replace(/''/g,"'")}function BJ($){let Z,z;try{Z=new RegExp(`(.*?)(?<![ ])[ ]*\r?
111
111
  `,"sy"),z=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
112
112
  `,"sy")}catch{Z=/(.*?)[ \t]*\r?\n/sy,z=/[ \t]*(.*?)[ \t]*\r?\n/sy}let Q=Z.exec($);if(!Q)return $;let X=Q[1],J=" ",Y=Z.lastIndex;z.lastIndex=Y;while(Q=z.exec($)){if(Q[1]==="")if(J===`
113
113
  `)X+=J;else J=`
114
- `;else X+=J+Q[1],J=" ";Y=z.lastIndex}let W=/[ \t]*(.*)/sy;return W.lastIndex=Y,Q=W.exec($),X+J+(Q?.[1]??"")}function XD($,Z){let z="";for(let Q=1;Q<$.length-1;++Q){let X=$[Q];if(X==="\r"&&$[Q+1]===`
114
+ `;else X+=J+Q[1],J=" ";Y=z.lastIndex}let W=/[ \t]*(.*)/sy;return W.lastIndex=Y,Q=W.exec($),X+J+(Q?.[1]??"")}function qD($,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}=JD($,Q);z+=J,Q=Y}else if(X==="\\"){let J=$[++Q],Y=YD[J];if(Y)z+=Y;else if(J===`
116
+ `){let{fold:J,offset:Y}=HD($,Q);z+=J,Q=Y}else if(X==="\\"){let J=$[++Q],Y=KD[J];if(Y)z+=Y;else if(J===`
117
117
  `){J=$[Q+1];while(J===" "||J==="\t")J=$[++Q+1]}else if(J==="\r"&&$[Q+1]===`
118
- `){J=$[++Q+1];while(J===" "||J==="\t")J=$[++Q+1]}else if(J==="x"||J==="u"||J==="U"){let W=J==="x"?2:J==="u"?4:8;z+=WD($,Q+1,W,Z),Q+=W}else{let W=$.substr(Q-1,2);Z(Q-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),z+=W}}else if(X===" "||X==="\t"){let J=Q,Y=$[Q+1];while(Y===" "||Y==="\t")Y=$[++Q+1];if(Y!==`
118
+ `){J=$[++Q+1];while(J===" "||J==="\t")J=$[++Q+1]}else if(J==="x"||J==="u"||J==="U"){let W=J==="x"?2:J==="u"?4:8;z+=BD($,Q+1,W,Z),Q+=W}else{let W=$.substr(Q-1,2);Z(Q-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),z+=W}}else if(X===" "||X==="\t"){let J=Q,Y=$[Q+1];while(Y===" "||Y==="\t")Y=$[++Q+1];if(Y!==`
119
119
  `&&!(Y==="\r"&&$[Q+2]===`
120
- `))z+=Q>J?$.slice(J,Q+1):X}else z+=X}if($[$.length-1]!=='"'||$.length===1)Z($.length,"MISSING_CHAR",'Missing closing "quote');return z}function JD($,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 HD($,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 YD={"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 WD($,Z,z,Q){let X=$.substr(Z,z),Y=X.length===z&&/^[0-9a-fA-F]+$/.test(X)?parseInt(X,16):NaN;try{return String.fromCodePoint(Y)}catch{let W=$.substr(Z-2,z+2);return Q(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),W}}UD.resolveFlowScalar=ZD});var KJ=P((MD)=>{var E6=o(),qJ=M0(),VD=h7(),HD=u7();function qD($,Z,z,Q){let{value:X,type:J,comment:Y,range:W}=Z.type==="block-scalar"?VD.resolveBlockScalar($,Z,Q):HD.resolveFlowScalar(Z,$.options.strict,Q),U=z?$.directives.tagName(z.source,(H)=>Q(z,"TAG_RESOLVE_FAILED",H)):null,G;if($.options.stringKeys&&$.atKey)G=$.schema[E6.SCALAR];else if(U)G=KD($.schema,X,U,z,Q);else if(Z.type==="scalar")G=BD($,X,Z,Q);else G=$.schema[E6.SCALAR];let V;try{let H=G.resolve(X,(q)=>Q(z??Z,"TAG_RESOLVE_FAILED",q),$.options);V=E6.isScalar(H)?H:new qJ.Scalar(H)}catch(H){let q=H instanceof Error?H.message:String(H);Q(z??Z,"TAG_RESOLVE_FAILED",q),V=new qJ.Scalar(X)}if(V.range=W,V.source=X,J)V.type=J;if(U)V.tag=U;if(G.format)V.format=G.format;if(Y)V.comment=Y;return V}function KD($,Z,z,Q,X){if(z==="!")return $[E6.SCALAR];let J=[];for(let W of $.tags)if(!W.collection&&W.tag===z)if(W.default&&W.test)J.push(W);else return W;for(let W of J)if(W.test?.test(Z))return W;let Y=$.knownTags[z];if(Y&&!Y.collection)return $.tags.push(Object.assign({},Y,{default:!1,test:void 0})),Y;return X(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${z}`,z!=="tag:yaml.org,2002:str"),$[E6.SCALAR]}function BD({atKey:$,directives:Z,schema:z},Q,X,J){let Y=z.tags.find((W)=>(W.default===!0||$&&W.default==="key")&&W.test?.test(Q))||z[E6.SCALAR];if(z.compat){let W=z.compat.find((U)=>U.default&&U.test?.test(Q))??z[E6.SCALAR];if(Y.tag!==W.tag){let U=Z.tagString(Y.tag),G=Z.tagString(W.tag),V=`Value may be parsed as either ${U} or ${G}`;J(X,"TAG_RESOLVE_FAILED",V,!0)}}return Y}MD.composeScalar=qD});var BJ=P((OD)=>{function ND($,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 $}OD.emptyScalarPosition=ND});var NJ=P((PD)=>{var ID=B1(),TD=o(),AD=VJ(),MJ=KJ(),CD=B$(),_D=BJ(),RD={composeNode:LJ,composeEmptyNode:m7};function LJ($,Z,z,Q){let X=$.atKey,{spaceBefore:J,comment:Y,anchor:W,tag:U}=z,G,V=!0;switch(Z.type){case"alias":if(G=FD($,Z,Q),W||U)Q(Z,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(G=MJ.composeScalar($,Z,U,Q),W)G.anchor=W.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(G=AD.composeCollection(RD,$,Z,z,Q),W)G.anchor=W.source.substring(1)}catch(H){let q=H instanceof Error?H.message:String(H);Q(Z,"RESOURCE_EXHAUSTION",q)}break;default:{let H=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;Q(Z,"UNEXPECTED_TOKEN",H),V=!1}}if(G??(G=m7($,Z.offset,void 0,null,z,Q)),W&&G.anchor==="")Q(W,"BAD_ALIAS","Anchor cannot be an empty string");if(X&&$.options.stringKeys&&(!TD.isScalar(G)||typeof G.value!=="string"||G.tag&&G.tag!=="tag:yaml.org,2002:str"))Q(U??Z,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(J)G.spaceBefore=!0;if(Y)if(Z.type==="scalar"&&Z.source==="")G.comment=Y;else G.commentBefore=Y;if($.options.keepSourceTokens&&V)G.srcToken=Z;return G}function m7($,Z,z,Q,{spaceBefore:X,comment:J,anchor:Y,tag:W,end:U},G){let V={type:"scalar",offset:_D.emptyScalarPosition(Z,z,Q),indent:-1,source:""},H=MJ.composeScalar($,V,W,G);if(Y){if(H.anchor=Y.source.substring(1),H.anchor==="")G(Y,"BAD_ALIAS","Anchor cannot be an empty string")}if(X)H.spaceBefore=!0;if(J)H.comment=J,H.range[2]=U;return H}function FD({options:$},{offset:Z,source:z,end:Q},X){let J=new ID.Alias(z.substring(1));if(J.source==="")X(Z,"BAD_ALIAS","Alias cannot be an empty string");if(J.source.endsWith(":"))X(Z+z.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let Y=Z+z.length,W=CD.resolveEnd(Q,Y,$.strict,X);if(J.range=[Z,Y,W.offset],W.comment)J.comment=W.comment;return J}PD.composeEmptyNode=m7;PD.composeNode=LJ});var DJ=P((kD)=>{var jD=S1(),OJ=NJ(),wD=B$(),xD=j1();function yD($,Z,{offset:z,start:Q,value:X,end:J},Y){let W=Object.assign({_directives:Z},$),U=new jD.Document(void 0,W),G={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},V=xD.resolveProps(Q,{indicator:"doc-start",next:X??J?.[0],offset:z,onError:Y,parentIndent:0,startOnNewline:!0});if(V.found){if(U.directives.docStart=!0,X&&(X.type==="block-map"||X.type==="block-seq")&&!V.hasNewline)Y(V.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}U.contents=X?OJ.composeNode(G,X,V,Y):OJ.composeEmptyNode(G,V.end,Q,null,V,Y);let H=U.contents.range[2],q=wD.resolveEnd(J,H,!1,Y);if(q.comment)U.comment=q.comment;return U.range=[z,H,q.offset],U}kD.composeDoc=yD});var c7=P((mD)=>{var vD=d0("process"),gD=iZ(),hD=S1(),w1=E1(),IJ=o(),fD=DJ(),uD=B$();function x1($){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 TJ($){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 KD={"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 BD($,Z,z,Q){let X=$.substr(Z,z),Y=X.length===z&&/^[0-9a-fA-F]+$/.test(X)?parseInt(X,16):NaN;try{return String.fromCodePoint(Y)}catch{let W=$.substr(Z-2,z+2);return Q(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),W}}MD.resolveFlowScalar=UD});var LJ=P((AD)=>{var j6=o(),MJ=M0(),ND=m7(),OD=p7();function DD($,Z,z,Q){let{value:X,type:J,comment:Y,range:W}=Z.type==="block-scalar"?ND.resolveBlockScalar($,Z,Q):OD.resolveFlowScalar(Z,$.options.strict,Q),U=z?$.directives.tagName(z.source,(q)=>Q(z,"TAG_RESOLVE_FAILED",q)):null,G;if($.options.stringKeys&&$.atKey)G=$.schema[j6.SCALAR];else if(U)G=ID($.schema,X,U,z,Q);else if(Z.type==="scalar")G=TD($,X,Z,Q);else G=$.schema[j6.SCALAR];let V;try{let q=G.resolve(X,(H)=>Q(z??Z,"TAG_RESOLVE_FAILED",H),$.options);V=j6.isScalar(q)?q:new MJ.Scalar(q)}catch(q){let H=q instanceof Error?q.message:String(q);Q(z??Z,"TAG_RESOLVE_FAILED",H),V=new MJ.Scalar(X)}if(V.range=W,V.source=X,J)V.type=J;if(U)V.tag=U;if(G.format)V.format=G.format;if(Y)V.comment=Y;return V}function ID($,Z,z,Q,X){if(z==="!")return $[j6.SCALAR];let J=[];for(let W of $.tags)if(!W.collection&&W.tag===z)if(W.default&&W.test)J.push(W);else return W;for(let W of J)if(W.test?.test(Z))return W;let Y=$.knownTags[z];if(Y&&!Y.collection)return $.tags.push(Object.assign({},Y,{default:!1,test:void 0})),Y;return X(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${z}`,z!=="tag:yaml.org,2002:str"),$[j6.SCALAR]}function TD({atKey:$,directives:Z,schema:z},Q,X,J){let Y=z.tags.find((W)=>(W.default===!0||$&&W.default==="key")&&W.test?.test(Q))||z[j6.SCALAR];if(z.compat){let W=z.compat.find((U)=>U.default&&U.test?.test(Q))??z[j6.SCALAR];if(Y.tag!==W.tag){let U=Z.tagString(Y.tag),G=Z.tagString(W.tag),V=`Value may be parsed as either ${U} or ${G}`;J(X,"TAG_RESOLVE_FAILED",V,!0)}}return Y}AD.composeScalar=DD});var NJ=P((RD)=>{function _D($,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 $}RD.emptyScalarPosition=_D});var IJ=P((kD)=>{var PD=N1(),SD=o(),ED=KJ(),OJ=LJ(),jD=M$(),wD=NJ(),xD={composeNode:DJ,composeEmptyNode:l7};function DJ($,Z,z,Q){let X=$.atKey,{spaceBefore:J,comment:Y,anchor:W,tag:U}=z,G,V=!0;switch(Z.type){case"alias":if(G=yD($,Z,Q),W||U)Q(Z,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(G=OJ.composeScalar($,Z,U,Q),W)G.anchor=W.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(G=ED.composeCollection(xD,$,Z,z,Q),W)G.anchor=W.source.substring(1)}catch(q){let H=q instanceof Error?q.message:String(q);Q(Z,"RESOURCE_EXHAUSTION",H)}break;default:{let q=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;Q(Z,"UNEXPECTED_TOKEN",q),V=!1}}if(G??(G=l7($,Z.offset,void 0,null,z,Q)),W&&G.anchor==="")Q(W,"BAD_ALIAS","Anchor cannot be an empty string");if(X&&$.options.stringKeys&&(!SD.isScalar(G)||typeof G.value!=="string"||G.tag&&G.tag!=="tag:yaml.org,2002:str"))Q(U??Z,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(J)G.spaceBefore=!0;if(Y)if(Z.type==="scalar"&&Z.source==="")G.comment=Y;else G.commentBefore=Y;if($.options.keepSourceTokens&&V)G.srcToken=Z;return G}function l7($,Z,z,Q,{spaceBefore:X,comment:J,anchor:Y,tag:W,end:U},G){let V={type:"scalar",offset:wD.emptyScalarPosition(Z,z,Q),indent:-1,source:""},q=OJ.composeScalar($,V,W,G);if(Y){if(q.anchor=Y.source.substring(1),q.anchor==="")G(Y,"BAD_ALIAS","Anchor cannot be an empty string")}if(X)q.spaceBefore=!0;if(J)q.comment=J,q.range[2]=U;return q}function yD({options:$},{offset:Z,source:z,end:Q},X){let J=new PD.Alias(z.substring(1));if(J.source==="")X(Z,"BAD_ALIAS","Alias cannot be an empty string");if(J.source.endsWith(":"))X(Z+z.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let Y=Z+z.length,W=jD.resolveEnd(Q,Y,$.strict,X);if(J.range=[Z,Y,W.offset],W.comment)J.comment=W.comment;return J}kD.composeEmptyNode=l7;kD.composeNode=DJ});var AJ=P((mD)=>{var gD=w1(),TJ=IJ(),hD=M$(),fD=y1();function uD($,Z,{offset:z,start:Q,value:X,end:J},Y){let W=Object.assign({_directives:Z},$),U=new gD.Document(void 0,W),G={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},V=fD.resolveProps(Q,{indicator:"doc-start",next:X??J?.[0],offset:z,onError:Y,parentIndent:0,startOnNewline:!0});if(V.found){if(U.directives.docStart=!0,X&&(X.type==="block-map"||X.type==="block-seq")&&!V.hasNewline)Y(V.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}U.contents=X?TJ.composeNode(G,X,V,Y):TJ.composeEmptyNode(G,V.end,Q,null,V,Y);let q=U.contents.range[2],H=hD.resolveEnd(J,q,!1,Y);if(H.comment)U.comment=H.comment;return U.range=[z,q,H.offset],U}mD.composeDoc=uD});var d7=P((rD)=>{var pD=d0("process"),lD=sZ(),dD=w1(),k1=x1(),CJ=o(),iD=AJ(),nD=M$();function b1($){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 _J($){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 AJ{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,z,Q,X)=>{let J=x1(Z);if(X)this.warnings.push(new w1.YAMLWarning(J,z,Q));else this.errors.push(new w1.YAMLParseError(J,z,Q))},this.directives=new gD.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:z,afterEmptyLine:Q}=TJ(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(IJ.isCollection(X)&&!X.flow&&X.items.length>0){let J=X.items[0];if(IJ.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 RJ{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,z,Q,X)=>{let J=b1(Z);if(X)this.warnings.push(new k1.YAMLWarning(J,z,Q));else this.errors.push(new k1.YAMLParseError(J,z,Q))},this.directives=new lD.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:z,afterEmptyLine:Q}=_J(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(CJ.isCollection(X)&&!X.flow&&X.items.length>0){let J=X.items[0];if(CJ.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:TJ(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(vD.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,z,Q)=>{let X=x1($);X[0]+=Z,this.onError(X,"BAD_DIRECTIVE",z,Q)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=fD.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 w1.YAMLParseError(x1($),"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 w1.YAMLParseError(x1($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=uD.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 w1.YAMLParseError(x1($),"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 hD.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}}}mD.Composer=AJ});var RJ=P((oD)=>{var pD=h7(),lD=u7(),dD=E1(),CJ=O1();function iD($,Z=!0,z){if($){let Q=(X,J,Y)=>{let W=typeof X==="number"?X:Array.isArray(X)?X[0]:X.offset;if(z)z(W,J,Y);else throw new dD.YAMLParseError([W,W+1],J,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return lD.resolveFlowScalar($,Z,Q);case"block-scalar":return pD.resolveBlockScalar({options:{strict:Z}},$,Q)}}return null}function nD($,Z){let{implicitKey:z=!1,indent:Q,inFlow:X=!1,offset:J=-1,type:Y="PLAIN"}=Z,W=CJ.stringifyString({type:Y,value:$},{implicitKey:z,indent:Q>0?" ".repeat(Q):"",inFlow:X,options:{blockQuote:!0,lineWidth:-1}}),U=Z.end??[{type:"newline",offset:-1,indent:Q,source:`
131
+ ${J}`:z}}if(Z){for(let X=0;X<this.errors.length;++X)$.errors.push(this.errors[X]);for(let X=0;X<this.warnings.length;++X)$.warnings.push(this.warnings[X])}else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:_J(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(pD.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,z,Q)=>{let X=b1($);X[0]+=Z,this.onError(X,"BAD_DIRECTIVE",z,Q)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=iD.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 k1.YAMLParseError(b1($),"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 k1.YAMLParseError(b1($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=nD.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 k1.YAMLParseError(b1($),"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 dD.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}}}rD.Composer=RJ});var SJ=P((QI)=>{var oD=m7(),aD=p7(),tD=x1(),FJ=T1();function eD($,Z=!0,z){if($){let Q=(X,J,Y)=>{let W=typeof X==="number"?X:Array.isArray(X)?X[0]:X.offset;if(z)z(W,J,Y);else throw new tD.YAMLParseError([W,W+1],J,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return aD.resolveFlowScalar($,Z,Q);case"block-scalar":return oD.resolveBlockScalar({options:{strict:Z}},$,Q)}}return null}function $I($,Z){let{implicitKey:z=!1,indent:Q,inFlow:X=!1,offset:J=-1,type:Y="PLAIN"}=Z,W=FJ.stringifyString({type:Y,value:$},{implicitKey:z,indent:Q>0?" ".repeat(Q):"",inFlow:X,options:{blockQuote:!0,lineWidth:-1}}),U=Z.end??[{type:"newline",offset:-1,indent:Q,source:`
133
133
  `}];switch(W[0]){case"|":case">":{let G=W.indexOf(`
134
- `),V=W.substring(0,G),H=W.substring(G+1)+`
135
- `,q=[{type:"block-scalar-header",offset:J,indent:Q,source:V}];if(!_J(q,U))q.push({type:"newline",offset:-1,indent:Q,source:`
136
- `});return{type:"block-scalar",offset:J,indent:Q,props:q,source:H}}case'"':return{type:"double-quoted-scalar",offset:J,indent:Q,source:W,end:U};case"'":return{type:"single-quoted-scalar",offset:J,indent:Q,source:W,end:U};default:return{type:"scalar",offset:J,indent:Q,source:W,end:U}}}function rD($,Z,z={}){let{afterKey:Q=!1,implicitKey:X=!1,inFlow:J=!1,type:Y}=z,W="indent"in $?$.indent:null;if(Q&&typeof W==="number")W+=2;if(!Y)switch($.type){case"single-quoted-scalar":Y="QUOTE_SINGLE";break;case"double-quoted-scalar":Y="QUOTE_DOUBLE";break;case"block-scalar":{let G=$.props[0];if(G.type!=="block-scalar-header")throw Error("Invalid block scalar header");Y=G.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:Y="PLAIN"}let U=CJ.stringifyString({type:Y,value:Z},{implicitKey:X||W===null,indent:W!==null&&W>0?" ".repeat(W):"",inFlow:J,options:{blockQuote:!0,lineWidth:-1}});switch(U[0]){case"|":case">":sD($,U);break;case'"':p7($,U,"double-quoted-scalar");break;case"'":p7($,U,"single-quoted-scalar");break;default:p7($,U,"scalar")}}function sD($,Z){let z=Z.indexOf(`
134
+ `),V=W.substring(0,G),q=W.substring(G+1)+`
135
+ `,H=[{type:"block-scalar-header",offset:J,indent:Q,source:V}];if(!PJ(H,U))H.push({type:"newline",offset:-1,indent:Q,source:`
136
+ `});return{type:"block-scalar",offset:J,indent:Q,props:H,source:q}}case'"':return{type:"double-quoted-scalar",offset:J,indent:Q,source:W,end:U};case"'":return{type:"single-quoted-scalar",offset:J,indent:Q,source:W,end:U};default:return{type:"scalar",offset:J,indent:Q,source:W,end:U}}}function ZI($,Z,z={}){let{afterKey:Q=!1,implicitKey:X=!1,inFlow:J=!1,type:Y}=z,W="indent"in $?$.indent:null;if(Q&&typeof W==="number")W+=2;if(!Y)switch($.type){case"single-quoted-scalar":Y="QUOTE_SINGLE";break;case"double-quoted-scalar":Y="QUOTE_DOUBLE";break;case"block-scalar":{let G=$.props[0];if(G.type!=="block-scalar-header")throw Error("Invalid block scalar header");Y=G.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:Y="PLAIN"}let U=FJ.stringifyString({type:Y,value:Z},{implicitKey:X||W===null,indent:W!==null&&W>0?" ".repeat(W):"",inFlow:J,options:{blockQuote:!0,lineWidth:-1}});switch(U[0]){case"|":case">":zI($,U);break;case'"':i7($,U,"double-quoted-scalar");break;case"'":i7($,U,"single-quoted-scalar");break;default:i7($,U,"scalar")}}function zI($,Z){let z=Z.indexOf(`
137
137
  `),Q=Z.substring(0,z),X=Z.substring(z+1)+`
138
- `;if($.type==="block-scalar"){let J=$.props[0];if(J.type!=="block-scalar-header")throw Error("Invalid block scalar header");J.source=Q,$.source=X}else{let{offset:J}=$,Y="indent"in $?$.indent:-1,W=[{type:"block-scalar-header",offset:J,indent:Y,source:Q}];if(!_J(W,"end"in $?$.end:void 0))W.push({type:"newline",offset:-1,indent:Y,source:`
139
- `});for(let U of Object.keys($))if(U!=="type"&&U!=="offset")delete $[U];Object.assign($,{type:"block-scalar",indent:Y,props:W,source:X})}}function _J($,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 p7($,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})}}}oD.createScalarToken=nD;oD.resolveAsScalar=iD;oD.setScalarValue=rD});var FJ=P((ZI)=>{var $I=($)=>("type"in $)?e8($):t8($);function e8($){switch($.type){case"block-scalar":{let Z="";for(let z of $.props)Z+=e8(z);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let z of $.items)Z+=t8(z);return Z}case"flow-collection":{let Z=$.start.source;for(let z of $.items)Z+=t8(z);for(let z of $.end)Z+=z.source;return Z}case"document":{let Z=t8($);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 t8({start:$,key:Z,sep:z,value:Q}){let X="";for(let J of $)X+=J.source;if(Z)X+=e8(Z);if(z)for(let J of z)X+=J.source;if(Q)X+=e8(Q);return X}ZI.stringify=$I});var EJ=P((XI)=>{var l7=Symbol("break visit"),QI=Symbol("skip children"),PJ=Symbol("remove item");function j6($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};SJ(Object.freeze([]),$,Z)}j6.BREAK=l7;j6.SKIP=QI;j6.REMOVE=PJ;j6.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};j6.parentCollection=($,Z)=>{let z=j6.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 SJ($,Z,z){let Q=z(Z,$);if(typeof Q==="symbol")return Q;for(let X of["key","value"]){let J=Z[X];if(J&&"items"in J){for(let Y=0;Y<J.items.length;++Y){let W=SJ(Object.freeze($.concat([[X,Y]])),J.items[Y],z);if(typeof W==="number")Y=W-1;else if(W===l7)return l7;else if(W===PJ)J.items.splice(Y,1),Y-=1}if(typeof Q==="function"&&X==="key")Q=Q(Z,$)}}return typeof Q==="function"?Q(Z,$):Q}XI.visit=j6});var $5=P((qI)=>{var d7=RJ(),YI=FJ(),WI=EJ(),i7="\uFEFF",n7="\x02",r7="\x18",s7="\x1F",UI=($)=>!!$&&("items"in $),GI=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function VI($){switch($){case i7:return"<BOM>";case n7:return"<DOC>";case r7:return"<FLOW_END>";case s7:return"<SCALAR>";default:return JSON.stringify($)}}function HI($){switch($){case i7:return"byte-order-mark";case n7:return"doc-mode";case r7:return"flow-error-end";case s7:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
138
+ `;if($.type==="block-scalar"){let J=$.props[0];if(J.type!=="block-scalar-header")throw Error("Invalid block scalar header");J.source=Q,$.source=X}else{let{offset:J}=$,Y="indent"in $?$.indent:-1,W=[{type:"block-scalar-header",offset:J,indent:Y,source:Q}];if(!PJ(W,"end"in $?$.end:void 0))W.push({type:"newline",offset:-1,indent:Y,source:`
139
+ `});for(let U of Object.keys($))if(U!=="type"&&U!=="offset")delete $[U];Object.assign($,{type:"block-scalar",indent:Y,props:W,source:X})}}function PJ($,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 i7($,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})}}}QI.createScalarToken=$I;QI.resolveAsScalar=eD;QI.setScalarValue=ZI});var EJ=P((UI)=>{var WI=($)=>("type"in $)?z5($):Z5($);function z5($){switch($.type){case"block-scalar":{let Z="";for(let z of $.props)Z+=z5(z);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let z of $.items)Z+=Z5(z);return Z}case"flow-collection":{let Z=$.start.source;for(let z of $.items)Z+=Z5(z);for(let z of $.end)Z+=z.source;return Z}case"document":{let Z=Z5($);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 Z5({start:$,key:Z,sep:z,value:Q}){let X="";for(let J of $)X+=J.source;if(Z)X+=z5(Z);if(z)for(let J of z)X+=J.source;if(Q)X+=z5(Q);return X}UI.stringify=WI});var xJ=P((qI)=>{var n7=Symbol("break visit"),VI=Symbol("skip children"),jJ=Symbol("remove item");function w6($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};wJ(Object.freeze([]),$,Z)}w6.BREAK=n7;w6.SKIP=VI;w6.REMOVE=jJ;w6.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};w6.parentCollection=($,Z)=>{let z=w6.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 wJ($,Z,z){let Q=z(Z,$);if(typeof Q==="symbol")return Q;for(let X of["key","value"]){let J=Z[X];if(J&&"items"in J){for(let Y=0;Y<J.items.length;++Y){let W=wJ(Object.freeze($.concat([[X,Y]])),J.items[Y],z);if(typeof W==="number")Y=W-1;else if(W===n7)return n7;else if(W===jJ)J.items.splice(Y,1),Y-=1}if(typeof Q==="function"&&X==="key")Q=Q(Z,$)}}return typeof Q==="function"?Q(Z,$):Q}qI.visit=w6});var Q5=P((DI)=>{var r7=SJ(),KI=EJ(),BI=xJ(),s7="\uFEFF",o7="\x02",a7="\x18",t7="\x1F",MI=($)=>!!$&&("items"in $),LI=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function NI($){switch($){case s7:return"<BOM>";case o7:return"<DOC>";case a7:return"<FLOW_END>";case t7:return"<SCALAR>";default:return JSON.stringify($)}}function OI($){switch($){case s7:return"byte-order-mark";case o7:return"doc-mode";case a7:return"flow-error-end";case t7: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}qI.createScalarToken=d7.createScalarToken;qI.resolveAsScalar=d7.resolveAsScalar;qI.setScalarValue=d7.setScalarValue;qI.stringify=YI.stringify;qI.visit=WI.visit;qI.BOM=i7;qI.DOCUMENT=n7;qI.FLOW_END=r7;qI.SCALAR=s7;qI.isCollection=UI;qI.isScalar=GI;qI.prettyToken=VI;qI.tokenType=HI});var a7=P((SI)=>{var y1=$5();function q2($){switch($){case void 0:case" ":case`
143
- `:case"\r":case"\t":return!0;default:return!1}}var jJ=new Set("0123456789ABCDEFabcdef"),FI=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Z5=new Set(",[]{}"),PI=new Set(` ,[]{}
144
- \r `),o7=($)=>!$||PI.has($);class wJ{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}DI.createScalarToken=r7.createScalarToken;DI.resolveAsScalar=r7.resolveAsScalar;DI.setScalarValue=r7.setScalarValue;DI.stringify=KI.stringify;DI.visit=BI.visit;DI.BOM=s7;DI.DOCUMENT=o7;DI.FLOW_END=a7;DI.SCALAR=t7;DI.isCollection=MI;DI.isScalar=LI;DI.prettyToken=NI;DI.tokenType=OI});var $3=P((bI)=>{var v1=Q5();function H2($){switch($){case void 0:case" ":case`
143
+ `:case"\r":case"\t":return!0;default:return!1}}var yJ=new Set("0123456789ABCDEFabcdef"),yI=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),X5=new Set(",[]{}"),kI=new Set(` ,[]{}
144
+ \r `),e7=($)=>!$||kI.has($);class kJ{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex($,Z=!1){if($){if(typeof $!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+$:$,this.lineEndPos=null}this.atEnd=!Z;let z=this.next??"stream";while(z&&(Z||this.hasChars(1)))z=yield*this.parseNext(z)}atLineEnd(){let $=this.pos,Z=this.buffer[$];while(Z===" "||Z==="\t")Z=this.buffer[++$];if(!Z||Z==="#"||Z===`
145
145
  `)return!0;if(Z==="\r")return this.buffer[$+1]===`
146
146
  `;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let Z=this.buffer[$];if(this.indentNext>0){let z=0;while(Z===" ")Z=this.buffer[++z+$];if(Z==="\r"){let Q=this.buffer[z+$+1];if(Q===`
147
147
  `||!Q&&!this.atEnd)return $+z+1}return Z===`
148
- `||z>=this.indentNext||!Z&&!this.atEnd?$+z:-1}if(Z==="-"||Z==="."){let z=this.buffer.substr($,3);if((z==="---"||z==="...")&&q2(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]===y1.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 y1.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==="...")&&q2(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&&!q2(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(($==="-"||$==="?"||$===":")&&q2(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(o7),"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("..."))&&q2(Q[3])){if(!(z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield y1.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(o7),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let J=this.charAt(1);if(this.flowKey||q2(J)||J===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=this.charAt(0),Z=this.buffer.indexOf($,this.pos+1);if($==="'")while(Z!==-1&&this.buffer[Z+1]==="'")Z=this.buffer.indexOf("'",Z+2);else while(Z!==-1){let X=0;while(this.buffer[Z-1-X]==="\\")X+=1;if(X%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let z=this.buffer.substring(0,Z),Q=z.indexOf(`
148
+ `||z>=this.indentNext||!Z&&!this.atEnd?$+z:-1}if(Z==="-"||Z==="."){let z=this.buffer.substr($,3);if((z==="---"||z==="...")&&H2(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]===v1.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 v1.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==="...")&&H2(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&&!H2(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(($==="-"||$==="?"||$===":")&&H2(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(e7),"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("..."))&&H2(Q[3])){if(!(z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield v1.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(e7),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let J=this.charAt(1);if(this.flowKey||H2(J)||J===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=this.charAt(0),Z=this.buffer.indexOf($,this.pos+1);if($==="'")while(Z!==-1&&this.buffer[Z+1]==="'")Z=this.buffer.indexOf("'",Z+2);else while(Z!==-1){let X=0;while(this.buffer[Z-1-X]==="\\")X+=1;if(X%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let z=this.buffer.substring(0,Z),Q=z.indexOf(`
150
150
  `,this.pos);if(Q!==-1){while(Q!==-1){let X=this.continueScalar(Q+1);if(X===-1)break;Q=z.indexOf(`
151
- `,X)}if(Q!==-1)Z=Q-(z[Q-1]==="\r"?2:1)}if(Z===-1){if(!this.atEnd)return this.setNext("quoted-scalar");Z=this.buffer.length}return yield*this.pushToIndex(Z+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let $=this.pos;while(!0){let Z=this.buffer[++$];if(Z==="+")this.blockScalarKeep=!0;else if(Z>"0"&&Z<="9")this.blockScalarIndent=Number(Z)-1;else if(Z!=="-")break}return yield*this.pushUntil((Z)=>q2(Z)||Z==="#")}*parseBlockScalar(){let $=this.pos-1,Z=0,z;$:for(let X=this.pos;z=this.buffer[X];++X)switch(z){case" ":Z+=1;break;case`
151
+ `,X)}if(Q!==-1)Z=Q-(z[Q-1]==="\r"?2:1)}if(Z===-1){if(!this.atEnd)return this.setNext("quoted-scalar");Z=this.buffer.length}return yield*this.pushToIndex(Z+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let $=this.pos;while(!0){let Z=this.buffer[++$];if(Z==="+")this.blockScalarKeep=!0;else if(Z>"0"&&Z<="9")this.blockScalarIndent=Number(Z)-1;else if(Z!=="-")break}return yield*this.pushUntil((Z)=>H2(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 y1.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(q2(X)||$&&Z5.has(X))break;Z=z}else if(q2(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 v1.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(H2(X)||$&&X5.has(X))break;Z=z}else if(H2(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==="#"||$&&Z5.has(X))break;if(Q===`
159
- `){let J=this.continueScalar(z+1);if(J===-1)break;z=Math.max(z,J-2)}}else{if($&&Z5.has(Q))break;Z=z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield y1.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(o7),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let Z=this.flowLevel>0,z=this.charAt(1);if(q2(z)||Z&&Z5.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(!q2(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(FI.has(Z))Z=this.buffer[++$];else if(Z==="%"&&jJ.has(this.buffer[$+1])&&jJ.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==="#"||$&&X5.has(X))break;if(Q===`
159
+ `){let J=this.continueScalar(z+1);if(J===-1)break;z=Math.max(z,J-2)}}else{if($&&X5.has(Q))break;Z=z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield v1.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(e7),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let Z=this.flowLevel>0,z=this.charAt(1);if(H2(z)||Z&&X5.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(!H2(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(yI.has(Z))Z=this.buffer[++$];else if(Z==="%"&&yJ.has(this.buffer[$+1])&&yJ.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)}}SI.Lexer=wJ});var t7=P((jI)=>{class xJ{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}}}}jI.LineCounter=xJ});var e7=P((kI)=>{var xI=d0("process"),yJ=$5(),yI=a7();function Q6($,Z){for(let z=0;z<$.length;++z)if($[z].type===Z)return!0;return!1}function kJ($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function vJ($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function z5($){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 M$($){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 Q5($,Z){if(Z.length<1e5)Array.prototype.push.apply($,Z);else for(let z=0;z<Z.length;++z)$.push(Z[z])}function bJ($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!Q6(Z.start,"explicit-key-ind")&&!Q6(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,vJ(Z.value))if(Z.value.end)Q5(Z.value.end,Z.sep);else Z.value.end=Z.sep;else Q5(Z.start,Z.sep);delete Z.sep}}}class gJ{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 yI.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=$,xI.env.LOG_TOKENS)console.log("|",yJ.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=yJ.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")bJ(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&&kJ(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(kJ($.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=z5(this.peek(2)),z=M$(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)}}bI.Lexer=kJ});var Z3=P((gI)=>{class bJ{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}}}}gI.LineCounter=bJ});var z3=P((mI)=>{var fI=d0("process"),vJ=Q5(),uI=$3();function Q6($,Z){for(let z=0;z<$.length;++z)if($[z].type===Z)return!0;return!1}function gJ($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function fJ($){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 L$($){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 Y5($,Z){if(Z.length<1e5)Array.prototype.push.apply($,Z);else for(let z=0;z<Z.length;++z)$.push(Z[z])}function hJ($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!Q6(Z.start,"explicit-key-ind")&&!Q6(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,fJ(Z.value))if(Z.value.end)Y5(Z.value.end,Z.sep);else Z.value.end=Z.sep;else Y5(Z.start,Z.sep);delete Z.sep}}}class uJ{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 uI.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=$,fI.env.LOG_TOKENS)console.log("|",vJ.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=vJ.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")hJ(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&&gJ(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(gJ($.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=L$(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)){Q5(Q,Z.start),Q.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let z=!this.onKeyLine&&this.indent===$.indent,Q=z&&(Z.sep||Z.explicitKey)&&this.type!=="seq-item-ind",X=[];if(Q&&Z.sep&&!Z.value){let J=[];for(let Y=0;Y<Z.sep.length;++Y){let W=Z.sep[Y];switch(W.type){case"newline":J.push(Y);break;case"space":break;case"comment":if(W.indent>$.indent)J.length=0;break;default:J.length=0}}if(J.length>=2)X=Z.sep.splice(J[1])}switch(this.type){case"anchor":case"tag":if(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X}),this.onKeyLine=!0;else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"explicit-key-ind":if(!Z.sep&&!Z.explicitKey)Z.start.push(this.sourceToken),Z.explicitKey=!0;else if(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(Z.explicitKey)if(!Z.sep)if(Q6(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let J=M$(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(Q6(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(vJ(Z.key)&&!Q6(Z.sep,"newline")){let J=M$(Z.start),Y=Z.key,W=Z.sep;W.push(this.sourceToken),delete Z.key,delete Z.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:Y,sep:W}]})}else if(X.length>0)Z.sep=Z.sep.concat(X,this.sourceToken);else Z.sep.push(this.sourceToken);else if(!Z.sep)Object.assign(Z,{key:null,sep:[this.sourceToken]});else if(Z.value||Q)$.items.push({start:X,key:null,sep:[this.sourceToken]});else if(Q6(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&&!Q6(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)){Q5(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||Q6(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=z5(z),X=M$(Q);bJ($);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)){Y5(Q,Z.start),Q.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let z=!this.onKeyLine&&this.indent===$.indent,Q=z&&(Z.sep||Z.explicitKey)&&this.type!=="seq-item-ind",X=[];if(Q&&Z.sep&&!Z.value){let J=[];for(let Y=0;Y<Z.sep.length;++Y){let W=Z.sep[Y];switch(W.type){case"newline":J.push(Y);break;case"space":break;case"comment":if(W.indent>$.indent)J.length=0;break;default:J.length=0}}if(J.length>=2)X=Z.sep.splice(J[1])}switch(this.type){case"anchor":case"tag":if(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X}),this.onKeyLine=!0;else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"explicit-key-ind":if(!Z.sep&&!Z.explicitKey)Z.start.push(this.sourceToken),Z.explicitKey=!0;else if(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(Z.explicitKey)if(!Z.sep)if(Q6(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let J=L$(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(Q6(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(fJ(Z.key)&&!Q6(Z.sep,"newline")){let J=L$(Z.start),Y=Z.key,W=Z.sep;W.push(this.sourceToken),delete Z.key,delete Z.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:Y,sep:W}]})}else if(X.length>0)Z.sep=Z.sep.concat(X,this.sourceToken);else Z.sep.push(this.sourceToken);else if(!Z.sep)Object.assign(Z,{key:null,sep:[this.sourceToken]});else if(Z.value||Q)$.items.push({start:X,key:null,sep:[this.sourceToken]});else if(Q6(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&&!Q6(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)){Y5(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||Q6(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=L$(Q);hJ($);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=z5($),z=M$(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=z5($),z=M$(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()}}}kI.Parser=gJ});var cJ=P((pI)=>{var hJ=c7(),vI=S1(),k1=E1(),gI=tZ(),hI=o(),fI=t7(),fJ=e7();function uJ($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new fI.LineCounter||null,prettyErrors:Z}}function uI($,Z={}){let{lineCounter:z,prettyErrors:Q}=uJ(Z),X=new fJ.Parser(z?.addNewLine),J=new hJ.Composer(Z),Y=Array.from(J.compose(X.parse($)));if(Q&&z)for(let W of Y)W.errors.forEach(k1.prettifyError($,z)),W.warnings.forEach(k1.prettifyError($,z));if(Y.length>0)return Y;return Object.assign([],{empty:!0},J.streamInfo())}function mJ($,Z={}){let{lineCounter:z,prettyErrors:Q}=uJ(Z),X=new fJ.Parser(z?.addNewLine),J=new hJ.Composer(Z),Y=null;for(let W of J.compose(X.parse($),!0,$.length))if(!Y)Y=W;else if(Y.options.logLevel!=="silent"){Y.errors.push(new k1.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&z)Y.errors.forEach(k1.prettifyError($,z)),Y.warnings.forEach(k1.prettifyError($,z));return Y}function mI($,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=mJ($,z);if(!X)return null;if(X.warnings.forEach((J)=>gI.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 cI($,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(hI.isDocument($)&&!Q)return $.toString(z);return new vI.Document($,Q,z).toString(z)}pI.parse=mI;pI.parseAllDocuments=uI;pI.parseDocument=mJ;pI.stringify=cI});var fY={};LQ(fY,{orange:()=>_0,italic:()=>gA,fafCyanDeep:()=>T5,fafCyan:()=>I,dim:()=>M,bold:()=>C,FAF_HEX:()=>r1});var A3=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,C,M,gA,r1,I=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,T5=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,_0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var d=v(()=>{C=A3("1"),M=A3("2"),gA=A3("3"),r1={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var g9=P((am,rE)=>{rE.exports={name:"faf",version:"7.15.0",description:"Persistent AI context + memory — .faf and .fafm, IANA-registered. Anthropic-merged.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",types:"./dist/index.d.ts",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"},"./pack":{types:"./dist/interop/pack.d.ts",default:"./dist/pack.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",clean:"rm -rf dist",build:"bun run clean && bun build src/cli.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/index.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/interop/pack.ts --outdir dist --target=browser --minify --sourcemap=linked && tsc -p tsconfig.build.json",compile:"bun build src/cli.ts --compile --bytecode --minify --outfile faf","compile:all":"bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-arm64 --outfile faf-darwin-arm64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-x64 --outfile faf-darwin-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-linux-x64 --outfile faf-linux-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-windows-x64 --outfile faf-windows-x64.exe",test:"bun test --timeout=120000","test:watch":"bun test --watch --timeout=120000",lint:"eslint 'src/**/*.ts'",format:"prettier --write 'src/**/*.ts'","check:no-hardcode":"! grep -rEln '/(Users|home/runner|private/var)/' dist/ || (echo '❌ Hardcoded build-machine path leaked into dist — see grep output above. Externalize the offending dep in the build script.'; exit 1)","check:engines":"node scripts/check-engines.mjs",prepublishOnly:"bun run check:engines && bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational","agents-md","context-engineering","codex","windsurf","fafm","ai-memory","agents"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.3","faf-scoring-kernel":"^2.0.3",open:"^11.0.0",yaml:"^2.9.0"},optionalDependencies:{"@anthropic-ai/sdk":"^0.91.1"},devDependencies:{"@faf/specification":"github:Wolfe-Jam/faf","@types/bun":"^1.3.14","@types/node":"^22.20.1","@typescript-eslint/eslint-plugin":"^8.66.0","@typescript-eslint/parser":"^8.66.0",ajv:"^8.20.0",eslint:"^9.39.5",prettier:"^3.9.6",typescript:"^5.9.3","typescript-eslint":"^8.66.0"},overrides:{"brace-expansion":"^1.1.18","fast-uri":"^3.1.5",picomatch:"^4.0.5"},engines:{node:">=22.0.0"},publishConfig:{access:"public"}}});function S($,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 l2=()=>{};var c9=function(){let{crypto:$}=globalThis;if($?.randomUUID)return c9=$.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 d2($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var A4=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var k,N0,S0,M6,f$,u$,m$,c$,p$,l$,d$,i$,n$;var p0=v(()=>{k=class k extends Error{};N0=class N0 extends k{constructor($,Z,z,Q,X){super(`${N0.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 M6({message:z,cause:A4(Z)});let X=Z,J=X?.error?.type;if($===400)return new u$($,X,z,Q,J);if($===401)return new m$($,X,z,Q,J);if($===403)return new c$($,X,z,Q,J);if($===404)return new p$($,X,z,Q,J);if($===409)return new l$($,X,z,Q,J);if($===422)return new d$($,X,z,Q,J);if($===429)return new i$($,X,z,Q,J);if($>=500)return new n$($,X,z,Q,J);return new N0($,X,z,Q,J)}};S0=class S0 extends N0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};M6=class M6 extends N0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};f$=class f$ extends M6{constructor({message:$}={}){super({message:$??"Request timed out."})}};u$=class u$ extends N0{};m$=class m$ extends N0{};c$=class c$ extends N0{};p$=class p$ extends N0{};l$=class l$ extends N0{};d$=class d$ extends N0{};i$=class i$ extends N0{};n$=class n$ extends N0{}});function YZ($){if(typeof $!=="object")return{};return $??{}}function d9($){if(!$)return!0;for(let Z in $)return!1;return!0}function VV($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var Fj,GV=($)=>{return Fj.test($)},p9=($)=>(p9=Array.isArray,p9($)),l9,HV=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new k(`${$} must be an integer`);if(Z<0)throw new k(`${$} must be a positive integer`);return Z},WZ=($)=>{try{return JSON.parse($)}catch(Z){return}};var o6=v(()=>{p0();Fj=/^[a-z][a-z0-9+.-]*:/i,l9=p9});var qV=($)=>new Promise((Z)=>setTimeout(Z,$));var L6="0.91.1";function Pj(){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 Ej(){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 LV=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},Sj=()=>{let $=Pj();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":L6,"X-Stainless-OS":BV(Deno.build.os),"X-Stainless-Arch":KV(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":L6,"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":L6,"X-Stainless-OS":BV(globalThis.process.platform??"unknown"),"X-Stainless-Arch":KV(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=Ej();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":L6,"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":L6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},KV=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},BV=($)=>{if($=$.toLowerCase(),$.includes("ios"))return"iOS";if($==="android")return"Android";if($==="darwin")return"MacOS";if($==="win32")return"Windows";if($==="freebsd")return"FreeBSD";if($==="openbsd")return"OpenBSD";if($==="linux")return"Linux";if($)return`Other:${$}`;return"Unknown"},MV,NV=()=>{return MV??(MV=Sj())};var i9=()=>{};function OV(){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 n9(...$){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 UZ($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return n9({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 C4($){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 DV($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),z=Z.cancel();Z.releaseLock(),await z}var IV=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function TV($){return Object.entries($).filter(([Z,z])=>typeof z<"u").map(([Z,z])=>{if(typeof z==="string"||typeof z==="number"||typeof z==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent(z)}`;if(z===null)return`${encodeURIComponent(Z)}=`;throw new k(`Cannot stringify type ${typeof z}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}var AV=v(()=>{p0()});function RV($){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 _4($){let Z;return(CV??(Z=new globalThis.TextEncoder,CV=Z.encode.bind(Z)))($)}function r9($){let Z;return(_V??(Z=new globalThis.TextDecoder,_V=Z.decode.bind(Z)))($)}var CV,_V;class N6{constructor(){s0.set(this,void 0),o0.set(this,void 0),S(this,s0,new Uint8Array,"f"),S(this,o0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?_4($):$;S(this,s0,RV([O(this,s0,"f"),Z]),"f");let z=[],Q;while((Q=xj(O(this,s0,"f"),O(this,o0,"f")))!=null){if(Q.carriage&&O(this,o0,"f")==null){S(this,o0,Q.index,"f");continue}if(O(this,o0,"f")!=null&&(Q.index!==O(this,o0,"f")+1||Q.carriage)){z.push(r9(O(this,s0,"f").subarray(0,O(this,o0,"f")-1))),S(this,s0,O(this,s0,"f").subarray(O(this,o0,"f")),"f"),S(this,o0,null,"f");continue}let X=O(this,o0,"f")!==null?Q.preceding-1:Q.preceding,J=r9(O(this,s0,"f").subarray(0,X));z.push(J),S(this,s0,O(this,s0,"f").subarray(Q.index),"f"),S(this,o0,null,"f")}return z}flush(){if(!O(this,s0,"f").length)return[];return this.decode(`
166
- `)}}function xj($,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 FV($){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 s0,o0;var s9=v(()=>{l2();s0=new WeakMap,o0=new WeakMap;N6.NEWLINE_CHARS=new Set([`
167
- `,"\r"]);N6.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function R4(){}function GZ($,Z,z){if(!Z||VZ[$]>VZ[z])return R4;else return Z[$].bind(Z)}function P0($){let Z=$.logger,z=$.logLevel??"off";if(!Z)return yj;let Q=PV.get(Z);if(Q&&Q[0]===z)return Q[1];let X={error:GZ("error",Z,z),warn:GZ("warn",Z,z),info:GZ("info",Z,z),debug:GZ("debug",Z,z)};return PV.set(Z,[z,X]),X}var VZ,o9=($,Z,z)=>{if(!$)return;if(VV(VZ,$))return $;P0(z).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(VZ))}`);return},yj,PV,i2=($)=>{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 HZ=v(()=>{o6();VZ={off:0,error:200,warn:300,info:400,debug:500};yj={error:R4,warn:R4,info:R4,debug:R4},PV=new WeakMap});async function*kj($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new k("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new k("Attempted to iterate over a response with no body")}let z=new SV,Q=new N6,X=C4($.body);for await(let J of bj(X))for(let Y of Q.decode(J)){let W=z.decode(Y);if(W)yield W}for(let J of Q.flush()){let Y=z.decode(J);if(Y)yield Y}}async function*bj($){let Z=new Uint8Array;for await(let z of $){if(z==null)continue;let Q=z instanceof ArrayBuffer?new Uint8Array(z):typeof z==="string"?_4(z):z,X=new Uint8Array(Z.length+Q.length);X.set(Z),X.set(Q,Z.length),Z=X;let J;while((J=FV(Z))!==-1)yield Z.slice(0,J),Z=Z.slice(J)}if(Z.length>0)yield Z}class SV{constructor(){this.event=null,this.data=[],this.chunks=[]}decode($){if($.endsWith("\r"))$=$.substring(0,$.length-1);if(!$){if(!this.event&&!this.data.length)return null;let X={event:this.event,data:this.data.join(`
168
- `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],X}if(this.chunks.push($),$.startsWith(":"))return null;let[Z,z,Q]=vj($,":");if(Q.startsWith(" "))Q=Q.substring(1);if(Z==="event")this.event=Q;else if(Z==="data")this.data.push(Q);return null}}function vj($,Z){let z=$.indexOf(Z);if(z!==-1)return[$.substring(0,z),Z,$.substring(z+Z.length)];return[$,"",""]}var F4,a0;var a9=v(()=>{l2();p0();s9();o6();HZ();p0();a0=class a0{constructor($,Z,z){this.iterator=$,F4.set(this,void 0),this.controller=Z,S(this,F4,z,"f")}static fromSSEResponse($,Z,z){let Q=!1,X=z?P0(z):console;async function*J(){if(Q)throw new k("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of kj($,Z)){if(W.event==="completion")try{yield JSON.parse(W.data)}catch(U){throw X.error("Could not parse message into JSON:",W.data),X.error("From chunk:",W.raw),U}if(W.event==="message_start"||W.event==="message_delta"||W.event==="message_stop"||W.event==="content_block_start"||W.event==="content_block_delta"||W.event==="content_block_stop"||W.event==="message"||W.event==="user.message"||W.event==="user.interrupt"||W.event==="user.tool_confirmation"||W.event==="user.custom_tool_result"||W.event==="agent.message"||W.event==="agent.thinking"||W.event==="agent.tool_use"||W.event==="agent.tool_result"||W.event==="agent.mcp_tool_use"||W.event==="agent.mcp_tool_result"||W.event==="agent.custom_tool_use"||W.event==="agent.thread_context_compacted"||W.event==="session.status_running"||W.event==="session.status_idle"||W.event==="session.status_rescheduled"||W.event==="session.status_terminated"||W.event==="session.error"||W.event==="session.deleted"||W.event==="span.model_request_start"||W.event==="span.model_request_end")try{yield JSON.parse(W.data)}catch(U){throw X.error("Could not parse message into JSON:",W.data),X.error("From chunk:",W.raw),U}if(W.event==="ping")continue;if(W.event==="error"){let U=WZ(W.data)??W.data,G=U?.error?.type;throw new N0(void 0,U,void 0,$.headers,G)}}Y=!0}catch(W){if(d2(W))return;throw W}finally{if(!Y)Z.abort()}}return new a0(J,Z,z)}static fromReadableStream($,Z,z){let Q=!1;async function*X(){let Y=new N6,W=C4($);for await(let U of W)for(let G of Y.decode(U))yield G;for(let U of Y.flush())yield U}async function*J(){if(Q)throw new k("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of X()){if(Y)continue;if(W)yield JSON.parse(W)}Y=!0}catch(W){if(d2(W))return;throw W}finally{if(!Y)Z.abort()}}return new a0(J,Z,z)}[(F4=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 a0(()=>Q($),this.controller,O(this,F4,"f")),new a0(()=>Q(Z),this.controller,O(this,F4,"f"))]}toReadableStream(){let $=this,Z;return n9({async start(){Z=$[Symbol.asyncIterator]()},async pull(z){try{let{value:Q,done:X}=await Z.next();if(X)return z.close();let J=_4(JSON.stringify(Q)+`
169
- `);z.enqueue(J)}catch(Q){z.error(Q)}},async cancel(){await Z.return?.()}})}}});async function qZ($,Z){let{response:z,requestLogID:Q,retryOfRequestLogID:X,startTime:J}=Z,Y=await(async()=>{if(Z.options.stream){if(P0($).debug("response",z.status,z.url,z.headers,z.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(z,Z.controller);return a0.fromSSEResponse(z,Z.controller)}if(z.status===204)return null;if(Z.options.__binaryResponse)return z;let U=z.headers.get("content-type")?.split(";")[0]?.trim();if(U?.includes("application/json")||U?.endsWith("+json")){if(z.headers.get("content-length")==="0")return;let q=await z.json();return t9(q,z)}return await z.text()})();return P0($).debug(`[${Q}] response parsed`,i2({retryOfRequestLogID:X,url:z.url,status:z.status,body:Y,durationMs:Date.now()-J})),Y}function t9($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var e9=v(()=>{a9();HZ()});var P4,O6;var KZ=v(()=>{l2();e9();O6=class O6 extends Promise{constructor($,Z,z=qZ){super((Q)=>{Q(null)});this.responsePromise=Z,this.parseResponse=z,P4.set(this,void 0),S(this,P4,$,"f")}_thenUnwrap($){return new O6(O(this,P4,"f"),this.responsePromise,async(Z,z)=>t9($(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,P4,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};P4=new WeakMap});var BZ,$z,S4,A2,Z0;var V0=v(()=>{l2();p0();e9();KZ();o6();$z=class $z{constructor($,Z,z,Q){BZ.set(this,void 0),S(this,BZ,$,"f"),this.options=Q,this.response=Z,this.body=z}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new k("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await O(this,BZ,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(BZ=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};S4=class S4 extends O6{constructor($,Z,z){super($,Z,async(Q,X)=>new z(Q,X.response,await qZ(Q,X),X.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};A2=class A2 extends $z{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:{...YZ(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...YZ(this.options.query),after_id:$}}}};Z0=class Z0 extends $z{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:{...YZ(this.options.query),page:$}}}}});function a6($,Z,z){return zz(),new File($,Z??"unknown_file",z)}function E4($,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 hj($){let Z=typeof $==="function"?$:$.fetch,z=EV.get(Z);if(z)return z;let Q=(async()=>{try{let X="Response"in Z?Z.Response:(await Z("data:,")).constructor,J=new FormData;if(J.toString()===await new X(J).text())return!1;return!0}catch{return!0}})();return EV.set(Z,Q),Q}var zz=()=>{if(typeof File>"u"){let{process:$}=globalThis,Z=typeof $?.versions?.node==="string"&&parseInt($.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(Z?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}},Qz=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",r$=async($,Z,z=!0)=>{return{...$,body:await fj($.body,Z,z)}},EV,fj=async($,Z,z=!0)=>{if(!await hj(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])=>Zz(Q,X,J,z))),Q},uj=($)=>$ instanceof Blob&&("name"in $),Zz=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,a6([await z.blob()],E4(z,Q),X))}else if(Qz(z))$.append(Z,a6([await new Response(UZ(z)).blob()],E4(z,Q)));else if(uj(z))$.append(Z,a6([z],E4(z,Q),{type:z.type}));else if(Array.isArray(z))await Promise.all(z.map((X)=>Zz($,Z+"[]",X,Q)));else if(typeof z==="object")await Promise.all(Object.entries(z).map(([X,J])=>Zz($,`${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 s$=v(()=>{EV=new WeakMap});async function j4($,Z,z){if(zz(),$=await $,Z||(Z=E4($,!0)),mj($)){if($ instanceof File&&Z==null&&z==null)return $;return a6([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...z})}if(cj($)){let X=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),a6(await Xz(X),Z,z)}let Q=await Xz($);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 a6(Q,Z,z)}async function Xz($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(jV($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(Qz($))for await(let z of $)Z.push(...await Xz(z));else{let z=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${z?`; constructor: ${z}`:""}${pj($)}`)}return Z}function pj($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((z)=>`"${z}"`).join(", ")}]`}var jV=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",mj=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&jV($),cj=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var wV=v(()=>{s$();s$()});var Jz=v(()=>{wV()});var xV=()=>{};class m{constructor($){this._client=$}}function*dj($){if(!$)return;if(yV 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(l9($))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=l9(Q[1])?Q[1]:[Q[1]],Y=!1;for(let W of J){if(W===void 0)continue;if(Z&&!Y)Y=!0,yield[X,null];yield[X,W]}}}var yV,D=($)=>{let Z=new Headers,z=new Set;for(let Q of $){let X=new Set;for(let[J,Y]of dj(Q)){let W=J.toLowerCase();if(!X.has(W))Z.delete(J),X.add(W);if(Y===null)Z.delete(J),z.add(W);else Z.append(J,Y),z.delete(W)}}return{[yV]:!0,values:Z,nulls:z}};var Y0=v(()=>{o6();yV=Symbol.for("brand.privateNullableHeaders")});function bV($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var kV,ij=($=bV)=>function(z,...Q){if(z.length===1)return z[0];let X=!1,J=[],Y=z.reduce((V,H,q)=>{if(/[?#]/.test(H))X=!0;let K=Q[q],L=(X?encodeURIComponent:$)(""+K);if(q!==Q.length&&(K==null||typeof K==="object"&&K.toString===Object.getPrototypeOf(Object.getPrototypeOf(K.hasOwnProperty??kV)??kV)?.toString))L=K+"",J.push({start:V.length+H.length,length:L.length,error:`Value of type ${Object.prototype.toString.call(K).slice(8,-1)} is not a valid path parameter`});return V+H+(q===Q.length?"":L)},""),W=Y.split(/[?#]/,1)[0],U=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,G;while((G=U.exec(W))!==null)J.push({start:G.index,length:G[0].length,error:`Value "${G[0]}" can't be safely passed as a path parameter`});if(J.sort((V,H)=>V.start-H.start),J.length>0){let V=0,H=J.reduce((q,K)=>{let L=" ".repeat(K.start-V),B="^".repeat(K.length);return V=K.start+K.length,q+L+B},"");throw new k(`Path parameters result in path with invalid segments:
170
- ${J.map((q)=>q.error).join(`
165
+ `,Z)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Z=J5($),z=L$(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=L$(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()}}}mI.Parser=uJ});var dJ=P((oI)=>{var mJ=d7(),pI=w1(),g1=x1(),lI=Z7(),dI=o(),iI=Z3(),cJ=z3();function pJ($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new iI.LineCounter||null,prettyErrors:Z}}function nI($,Z={}){let{lineCounter:z,prettyErrors:Q}=pJ(Z),X=new cJ.Parser(z?.addNewLine),J=new mJ.Composer(Z),Y=Array.from(J.compose(X.parse($)));if(Q&&z)for(let W of Y)W.errors.forEach(g1.prettifyError($,z)),W.warnings.forEach(g1.prettifyError($,z));if(Y.length>0)return Y;return Object.assign([],{empty:!0},J.streamInfo())}function lJ($,Z={}){let{lineCounter:z,prettyErrors:Q}=pJ(Z),X=new cJ.Parser(z?.addNewLine),J=new mJ.Composer(Z),Y=null;for(let W of J.compose(X.parse($),!0,$.length))if(!Y)Y=W;else if(Y.options.logLevel!=="silent"){Y.errors.push(new g1.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&z)Y.errors.forEach(g1.prettifyError($,z)),Y.warnings.forEach(g1.prettifyError($,z));return Y}function rI($,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=lJ($,z);if(!X)return null;if(X.warnings.forEach((J)=>lI.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 sI($,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(dI.isDocument($)&&!Q)return $.toString(z);return new pI.Document($,Q,z).toString(z)}oI.parse=rI;oI.parseAllDocuments=nI;oI.parseDocument=lJ;oI.stringify=sI});var pY={};DQ(pY,{orange:()=>_0,italic:()=>lA,fafCyanDeep:()=>_5,fafCyan:()=>I,dim:()=>M,bold:()=>C,FAF_HEX:()=>a1});var R3=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,C,M,lA,a1,I=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,_5=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,_0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var d=v(()=>{C=R3("1"),M=R3("2"),lA=R3("3"),a1={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var u9=P((Yc,Qj)=>{Qj.exports={name:"faf",version:"7.16.2",description:"Persistent AI context + memory — .faf and .fafm, IANA-registered. Anthropic-merged.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",types:"./dist/index.d.ts",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"},"./pack":{types:"./dist/interop/pack.d.ts",default:"./dist/pack.js"}},files:["dist/**/*","README.md","LICENSE","project.faf","vendor/faf-scoring-kernel/**"],scripts:{dev:"bun src/cli.ts",clean:"rm -rf dist",build:"bun run clean && bun build src/cli.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/index.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/interop/pack.ts --outdir dist --target=browser --minify --sourcemap=linked && tsc -p tsconfig.build.json",compile:"bun build src/cli.ts --compile --bytecode --minify --outfile faf","compile:all":"bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-arm64 --outfile faf-darwin-arm64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-x64 --outfile faf-darwin-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-linux-x64 --outfile faf-linux-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-windows-x64 --outfile faf-windows-x64.exe",test:"bun test --timeout=120000","test:watch":"bun test --watch --timeout=120000",lint:"eslint 'src/**/*.ts'",format:"prettier --write 'src/**/*.ts'","check:no-hardcode":"! grep -rEln '/(Users|home/runner|private/var)/' dist/ || (echo '❌ Hardcoded build-machine path leaked into dist — see grep output above. Externalize the offending dep in the build script.'; exit 1)","check:engines":"node scripts/check-engines.mjs",prepublishOnly:"bun run check:engines && bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational","agents-md","context-engineering","codex","windsurf","fafm","ai-memory","agents"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.3","faf-scoring-kernel":"file:./vendor/faf-scoring-kernel",open:"^11.0.0",yaml:"^2.9.0"},optionalDependencies:{"@anthropic-ai/sdk":"^0.91.1"},devDependencies:{"@faf/specification":"github:Wolfe-Jam/faf","@types/bun":"^1.3.14","@types/node":"^22.20.1","@typescript-eslint/eslint-plugin":"^8.66.0","@typescript-eslint/parser":"^8.66.0",ajv:"^8.20.0",eslint:"^9.39.5",prettier:"^3.9.6",typescript:"^5.9.3","typescript-eslint":"^8.66.0"},overrides:{"brace-expansion":"^1.1.18","fast-uri":"^3.1.5",picomatch:"^4.0.5"},engines:{node:">=22.0.0"},publishConfig:{access:"public"}}});function S($,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 l2=()=>{};var d9=function(){let{crypto:$}=globalThis;if($?.randomUUID)return d9=$.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 d2($){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 k,N0,E0,L6,c$,p$,l$,d$,i$,n$,r$,s$,o$;var p0=v(()=>{k=class k extends Error{};N0=class N0 extends k{constructor($,Z,z,Q,X){super(`${N0.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 L6({message:z,cause:R4(Z)});let X=Z,J=X?.error?.type;if($===400)return new p$($,X,z,Q,J);if($===401)return new l$($,X,z,Q,J);if($===403)return new d$($,X,z,Q,J);if($===404)return new i$($,X,z,Q,J);if($===409)return new n$($,X,z,Q,J);if($===422)return new r$($,X,z,Q,J);if($===429)return new s$($,X,z,Q,J);if($>=500)return new o$($,X,z,Q,J);return new N0($,X,z,Q,J)}};E0=class E0 extends N0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};L6=class L6 extends N0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};c$=class c$ extends L6{constructor({message:$}={}){super({message:$??"Request timed out."})}};p$=class p$ extends N0{};l$=class l$ extends N0{};d$=class d$ extends N0{};i$=class i$ extends N0{};n$=class n$ extends N0{};r$=class r$ extends N0{};s$=class s$ extends N0{};o$=class o$ extends N0{}});function GZ($){if(typeof $!=="object")return{};return $??{}}function r9($){if(!$)return!0;for(let Z in $)return!1;return!0}function NV($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var bj,LV=($)=>{return bj.test($)},i9=($)=>(i9=Array.isArray,i9($)),n9,OV=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new k(`${$} must be an integer`);if(Z<0)throw new k(`${$} must be a positive integer`);return Z},VZ=($)=>{try{return JSON.parse($)}catch(Z){return}};var a6=v(()=>{p0();bj=/^[a-z][a-z0-9+.-]*:/i,n9=i9});var DV=($)=>new Promise((Z)=>setTimeout(Z,$));var N6="0.91.1";function vj(){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 hj(){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 CV=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},gj=()=>{let $=vj();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":N6,"X-Stainless-OS":TV(Deno.build.os),"X-Stainless-Arch":IV(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":N6,"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":N6,"X-Stainless-OS":TV(globalThis.process.platform??"unknown"),"X-Stainless-Arch":IV(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=hj();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":N6,"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":N6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},IV=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},TV=($)=>{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"},AV,_V=()=>{return AV??(AV=gj())};var s9=()=>{};function RV(){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 o9(...$){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 qZ($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return o9({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 F4($){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 FV($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),z=Z.cancel();Z.releaseLock(),await z}var PV=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function SV($){return Object.entries($).filter(([Z,z])=>typeof z<"u").map(([Z,z])=>{if(typeof z==="string"||typeof z==="number"||typeof z==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent(z)}`;if(z===null)return`${encodeURIComponent(Z)}=`;throw new k(`Cannot stringify type ${typeof z}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}var EV=v(()=>{p0()});function xV($){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 P4($){let Z;return(jV??(Z=new globalThis.TextEncoder,jV=Z.encode.bind(Z)))($)}function a9($){let Z;return(wV??(Z=new globalThis.TextDecoder,wV=Z.decode.bind(Z)))($)}var jV,wV;class O6{constructor(){s0.set(this,void 0),o0.set(this,void 0),S(this,s0,new Uint8Array,"f"),S(this,o0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?P4($):$;S(this,s0,xV([O(this,s0,"f"),Z]),"f");let z=[],Q;while((Q=mj(O(this,s0,"f"),O(this,o0,"f")))!=null){if(Q.carriage&&O(this,o0,"f")==null){S(this,o0,Q.index,"f");continue}if(O(this,o0,"f")!=null&&(Q.index!==O(this,o0,"f")+1||Q.carriage)){z.push(a9(O(this,s0,"f").subarray(0,O(this,o0,"f")-1))),S(this,s0,O(this,s0,"f").subarray(O(this,o0,"f")),"f"),S(this,o0,null,"f");continue}let X=O(this,o0,"f")!==null?Q.preceding-1:Q.preceding,J=a9(O(this,s0,"f").subarray(0,X));z.push(J),S(this,s0,O(this,s0,"f").subarray(Q.index),"f"),S(this,o0,null,"f")}return z}flush(){if(!O(this,s0,"f").length)return[];return this.decode(`
166
+ `)}}function mj($,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 yV($){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 s0,o0;var t9=v(()=>{l2();s0=new WeakMap,o0=new WeakMap;O6.NEWLINE_CHARS=new Set([`
167
+ `,"\r"]);O6.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function S4(){}function HZ($,Z,z){if(!Z||KZ[$]>KZ[z])return S4;else return Z[$].bind(Z)}function P0($){let Z=$.logger,z=$.logLevel??"off";if(!Z)return cj;let Q=kV.get(Z);if(Q&&Q[0]===z)return Q[1];let X={error:HZ("error",Z,z),warn:HZ("warn",Z,z),info:HZ("info",Z,z),debug:HZ("debug",Z,z)};return kV.set(Z,[z,X]),X}var KZ,e9=($,Z,z)=>{if(!$)return;if(NV(KZ,$))return $;P0(z).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(KZ))}`);return},cj,kV,i2=($)=>{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 BZ=v(()=>{a6();KZ={off:0,error:200,warn:300,info:400,debug:500};cj={error:S4,warn:S4,info:S4,debug:S4},kV=new WeakMap});async function*pj($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new k("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new k("Attempted to iterate over a response with no body")}let z=new bV,Q=new O6,X=F4($.body);for await(let J of lj(X))for(let Y of Q.decode(J)){let W=z.decode(Y);if(W)yield W}for(let J of Q.flush()){let Y=z.decode(J);if(Y)yield Y}}async function*lj($){let Z=new Uint8Array;for await(let z of $){if(z==null)continue;let Q=z instanceof ArrayBuffer?new Uint8Array(z):typeof z==="string"?P4(z):z,X=new Uint8Array(Z.length+Q.length);X.set(Z),X.set(Q,Z.length),Z=X;let J;while((J=yV(Z))!==-1)yield Z.slice(0,J),Z=Z.slice(J)}if(Z.length>0)yield Z}class bV{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]=dj($,":");if(Q.startsWith(" "))Q=Q.substring(1);if(Z==="event")this.event=Q;else if(Z==="data")this.data.push(Q);return null}}function dj($,Z){let z=$.indexOf(Z);if(z!==-1)return[$.substring(0,z),Z,$.substring(z+Z.length)];return[$,"",""]}var E4,a0;var $z=v(()=>{l2();p0();t9();a6();BZ();p0();a0=class a0{constructor($,Z,z){this.iterator=$,E4.set(this,void 0),this.controller=Z,S(this,E4,z,"f")}static fromSSEResponse($,Z,z){let Q=!1,X=z?P0(z):console;async function*J(){if(Q)throw new k("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of pj($,Z)){if(W.event==="completion")try{yield JSON.parse(W.data)}catch(U){throw X.error("Could not parse message into JSON:",W.data),X.error("From chunk:",W.raw),U}if(W.event==="message_start"||W.event==="message_delta"||W.event==="message_stop"||W.event==="content_block_start"||W.event==="content_block_delta"||W.event==="content_block_stop"||W.event==="message"||W.event==="user.message"||W.event==="user.interrupt"||W.event==="user.tool_confirmation"||W.event==="user.custom_tool_result"||W.event==="agent.message"||W.event==="agent.thinking"||W.event==="agent.tool_use"||W.event==="agent.tool_result"||W.event==="agent.mcp_tool_use"||W.event==="agent.mcp_tool_result"||W.event==="agent.custom_tool_use"||W.event==="agent.thread_context_compacted"||W.event==="session.status_running"||W.event==="session.status_idle"||W.event==="session.status_rescheduled"||W.event==="session.status_terminated"||W.event==="session.error"||W.event==="session.deleted"||W.event==="span.model_request_start"||W.event==="span.model_request_end")try{yield JSON.parse(W.data)}catch(U){throw X.error("Could not parse message into JSON:",W.data),X.error("From chunk:",W.raw),U}if(W.event==="ping")continue;if(W.event==="error"){let U=VZ(W.data)??W.data,G=U?.error?.type;throw new N0(void 0,U,void 0,$.headers,G)}}Y=!0}catch(W){if(d2(W))return;throw W}finally{if(!Y)Z.abort()}}return new a0(J,Z,z)}static fromReadableStream($,Z,z){let Q=!1;async function*X(){let Y=new O6,W=F4($);for await(let U of W)for(let G of Y.decode(U))yield G;for(let U of Y.flush())yield U}async function*J(){if(Q)throw new k("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of X()){if(Y)continue;if(W)yield JSON.parse(W)}Y=!0}catch(W){if(d2(W))return;throw W}finally{if(!Y)Z.abort()}}return new a0(J,Z,z)}[(E4=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 a0(()=>Q($),this.controller,O(this,E4,"f")),new a0(()=>Q(Z),this.controller,O(this,E4,"f"))]}toReadableStream(){let $=this,Z;return o9({async start(){Z=$[Symbol.asyncIterator]()},async pull(z){try{let{value:Q,done:X}=await Z.next();if(X)return z.close();let J=P4(JSON.stringify(Q)+`
169
+ `);z.enqueue(J)}catch(Q){z.error(Q)}},async cancel(){await Z.return?.()}})}}});async function MZ($,Z){let{response:z,requestLogID:Q,retryOfRequestLogID:X,startTime:J}=Z,Y=await(async()=>{if(Z.options.stream){if(P0($).debug("response",z.status,z.url,z.headers,z.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(z,Z.controller);return a0.fromSSEResponse(z,Z.controller)}if(z.status===204)return null;if(Z.options.__binaryResponse)return z;let U=z.headers.get("content-type")?.split(";")[0]?.trim();if(U?.includes("application/json")||U?.endsWith("+json")){if(z.headers.get("content-length")==="0")return;let H=await z.json();return Zz(H,z)}return await z.text()})();return P0($).debug(`[${Q}] response parsed`,i2({retryOfRequestLogID:X,url:z.url,status:z.status,body:Y,durationMs:Date.now()-J})),Y}function Zz($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var zz=v(()=>{$z();BZ()});var j4,D6;var LZ=v(()=>{l2();zz();D6=class D6 extends Promise{constructor($,Z,z=MZ){super((Q)=>{Q(null)});this.responsePromise=Z,this.parseResponse=z,j4.set(this,void 0),S(this,j4,$,"f")}_thenUnwrap($){return new D6(O(this,j4,"f"),this.responsePromise,async(Z,z)=>Zz($(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,j4,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};j4=new WeakMap});var NZ,Qz,w4,A2,Z0;var V0=v(()=>{l2();p0();zz();LZ();a6();Qz=class Qz{constructor($,Z,z,Q){NZ.set(this,void 0),S(this,NZ,$,"f"),this.options=Q,this.response=Z,this.body=z}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new k("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await O(this,NZ,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(NZ=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};w4=class w4 extends D6{constructor($,Z,z){super($,Z,async(Q,X)=>new z(Q,X.response,await MZ(Q,X),X.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};A2=class A2 extends Qz{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:{...GZ(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...GZ(this.options.query),after_id:$}}}};Z0=class Z0 extends Qz{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:{...GZ(this.options.query),page:$}}}}});function t6($,Z,z){return Jz(),new File($,Z??"unknown_file",z)}function x4($,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 nj($){let Z=typeof $==="function"?$:$.fetch,z=vV.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 vV.set(Z,Q),Q}var Jz=()=>{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`.":""))}},Yz=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",a$=async($,Z,z=!0)=>{return{...$,body:await rj($.body,Z,z)}},vV,rj=async($,Z,z=!0)=>{if(!await nj(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])=>Xz(Q,X,J,z))),Q},sj=($)=>$ instanceof Blob&&("name"in $),Xz=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,t6([await z.blob()],x4(z,Q),X))}else if(Yz(z))$.append(Z,t6([await new Response(qZ(z)).blob()],x4(z,Q)));else if(sj(z))$.append(Z,t6([z],x4(z,Q),{type:z.type}));else if(Array.isArray(z))await Promise.all(z.map((X)=>Xz($,Z+"[]",X,Q)));else if(typeof z==="object")await Promise.all(Object.entries(z).map(([X,J])=>Xz($,`${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 t$=v(()=>{vV=new WeakMap});async function y4($,Z,z){if(Jz(),$=await $,Z||(Z=x4($,!0)),oj($)){if($ instanceof File&&Z==null&&z==null)return $;return t6([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...z})}if(aj($)){let X=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),t6(await Wz(X),Z,z)}let Q=await Wz($);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 t6(Q,Z,z)}async function Wz($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(gV($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(Yz($))for await(let z of $)Z.push(...await Wz(z));else{let z=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${z?`; constructor: ${z}`:""}${tj($)}`)}return Z}function tj($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((z)=>`"${z}"`).join(", ")}]`}var gV=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",oj=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&gV($),aj=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var hV=v(()=>{t$();t$()});var Uz=v(()=>{hV()});var fV=()=>{};class m{constructor($){this._client=$}}function*$w($){if(!$)return;if(uV 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(n9($))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=n9(Q[1])?Q[1]:[Q[1]],Y=!1;for(let W of J){if(W===void 0)continue;if(Z&&!Y)Y=!0,yield[X,null];yield[X,W]}}}var uV,D=($)=>{let Z=new Headers,z=new Set;for(let Q of $){let X=new Set;for(let[J,Y]of $w(Q)){let W=J.toLowerCase();if(!X.has(W))Z.delete(J),X.add(W);if(Y===null)Z.delete(J),z.add(W);else Z.append(J,Y),z.delete(W)}}return{[uV]:!0,values:Z,nulls:z}};var Y0=v(()=>{a6();uV=Symbol.for("brand.privateNullableHeaders")});function cV($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var mV,Zw=($=cV)=>function(z,...Q){if(z.length===1)return z[0];let X=!1,J=[],Y=z.reduce((V,q,H)=>{if(/[?#]/.test(q))X=!0;let K=Q[H],L=(X?encodeURIComponent:$)(""+K);if(H!==Q.length&&(K==null||typeof K==="object"&&K.toString===Object.getPrototypeOf(Object.getPrototypeOf(K.hasOwnProperty??mV)??mV)?.toString))L=K+"",J.push({start:V.length+q.length,length:L.length,error:`Value of type ${Object.prototype.toString.call(K).slice(8,-1)} is not a valid path parameter`});return V+q+(H===Q.length?"":L)},""),W=Y.split(/[?#]/,1)[0],U=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,G;while((G=U.exec(W))!==null)J.push({start:G.index,length:G[0].length,error:`Value "${G[0]}" can't be safely passed as a path parameter`});if(J.sort((V,q)=>V.start-q.start),J.length>0){let V=0,q=J.reduce((H,K)=>{let L=" ".repeat(K.start-V),B="^".repeat(K.length);return V=K.start+K.length,H+L+B},"");throw new k(`Path parameters result in path with invalid segments:
170
+ ${J.map((H)=>H.error).join(`
171
171
  `)}
172
172
  ${Y}
173
- ${H}`)}return Y},_;var O0=v(()=>{p0();kV=Object.freeze(Object.create(null)),_=ij(bV)});var w4;var Yz=v(()=>{V0();Y0();O0();w4=class w4 extends m{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/environments?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/environments/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/environments/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/environments?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(_`/v1/environments/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(_`/v1/environments/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});function MZ($){return typeof $==="object"&&$!==null&&x4 in $}function Wz($,Z){let z=new Set;if($){for(let Q of $)if(MZ(Q))z.add(Q[x4])}if(Z)for(let Q of Z){if(MZ(Q))z.add(Q[x4]);if(Array.isArray(Q.content)){for(let X of Q.content)if(MZ(X))z.add(X[x4])}}return Array.from(z)}function LZ($,Z){let z=Wz($,Z);if(z.length===0)return{};return{"x-stainless-helper":z.join(", ")}}function vV($){if(MZ($))return{"x-stainless-helper":$[x4]};return{}}var x4;var y4=v(()=>{x4=Symbol("anthropic.sdk.stainlessHelper")});var k4;var Uz=v(()=>{V0();Y0();y4();s$();O0();k4=class k4 extends m{list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/files?beta=true",A2,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(_`/v1/files/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}download($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/files/${$}/content?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},z?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/files/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}upload($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/files?beta=true",r$({body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},vV(Q.file),Z?.headers])},this._client))}}});var b4;var Gz=v(()=>{V0();Y0();O0();b4=class b4 extends m{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/models/${$}?beta=true`,{...z,headers:D([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models?beta=true",A2,{query:Q,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var v4;var Vz=v(()=>{V0();Y0();O0();v4=class v4 extends m{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/user_profiles?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/user_profiles/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/user_profiles/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/user_profiles?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},z){let{betas:Q}=Z??{};return this._client.post(_`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}}});var g4;var Hz=v(()=>{V0();Y0();O0();g4=class g4 extends m{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(_`/v1/agents/${$}/versions?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var o$;var qz=v(()=>{Hz();Hz();V0();Y0();O0();o$=class o$ extends m{constructor(){super(...arguments);this.versions=new g4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/agents?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.get(_`/v1/agents/${$}?beta=true`,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/agents/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/agents?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(_`/v1/agents/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};o$.Versions=g4});var h4;var Kz=v(()=>{V0();Y0();O0();h4=class h4 extends m{create($,Z,z){let{view:Q,betas:X,...J}=Z;return this._client.post(_`/v1/memory_stores/${$}/memories?beta=true`,{query:{view:Q},body:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(_`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{memory_store_id:Q,view:X,betas:J,...Y}=Z;return this._client.post(_`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{view:X},body:Y,...z,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(_`/v1/memory_stores/${$}/memories?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{memory_store_id:Q,expected_content_sha256:X,betas:J}=Z;return this._client.delete(_`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{expected_content_sha256:X},...z,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var f4;var Bz=v(()=>{V0();Y0();O0();f4=class f4 extends m{retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(_`/v1/memory_stores/${Q}/memory_versions/${$}?beta=true`,{query:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(_`/v1/memory_stores/${$}/memory_versions?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}redact($,Z,z){let{memory_store_id:Q,betas:X}=Z;return this._client.post(_`/v1/memory_stores/${Q}/memory_versions/${$}/redact?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var t6;var Mz=v(()=>{Kz();Kz();Bz();Bz();V0();Y0();O0();t6=class t6 extends m{constructor(){super(...arguments);this.memories=new h4(this._client),this.memoryVersions=new f4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/memory_stores?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/memory_stores/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/memory_stores/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/memory_stores?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(_`/v1/memory_stores/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(_`/v1/memory_stores/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};t6.Memories=h4;t6.MemoryVersions=f4});var a$=v(()=>{p0()});var NZ;var Lz=v(()=>{NZ={"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 gV($){return $?.output_format??$?.output_config?.format}function Nz($,Z,z){let Q=gV(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 Oz($,Z,z)}function Oz($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=zw(Z,J.text);if(Q===null)Q=Y;let W=Object.defineProperty({...J},"parsed_output",{value:Y,enumerable:!1});return Object.defineProperty(W,"parsed",{get(){return z.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),Y},enumerable:!1})}return J});return{...$,content:X,parsed_output:Q}}function zw($,Z){let z=gV($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new k(`Failed to parse structured output: ${Q}`)}}var Dz=v(()=>{p0()});var Qw=($)=>{let Z=0,z=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"){Z++;continue}if(Q==="{"){z.push({type:"brace",value:"{"}),Z++;continue}if(Q==="}"){z.push({type:"brace",value:"}"}),Z++;continue}if(Q==="["){z.push({type:"paren",value:"["}),Z++;continue}if(Q==="]"){z.push({type:"paren",value:"]"}),Z++;continue}if(Q===":"){z.push({type:"separator",value:":"}),Z++;continue}if(Q===","){z.push({type:"delimiter",value:","}),Z++;continue}if(Q==='"'){let W="",U=!1;Q=$[++Z];while(Q!=='"'){if(Z===$.length){U=!0;break}if(Q==="\\"){if(Z++,Z===$.length){U=!0;break}W+=Q+$[Z],Q=$[++Z]}else W+=Q,Q=$[++Z]}if(Q=$[++Z],!U)z.push({type:"string",value:W});continue}if(Q&&/\s/.test(Q)){Z++;continue}let J=/[0-9]/;if(Q&&J.test(Q)||Q==="-"||Q==="."){let W="";if(Q==="-")W+=Q,Q=$[++Z];while(Q&&J.test(Q)||Q===".")W+=Q,Q=$[++Z];z.push({type:"number",value:W});continue}let Y=/[a-z]/i;if(Q&&Y.test(Q)){let W="";while(Q&&Y.test(Q)){if(Z===$.length)break;W+=Q,Q=$[++Z]}if(W=="true"||W=="false"||W==="null")z.push({type:"name",value:W});else{Z++;continue}continue}Z++}return z},t$=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),t$($);break;case"number":let z=Z.value[Z.value.length-1];if(z==="."||z==="-")return $=$.slice(0,$.length-1),t$($);case"string":let Q=$[$.length-2];if(Q?.type==="delimiter")return $=$.slice(0,$.length-1),t$($);else if(Q?.type==="brace"&&Q.value==="{")return $=$.slice(0,$.length-1),t$($);break;case"delimiter":return $=$.slice(0,$.length-1),t$($);break}return $},Xw=($)=>{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 $},Jw=($)=>{let Z="";return $.map((z)=>{switch(z.type){case"string":Z+='"'+z.value+'"';break;default:Z+=z.value;break}}),Z},OZ=($)=>JSON.parse(Jw(Xw(t$(Qw($)))));var Iz=()=>{};var Tz=v(()=>{a9()});function mV($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function cV($){}var U2,D6,e$,u4,DZ,m4,c4,IZ,p4,n2,l4,TZ,AZ,e6,CZ,_Z,d4,Az,hV,RZ,Cz,_z,Rz,fV,uV="__json_buf",i4;var pV=v(()=>{l2();Iz();a$();Tz();Dz();i4=class i4{constructor($,Z){U2.add(this),this.messages=[],this.receivedMessages=[],D6.set(this,void 0),e$.set(this,null),this.controller=new AbortController,u4.set(this,void 0),DZ.set(this,()=>{}),m4.set(this,()=>{}),c4.set(this,void 0),IZ.set(this,()=>{}),p4.set(this,()=>{}),n2.set(this,{}),l4.set(this,!1),TZ.set(this,!1),AZ.set(this,!1),e6.set(this,!1),CZ.set(this,void 0),_Z.set(this,void 0),d4.set(this,void 0),RZ.set(this,(z)=>{if(S(this,TZ,!0,"f"),d2(z))z=new S0;if(z instanceof S0)return S(this,AZ,!0,"f"),this._emit("abort",z);if(z instanceof k)return this._emit("error",z);if(z instanceof Error){let Q=new k(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new k(String(z)))}),S(this,u4,new Promise((z,Q)=>{S(this,DZ,z,"f"),S(this,m4,Q,"f")}),"f"),S(this,c4,new Promise((z,Q)=>{S(this,IZ,z,"f"),S(this,p4,Q,"f")}),"f"),O(this,u4,"f").catch(()=>{}),O(this,c4,"f").catch(()=>{}),S(this,e$,$,"f"),S(this,d4,Z?.logger??console,"f")}get response(){return O(this,CZ,"f")}get request_id(){return O(this,_Z,"f")}async withResponse(){S(this,e6,!0,"f");let $=await O(this,u4,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new i4(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new i4(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return S(X,e$,{...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,RZ,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,z){let Q=z?.signal,X;if(Q){if(Q.aborted)this.controller.abort();X=this.controller.abort.bind(this.controller),Q.addEventListener("abort",X)}try{O(this,U2,"m",Cz).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let W of Y)O(this,U2,"m",_z).call(this,W);if(Y.controller.signal?.aborted)throw new S0;O(this,U2,"m",Rz).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;S(this,CZ,$,"f"),S(this,_Z,$?.headers.get("request-id"),"f"),O(this,DZ,"f").call(this,$),this._emit("connect")}get ended(){return O(this,l4,"f")}get errored(){return O(this,TZ,"f")}get aborted(){return O(this,AZ,"f")}abort(){this.controller.abort()}on($,Z){return(O(this,n2,"f")[$]||(O(this,n2,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=O(this,n2,"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,n2,"f")[$]||(O(this,n2,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(S(this,e6,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){S(this,e6,!0,"f"),await O(this,c4,"f")}get currentMessage(){return O(this,D6,"f")}async finalMessage(){return await this.done(),O(this,U2,"m",Az).call(this)}async finalText(){return await this.done(),O(this,U2,"m",hV).call(this)}_emit($,...Z){if(O(this,l4,"f"))return;if($==="end")S(this,l4,!0,"f"),O(this,IZ,"f").call(this);let z=O(this,n2,"f")[$];if(z)O(this,n2,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!O(this,e6,"f")&&!z?.length)Promise.reject(Q);O(this,m4,"f").call(this,Q),O(this,p4,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!O(this,e6,"f")&&!z?.length)Promise.reject(Q);O(this,m4,"f").call(this,Q),O(this,p4,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",O(this,U2,"m",Az).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,U2,"m",Cz).call(this),this._connected(null);let X=a0.fromReadableStream($,this.controller);for await(let J of X)O(this,U2,"m",_z).call(this,J);if(X.controller.signal?.aborted)throw new S0;O(this,U2,"m",Rz).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(D6=new WeakMap,e$=new WeakMap,u4=new WeakMap,DZ=new WeakMap,m4=new WeakMap,c4=new WeakMap,IZ=new WeakMap,p4=new WeakMap,n2=new WeakMap,l4=new WeakMap,TZ=new WeakMap,AZ=new WeakMap,e6=new WeakMap,CZ=new WeakMap,_Z=new WeakMap,d4=new WeakMap,RZ=new WeakMap,U2=new WeakSet,Az=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},hV=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},Cz=function(){if(this.ended)return;S(this,D6,void 0,"f")},_z=function(Z){if(this.ended)return;let z=O(this,U2,"m",fV).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(mV(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:cV(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(Nz(z,O(this,e$,"f"),{logger:O(this,d4,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{S(this,D6,z,"f");break}case"content_block_start":case"message_delta":break}},Rz=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=O(this,D6,"f");if(!Z)throw new k("request ended without sending any chunks");return S(this,D6,void 0,"f"),Nz(Z,O(this,e$,"f"),{logger:O(this,d4,"f")})},fV=function(Z){let z=O(this,D6,"f");if(Z.type==="message_start"){if(z)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new k(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return z;case"message_delta":if(z.container=Z.delta.container,z.stop_reason=Z.delta.stop_reason,z.stop_sequence=Z.delta.stop_sequence,z.usage.output_tokens=Z.usage.output_tokens,z.context_management=Z.context_management,Z.usage.input_tokens!=null)z.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)z.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)z.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)z.usage.server_tool_use=Z.usage.server_tool_use;if(Z.usage.iterations!=null)z.usage.iterations=Z.usage.iterations;return z;case"content_block_start":return z.content.push(Z.content_block),z;case"content_block_delta":{let Q=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,text:(Q.text||"")+Z.delta.text};break}case"citations_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,citations:[...Q.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(Q&&mV(Q)){let X=Q[uV]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,uV,{value:X,enumerable:!1,writable:!0}),X)try{J.input=OZ(X)}catch(Y){let W=new k(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${X}`);O(this,RZ,"f").call(this,W)}z.content[Z.index]=J}break}case"thinking_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,thinking:Q.thinking+Z.delta.thinking};break}case"signature_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,signature:Z.delta.signature};break}case"compaction_delta":{if(Q?.type==="compaction")z.content[Z.index]={...Q,content:(Q.content||"")+Z.delta.content};break}default:cV(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 a0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var $1;var FZ=v(()=>{$1=class $1 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 lV=1e5,dV=`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},_;var O0=v(()=>{p0();mV=Object.freeze(Object.create(null)),_=Zw(cV)});var k4;var Gz=v(()=>{V0();Y0();O0();k4=class k4 extends m{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/environments?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/environments/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/environments/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/environments?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(_`/v1/environments/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(_`/v1/environments/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});function OZ($){return typeof $==="object"&&$!==null&&b4 in $}function Vz($,Z){let z=new Set;if($){for(let Q of $)if(OZ(Q))z.add(Q[b4])}if(Z)for(let Q of Z){if(OZ(Q))z.add(Q[b4]);if(Array.isArray(Q.content)){for(let X of Q.content)if(OZ(X))z.add(X[b4])}}return Array.from(z)}function DZ($,Z){let z=Vz($,Z);if(z.length===0)return{};return{"x-stainless-helper":z.join(", ")}}function pV($){if(OZ($))return{"x-stainless-helper":$[b4]};return{}}var b4;var v4=v(()=>{b4=Symbol("anthropic.sdk.stainlessHelper")});var g4;var qz=v(()=>{V0();Y0();v4();t$();O0();g4=class g4 extends m{list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/files?beta=true",A2,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(_`/v1/files/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}download($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/files/${$}/content?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},z?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/files/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}upload($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/files?beta=true",a$({body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},pV(Q.file),Z?.headers])},this._client))}}});var h4;var Hz=v(()=>{V0();Y0();O0();h4=class h4 extends m{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/models/${$}?beta=true`,{...z,headers:D([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models?beta=true",A2,{query:Q,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var f4;var Kz=v(()=>{V0();Y0();O0();f4=class f4 extends m{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/user_profiles?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/user_profiles/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/user_profiles/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/user_profiles?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},z){let{betas:Q}=Z??{};return this._client.post(_`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}}});var u4;var Bz=v(()=>{V0();Y0();O0();u4=class u4 extends m{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(_`/v1/agents/${$}/versions?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var e$;var Mz=v(()=>{Bz();Bz();V0();Y0();O0();e$=class e$ extends m{constructor(){super(...arguments);this.versions=new u4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/agents?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.get(_`/v1/agents/${$}?beta=true`,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/agents/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/agents?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(_`/v1/agents/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};e$.Versions=u4});var m4;var Lz=v(()=>{V0();Y0();O0();m4=class m4 extends m{create($,Z,z){let{view:Q,betas:X,...J}=Z;return this._client.post(_`/v1/memory_stores/${$}/memories?beta=true`,{query:{view:Q},body:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(_`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{memory_store_id:Q,view:X,betas:J,...Y}=Z;return this._client.post(_`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{view:X},body:Y,...z,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(_`/v1/memory_stores/${$}/memories?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{memory_store_id:Q,expected_content_sha256:X,betas:J}=Z;return this._client.delete(_`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{expected_content_sha256:X},...z,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var c4;var Nz=v(()=>{V0();Y0();O0();c4=class c4 extends m{retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(_`/v1/memory_stores/${Q}/memory_versions/${$}?beta=true`,{query:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(_`/v1/memory_stores/${$}/memory_versions?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}redact($,Z,z){let{memory_store_id:Q,betas:X}=Z;return this._client.post(_`/v1/memory_stores/${Q}/memory_versions/${$}/redact?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var e6;var Oz=v(()=>{Lz();Lz();Nz();Nz();V0();Y0();O0();e6=class e6 extends m{constructor(){super(...arguments);this.memories=new m4(this._client),this.memoryVersions=new c4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/memory_stores?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/memory_stores/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/memory_stores/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/memory_stores?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(_`/v1/memory_stores/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(_`/v1/memory_stores/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};e6.Memories=m4;e6.MemoryVersions=c4});var $1=v(()=>{p0()});var IZ;var Dz=v(()=>{IZ={"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 lV($){return $?.output_format??$?.output_config?.format}function Iz($,Z,z){let Q=lV(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 Tz($,Z,z)}function Tz($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=qw(Z,J.text);if(Q===null)Q=Y;let W=Object.defineProperty({...J},"parsed_output",{value:Y,enumerable:!1});return Object.defineProperty(W,"parsed",{get(){return z.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),Y},enumerable:!1})}return J});return{...$,content:X,parsed_output:Q}}function qw($,Z){let z=lV($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new k(`Failed to parse structured output: ${Q}`)}}var Az=v(()=>{p0()});var Hw=($)=>{let Z=0,z=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"){Z++;continue}if(Q==="{"){z.push({type:"brace",value:"{"}),Z++;continue}if(Q==="}"){z.push({type:"brace",value:"}"}),Z++;continue}if(Q==="["){z.push({type:"paren",value:"["}),Z++;continue}if(Q==="]"){z.push({type:"paren",value:"]"}),Z++;continue}if(Q===":"){z.push({type:"separator",value:":"}),Z++;continue}if(Q===","){z.push({type:"delimiter",value:","}),Z++;continue}if(Q==='"'){let W="",U=!1;Q=$[++Z];while(Q!=='"'){if(Z===$.length){U=!0;break}if(Q==="\\"){if(Z++,Z===$.length){U=!0;break}W+=Q+$[Z],Q=$[++Z]}else W+=Q,Q=$[++Z]}if(Q=$[++Z],!U)z.push({type:"string",value:W});continue}if(Q&&/\s/.test(Q)){Z++;continue}let J=/[0-9]/;if(Q&&J.test(Q)||Q==="-"||Q==="."){let W="";if(Q==="-")W+=Q,Q=$[++Z];while(Q&&J.test(Q)||Q===".")W+=Q,Q=$[++Z];z.push({type:"number",value:W});continue}let Y=/[a-z]/i;if(Q&&Y.test(Q)){let W="";while(Q&&Y.test(Q)){if(Z===$.length)break;W+=Q,Q=$[++Z]}if(W=="true"||W=="false"||W==="null")z.push({type:"name",value:W});else{Z++;continue}continue}Z++}return z},Z1=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),Z1($);break;case"number":let z=Z.value[Z.value.length-1];if(z==="."||z==="-")return $=$.slice(0,$.length-1),Z1($);case"string":let Q=$[$.length-2];if(Q?.type==="delimiter")return $=$.slice(0,$.length-1),Z1($);else if(Q?.type==="brace"&&Q.value==="{")return $=$.slice(0,$.length-1),Z1($);break;case"delimiter":return $=$.slice(0,$.length-1),Z1($);break}return $},Kw=($)=>{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 $},Bw=($)=>{let Z="";return $.map((z)=>{switch(z.type){case"string":Z+='"'+z.value+'"';break;default:Z+=z.value;break}}),Z},TZ=($)=>JSON.parse(Bw(Kw(Z1(Hw($)))));var Cz=()=>{};var _z=v(()=>{$z()});function rV($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function sV($){}var U2,I6,z1,p4,AZ,l4,d4,CZ,i4,n2,n4,_Z,RZ,$$,FZ,PZ,r4,Rz,dV,SZ,Fz,Pz,Sz,iV,nV="__json_buf",s4;var oV=v(()=>{l2();Cz();$1();_z();Az();s4=class s4{constructor($,Z){U2.add(this),this.messages=[],this.receivedMessages=[],I6.set(this,void 0),z1.set(this,null),this.controller=new AbortController,p4.set(this,void 0),AZ.set(this,()=>{}),l4.set(this,()=>{}),d4.set(this,void 0),CZ.set(this,()=>{}),i4.set(this,()=>{}),n2.set(this,{}),n4.set(this,!1),_Z.set(this,!1),RZ.set(this,!1),$$.set(this,!1),FZ.set(this,void 0),PZ.set(this,void 0),r4.set(this,void 0),SZ.set(this,(z)=>{if(S(this,_Z,!0,"f"),d2(z))z=new E0;if(z instanceof E0)return S(this,RZ,!0,"f"),this._emit("abort",z);if(z instanceof k)return this._emit("error",z);if(z instanceof Error){let Q=new k(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new k(String(z)))}),S(this,p4,new Promise((z,Q)=>{S(this,AZ,z,"f"),S(this,l4,Q,"f")}),"f"),S(this,d4,new Promise((z,Q)=>{S(this,CZ,z,"f"),S(this,i4,Q,"f")}),"f"),O(this,p4,"f").catch(()=>{}),O(this,d4,"f").catch(()=>{}),S(this,z1,$,"f"),S(this,r4,Z?.logger??console,"f")}get response(){return O(this,FZ,"f")}get request_id(){return O(this,PZ,"f")}async withResponse(){S(this,$$,!0,"f");let $=await O(this,p4,"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 s4(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new s4(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return S(X,z1,{...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,SZ,"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,U2,"m",Fz).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let W of Y)O(this,U2,"m",Pz).call(this,W);if(Y.controller.signal?.aborted)throw new E0;O(this,U2,"m",Sz).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;S(this,FZ,$,"f"),S(this,PZ,$?.headers.get("request-id"),"f"),O(this,AZ,"f").call(this,$),this._emit("connect")}get ended(){return O(this,n4,"f")}get errored(){return O(this,_Z,"f")}get aborted(){return O(this,RZ,"f")}abort(){this.controller.abort()}on($,Z){return(O(this,n2,"f")[$]||(O(this,n2,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=O(this,n2,"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,n2,"f")[$]||(O(this,n2,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(S(this,$$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){S(this,$$,!0,"f"),await O(this,d4,"f")}get currentMessage(){return O(this,I6,"f")}async finalMessage(){return await this.done(),O(this,U2,"m",Rz).call(this)}async finalText(){return await this.done(),O(this,U2,"m",dV).call(this)}_emit($,...Z){if(O(this,n4,"f"))return;if($==="end")S(this,n4,!0,"f"),O(this,CZ,"f").call(this);let z=O(this,n2,"f")[$];if(z)O(this,n2,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!O(this,$$,"f")&&!z?.length)Promise.reject(Q);O(this,l4,"f").call(this,Q),O(this,i4,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!O(this,$$,"f")&&!z?.length)Promise.reject(Q);O(this,l4,"f").call(this,Q),O(this,i4,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",O(this,U2,"m",Rz).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,U2,"m",Fz).call(this),this._connected(null);let X=a0.fromReadableStream($,this.controller);for await(let J of X)O(this,U2,"m",Pz).call(this,J);if(X.controller.signal?.aborted)throw new E0;O(this,U2,"m",Sz).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(I6=new WeakMap,z1=new WeakMap,p4=new WeakMap,AZ=new WeakMap,l4=new WeakMap,d4=new WeakMap,CZ=new WeakMap,i4=new WeakMap,n2=new WeakMap,n4=new WeakMap,_Z=new WeakMap,RZ=new WeakMap,$$=new WeakMap,FZ=new WeakMap,PZ=new WeakMap,r4=new WeakMap,SZ=new WeakMap,U2=new WeakSet,Rz=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},dV=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},Fz=function(){if(this.ended)return;S(this,I6,void 0,"f")},Pz=function(Z){if(this.ended)return;let z=O(this,U2,"m",iV).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(rV(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:sV(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(Iz(z,O(this,z1,"f"),{logger:O(this,r4,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{S(this,I6,z,"f");break}case"content_block_start":case"message_delta":break}},Sz=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=O(this,I6,"f");if(!Z)throw new k("request ended without sending any chunks");return S(this,I6,void 0,"f"),Iz(Z,O(this,z1,"f"),{logger:O(this,r4,"f")})},iV=function(Z){let z=O(this,I6,"f");if(Z.type==="message_start"){if(z)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new k(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return z;case"message_delta":if(z.container=Z.delta.container,z.stop_reason=Z.delta.stop_reason,z.stop_sequence=Z.delta.stop_sequence,z.usage.output_tokens=Z.usage.output_tokens,z.context_management=Z.context_management,Z.usage.input_tokens!=null)z.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)z.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)z.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)z.usage.server_tool_use=Z.usage.server_tool_use;if(Z.usage.iterations!=null)z.usage.iterations=Z.usage.iterations;return z;case"content_block_start":return z.content.push(Z.content_block),z;case"content_block_delta":{let Q=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,text:(Q.text||"")+Z.delta.text};break}case"citations_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,citations:[...Q.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(Q&&rV(Q)){let X=Q[nV]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,nV,{value:X,enumerable:!1,writable:!0}),X)try{J.input=TZ(X)}catch(Y){let W=new k(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${X}`);O(this,SZ,"f").call(this,W)}z.content[Z.index]=J}break}case"thinking_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,thinking:Q.thinking+Z.delta.thinking};break}case"signature_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,signature:Z.delta.signature};break}case"compaction_delta":{if(Q?.type==="compaction")z.content[Z.index]={...Q,content:(Q.content||"")+Z.delta.content};break}default:sV(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 a0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var Q1;var EZ=v(()=>{Q1=class Q1 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 aV=1e5,tV=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
174
174
  1. Task Overview
175
175
  The user's core request and success criteria
176
176
  Any clarifications or constraints they specified
@@ -192,115 +192,115 @@ User preferences or style requirements
192
192
  Domain-specific details that aren't obvious
193
193
  Any promises made to the user
194
194
  Be concise but complete—err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.
195
- Wrap your summary in <summary></summary> tags.`;function nV(){let $,Z;return{promise:new Promise((Q,X)=>{$=Q,Z=X}),resolve:$,reject:Z}}async function Yw($,Z=$.messages.at(-1),z){if(!Z||Z.role!=="assistant"||!Z.content||typeof Z.content==="string")return null;let Q=Z.content.filter((J)=>J.type==="tool_use");if(Q.length===0)return null;return{role:"user",content:await Promise.all(Q.map(async(J)=>{let Y=$.tools.find((W)=>("name"in W?W.name:W.mcp_server_name)===J.name);if(!Y||!("run"in Y))return{type:"tool_result",tool_use_id:J.id,content:`Error: Tool '${J.name}' not found`,is_error:!0};try{let W=J.input;if("parse"in Y&&Y.parse)W=Y.parse(W);let U=await Y.run(W,{toolUseBlock:J,signal:z?.signal});return{type:"tool_result",tool_use_id:J.id,content:U}}catch(W){return{type:"tool_result",tool_use_id:J.id,content:W instanceof $1?W.content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}var n4,Z1,$$,C0,l0,t0,r2,I6,r4,iV,Fz,s4;var Pz=v(()=>{l2();FZ();p0();Y0();y4();s4=class s4{constructor($,Z,z){n4.add(this),this.client=$,Z1.set(this,!1),$$.set(this,!1),C0.set(this,void 0),l0.set(this,void 0),t0.set(this,void 0),r2.set(this,void 0),I6.set(this,void 0),r4.set(this,0),S(this,C0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let X=["BetaToolRunner",...Wz(Z.tools,Z.messages)].join(", ");if(S(this,l0,{...z,headers:D([{"x-stainless-helper":X},z?.headers])},"f"),S(this,I6,nV(),"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*[(Z1=new WeakMap,$$=new WeakMap,C0=new WeakMap,l0=new WeakMap,t0=new WeakMap,r2=new WeakMap,I6=new WeakMap,r4=new WeakMap,n4=new WeakSet,iV=async function(){let Z=O(this,C0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let z=0;if(O(this,t0,"f")!==void 0)try{let U=await O(this,t0,"f");z=U.usage.input_tokens+(U.usage.cache_creation_input_tokens??0)+(U.usage.cache_read_input_tokens??0)+U.usage.output_tokens}catch{return!1}let Q=Z.contextTokenThreshold??lV;if(z<Q)return!1;let X=Z.model??O(this,C0,"f").params.model,J=Z.summaryPrompt??dV,Y=O(this,C0,"f").params.messages;if(Y[Y.length-1].role==="assistant"){let U=Y[Y.length-1];if(Array.isArray(U.content)){let G=U.content.filter((V)=>V.type!=="tool_use");if(G.length===0)Y.pop();else U.content=G}}let W=await this.client.beta.messages.create({model:X,messages:[...Y,{role:"user",content:[{type:"text",text:J}]}],max_tokens:O(this,C0,"f").params.max_tokens},{signal:O(this,l0,"f").signal,headers:D([O(this,l0,"f").headers,{"x-stainless-helper":"compaction"}])});if(W.content[0]?.type!=="text")throw new k("Expected text response for compaction");return O(this,C0,"f").params.messages=[{role:"user",content:W.content}],!0},Symbol.asyncIterator)](){var $;if(O(this,Z1,"f"))throw new k("Cannot iterate over a consumed stream");S(this,Z1,!0,"f"),S(this,$$,!0,"f"),S(this,r2,void 0,"f");try{while(!0){let Z;try{if(O(this,C0,"f").params.max_iterations&&O(this,r4,"f")>=O(this,C0,"f").params.max_iterations)break;S(this,$$,!1,"f"),S(this,r2,void 0,"f"),S(this,r4,($=O(this,r4,"f"),$++,$),"f"),S(this,t0,void 0,"f");let{max_iterations:z,compactionControl:Q,...X}=O(this,C0,"f").params;if(X.stream)Z=this.client.beta.messages.stream({...X},O(this,l0,"f")),S(this,t0,Z.finalMessage(),"f"),O(this,t0,"f").catch(()=>{}),yield Z;else S(this,t0,this.client.beta.messages.create({...X,stream:!1},O(this,l0,"f")),"f"),yield O(this,t0,"f");if(!await O(this,n4,"m",iV).call(this)){if(!O(this,$$,"f")){let{role:W,content:U}=await O(this,t0,"f");O(this,C0,"f").params.messages.push({role:W,content:U})}let Y=await O(this,n4,"m",Fz).call(this,O(this,C0,"f").params.messages.at(-1));if(Y)O(this,C0,"f").params.messages.push(Y);else if(!O(this,$$,"f"))break}}finally{if(Z)Z.abort()}}if(!O(this,t0,"f"))throw new k("ToolRunner concluded without a message from the server");O(this,I6,"f").resolve(await O(this,t0,"f"))}catch(Z){throw S(this,Z1,!1,"f"),O(this,I6,"f").promise.catch(()=>{}),O(this,I6,"f").reject(Z),S(this,I6,nV(),"f"),Z}}setMessagesParams($){if(typeof $==="function")O(this,C0,"f").params=$(O(this,C0,"f").params);else O(this,C0,"f").params=$;S(this,$$,!0,"f"),S(this,r2,void 0,"f")}setRequestOptions($){if(typeof $==="function")S(this,l0,$(O(this,l0,"f")),"f");else S(this,l0,{...O(this,l0,"f"),...$},"f")}async generateToolResponse($=O(this,l0,"f").signal){let Z=await O(this,t0,"f")??this.params.messages.at(-1);if(!Z)return null;return O(this,n4,"m",Fz).call(this,Z,$)}done(){return O(this,I6,"f").promise}async runUntilDone(){if(!O(this,Z1,"f"))for await(let $ of this);return this.done()}get params(){return O(this,C0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};Fz=async function(Z,z=O(this,l0,"f").signal){if(O(this,r2,"f")!==void 0)return O(this,r2,"f");return S(this,r2,Yw(O(this,C0,"f").params,Z,{...O(this,l0,"f"),signal:z}),"f"),O(this,r2,"f")}});var z1;var Sz=v(()=>{p0();s9();z1=class z1{constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new N6;for await(let Z of this.iterator)for(let z of $.decode(Z))yield JSON.parse(z);for(let Z of $.flush())yield JSON.parse(Z)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new k("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new k("Attempted to iterate over a response with no body")}return new z1(C4($.body),Z)}}});var o4;var Ez=v(()=>{V0();Y0();Sz();a$();O0();o4=class o4 extends m{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/messages/batches?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/messages/batches/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",A2,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(_`/v1/messages/batches/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}cancel($,Z={},z){let{betas:Q}=Z??{};return this._client.post(_`/v1/messages/batches/${$}/cancel?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}async results($,Z={},z){let Q=await this.retrieve($);if(!Q.results_url)throw new k(`No batch \`results_url\`; Has it finished processing? ${Q.processing_status} - ${Q.id}`);let{betas:X}=Z??{};return this._client.get(Q.results_url,{...z,headers:D([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((J,Y)=>z1.fromResponse(Y.response,Y.controller))}}});function sV($){if(!$.output_format)return $;if($.output_config?.format)throw new k("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...z}=$;return{...z,output_config:{...$.output_config,format:Z}}}var rV,Uw,T6;var jz=v(()=>{a$();Lz();Y0();y4();Dz();pV();Pz();FZ();Ez();Ez();Pz();FZ();rV={"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"},Uw=["claude-mythos-preview","claude-opus-4-6"];T6=class T6 extends m{constructor(){super(...arguments);this.batches=new o4(this._client)}create($,Z){let z=sV($),{betas:Q,...X}=z;if(X.model in rV)console.warn(`The model '${X.model}' is deprecated and will reach end-of-life on ${rV[X.model]}
196
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Uw.includes(X.model)&&X.thinking&&X.thinking.type==="enabled")console.warn(`Using Claude with ${X.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let J=this._client._options.timeout;if(!X.stream&&J==null){let W=NZ[X.model]??void 0;J=this._client.calculateNonstreamingTimeout(X.max_tokens,W)}let Y=LZ(X.tools,X.messages);return this._client.post("/v1/messages?beta=true",{body:X,timeout:J??600000,...Z,headers:D([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},Y,Z?.headers]),stream:z.stream??!1})}parse($,Z){return Z={...Z,headers:D([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((z)=>Oz(z,$,{logger:this._client.logger??console}))}stream($,Z){return i4.createMessage(this,$,Z)}countTokens($,Z){let z=sV($),{betas:Q,...X}=z;return this._client.post("/v1/messages/count_tokens?beta=true",{body:X,...Z,headers:D([{"anthropic-beta":[...Q??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new s4(this._client,$,Z)}};T6.Batches=o4;T6.BetaToolRunner=s4;T6.ToolError=$1});var a4;var wz=v(()=>{V0();Y0();O0();a4=class a4 extends m{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(_`/v1/sessions/${$}/events?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}send($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/sessions/${$}/events?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}stream($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/sessions/${$}/events/stream?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers]),stream:!0})}}});var t4;var xz=v(()=>{V0();Y0();O0();t4=class t4 extends m{retrieve($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.get(_`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{session_id:Q,betas:X,...J}=Z;return this._client.post(_`/v1/sessions/${Q}/resources/${$}?beta=true`,{body:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(_`/v1/sessions/${$}/resources?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.delete(_`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}add($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/sessions/${$}/resources?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var Z$;var yz=v(()=>{wz();wz();xz();xz();V0();Y0();O0();Z$=class Z$ extends m{constructor(){super(...arguments);this.events=new a4(this._client),this.resources=new t4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/sessions?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/sessions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/sessions/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/sessions?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(_`/v1/sessions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(_`/v1/sessions/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};Z$.Events=a4;Z$.Resources=t4});var e4;var kz=v(()=>{V0();Y0();s$();O0();e4=class e4 extends m{create($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.post(_`/v1/skills/${$}/versions?beta=true`,r$({body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])},this._client))}retrieve($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.get(_`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(_`/v1/skills/${$}/versions?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}delete($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.delete(_`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}}});var Q1;var bz=v(()=>{kz();kz();V0();Y0();s$();O0();Q1=class Q1 extends m{constructor(){super(...arguments);this.versions=new e4(this._client)}create($={},Z){let{betas:z,...Q}=$??{};return this._client.post("/v1/skills?beta=true",r$({body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/skills/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/skills?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(_`/v1/skills/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}};Q1.Versions=e4});var $8;var vz=v(()=>{V0();Y0();O0();$8=class $8 extends m{create($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/vaults/${$}/credentials?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.get(_`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{vault_id:Q,betas:X,...J}=Z;return this._client.post(_`/v1/vaults/${Q}/credentials/${$}?beta=true`,{body:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(_`/v1/vaults/${$}/credentials?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.delete(_`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.post(_`/v1/vaults/${Q}/credentials/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var X1;var gz=v(()=>{vz();vz();V0();Y0();O0();X1=class X1 extends m{constructor(){super(...arguments);this.credentials=new $8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/vaults?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/vaults/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/vaults/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/vaults?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(_`/v1/vaults/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(_`/v1/vaults/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};X1.Credentials=$8});var k0;var hz=v(()=>{Yz();Yz();Uz();Uz();Gz();Gz();Vz();Vz();qz();qz();Mz();Mz();jz();jz();yz();yz();bz();bz();gz();gz();k0=class k0 extends m{constructor(){super(...arguments);this.models=new b4(this._client),this.messages=new T6(this._client),this.agents=new o$(this._client),this.environments=new w4(this._client),this.sessions=new Z$(this._client),this.vaults=new X1(this._client),this.memoryStores=new t6(this._client),this.files=new k4(this._client),this.skills=new Q1(this._client),this.userProfiles=new v4(this._client)}};k0.Models=b4;k0.Messages=T6;k0.Agents=o$;k0.Environments=w4;k0.Sessions=Z$;k0.Vaults=X1;k0.MemoryStores=t6;k0.Files=k4;k0.Skills=Q1;k0.UserProfiles=v4});var J1;var fz=v(()=>{Y0();J1=class J1 extends m{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/complete",{body:Q,timeout:this._client._options.timeout??600000,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function oV($){return $?.output_config?.format}function uz($,Z,z){let Q=oV(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 mz($,Z,z)}function mz($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=Nw(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 Nw($,Z){let z=oV($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new k(`Failed to parse structured output: ${Q}`)}}var cz=v(()=>{p0()});function $H($){return $.type==="tool_use"||$.type==="server_tool_use"}function ZH($){}var G2,A6,Y1,Z8,PZ,z8,Q8,SZ,X8,s2,J8,EZ,jZ,z$,wZ,xZ,Y8,pz,aV,lz,dz,iz,nz,tV,eV="__json_buf",W8;var zH=v(()=>{l2();a$();Tz();Iz();cz();W8=class W8{constructor($,Z){G2.add(this),this.messages=[],this.receivedMessages=[],A6.set(this,void 0),Y1.set(this,null),this.controller=new AbortController,Z8.set(this,void 0),PZ.set(this,()=>{}),z8.set(this,()=>{}),Q8.set(this,void 0),SZ.set(this,()=>{}),X8.set(this,()=>{}),s2.set(this,{}),J8.set(this,!1),EZ.set(this,!1),jZ.set(this,!1),z$.set(this,!1),wZ.set(this,void 0),xZ.set(this,void 0),Y8.set(this,void 0),lz.set(this,(z)=>{if(S(this,EZ,!0,"f"),d2(z))z=new S0;if(z instanceof S0)return S(this,jZ,!0,"f"),this._emit("abort",z);if(z instanceof k)return this._emit("error",z);if(z instanceof Error){let Q=new k(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new k(String(z)))}),S(this,Z8,new Promise((z,Q)=>{S(this,PZ,z,"f"),S(this,z8,Q,"f")}),"f"),S(this,Q8,new Promise((z,Q)=>{S(this,SZ,z,"f"),S(this,X8,Q,"f")}),"f"),O(this,Z8,"f").catch(()=>{}),O(this,Q8,"f").catch(()=>{}),S(this,Y1,$,"f"),S(this,Y8,Z?.logger??console,"f")}get response(){return O(this,wZ,"f")}get request_id(){return O(this,xZ,"f")}async withResponse(){S(this,z$,!0,"f");let $=await O(this,Z8,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new W8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new W8(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return S(X,Y1,{...Z,stream:!0},"f"),X._run(()=>X._createMessage($,{...Z,stream:!0},{...z,headers:{...z?.headers,"X-Stainless-Helper-Method":"stream"}})),X}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},O(this,lz,"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,G2,"m",dz).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let W of Y)O(this,G2,"m",iz).call(this,W);if(Y.controller.signal?.aborted)throw new S0;O(this,G2,"m",nz).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;S(this,wZ,$,"f"),S(this,xZ,$?.headers.get("request-id"),"f"),O(this,PZ,"f").call(this,$),this._emit("connect")}get ended(){return O(this,J8,"f")}get errored(){return O(this,EZ,"f")}get aborted(){return O(this,jZ,"f")}abort(){this.controller.abort()}on($,Z){return(O(this,s2,"f")[$]||(O(this,s2,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=O(this,s2,"f")[$];if(!z)return this;let Q=z.findIndex((X)=>X.listener===Z);if(Q>=0)z.splice(Q,1);return this}once($,Z){return(O(this,s2,"f")[$]||(O(this,s2,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(S(this,z$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){S(this,z$,!0,"f"),await O(this,Q8,"f")}get currentMessage(){return O(this,A6,"f")}async finalMessage(){return await this.done(),O(this,G2,"m",pz).call(this)}async finalText(){return await this.done(),O(this,G2,"m",aV).call(this)}_emit($,...Z){if(O(this,J8,"f"))return;if($==="end")S(this,J8,!0,"f"),O(this,SZ,"f").call(this);let z=O(this,s2,"f")[$];if(z)O(this,s2,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!O(this,z$,"f")&&!z?.length)Promise.reject(Q);O(this,z8,"f").call(this,Q),O(this,X8,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!O(this,z$,"f")&&!z?.length)Promise.reject(Q);O(this,z8,"f").call(this,Q),O(this,X8,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",O(this,G2,"m",pz).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,G2,"m",dz).call(this),this._connected(null);let X=a0.fromReadableStream($,this.controller);for await(let J of X)O(this,G2,"m",iz).call(this,J);if(X.controller.signal?.aborted)throw new S0;O(this,G2,"m",nz).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(A6=new WeakMap,Y1=new WeakMap,Z8=new WeakMap,PZ=new WeakMap,z8=new WeakMap,Q8=new WeakMap,SZ=new WeakMap,X8=new WeakMap,s2=new WeakMap,J8=new WeakMap,EZ=new WeakMap,jZ=new WeakMap,z$=new WeakMap,wZ=new WeakMap,xZ=new WeakMap,Y8=new WeakMap,lz=new WeakMap,G2=new WeakSet,pz=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},aV=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},dz=function(){if(this.ended)return;S(this,A6,void 0,"f")},iz=function(Z){if(this.ended)return;let z=O(this,G2,"m",tV).call(this,Z);switch(this._emit("streamEvent",Z,z),Z.type){case"content_block_delta":{let Q=z.content.at(-1);switch(Z.delta.type){case"text_delta":{if(Q.type==="text")this._emit("text",Z.delta.text,Q.text||"");break}case"citations_delta":{if(Q.type==="text")this._emit("citation",Z.delta.citation,Q.citations??[]);break}case"input_json_delta":{if($H(Q)&&Q.input)this._emit("inputJson",Z.delta.partial_json,Q.input);break}case"thinking_delta":{if(Q.type==="thinking")this._emit("thinking",Z.delta.thinking,Q.thinking);break}case"signature_delta":{if(Q.type==="thinking")this._emit("signature",Q.signature);break}default:ZH(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(uz(z,O(this,Y1,"f"),{logger:O(this,Y8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{S(this,A6,z,"f");break}case"content_block_start":case"message_delta":break}},nz=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=O(this,A6,"f");if(!Z)throw new k("request ended without sending any chunks");return S(this,A6,void 0,"f"),uz(Z,O(this,Y1,"f"),{logger:O(this,Y8,"f")})},tV=function(Z){let z=O(this,A6,"f");if(Z.type==="message_start"){if(z)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new k(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return z;case"message_delta":if(z.stop_reason=Z.delta.stop_reason,z.stop_sequence=Z.delta.stop_sequence,z.usage.output_tokens=Z.usage.output_tokens,Z.usage.input_tokens!=null)z.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)z.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)z.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)z.usage.server_tool_use=Z.usage.server_tool_use;return z;case"content_block_start":return z.content.push({...Z.content_block}),z;case"content_block_delta":{let Q=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,text:(Q.text||"")+Z.delta.text};break}case"citations_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,citations:[...Q.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(Q&&$H(Q)){let X=Q[eV]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,eV,{value:X,enumerable:!1,writable:!0}),X)J.input=OZ(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: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 a0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var U8;var rz=v(()=>{V0();Y0();Sz();a$();O0();U8=class U8 extends m{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(_`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",A2,{query:$,...Z})}delete($,Z){return this._client.delete(_`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(_`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let z=await this.retrieve($);if(!z.results_url)throw new k(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);return this._client.get(z.results_url,{...Z,headers:D([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,X)=>z1.fromResponse(X.response,X.controller))}}});var Q$,QH,Dw;var sz=v(()=>{Y0();y4();zH();cz();rz();rz();Lz();Q$=class Q$ extends m{constructor(){super(...arguments);this.batches=new U8(this._client)}create($,Z){if($.model in QH)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${QH[$.model]}
197
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Dw.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=NZ[$.model]??void 0;z=this._client.calculateNonstreamingTimeout($.max_tokens,X)}let Q=LZ($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:z??600000,...Z,headers:D([Q,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((z)=>mz(z,$,{logger:this._client.logger??console}))}stream($,Z){return W8.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};QH={"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"},Dw=["claude-mythos-preview","claude-opus-4-6"];Q$.Batches=U8});var W1;var oz=v(()=>{V0();Y0();O0();W1=class W1 extends m{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/models/${$}`,{...z,headers:D([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models",A2,{query:Q,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var XH=v(()=>{hz();fz();sz();oz();xV()});var G8=($)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[$]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.($)?.trim()||void 0;return};class W0{constructor({baseURL:$=G8("ANTHROPIC_BASE_URL"),apiKey:Z=G8("ANTHROPIC_API_KEY")??null,authToken:z=G8("ANTHROPIC_AUTH_TOKEN")??null,...Q}={}){az.add(this),yZ.set(this,void 0);let X={apiKey:Z,authToken:z,...Q,baseURL:$||"https://api.anthropic.com"};if(!X.dangerouslyAllowBrowser&&LV())throw new k(`It looks like you're running in a browser-like environment.
195
+ Wrap your summary in <summary></summary> tags.`;function $q(){let $,Z;return{promise:new Promise((Q,X)=>{$=Q,Z=X}),resolve:$,reject:Z}}async function Mw($,Z=$.messages.at(-1),z){if(!Z||Z.role!=="assistant"||!Z.content||typeof Z.content==="string")return null;let Q=Z.content.filter((J)=>J.type==="tool_use");if(Q.length===0)return null;return{role:"user",content:await Promise.all(Q.map(async(J)=>{let Y=$.tools.find((W)=>("name"in W?W.name:W.mcp_server_name)===J.name);if(!Y||!("run"in Y))return{type:"tool_result",tool_use_id:J.id,content:`Error: Tool '${J.name}' not found`,is_error:!0};try{let W=J.input;if("parse"in Y&&Y.parse)W=Y.parse(W);let U=await Y.run(W,{toolUseBlock:J,signal:z?.signal});return{type:"tool_result",tool_use_id:J.id,content:U}}catch(W){return{type:"tool_result",tool_use_id:J.id,content:W instanceof Q1?W.content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}var o4,X1,Z$,C0,l0,t0,r2,T6,a4,eV,Ez,t4;var jz=v(()=>{l2();EZ();p0();Y0();v4();t4=class t4{constructor($,Z,z){o4.add(this),this.client=$,X1.set(this,!1),Z$.set(this,!1),C0.set(this,void 0),l0.set(this,void 0),t0.set(this,void 0),r2.set(this,void 0),T6.set(this,void 0),a4.set(this,0),S(this,C0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let X=["BetaToolRunner",...Vz(Z.tools,Z.messages)].join(", ");if(S(this,l0,{...z,headers:D([{"x-stainless-helper":X},z?.headers])},"f"),S(this,T6,$q(),"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*[(X1=new WeakMap,Z$=new WeakMap,C0=new WeakMap,l0=new WeakMap,t0=new WeakMap,r2=new WeakMap,T6=new WeakMap,a4=new WeakMap,o4=new WeakSet,eV=async function(){let Z=O(this,C0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let z=0;if(O(this,t0,"f")!==void 0)try{let U=await O(this,t0,"f");z=U.usage.input_tokens+(U.usage.cache_creation_input_tokens??0)+(U.usage.cache_read_input_tokens??0)+U.usage.output_tokens}catch{return!1}let Q=Z.contextTokenThreshold??aV;if(z<Q)return!1;let X=Z.model??O(this,C0,"f").params.model,J=Z.summaryPrompt??tV,Y=O(this,C0,"f").params.messages;if(Y[Y.length-1].role==="assistant"){let U=Y[Y.length-1];if(Array.isArray(U.content)){let G=U.content.filter((V)=>V.type!=="tool_use");if(G.length===0)Y.pop();else U.content=G}}let W=await this.client.beta.messages.create({model:X,messages:[...Y,{role:"user",content:[{type:"text",text:J}]}],max_tokens:O(this,C0,"f").params.max_tokens},{signal:O(this,l0,"f").signal,headers:D([O(this,l0,"f").headers,{"x-stainless-helper":"compaction"}])});if(W.content[0]?.type!=="text")throw new k("Expected text response for compaction");return O(this,C0,"f").params.messages=[{role:"user",content:W.content}],!0},Symbol.asyncIterator)](){var $;if(O(this,X1,"f"))throw new k("Cannot iterate over a consumed stream");S(this,X1,!0,"f"),S(this,Z$,!0,"f"),S(this,r2,void 0,"f");try{while(!0){let Z;try{if(O(this,C0,"f").params.max_iterations&&O(this,a4,"f")>=O(this,C0,"f").params.max_iterations)break;S(this,Z$,!1,"f"),S(this,r2,void 0,"f"),S(this,a4,($=O(this,a4,"f"),$++,$),"f"),S(this,t0,void 0,"f");let{max_iterations:z,compactionControl:Q,...X}=O(this,C0,"f").params;if(X.stream)Z=this.client.beta.messages.stream({...X},O(this,l0,"f")),S(this,t0,Z.finalMessage(),"f"),O(this,t0,"f").catch(()=>{}),yield Z;else S(this,t0,this.client.beta.messages.create({...X,stream:!1},O(this,l0,"f")),"f"),yield O(this,t0,"f");if(!await O(this,o4,"m",eV).call(this)){if(!O(this,Z$,"f")){let{role:W,content:U}=await O(this,t0,"f");O(this,C0,"f").params.messages.push({role:W,content:U})}let Y=await O(this,o4,"m",Ez).call(this,O(this,C0,"f").params.messages.at(-1));if(Y)O(this,C0,"f").params.messages.push(Y);else if(!O(this,Z$,"f"))break}}finally{if(Z)Z.abort()}}if(!O(this,t0,"f"))throw new k("ToolRunner concluded without a message from the server");O(this,T6,"f").resolve(await O(this,t0,"f"))}catch(Z){throw S(this,X1,!1,"f"),O(this,T6,"f").promise.catch(()=>{}),O(this,T6,"f").reject(Z),S(this,T6,$q(),"f"),Z}}setMessagesParams($){if(typeof $==="function")O(this,C0,"f").params=$(O(this,C0,"f").params);else O(this,C0,"f").params=$;S(this,Z$,!0,"f"),S(this,r2,void 0,"f")}setRequestOptions($){if(typeof $==="function")S(this,l0,$(O(this,l0,"f")),"f");else S(this,l0,{...O(this,l0,"f"),...$},"f")}async generateToolResponse($=O(this,l0,"f").signal){let Z=await O(this,t0,"f")??this.params.messages.at(-1);if(!Z)return null;return O(this,o4,"m",Ez).call(this,Z,$)}done(){return O(this,T6,"f").promise}async runUntilDone(){if(!O(this,X1,"f"))for await(let $ of this);return this.done()}get params(){return O(this,C0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};Ez=async function(Z,z=O(this,l0,"f").signal){if(O(this,r2,"f")!==void 0)return O(this,r2,"f");return S(this,r2,Mw(O(this,C0,"f").params,Z,{...O(this,l0,"f"),signal:z}),"f"),O(this,r2,"f")}});var J1;var wz=v(()=>{p0();t9();J1=class J1{constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new O6;for await(let Z of this.iterator)for(let z of $.decode(Z))yield JSON.parse(z);for(let Z of $.flush())yield JSON.parse(Z)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new k("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new k("Attempted to iterate over a response with no body")}return new J1(F4($.body),Z)}}});var e4;var xz=v(()=>{V0();Y0();wz();$1();O0();e4=class e4 extends m{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/messages/batches?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/messages/batches/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",A2,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(_`/v1/messages/batches/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}cancel($,Z={},z){let{betas:Q}=Z??{};return this._client.post(_`/v1/messages/batches/${$}/cancel?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}async results($,Z={},z){let Q=await this.retrieve($);if(!Q.results_url)throw new k(`No batch \`results_url\`; Has it finished processing? ${Q.processing_status} - ${Q.id}`);let{betas:X}=Z??{};return this._client.get(Q.results_url,{...z,headers:D([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((J,Y)=>J1.fromResponse(Y.response,Y.controller))}}});function zq($){if(!$.output_format)return $;if($.output_config?.format)throw new k("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...z}=$;return{...z,output_config:{...$.output_config,format:Z}}}var Zq,Nw,A6;var yz=v(()=>{$1();Dz();Y0();v4();Az();oV();jz();EZ();xz();xz();jz();EZ();Zq={"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"},Nw=["claude-mythos-preview","claude-opus-4-6"];A6=class A6 extends m{constructor(){super(...arguments);this.batches=new e4(this._client)}create($,Z){let z=zq($),{betas:Q,...X}=z;if(X.model in Zq)console.warn(`The model '${X.model}' is deprecated and will reach end-of-life on ${Zq[X.model]}
196
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Nw.includes(X.model)&&X.thinking&&X.thinking.type==="enabled")console.warn(`Using Claude with ${X.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let J=this._client._options.timeout;if(!X.stream&&J==null){let W=IZ[X.model]??void 0;J=this._client.calculateNonstreamingTimeout(X.max_tokens,W)}let Y=DZ(X.tools,X.messages);return this._client.post("/v1/messages?beta=true",{body:X,timeout:J??600000,...Z,headers:D([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},Y,Z?.headers]),stream:z.stream??!1})}parse($,Z){return Z={...Z,headers:D([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((z)=>Tz(z,$,{logger:this._client.logger??console}))}stream($,Z){return s4.createMessage(this,$,Z)}countTokens($,Z){let z=zq($),{betas:Q,...X}=z;return this._client.post("/v1/messages/count_tokens?beta=true",{body:X,...Z,headers:D([{"anthropic-beta":[...Q??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new t4(this._client,$,Z)}};A6.Batches=e4;A6.BetaToolRunner=t4;A6.ToolError=Q1});var $8;var kz=v(()=>{V0();Y0();O0();$8=class $8 extends m{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(_`/v1/sessions/${$}/events?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}send($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/sessions/${$}/events?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}stream($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/sessions/${$}/events/stream?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers]),stream:!0})}}});var Z8;var bz=v(()=>{V0();Y0();O0();Z8=class Z8 extends m{retrieve($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.get(_`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{session_id:Q,betas:X,...J}=Z;return this._client.post(_`/v1/sessions/${Q}/resources/${$}?beta=true`,{body:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(_`/v1/sessions/${$}/resources?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.delete(_`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}add($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/sessions/${$}/resources?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var z$;var vz=v(()=>{kz();kz();bz();bz();V0();Y0();O0();z$=class z$ extends m{constructor(){super(...arguments);this.events=new $8(this._client),this.resources=new Z8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/sessions?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/sessions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/sessions/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/sessions?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(_`/v1/sessions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(_`/v1/sessions/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};z$.Events=$8;z$.Resources=Z8});var z8;var gz=v(()=>{V0();Y0();t$();O0();z8=class z8 extends m{create($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.post(_`/v1/skills/${$}/versions?beta=true`,a$({body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])},this._client))}retrieve($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.get(_`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(_`/v1/skills/${$}/versions?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}delete($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.delete(_`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}}});var Y1;var hz=v(()=>{gz();gz();V0();Y0();t$();O0();Y1=class Y1 extends m{constructor(){super(...arguments);this.versions=new z8(this._client)}create($={},Z){let{betas:z,...Q}=$??{};return this._client.post("/v1/skills?beta=true",a$({body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/skills/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/skills?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(_`/v1/skills/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}};Y1.Versions=z8});var Q8;var fz=v(()=>{V0();Y0();O0();Q8=class Q8 extends m{create($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/vaults/${$}/credentials?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.get(_`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{vault_id:Q,betas:X,...J}=Z;return this._client.post(_`/v1/vaults/${Q}/credentials/${$}?beta=true`,{body:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(_`/v1/vaults/${$}/credentials?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.delete(_`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.post(_`/v1/vaults/${Q}/credentials/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var W1;var uz=v(()=>{fz();fz();V0();Y0();O0();W1=class W1 extends m{constructor(){super(...arguments);this.credentials=new Q8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/vaults?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/vaults/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(_`/v1/vaults/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/vaults?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(_`/v1/vaults/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(_`/v1/vaults/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};W1.Credentials=Q8});var k0;var mz=v(()=>{Gz();Gz();qz();qz();Hz();Hz();Kz();Kz();Mz();Mz();Oz();Oz();yz();yz();vz();vz();hz();hz();uz();uz();k0=class k0 extends m{constructor(){super(...arguments);this.models=new h4(this._client),this.messages=new A6(this._client),this.agents=new e$(this._client),this.environments=new k4(this._client),this.sessions=new z$(this._client),this.vaults=new W1(this._client),this.memoryStores=new e6(this._client),this.files=new g4(this._client),this.skills=new Y1(this._client),this.userProfiles=new f4(this._client)}};k0.Models=h4;k0.Messages=A6;k0.Agents=e$;k0.Environments=k4;k0.Sessions=z$;k0.Vaults=W1;k0.MemoryStores=e6;k0.Files=g4;k0.Skills=Y1;k0.UserProfiles=f4});var U1;var cz=v(()=>{Y0();U1=class U1 extends m{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/complete",{body:Q,timeout:this._client._options.timeout??600000,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function Qq($){return $?.output_config?.format}function pz($,Z,z){let Q=Qq(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 lz($,Z,z)}function lz($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=Fw(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 Fw($,Z){let z=Qq($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new k(`Failed to parse structured output: ${Q}`)}}var dz=v(()=>{p0()});function Wq($){return $.type==="tool_use"||$.type==="server_tool_use"}function Uq($){}var G2,C6,G1,X8,jZ,J8,Y8,wZ,W8,s2,U8,xZ,yZ,Q$,kZ,bZ,G8,iz,Xq,nz,rz,sz,oz,Jq,Yq="__json_buf",V8;var Gq=v(()=>{l2();$1();_z();Cz();dz();V8=class V8{constructor($,Z){G2.add(this),this.messages=[],this.receivedMessages=[],C6.set(this,void 0),G1.set(this,null),this.controller=new AbortController,X8.set(this,void 0),jZ.set(this,()=>{}),J8.set(this,()=>{}),Y8.set(this,void 0),wZ.set(this,()=>{}),W8.set(this,()=>{}),s2.set(this,{}),U8.set(this,!1),xZ.set(this,!1),yZ.set(this,!1),Q$.set(this,!1),kZ.set(this,void 0),bZ.set(this,void 0),G8.set(this,void 0),nz.set(this,(z)=>{if(S(this,xZ,!0,"f"),d2(z))z=new E0;if(z instanceof E0)return S(this,yZ,!0,"f"),this._emit("abort",z);if(z instanceof k)return this._emit("error",z);if(z instanceof Error){let Q=new k(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new k(String(z)))}),S(this,X8,new Promise((z,Q)=>{S(this,jZ,z,"f"),S(this,J8,Q,"f")}),"f"),S(this,Y8,new Promise((z,Q)=>{S(this,wZ,z,"f"),S(this,W8,Q,"f")}),"f"),O(this,X8,"f").catch(()=>{}),O(this,Y8,"f").catch(()=>{}),S(this,G1,$,"f"),S(this,G8,Z?.logger??console,"f")}get response(){return O(this,kZ,"f")}get request_id(){return O(this,bZ,"f")}async withResponse(){S(this,Q$,!0,"f");let $=await O(this,X8,"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 V8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new V8(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return S(X,G1,{...Z,stream:!0},"f"),X._run(()=>X._createMessage($,{...Z,stream:!0},{...z,headers:{...z?.headers,"X-Stainless-Helper-Method":"stream"}})),X}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},O(this,nz,"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,G2,"m",rz).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let W of Y)O(this,G2,"m",sz).call(this,W);if(Y.controller.signal?.aborted)throw new E0;O(this,G2,"m",oz).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;S(this,kZ,$,"f"),S(this,bZ,$?.headers.get("request-id"),"f"),O(this,jZ,"f").call(this,$),this._emit("connect")}get ended(){return O(this,U8,"f")}get errored(){return O(this,xZ,"f")}get aborted(){return O(this,yZ,"f")}abort(){this.controller.abort()}on($,Z){return(O(this,s2,"f")[$]||(O(this,s2,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=O(this,s2,"f")[$];if(!z)return this;let Q=z.findIndex((X)=>X.listener===Z);if(Q>=0)z.splice(Q,1);return this}once($,Z){return(O(this,s2,"f")[$]||(O(this,s2,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(S(this,Q$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){S(this,Q$,!0,"f"),await O(this,Y8,"f")}get currentMessage(){return O(this,C6,"f")}async finalMessage(){return await this.done(),O(this,G2,"m",iz).call(this)}async finalText(){return await this.done(),O(this,G2,"m",Xq).call(this)}_emit($,...Z){if(O(this,U8,"f"))return;if($==="end")S(this,U8,!0,"f"),O(this,wZ,"f").call(this);let z=O(this,s2,"f")[$];if(z)O(this,s2,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!O(this,Q$,"f")&&!z?.length)Promise.reject(Q);O(this,J8,"f").call(this,Q),O(this,W8,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!O(this,Q$,"f")&&!z?.length)Promise.reject(Q);O(this,J8,"f").call(this,Q),O(this,W8,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",O(this,G2,"m",iz).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,G2,"m",rz).call(this),this._connected(null);let X=a0.fromReadableStream($,this.controller);for await(let J of X)O(this,G2,"m",sz).call(this,J);if(X.controller.signal?.aborted)throw new E0;O(this,G2,"m",oz).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(C6=new WeakMap,G1=new WeakMap,X8=new WeakMap,jZ=new WeakMap,J8=new WeakMap,Y8=new WeakMap,wZ=new WeakMap,W8=new WeakMap,s2=new WeakMap,U8=new WeakMap,xZ=new WeakMap,yZ=new WeakMap,Q$=new WeakMap,kZ=new WeakMap,bZ=new WeakMap,G8=new WeakMap,nz=new WeakMap,G2=new WeakSet,iz=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Xq=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},rz=function(){if(this.ended)return;S(this,C6,void 0,"f")},sz=function(Z){if(this.ended)return;let z=O(this,G2,"m",Jq).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(Wq(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:Uq(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(pz(z,O(this,G1,"f"),{logger:O(this,G8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{S(this,C6,z,"f");break}case"content_block_start":case"message_delta":break}},oz=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=O(this,C6,"f");if(!Z)throw new k("request ended without sending any chunks");return S(this,C6,void 0,"f"),pz(Z,O(this,G1,"f"),{logger:O(this,G8,"f")})},Jq=function(Z){let z=O(this,C6,"f");if(Z.type==="message_start"){if(z)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new k(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return z;case"message_delta":if(z.stop_reason=Z.delta.stop_reason,z.stop_sequence=Z.delta.stop_sequence,z.usage.output_tokens=Z.usage.output_tokens,Z.usage.input_tokens!=null)z.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)z.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)z.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)z.usage.server_tool_use=Z.usage.server_tool_use;return z;case"content_block_start":return z.content.push({...Z.content_block}),z;case"content_block_delta":{let Q=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,text:(Q.text||"")+Z.delta.text};break}case"citations_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,citations:[...Q.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(Q&&Wq(Q)){let X=Q[Yq]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,Yq,{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:Uq(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 a0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var q8;var az=v(()=>{V0();Y0();wz();$1();O0();q8=class q8 extends m{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(_`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",A2,{query:$,...Z})}delete($,Z){return this._client.delete(_`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(_`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let z=await this.retrieve($);if(!z.results_url)throw new k(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);return this._client.get(z.results_url,{...Z,headers:D([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,X)=>J1.fromResponse(X.response,X.controller))}}});var X$,Vq,Sw;var tz=v(()=>{Y0();v4();Gq();dz();az();az();Dz();X$=class X$ extends m{constructor(){super(...arguments);this.batches=new q8(this._client)}create($,Z){if($.model in Vq)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${Vq[$.model]}
197
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Sw.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=IZ[$.model]??void 0;z=this._client.calculateNonstreamingTimeout($.max_tokens,X)}let Q=DZ($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:z??600000,...Z,headers:D([Q,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((z)=>lz(z,$,{logger:this._client.logger??console}))}stream($,Z){return V8.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};Vq={"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"},Sw=["claude-mythos-preview","claude-opus-4-6"];X$.Batches=q8});var V1;var ez=v(()=>{V0();Y0();O0();V1=class V1 extends m{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(_`/v1/models/${$}`,{...z,headers:D([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models",A2,{query:Q,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var qq=v(()=>{mz();cz();tz();ez();fV()});var H8=($)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[$]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.($)?.trim()||void 0;return};class W0{constructor({baseURL:$=H8("ANTHROPIC_BASE_URL"),apiKey:Z=H8("ANTHROPIC_API_KEY")??null,authToken:z=H8("ANTHROPIC_AUTH_TOKEN")??null,...Q}={}){$Q.add(this),vZ.set(this,void 0);let X={apiKey:Z,authToken:z,...Q,baseURL:$||"https://api.anthropic.com"};if(!X.dangerouslyAllowBrowser&&CV())throw new k(`It looks like you're running in a browser-like environment.
198
198
 
199
199
  This is disabled by default, as it risks exposing your secret API credentials to attackers.
200
200
  If you understand the risks and have appropriate mitigations in place,
201
201
  you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
202
202
 
203
203
  new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
204
- `);this.baseURL=X.baseURL,this.timeout=X.timeout??tz.DEFAULT_TIMEOUT,this.logger=X.logger??console;let J="warn";this.logLevel=J,this.logLevel=o9(X.logLevel,"ClientOptions.logLevel",this)??o9(G8("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=X.fetchOptions,this.maxRetries=X.maxRetries??2,this.fetch=X.fetch??OV(),S(this,yZ,IV,"f"),this._options=X,this.apiKey=typeof Z==="string"?Z:null,this.authToken=z}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders($){return D([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return D([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return D([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return TV($)}getUserAgent(){return`${this.constructor.name}/JS ${L6}`}defaultIdempotencyKey(){return`stainless-node-retry-${c9()}`}makeStatusError($,Z,z,Q){return N0.generate($,Z,z,Q)}buildURL($,Z,z){let Q=!O(this,az,"m",JH).call(this)&&z||this.baseURL,X=GV($)?new URL($):new URL(Q+(Q.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),J=this.defaultQuery(),Y=Object.fromEntries(X.searchParams);if(!d9(J)||!d9(Y))Z={...Y,...J,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))X.search=this.stringifyQuery(Z);return X.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options:z}){}get($,Z){return this.methodRequest("get",$,Z)}post($,Z){return this.methodRequest("post",$,Z)}patch($,Z){return this.methodRequest("patch",$,Z)}put($,Z){return this.methodRequest("put",$,Z)}delete($,Z){return this.methodRequest("delete",$,Z)}methodRequest($,Z,z){return this.request(Promise.resolve(z).then((Q)=>{return{method:$,path:Z,...Q}}))}request($,Z=null){return new O6(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,z){let Q=await $,X=Q.maxRetries??this.maxRetries;if(Z==null)Z=X;await this.prepareOptions(Q);let{req:J,url:Y,timeout:W}=await this.buildRequest(Q,{retryCount:X-Z});await this.prepareRequest(J,{url:Y,options:Q});let U="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),G=z===void 0?"":`, retryOf: ${z}`,V=Date.now();if(P0(this).debug(`[${U}] sending request`,i2({retryOfRequestLogID:z,method:Q.method,url:Y,options:Q,headers:J.headers})),Q.signal?.aborted)throw new S0;let H=new AbortController,q=await this.fetchWithTimeout(Y,J,W,H).catch(A4),K=Date.now();if(q instanceof globalThis.Error){let N=`retrying, ${Z} attempts remaining`;if(Q.signal?.aborted)throw new S0;let T=d2(q)||/timed? ?out/i.test(String(q)+("cause"in q?String(q.cause):""));if(Z)return P0(this).info(`[${U}] connection ${T?"timed out":"failed"} - ${N}`),P0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (${N})`,i2({retryOfRequestLogID:z,url:Y,durationMs:K-V,message:q.message})),this.retryRequest(Q,Z,z??U);if(P0(this).info(`[${U}] connection ${T?"timed out":"failed"} - error; no more retries left`),P0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (error; no more retries left)`,i2({retryOfRequestLogID:z,url:Y,durationMs:K-V,message:q.message})),T)throw new f$;throw new M6({cause:q})}let L=[...q.headers.entries()].filter(([N])=>N==="request-id").map(([N,T])=>", "+N+": "+JSON.stringify(T)).join(""),B=`[${U}${G}${L}] ${J.method} ${Y} ${q.ok?"succeeded":"failed"} with status ${q.status} in ${K-V}ms`;if(!q.ok){let N=await this.shouldRetry(q);if(Z&&N){let x=`retrying, ${Z} attempts remaining`;return await DV(q.body),P0(this).info(`${B} - ${x}`),P0(this).debug(`[${U}] response error (${x})`,i2({retryOfRequestLogID:z,url:q.url,status:q.status,headers:q.headers,durationMs:K-V})),this.retryRequest(Q,Z,z??U,q.headers)}let T=N?"error; no more retries left":"error; not retryable";P0(this).info(`${B} - ${T}`);let R=await q.text().catch((x)=>A4(x).message),w=WZ(R),j=w?void 0:R;throw P0(this).debug(`[${U}] response error (${T})`,i2({retryOfRequestLogID:z,url:q.url,status:q.status,headers:q.headers,message:j,durationMs:Date.now()-V})),this.makeStatusError(q.status,w,j,q.headers)}return P0(this).info(B),P0(this).debug(`[${U}] response start`,i2({retryOfRequestLogID:z,url:q.url,status:q.status,headers:q.headers,durationMs:K-V})),{response:q,options:Q,controller:H,requestLogID:U,retryOfRequestLogID:z,startTime:V}}getAPIList($,Z,z){return this.requestAPIList(Z,z&&"then"in z?z.then((Q)=>({method:"get",path:$,...Q})):{method:"get",path:$,...z})}requestAPIList($,Z){let z=this.makeRequest(Z,null,void 0);return new S4(this,z,$)}async fetchWithTimeout($,Z,z,Q){let{signal:X,method:J,...Y}=Z||{},W=this._makeAbort(Q);if(X)X.addEventListener("abort",W,{once:!0});let U=setTimeout(W,z),G=globalThis.ReadableStream&&Y.body instanceof globalThis.ReadableStream||typeof Y.body==="object"&&Y.body!==null&&Symbol.asyncIterator in Y.body,V={signal:Q.signal,...G?{duplex:"half"}:{},method:"GET",...Y};if(J)V.method=J.toUpperCase();try{return await this.fetch.call(void 0,$,V)}finally{clearTimeout(U)}}async shouldRetry($){let Z=$.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,Z,z,Q){let X,J=Q?.get("retry-after-ms");if(J){let W=parseFloat(J);if(!Number.isNaN(W))X=W}let Y=Q?.get("retry-after");if(Y&&!X){let W=parseFloat(Y);if(!Number.isNaN(W))X=W*1000;else X=Date.parse(Y)-Date.now()}if(X===void 0){let W=$.maxRetries??this.maxRetries;X=this.calculateDefaultRetryTimeoutMillis(Z,W)}return await qV(X),this.makeRequest($,Z-1,z)}calculateDefaultRetryTimeoutMillis($,Z){let X=Z-$,J=Math.min(0.5*Math.pow(2,X),8),Y=1-Math.random()*0.25;return J*Y*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let z={...$},{method:Q,path:X,query:J,defaultBaseURL:Y}=z,W=this.buildURL(X,J,Y);if("timeout"in z)HV("timeout",z.timeout);z.timeout=z.timeout??this.timeout;let{bodyHeaders:U,body:G}=this.buildBody({options:z}),V=await this.buildHeaders({options:$,method:Q,bodyHeaders:U,retryCount:Z});return{req:{method:Q,headers:V,...z.signal&&{signal:z.signal},...globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"},...G&&{body:G},...this.fetchOptions??{},...z.fetchOptions??{}},url:W,timeout:z.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:z,retryCount:Q}){let X={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();X[this.idempotencyHeader]=$.idempotencyKey}let J=D([X,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(Q),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...NV(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,z,$.headers]);return this.validateHeaders(J),J.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let z=D([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&z.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:UZ($)};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,yZ,"f").call(this,{body:$,headers:z})}}var az,tz,yZ,JH,ez="\\n\\nHuman:",$Q="\\n\\nAssistant:",C6;var ZQ=v(()=>{l2();o6();i9();AV();p0();V0();Jz();XH();KZ();fz();oz();hz();sz();i9();Y0();HZ();o6();tz=W0,yZ=new WeakMap,az=new WeakSet,JH=function(){return this.baseURL!=="https://api.anthropic.com"};W0.Anthropic=tz;W0.HUMAN_PROMPT=ez;W0.AI_PROMPT=$Q;W0.DEFAULT_TIMEOUT=600000;W0.AnthropicError=k;W0.APIError=N0;W0.APIConnectionError=M6;W0.APIConnectionTimeoutError=f$;W0.APIUserAbortError=S0;W0.NotFoundError=p$;W0.ConflictError=l$;W0.RateLimitError=i$;W0.BadRequestError=u$;W0.AuthenticationError=m$;W0.InternalServerError=n$;W0.PermissionDeniedError=c$;W0.UnprocessableEntityError=d$;W0.toFile=j4;C6=class C6 extends W0{constructor(){super(...arguments);this.completions=new J1(this),this.messages=new Q$(this),this.models=new W1(this),this.beta=new k0(this)}};C6.Completions=J1;C6.Messages=Q$;C6.Models=W1;C6.Beta=k0});var YH={};LQ(YH,{toFile:()=>j4,default:()=>C6,UnprocessableEntityError:()=>d$,RateLimitError:()=>i$,PermissionDeniedError:()=>c$,PagePromise:()=>S4,NotFoundError:()=>p$,InternalServerError:()=>n$,HUMAN_PROMPT:()=>ez,ConflictError:()=>l$,BaseAnthropic:()=>W0,BadRequestError:()=>u$,AuthenticationError:()=>m$,AnthropicError:()=>k,Anthropic:()=>C6,APIUserAbortError:()=>S0,APIPromise:()=>O6,APIError:()=>N0,APIConnectionTimeoutError:()=>f$,APIConnectionError:()=>M6,AI_PROMPT:()=>$Q});var WH=v(()=>{ZQ();Jz();KZ();ZQ();V0();p0()});var yQ=pH(xQ(),1),{program:cx,createCommand:px,createArgument:lx,createOption:dx,CommanderError:ix,InvalidArgumentError:nx,InvalidOptionArgumentError:rx,Command:kQ,Argument:sx,Option:ox,Help:ax}=yQ.default;import{lstatSync as gY}from"fs";import{join as kY,dirname as D5,basename as jA,resolve as C$}from"path";import{execFileSync as wA}from"child_process";var rI=c7(),sI=S1(),oI=F7(),$3=E1(),aI=B1(),X6=o(),tI=e2(),eI=M0(),$T=Z6(),ZT=z6(),Lk=$5(),zT=a7(),QT=t7(),XT=e7(),X5=cJ(),pJ=q1();var JT=rI.Composer,J5=sI.Document,YT=oI.Schema,WT=$3.YAMLError,Y5=$3.YAMLParseError,UT=$3.YAMLWarning,GT=aI.Alias,x2=X6.isAlias,w6=X6.isCollection,VT=X6.isDocument,q0=X6.isMap,K2=X6.isNode,HT=X6.isPair,T0=X6.isScalar,y2=X6.isSeq,qT=tI.Pair,KT=eI.Scalar,L$=$T.YAMLMap,b1=ZT.YAMLSeq;var BT=zT.Lexer,MT=QT.LineCounter,LT=XT.Parser,i0=X5.parse,NT=X5.parseAllDocuments,x6=X5.parseDocument,N$=X5.stringify,OT=pJ.visit,DT=pJ.visitAsync;import{accessSync as lJ,closeSync as U5,constants as dJ,existsSync as IT,fchmodSync as iJ,fchownSync as TT,fsyncSync as nJ,lstatSync as g1,mkdirSync as rJ,mkdtempSync as AT,openSync as J3,readdirSync as sJ,readFileSync as G5,readlinkSync as CT,realpathSync as _T,renameSync as RT,rmSync as oJ,statSync as O$,unlinkSync as aJ,writeFileSync as tJ}from"fs";import{randomBytes as FT}from"crypto";import{tmpdir as eJ}from"os";import{basename as J6,dirname as y6,isAbsolute as $Y,join as R2,relative as Y3,resolve as Z2,sep as W5}from"path";class b extends Error{reason;path;onWrite;constructor($,Z,z,Q={}){super(z,Q.cause===void 0?void 0:{cause:Q.cause});this.name="SafePathError",this.reason=$,this.path=Z,this.onWrite=Q.onWrite===!0}}var E0=Object.freeze({claude:"CLAUDE.md",agents:"AGENTS.md",gemini:"GEMINI.md",cursorrules:".cursorrules",copilot:"copilot-instructions.md",memory:"MEMORY.md",llms:"llms.txt"}),PT=new Set(Object.values(E0).map(($)=>$.toLowerCase())),ST=($,Z)=>$.toLowerCase()===Z.toLowerCase(),Z3=($)=>PT.has($.toLowerCase());function D$($){return $.split(/[\\/]/).some((Z)=>Z.toLowerCase()===".git")}var ET=/\.fafm?$/i,jT=/^[a-z][a-z0-9-]*$/,B2=($)=>_T.native($),Y6=($)=>$?.code;function h1($,Z){let z=Y3($,Z);return z===""||z!==".."&&!z.startsWith(`..${W5}`)&&!$Y(z)}function ZY($){try{return CT($)}catch{return"?"}}function wT($,Z,z,Q){let X;try{X=B2(z)}catch(J){let Y=Y6(J);if(Y==="ENOENT"||Y==="ELOOP"||Y==="ENOTDIR")throw new b("dangling",Z,`${Z} is a link to ${ZY(z)}, which does not exist. faf does not create files through a link — refused.`);throw J}if(!h1($,X))throw new b("outside",Z,`${Z} is a link to ${X}, outside ${$} — refused.`);if(D$(X)&&!(Q.inGit&&y6(X)===$))throw new b("git",Z,`${Z} is a link to ${X}, inside .git/ — refused.`);if(!O$(X).isFile())throw new b("not-a-file",Z,`${Z} is a link to ${X}, which is not a regular file — refused.`);return xT(Z,X,Q.read),X}function xT($,Z,z){let Q=J6($),X=J6(Z),J=Z3(Q)&&Z3(X);if(z&&!ET.test(X)&&!J){let Y=Z3(Q)?"a .faf or .fafm file, nor another AI context file":"a .faf or .fafm file";throw new b("not-faf",$,`${$} is a link to ${Z}, which is not ${Y} — refused.`)}if(!z&&!ST(Q,X)&&!J)throw new b("other-file",$,`${$} is a link to ${Z}, a file with another name — refused (faf follows a link only to a file of the same name, or from one AI context file to another).`)}function yT($,Z,z,Q){if(J6(Z2($))!=="hooks"||!jT.test(J6(Z)))throw new b("git",Z,`${Z} is not a git hook in a hooks folder — refused.`);if(Q!==z)throw new b("git",Z,`${Z} is not directly in the hooks folder ${z} — refused.`)}function kT($,Z,z){if(J6($)!=="config"||z!==Z)throw new b("git",$,`${$} is not the git config file directly in ${Z} — refused.`)}function l($,Z,z={}){let Q=B2(Z2($)),X=Z2($,Z),J=B2(y6(X));if(!h1(Q,J))throw new b("outside",X,`${X} is in ${J}, outside ${Q} — refused.`);let Y=z.allowGitHooks===!0,W=z.allowGitConfig===!0;if(Y)yT($,X,Q,J);if(W)kT(X,Q,J);let U=R2(J,J6(X));if(D$(U)&&!Y&&!W)throw new b("git",X,U===X?`${X} is inside .git/ — refused.`:`${X} resolves to ${U}, inside .git/ — refused.`);let G;try{G=g1(U)}catch(V){if(Y6(V)==="ENOENT")return U;throw V}if(G.isSymbolicLink())return wT(Q,X,U,{read:z.read===!0,inGit:Y||W});if(!G.isFile())throw new b("not-a-file",X,`${X} is not a regular file — refused.`);return B2(U)}var bT=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function vT($,Z){if(!($.length>=2&&($[0]===255&&$[1]===254||$[0]===254&&$[1]===255)))try{return bT.decode($)}catch{}throw new b("not-utf8",Z,`${Z} is not UTF-8 — faf left it unchanged`)}function J0($){return vT(G5($),$)}function j0($){try{return G5($)}catch(Z){if(Y6(Z)==="ENOENT")return null;throw Z}}function v1($,Z){let z=Z2(R2($,Z));if(!IT(z))return null;let Q,X;try{Q=B2(gT($)),X=B2(z)}catch{return null}if(!h1(Q,X)||D$(Y3(Q,X)))return null;return X}var Q3=[];function gT($){let Z=Z2($);return Q3.find((z)=>Z===z||Z.startsWith(z.endsWith(W5)?z:z+W5))??Z}function I$($,Z){Q3.push(Z2($));try{return Z()}finally{Q3.pop()}}function A($,Z){return v1($,Z)!==null}function f($,Z){let z=v1($,Z);if(z===null)return null;try{return O$(z).isFile()?G5(z,"utf-8"):null}catch{return null}}function M2($,Z){let z=v1($,Z);if(z===null)return null;try{return O$(z)}catch{return null}}function z0($,Z="."){let z=v1($,Z);if(z===null)return null;let Q;try{Q=sJ(z,{withFileTypes:!0})}catch{return null}return Q.filter((X)=>!X.isSymbolicLink()||v1($,R2(Z,X.name))!==null)}function hT($){try{let Z=O$($);return{mode:Z.mode&511,perm:Z.mode&4095,uid:Z.uid,gid:Z.gid}}catch(Z){if(Y6(Z)==="ENOENT")return;throw Z}}class k2 extends Error{path;constructor($,Z,z={}){super(Z,{cause:z.cause});this.path=$}}var z3=($)=>new b("changed",$,`${$} changed on disk while faf was writing — not written; original kept`,{onWrite:!0});function W3($,Z,z){if(Z!==void 0){let X=j0($),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 z3($)}if(!z)return;let Q;try{Q=O$($)}catch(X){if(Y6(X)==="ENOENT")return;throw X}if((Q.mode&4095)!==z.perm)throw z3($);try{lJ($,dJ.W_OK)}catch{throw z3($)}}function fT($,Z){if(process.platform!=="win32")try{TT($,Z.uid,Z.gid)}catch{}iJ($,Z.mode)}function uT($){if(process.platform==="win32")return;try{let Z=J3($,"r");try{nJ(Z)}finally{U5(Z)}}catch{}}function mT($,Z,z,Q){if($.fd=J3($.path,"wx",Q??z?.mode??438),$.created=!0,tJ($.fd,Z),z)fT($.fd,z);if(Q!==void 0)iJ($.fd,Q);nJ($.fd),U5($.fd),$.fd=void 0}function cT($){if($.fd!==void 0)try{U5($.fd)}catch{}if($.created)try{aJ($.path)}catch{}}function pT($,Z,z){let Q=y6($),X={path:R2(Q,`.${J6($).slice(0,100)}.${process.pid}.${FT(6).toString("hex")}.faf-tmp`),created:!1},J=hT($);try{if(J)lJ($,dJ.W_OK);mT(X,Z,J,z.mode),W3($,z.expect,J),RT(X.path,$)}catch(Y){if(cT(X),Y instanceof b)throw Y;let W=Y6(Y)??(Y instanceof Error?Y.message:String(Y));throw new k2($,`${$}: not written${J?"; original kept":""} (${W})`,{cause:Y})}uT(Q)}function lT($){return $ instanceof b&&!$.onWrite?new b($.reason,$.path,$.message,{onWrite:!0}):$}function a($,Z,z={}){let Q=Z2($),X;try{X=l(z.root??y6(Q),Q,{allowGitHooks:z.allowGitHooks,allowGitConfig:z.allowGitConfig})}catch(J){throw lT(J)}return pT(X,Z,z),X}function F2($,Z,z){let Q=Z2($),X=z.root??y6(Q),J=l(X,Q),Y=j0(J);if(z.expect!==void 0)W3(J,z.expect,void 0);if(Y!==null&&z.force!==!0&&!z.owns(Y))throw new b("not-owned",Q,`${Q} has no ${z.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});return a(J,Z,{root:X,expect:Y})}function w0($,Z=$){let z=Z2($);rJ(z,{recursive:!0});let Q=B2(z),X=Z2(z,Z),J=Y3(z,X);if(J===".."||J.startsWith(`..${W5}`)||$Y(J))throw new b("outside",X,`${X} is outside ${Q} — refused.`,{onWrite:!0});let Y=Q;for(let W of J.split(/[\\/]/).filter(Boolean)){let U=R2(Y,W);if(D$(U))throw new b("git",X,`${X} runs through ${U}, inside .git/ — refused.`,{onWrite:!0});Y=dT(Q,X,U)}return Y}function dT($,Z,z){let Q;try{Q=g1(z)}catch(J){if(Y6(J)!=="ENOENT")throw J;return rJ(z),z}let X=z;if(Q.isSymbolicLink()){try{X=B2(z)}catch{throw new b("dangling",Z,`${z} is a link to ${ZY(z)}, which does not exist. faf does not create folders through a link — refused.`,{onWrite:!0})}if(!h1($,X))throw new b("outside",Z,`${z} is a link to ${X}, outside ${$} — refused.`,{onWrite:!0});if(D$(X))throw new b("git",Z,`${z} is a link to ${X}, inside .git/ — refused.`,{onWrite:!0})}if(!O$(X).isDirectory())throw new b("not-a-file",Z,`${z} is not a folder — refused.`,{onWrite:!0});return X}function V5($,Z){let z=Z2($),Q=B2(Z2(Z.root??y6(z))),X=B2(y6(z));if(!h1(Q,X))throw new b("outside",z,`${z} is in ${X}, outside ${Q} — refused.`,{onWrite:!0});let J=R2(X,J6(z));if(D$(J))throw new b("git",z,`${z} is inside .git/ — refused.`,{onWrite:!0});let Y;try{Y=g1(J)}catch(W){if(Y6(W)==="ENOENT")return!1;throw W}if(!Y.isFile())throw new b("not-a-file",z,`${z} is not a regular file faf wrote — left as it is.`,{onWrite:!0});return W3(J,Z.expect,void 0),aJ(J),!0}var X3=new Set,zY=".faf-temp",QY="faf made this temp folder; `faf clear` removes it.\n";function H5($){let Z=B2(AT(R2(eJ(),$)));X3.add(Z);let z=J3(R2(Z,zY),"wx",420);try{tJ(z,QY)}finally{U5(z)}return Z}function q5($){if(!X3.has($))throw Error(`${$} is not a temp folder faf made — not removed`);oJ($,{recursive:!0,force:!0}),X3.delete($)}function iT($){let Z=R2($,zY);try{if(!g1(Z).isFile())return!1;return G5(Z,"utf-8")===QY}catch{return!1}}var nT=($)=>$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function XY($){let Z=eJ(),z=typeof process.getuid==="function"?process.getuid():void 0,Q=new RegExp(`^${nT($)}[A-Za-z0-9]{6}$`),X=0;for(let J of sJ(Z)){if(!Q.test(J))continue;let Y=R2(Z,J);try{let W=g1(Y);if(!W.isDirectory()||z!==void 0&&W.uid!==z||!iT(Y))continue;oJ(Y,{recursive:!0,force:!0}),X++}catch{}}return X}function $0($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function k6($){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 f1($,Z){if($===null||$===void 0)return{};if(!$0($))throw new b("not-yaml",Z,`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${k6($)}. `+"faf left it unchanged — fix it by hand.");return $}var Q0=[{index:1,path:"project.name",label:"Name",description:"Project name",category:"project"},{index:2,path:"project.goal",label:"Goal",description:"Goal (use case)",category:"project"},{index:3,path:"project.main_language",label:"Language",description:"Primary language",category:"project"},{index:4,path:"human_context.who",label:"Who",description:"Who is this for?",category:"human"},{index:5,path:"human_context.what",label:"What",description:"What are they building",category:"human"},{index:6,path:"human_context.why",label:"Why",description:"Why does it exist",category:"human"},{index:7,path:"human_context.where",label:"Where",description:"Where does it run",category:"human"},{index:8,path:"human_context.when",label:"When",description:"When was it started / timeline",category:"human"},{index:9,path:"human_context.how",label:"How",description:"How is it built",category:"human"},{index:10,path:"stack.frontend",canonical:"stack.framework",label:"Framework",description:"Framework (React, Svelte, etc.)",category:"frontend"},{index:11,path:"stack.css_framework",canonical:"stack.css",label:"CSS",description:"CSS framework",category:"frontend"},{index:12,path:"stack.ui_library",label:"UI Library",description:"UI component library",category:"frontend"},{index:13,path:"stack.state_management",canonical:"stack.state",label:"State",description:"State management",category:"frontend"},{index:14,path:"stack.backend",label:"Backend",description:"Backend framework",category:"backend"},{index:15,path:"stack.api_type",canonical:"stack.api",label:"API",description:"API style (REST, GraphQL, etc.)",category:"backend"},{index:16,path:"stack.runtime",label:"Runtime",description:"Runtime (Node, Bun, Python, etc.)",category:"backend"},{index:17,path:"stack.database",canonical:"stack.db",label:"Database",description:"Database",category:"backend"},{index:18,path:"stack.connection",label:"Connection",description:"Connection method (Prisma, etc.)",category:"backend"},{index:19,path:"stack.hosting",label:"Hosting",description:"Hosting platform",category:"universal"},{index:20,path:"stack.build",label:"Build",description:"Build tool",category:"universal"},{index:21,path:"stack.cicd",label:"CI/CD",description:"CI/CD",category:"universal"},{index:22,path:"stack.monorepo_tool",label:"Monorepo",description:"Monorepo tool",category:"enterprise_infra"},{index:23,path:"stack.package_manager",canonical:"stack.pkg_manager",label:"Package Manager",description:"Package manager",category:"enterprise_infra"},{index:24,path:"stack.workspaces",label:"Workspaces",description:"Workspace configuration",category:"enterprise_infra"},{index:25,path:"monorepo.packages_count",label:"Packages",description:"Number of packages",category:"enterprise_infra"},{index:26,path:"monorepo.build_orchestrator",label:"Build Orchestrator",description:"Build orchestration tool",category:"enterprise_infra"},{index:27,path:"stack.admin",label:"Admin",description:"Admin panel",category:"enterprise_app"},{index:28,path:"stack.cache",label:"Cache",description:"Caching layer",category:"enterprise_app"},{index:29,path:"stack.search",label:"Search",description:"Search engine",category:"enterprise_app"},{index:30,path:"stack.storage",label:"Storage",description:"Object storage",category:"enterprise_app"},{index:31,path:"monorepo.versioning_strategy",label:"Versioning",description:"Version strategy",category:"enterprise_ops"},{index:32,path:"monorepo.shared_configs",label:"Shared Configs",description:"Shared configs",category:"enterprise_ops"},{index:33,path:"monorepo.remote_cache",label:"Remote Cache",description:"Remote build cache",category:"enterprise_ops"}],W6=new Map(Q0.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),Rk=new Map(Q0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),Fk=new Map(Q0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function u1($,Z){let z=(X)=>{let J=X.split("."),Y=$;for(let W of J)if(Y&&typeof Y==="object"&&W in Y)Y=Y[W];else return;return Y},Q=z(Z.path);if(Q!==void 0)return Q;if(Z.canonical)return z(Z.canonical);return}var Pk=Q0.filter(($)=>$.index<=21);var U3=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","n/a","not applicable"]);var m1="slotignored";function T$($){return typeof $==="string"&&$.trim()!==""&&U0($)}function U0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return U3.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var A$="no classifying signals — fallback",rT=new Set(["stack.css_framework","stack.ui_library","stack.database","stack.connection","stack.hosting"]);function v6($,Z){if(typeof $!=="string"||!Object.prototype.hasOwnProperty.call(b6,$))return null;if(!b6[$].includes(Z.category))return!1;return!($==="framework"&&rT.has(Z.path))}var b6={documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],cli:["project","human","universal"],library:["project","human","universal"],sdk:["project","human","universal"],wasm:["project","human","universal"],html:["project","human","universal"],"server-card":["project","human","universal"],frontend:["project","frontend","human","universal"],website:["project","frontend","human","universal"],mobile:["project","frontend","human","universal"],app:["project","frontend","human","universal"],extension:["project","frontend","human","universal"],mcp:["project","backend","human","universal"],backend:["project","backend","universal","human"],"data-science":["project","backend","human","universal"],fullstack:["project","frontend","backend","universal","human"],svelte:["project","frontend","backend","universal","human"],framework:["project","frontend","backend","universal","human"],"monorepo-root":["project","human","enterprise_infra","enterprise_app","enterprise_ops"],mcpaas:["project","backend","universal","human","enterprise_app","enterprise_ops"],saas:["project","frontend","backend","universal","human","enterprise_app"],enterprise:["project","frontend","backend","universal","human","enterprise_infra","enterprise_app","enterprise_ops"]};var VY=new Set(["tag:yaml.org,2002:int","tag:yaml.org,2002:float"]);function JY($){return typeof $==="object"&&$.collection===void 0}function sT($,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||!VY.has(Q.tag))return;let X;try{X=Q.resolve(z,()=>{return},{})}catch{return}return Object.is(T0(X)?X.value:X,$.value)?z:void 0}function oT($){let Z=$.filter(JY);return $.map((z)=>{if(!JY(z)||!VY.has(z.tag)||!z.stringify)return z;let Q=z.stringify;return{...z,stringify:(X,J,Y,W)=>sT(X,Z)??Q(X,J,Y,W)}})}var K5={keepSourceTokens:!0,customTags:oT};function aT($,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 tT($){let Z=$.split(/\r?\n/),z,Q;for(let X=0;X+1<Z.length;X++){let J=aT(Z[X],Z[X+1]);z??=J.indent,Q??=J.indentSeq}return{indent:z??2,indentSeq:Q??!0}}function K3($,Z){let z=x6($,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 g6($,Z,z,Q){$.edits.push({start:Z,end:z,text:Q,seq:$.edits.length})}function c1($,Z){return $.lastIndexOf(`
207
- `,Z-1)+1}function HY($,Z){if(Z>0&&$[Z-1]===`
204
+ `);this.baseURL=X.baseURL,this.timeout=X.timeout??ZQ.DEFAULT_TIMEOUT,this.logger=X.logger??console;let J="warn";this.logLevel=J,this.logLevel=e9(X.logLevel,"ClientOptions.logLevel",this)??e9(H8("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=X.fetchOptions,this.maxRetries=X.maxRetries??2,this.fetch=X.fetch??RV(),S(this,vZ,PV,"f"),this._options=X,this.apiKey=typeof Z==="string"?Z:null,this.authToken=z}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders($){return D([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return D([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return D([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return SV($)}getUserAgent(){return`${this.constructor.name}/JS ${N6}`}defaultIdempotencyKey(){return`stainless-node-retry-${d9()}`}makeStatusError($,Z,z,Q){return N0.generate($,Z,z,Q)}buildURL($,Z,z){let Q=!O(this,$Q,"m",Hq).call(this)&&z||this.baseURL,X=LV($)?new URL($):new URL(Q+(Q.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),J=this.defaultQuery(),Y=Object.fromEntries(X.searchParams);if(!r9(J)||!r9(Y))Z={...Y,...J,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))X.search=this.stringifyQuery(Z);return X.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options:z}){}get($,Z){return this.methodRequest("get",$,Z)}post($,Z){return this.methodRequest("post",$,Z)}patch($,Z){return this.methodRequest("patch",$,Z)}put($,Z){return this.methodRequest("put",$,Z)}delete($,Z){return this.methodRequest("delete",$,Z)}methodRequest($,Z,z){return this.request(Promise.resolve(z).then((Q)=>{return{method:$,path:Z,...Q}}))}request($,Z=null){return new D6(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,z){let Q=await $,X=Q.maxRetries??this.maxRetries;if(Z==null)Z=X;await this.prepareOptions(Q);let{req:J,url:Y,timeout:W}=await this.buildRequest(Q,{retryCount:X-Z});await this.prepareRequest(J,{url:Y,options:Q});let U="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),G=z===void 0?"":`, retryOf: ${z}`,V=Date.now();if(P0(this).debug(`[${U}] sending request`,i2({retryOfRequestLogID:z,method:Q.method,url:Y,options:Q,headers:J.headers})),Q.signal?.aborted)throw new E0;let q=new AbortController,H=await this.fetchWithTimeout(Y,J,W,q).catch(R4),K=Date.now();if(H instanceof globalThis.Error){let N=`retrying, ${Z} attempts remaining`;if(Q.signal?.aborted)throw new E0;let T=d2(H)||/timed? ?out/i.test(String(H)+("cause"in H?String(H.cause):""));if(Z)return P0(this).info(`[${U}] connection ${T?"timed out":"failed"} - ${N}`),P0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (${N})`,i2({retryOfRequestLogID:z,url:Y,durationMs:K-V,message:H.message})),this.retryRequest(Q,Z,z??U);if(P0(this).info(`[${U}] connection ${T?"timed out":"failed"} - error; no more retries left`),P0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (error; no more retries left)`,i2({retryOfRequestLogID:z,url:Y,durationMs:K-V,message:H.message})),T)throw new c$;throw new L6({cause:H})}let L=[...H.headers.entries()].filter(([N])=>N==="request-id").map(([N,T])=>", "+N+": "+JSON.stringify(T)).join(""),B=`[${U}${G}${L}] ${J.method} ${Y} ${H.ok?"succeeded":"failed"} with status ${H.status} in ${K-V}ms`;if(!H.ok){let N=await this.shouldRetry(H);if(Z&&N){let x=`retrying, ${Z} attempts remaining`;return await FV(H.body),P0(this).info(`${B} - ${x}`),P0(this).debug(`[${U}] response error (${x})`,i2({retryOfRequestLogID:z,url:H.url,status:H.status,headers:H.headers,durationMs:K-V})),this.retryRequest(Q,Z,z??U,H.headers)}let T=N?"error; no more retries left":"error; not retryable";P0(this).info(`${B} - ${T}`);let R=await H.text().catch((x)=>R4(x).message),w=VZ(R),j=w?void 0:R;throw P0(this).debug(`[${U}] response error (${T})`,i2({retryOfRequestLogID:z,url:H.url,status:H.status,headers:H.headers,message:j,durationMs:Date.now()-V})),this.makeStatusError(H.status,w,j,H.headers)}return P0(this).info(B),P0(this).debug(`[${U}] response start`,i2({retryOfRequestLogID:z,url:H.url,status:H.status,headers:H.headers,durationMs:K-V})),{response:H,options:Q,controller:q,requestLogID:U,retryOfRequestLogID:z,startTime:V}}getAPIList($,Z,z){return this.requestAPIList(Z,z&&"then"in z?z.then((Q)=>({method:"get",path:$,...Q})):{method:"get",path:$,...z})}requestAPIList($,Z){let z=this.makeRequest(Z,null,void 0);return new w4(this,z,$)}async fetchWithTimeout($,Z,z,Q){let{signal:X,method:J,...Y}=Z||{},W=this._makeAbort(Q);if(X)X.addEventListener("abort",W,{once:!0});let U=setTimeout(W,z),G=globalThis.ReadableStream&&Y.body instanceof globalThis.ReadableStream||typeof Y.body==="object"&&Y.body!==null&&Symbol.asyncIterator in Y.body,V={signal:Q.signal,...G?{duplex:"half"}:{},method:"GET",...Y};if(J)V.method=J.toUpperCase();try{return await this.fetch.call(void 0,$,V)}finally{clearTimeout(U)}}async shouldRetry($){let Z=$.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,Z,z,Q){let X,J=Q?.get("retry-after-ms");if(J){let W=parseFloat(J);if(!Number.isNaN(W))X=W}let Y=Q?.get("retry-after");if(Y&&!X){let W=parseFloat(Y);if(!Number.isNaN(W))X=W*1000;else X=Date.parse(Y)-Date.now()}if(X===void 0){let W=$.maxRetries??this.maxRetries;X=this.calculateDefaultRetryTimeoutMillis(Z,W)}return await DV(X),this.makeRequest($,Z-1,z)}calculateDefaultRetryTimeoutMillis($,Z){let X=Z-$,J=Math.min(0.5*Math.pow(2,X),8),Y=1-Math.random()*0.25;return J*Y*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let z={...$},{method:Q,path:X,query:J,defaultBaseURL:Y}=z,W=this.buildURL(X,J,Y);if("timeout"in z)OV("timeout",z.timeout);z.timeout=z.timeout??this.timeout;let{bodyHeaders:U,body:G}=this.buildBody({options:z}),V=await this.buildHeaders({options:$,method:Q,bodyHeaders:U,retryCount:Z});return{req:{method:Q,headers:V,...z.signal&&{signal:z.signal},...globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"},...G&&{body:G},...this.fetchOptions??{},...z.fetchOptions??{}},url:W,timeout:z.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:z,retryCount:Q}){let X={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();X[this.idempotencyHeader]=$.idempotencyKey}let J=D([X,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(Q),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},..._V(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,z,$.headers]);return this.validateHeaders(J),J.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let z=D([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&z.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:qZ($)};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,vZ,"f").call(this,{body:$,headers:z})}}var $Q,ZQ,vZ,Hq,zQ="\\n\\nHuman:",QQ="\\n\\nAssistant:",_6;var XQ=v(()=>{l2();a6();s9();EV();p0();V0();Uz();qq();LZ();cz();ez();mz();tz();s9();Y0();BZ();a6();ZQ=W0,vZ=new WeakMap,$Q=new WeakSet,Hq=function(){return this.baseURL!=="https://api.anthropic.com"};W0.Anthropic=ZQ;W0.HUMAN_PROMPT=zQ;W0.AI_PROMPT=QQ;W0.DEFAULT_TIMEOUT=600000;W0.AnthropicError=k;W0.APIError=N0;W0.APIConnectionError=L6;W0.APIConnectionTimeoutError=c$;W0.APIUserAbortError=E0;W0.NotFoundError=i$;W0.ConflictError=n$;W0.RateLimitError=s$;W0.BadRequestError=p$;W0.AuthenticationError=l$;W0.InternalServerError=o$;W0.PermissionDeniedError=d$;W0.UnprocessableEntityError=r$;W0.toFile=y4;_6=class _6 extends W0{constructor(){super(...arguments);this.completions=new U1(this),this.messages=new X$(this),this.models=new V1(this),this.beta=new k0(this)}};_6.Completions=U1;_6.Messages=X$;_6.Models=V1;_6.Beta=k0});var Kq={};DQ(Kq,{toFile:()=>y4,default:()=>_6,UnprocessableEntityError:()=>r$,RateLimitError:()=>s$,PermissionDeniedError:()=>d$,PagePromise:()=>w4,NotFoundError:()=>i$,InternalServerError:()=>o$,HUMAN_PROMPT:()=>zQ,ConflictError:()=>n$,BaseAnthropic:()=>W0,BadRequestError:()=>p$,AuthenticationError:()=>l$,AnthropicError:()=>k,Anthropic:()=>_6,APIUserAbortError:()=>E0,APIPromise:()=>D6,APIError:()=>N0,APIConnectionTimeoutError:()=>c$,APIConnectionError:()=>L6,AI_PROMPT:()=>QQ});var Bq=v(()=>{XQ();Uz();LZ();XQ();V0();p0()});var vQ=oq(bQ(),1),{program:ax,createCommand:tx,createArgument:ex,createOption:$y,CommanderError:Zy,InvalidArgumentError:zy,InvalidOptionArgumentError:Qy,Command:gQ,Argument:Xy,Option:Jy,Help:Yy}=vQ.default;import{lstatSync as mY}from"fs";import{join as hY,dirname as A5,basename as gA,resolve as _$}from"path";import{execFileSync as hA}from"child_process";var ZT=d7(),zT=w1(),QT=E7(),Q3=x1(),XT=N1(),X6=o(),JT=e2(),YT=M0(),WT=Z6(),UT=z6(),Rk=Q5(),GT=$3(),VT=Z3(),qT=z3(),W5=dJ(),iJ=M1();var HT=ZT.Composer,U5=zT.Document,KT=QT.Schema,BT=Q3.YAMLError,G5=Q3.YAMLParseError,MT=Q3.YAMLWarning,LT=XT.Alias,x2=X6.isAlias,x6=X6.isCollection,NT=X6.isDocument,H0=X6.isMap,K2=X6.isNode,OT=X6.isPair,T0=X6.isScalar,y2=X6.isSeq,DT=JT.Pair,IT=YT.Scalar,N$=WT.YAMLMap,h1=UT.YAMLSeq;var TT=GT.Lexer,AT=VT.LineCounter,CT=qT.Parser,i0=W5.parse,_T=W5.parseAllDocuments,y6=W5.parseDocument,O$=W5.stringify,RT=iJ.visit,FT=iJ.visitAsync;import{accessSync as nJ,closeSync as q5,constants as rJ,existsSync as PT,fchmodSync as sJ,fchownSync as ST,fsyncSync as oJ,lstatSync as u1,mkdirSync as aJ,mkdtempSync as ET,openSync as U3,readdirSync as tJ,readFileSync as H5,readlinkSync as jT,realpathSync as wT,renameSync as xT,rmSync as eJ,statSync as D$,unlinkSync as $Y,writeFileSync as ZY}from"fs";import{randomBytes as yT}from"crypto";import{tmpdir as zY}from"os";import{basename as J6,dirname as k6,isAbsolute as QY,join as R2,relative as G3,resolve as Z2,sep as V5}from"path";class b extends Error{reason;path;onWrite;constructor($,Z,z,Q={}){super(z,Q.cause===void 0?void 0:{cause:Q.cause});this.name="SafePathError",this.reason=$,this.path=Z,this.onWrite=Q.onWrite===!0}}var j0=Object.freeze({claude:"CLAUDE.md",agents:"AGENTS.md",gemini:"GEMINI.md",cursorrules:".cursorrules",copilot:"copilot-instructions.md",memory:"MEMORY.md",llms:"llms.txt"}),kT=new Set(Object.values(j0).map(($)=>$.toLowerCase())),bT=($,Z)=>$.toLowerCase()===Z.toLowerCase(),X3=($)=>kT.has($.toLowerCase());function I$($){return $.split(/[\\/]/).some((Z)=>Z.toLowerCase()===".git")}var vT=/\.fafm?$/i,gT=/^[a-z][a-z0-9-]*$/,B2=($)=>wT.native($),Y6=($)=>$?.code;function m1($,Z){let z=G3($,Z);return z===""||z!==".."&&!z.startsWith(`..${V5}`)&&!QY(z)}function XY($){try{return jT($)}catch{return"?"}}function hT($,Z,z,Q){let X;try{X=B2(z)}catch(J){let Y=Y6(J);if(Y==="ENOENT"||Y==="ELOOP"||Y==="ENOTDIR")throw new b("dangling",Z,`${Z} is a link to ${XY(z)}, which does not exist. faf does not create files through a link — refused.`);throw J}if(!m1($,X))throw new b("outside",Z,`${Z} is a link to ${X}, outside ${$} — refused.`);if(I$(X)&&!(Q.inGit&&k6(X)===$))throw new b("git",Z,`${Z} is a link to ${X}, inside .git/ — refused.`);if(!D$(X).isFile())throw new b("not-a-file",Z,`${Z} is a link to ${X}, which is not a regular file — refused.`);return fT(Z,X,Q.read),X}function fT($,Z,z){let Q=J6($),X=J6(Z),J=X3(Q)&&X3(X);if(z&&!vT.test(X)&&!J){let Y=X3(Q)?"a .faf or .fafm file, nor another AI context file":"a .faf or .fafm file";throw new b("not-faf",$,`${$} is a link to ${Z}, which is not ${Y} — refused.`)}if(!z&&!bT(Q,X)&&!J)throw new b("other-file",$,`${$} is a link to ${Z}, a file with another name — refused (faf follows a link only to a file of the same name, or from one AI context file to another).`)}function uT($,Z,z,Q){if(J6(Z2($))!=="hooks"||!gT.test(J6(Z)))throw new b("git",Z,`${Z} is not a git hook in a hooks folder — refused.`);if(Q!==z)throw new b("git",Z,`${Z} is not directly in the hooks folder ${z} — refused.`)}function mT($,Z,z){if(J6($)!=="config"||z!==Z)throw new b("git",$,`${$} is not the git config file directly in ${Z} — refused.`)}function l($,Z,z={}){let Q=B2(Z2($)),X=Z2($,Z),J=B2(k6(X));if(!m1(Q,J))throw new b("outside",X,`${X} is in ${J}, outside ${Q} — refused.`);let Y=z.allowGitHooks===!0,W=z.allowGitConfig===!0;if(Y)uT($,X,Q,J);if(W)mT(X,Q,J);let U=R2(J,J6(X));if(I$(U)&&!Y&&!W)throw new b("git",X,U===X?`${X} is inside .git/ — refused.`:`${X} resolves to ${U}, inside .git/ — refused.`);let G;try{G=u1(U)}catch(V){if(Y6(V)==="ENOENT")return U;throw V}if(G.isSymbolicLink())return hT(Q,X,U,{read:z.read===!0,inGit:Y||W});if(!G.isFile())throw new b("not-a-file",X,`${X} is not a regular file — refused.`);return B2(U)}var cT=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function pT($,Z){if(!($.length>=2&&($[0]===255&&$[1]===254||$[0]===254&&$[1]===255)))try{return cT.decode($)}catch{}throw new b("not-utf8",Z,`${Z} is not UTF-8 — faf left it unchanged`)}function z0($){return pT(H5($),$)}function w0($){try{return H5($)}catch(Z){if(Y6(Z)==="ENOENT")return null;throw Z}}function f1($,Z){let z=Z2(R2($,Z));if(!PT(z))return null;let Q,X;try{Q=B2(lT($)),X=B2(z)}catch{return null}if(!m1(Q,X)||I$(G3(Q,X)))return null;return X}var Y3=[];function lT($){let Z=Z2($);return Y3.find((z)=>Z===z||Z.startsWith(z.endsWith(V5)?z:z+V5))??Z}function T$($,Z){Y3.push(Z2($));try{return Z()}finally{Y3.pop()}}function A($,Z){return f1($,Z)!==null}function f($,Z){let z=f1($,Z);if(z===null)return null;try{return D$(z).isFile()?H5(z,"utf-8"):null}catch{return null}}function M2($,Z){let z=f1($,Z);if(z===null)return null;try{return D$(z)}catch{return null}}function Q0($,Z="."){let z=f1($,Z);if(z===null)return null;let Q;try{Q=tJ(z,{withFileTypes:!0})}catch{return null}return Q.filter((X)=>!X.isSymbolicLink()||f1($,R2(Z,X.name))!==null)}function dT($){try{let Z=D$($);return{mode:Z.mode&511,perm:Z.mode&4095,uid:Z.uid,gid:Z.gid}}catch(Z){if(Y6(Z)==="ENOENT")return;throw Z}}class k2 extends Error{path;constructor($,Z,z={}){super(Z,{cause:z.cause});this.path=$}}var J3=($)=>new b("changed",$,`${$} changed on disk while faf was writing — not written; original kept`,{onWrite:!0});function V3($,Z,z){if(Z!==void 0){let X=w0($),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 J3($)}if(!z)return;let Q;try{Q=D$($)}catch(X){if(Y6(X)==="ENOENT")return;throw X}if((Q.mode&4095)!==z.perm)throw J3($);try{nJ($,rJ.W_OK)}catch{throw J3($)}}function iT($,Z){if(process.platform!=="win32")try{ST($,Z.uid,Z.gid)}catch{}sJ($,Z.mode)}function nT($){if(process.platform==="win32")return;try{let Z=U3($,"r");try{oJ(Z)}finally{q5(Z)}}catch{}}function rT($,Z,z,Q){if($.fd=U3($.path,"wx",Q??z?.mode??438),$.created=!0,ZY($.fd,Z),z)iT($.fd,z);if(Q!==void 0)sJ($.fd,Q);oJ($.fd),q5($.fd),$.fd=void 0}function sT($){if($.fd!==void 0)try{q5($.fd)}catch{}if($.created)try{$Y($.path)}catch{}}function oT($,Z,z){let Q=k6($),X={path:R2(Q,`.${J6($).slice(0,100)}.${process.pid}.${yT(6).toString("hex")}.faf-tmp`),created:!1},J=dT($);try{if(J)nJ($,rJ.W_OK);rT(X,Z,J,z.mode),V3($,z.expect,J),xT(X.path,$)}catch(Y){if(sT(X),Y instanceof b)throw Y;let W=Y6(Y)??(Y instanceof Error?Y.message:String(Y));throw new k2($,`${$}: not written${J?"; original kept":""} (${W})`,{cause:Y})}nT(Q)}function aT($){return $ instanceof b&&!$.onWrite?new b($.reason,$.path,$.message,{onWrite:!0}):$}function a($,Z,z={}){let Q=Z2($),X;try{X=l(z.root??k6(Q),Q,{allowGitHooks:z.allowGitHooks,allowGitConfig:z.allowGitConfig})}catch(J){throw aT(J)}return oT(X,Z,z),X}function F2($,Z,z){let Q=Z2($),X=z.root??k6(Q),J=l(X,Q),Y=w0(J);if(z.expect!==void 0)V3(J,z.expect,void 0);if(Y!==null&&z.force!==!0&&!z.owns(Y))throw new b("not-owned",Q,`${Q} has no ${z.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});return a(J,Z,{root:X,expect:Y})}function S0($,Z=$){let z=Z2($);aJ(z,{recursive:!0});let Q=B2(z),X=Z2(z,Z),J=G3(z,X);if(J===".."||J.startsWith(`..${V5}`)||QY(J))throw new b("outside",X,`${X} is outside ${Q} — refused.`,{onWrite:!0});let Y=Q;for(let W of J.split(/[\\/]/).filter(Boolean)){let U=R2(Y,W);if(I$(U))throw new b("git",X,`${X} runs through ${U}, inside .git/ — refused.`,{onWrite:!0});Y=tT(Q,X,U)}return Y}function tT($,Z,z){let Q;try{Q=u1(z)}catch(J){if(Y6(J)!=="ENOENT")throw J;return aJ(z),z}let X=z;if(Q.isSymbolicLink()){try{X=B2(z)}catch{throw new b("dangling",Z,`${z} is a link to ${XY(z)}, which does not exist. faf does not create folders through a link — refused.`,{onWrite:!0})}if(!m1($,X))throw new b("outside",Z,`${z} is a link to ${X}, outside ${$} — refused.`,{onWrite:!0});if(I$(X))throw new b("git",Z,`${z} is a link to ${X}, inside .git/ — refused.`,{onWrite:!0})}if(!D$(X).isDirectory())throw new b("not-a-file",Z,`${z} is not a folder — refused.`,{onWrite:!0});return X}function K5($,Z){let z=Z2($),Q=B2(Z2(Z.root??k6(z))),X=B2(k6(z));if(!m1(Q,X))throw new b("outside",z,`${z} is in ${X}, outside ${Q} — refused.`,{onWrite:!0});let J=R2(X,J6(z));if(I$(J))throw new b("git",z,`${z} is inside .git/ — refused.`,{onWrite:!0});let Y;try{Y=u1(J)}catch(W){if(Y6(W)==="ENOENT")return!1;throw W}if(!Y.isFile())throw new b("not-a-file",z,`${z} is not a regular file faf wrote — left as it is.`,{onWrite:!0});return V3(J,Z.expect,void 0),$Y(J),!0}var W3=new Set,JY=".faf-temp",YY="faf made this temp folder; `faf clear` removes it.\n";function B5($){let Z=B2(ET(R2(zY(),$)));W3.add(Z);let z=U3(R2(Z,JY),"wx",420);try{ZY(z,YY)}finally{q5(z)}return Z}function M5($){if(!W3.has($))throw Error(`${$} is not a temp folder faf made — not removed`);eJ($,{recursive:!0,force:!0}),W3.delete($)}function eT($){let Z=R2($,JY);try{if(!u1(Z).isFile())return!1;return H5(Z,"utf-8")===YY}catch{return!1}}var $A=($)=>$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function WY($){let Z=zY(),z=typeof process.getuid==="function"?process.getuid():void 0,Q=new RegExp(`^${$A($)}[A-Za-z0-9]{6}$`),X=0;for(let J of tJ(Z)){if(!Q.test(J))continue;let Y=R2(Z,J);try{let W=u1(Y);if(!W.isDirectory()||z!==void 0&&W.uid!==z||!eT(Y))continue;eJ(Y,{recursive:!0,force:!0}),X++}catch{}}return X}function $0($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function b6($){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 c1($,Z){if($===null||$===void 0)return{};if(!$0($))throw new b("not-yaml",Z,`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${b6($)}. `+"faf left it unchanged — fix it by hand.");return $}var X0=[{index:1,path:"project.name",label:"Name",description:"Project name",category:"project"},{index:2,path:"project.goal",label:"Goal",description:"Goal (use case)",category:"project"},{index:3,path:"project.main_language",label:"Language",description:"Primary language",category:"project"},{index:4,path:"human_context.who",label:"Who",description:"Who is this for?",category:"human"},{index:5,path:"human_context.what",label:"What",description:"What are they building",category:"human"},{index:6,path:"human_context.why",label:"Why",description:"Why does it exist",category:"human"},{index:7,path:"human_context.where",label:"Where",description:"Where does it run",category:"human"},{index:8,path:"human_context.when",label:"When",description:"When was it started / timeline",category:"human"},{index:9,path:"human_context.how",label:"How",description:"How is it built",category:"human"},{index:10,path:"stack.frontend",canonical:"stack.framework",label:"Framework",description:"Framework (React, Svelte, etc.)",category:"frontend"},{index:11,path:"stack.css_framework",canonical:"stack.css",label:"CSS",description:"CSS framework",category:"frontend"},{index:12,path:"stack.ui_library",label:"UI Library",description:"UI component library",category:"frontend"},{index:13,path:"stack.state_management",canonical:"stack.state",label:"State",description:"State management",category:"frontend"},{index:14,path:"stack.backend",label:"Backend",description:"Backend framework",category:"backend"},{index:15,path:"stack.api_type",canonical:"stack.api",label:"API",description:"API style (REST, GraphQL, etc.)",category:"backend"},{index:16,path:"stack.runtime",label:"Runtime",description:"Runtime (Node, Bun, Python, etc.)",category:"backend"},{index:17,path:"stack.database",canonical:"stack.db",label:"Database",description:"Database",category:"backend"},{index:18,path:"stack.connection",label:"Connection",description:"Connection method (Prisma, etc.)",category:"backend"},{index:19,path:"stack.hosting",label:"Hosting",description:"Hosting platform",category:"universal"},{index:20,path:"stack.build",label:"Build",description:"Build tool",category:"universal"},{index:21,path:"stack.cicd",label:"CI/CD",description:"CI/CD",category:"universal"},{index:22,path:"stack.monorepo_tool",label:"Monorepo",description:"Monorepo tool",category:"enterprise_infra"},{index:23,path:"stack.package_manager",canonical:"stack.pkg_manager",label:"Package Manager",description:"Package manager",category:"enterprise_infra"},{index:24,path:"stack.workspaces",label:"Workspaces",description:"Workspace configuration",category:"enterprise_infra"},{index:25,path:"monorepo.packages_count",label:"Packages",description:"Number of packages",category:"enterprise_infra"},{index:26,path:"monorepo.build_orchestrator",label:"Build Orchestrator",description:"Build orchestration tool",category:"enterprise_infra"},{index:27,path:"stack.admin",label:"Admin",description:"Admin panel",category:"enterprise_app"},{index:28,path:"stack.cache",label:"Cache",description:"Caching layer",category:"enterprise_app"},{index:29,path:"stack.search",label:"Search",description:"Search engine",category:"enterprise_app"},{index:30,path:"stack.storage",label:"Storage",description:"Object storage",category:"enterprise_app"},{index:31,path:"monorepo.versioning_strategy",label:"Versioning",description:"Version strategy",category:"enterprise_ops"},{index:32,path:"monorepo.shared_configs",label:"Shared Configs",description:"Shared configs",category:"enterprise_ops"},{index:33,path:"monorepo.remote_cache",label:"Remote Cache",description:"Remote build cache",category:"enterprise_ops"}],W6=new Map(X0.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),UY=new Map(X0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),kk=new Map(X0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function p1($,Z){let z=(X)=>{let J=X.split("."),Y=$;for(let W of J)if(Y&&typeof Y==="object"&&W in Y)Y=Y[W];else return;return Y},Q=z(Z.path);if(Q!==void 0)return Q;if(Z.canonical)return z(Z.canonical);return}var bk=X0.filter(($)=>$.index<=21);var q3=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","n/a","not applicable"]);var l1="slotignored";function A$($){return typeof $==="string"&&$.trim()!==""&&U0($)}function U0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return q3.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var C$="no classifying signals — fallback",ZA=new Set(["stack.css_framework","stack.ui_library","stack.database","stack.connection","stack.hosting"]);function g6($,Z){if(typeof $!=="string"||!Object.prototype.hasOwnProperty.call(v6,$))return null;if(!v6[$].includes(Z.category))return!1;return!($==="framework"&&ZA.has(Z.path))}var v6={documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],cli:["project","human","universal"],library:["project","human","universal"],sdk:["project","human","universal"],wasm:["project","human","universal"],html:["project","human","universal"],"server-card":["project","human","universal"],frontend:["project","frontend","human","universal"],website:["project","frontend","human","universal"],mobile:["project","frontend","human","universal"],app:["project","frontend","human","universal"],extension:["project","frontend","human","universal"],mcp:["project","backend","human","universal"],backend:["project","backend","universal","human"],"data-science":["project","backend","human","universal"],fullstack:["project","frontend","backend","universal","human"],svelte:["project","frontend","backend","universal","human"],framework:["project","frontend","backend","universal","human"],"monorepo-root":["project","human","enterprise_infra","enterprise_app","enterprise_ops"],mcpaas:["project","backend","universal","human","enterprise_app","enterprise_ops"],saas:["project","frontend","backend","universal","human","enterprise_app"],enterprise:["project","frontend","backend","universal","human","enterprise_infra","enterprise_app","enterprise_ops"]};var BY=new Set(["tag:yaml.org,2002:int","tag:yaml.org,2002:float"]);function GY($){return typeof $==="object"&&$.collection===void 0}function zA($,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||!BY.has(Q.tag))return;let X;try{X=Q.resolve(z,()=>{return},{})}catch{return}return Object.is(T0(X)?X.value:X,$.value)?z:void 0}function QA($){let Z=$.filter(GY);return $.map((z)=>{if(!GY(z)||!BY.has(z.tag)||!z.stringify)return z;let Q=z.stringify;return{...z,stringify:(X,J,Y,W)=>zA(X,Z)??Q(X,J,Y,W)}})}var L5={keepSourceTokens:!0,customTags:QA};function XA($,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 JA($){let Z=$.split(/\r?\n/),z,Q;for(let X=0;X+1<Z.length;X++){let J=XA(Z[X],Z[X+1]);z??=J.indent,Q??=J.indentSeq}return{indent:z??2,indentSeq:Q??!0}}function L3($,Z){let z=y6($,L5);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 h6($,Z,z,Q){$.edits.push({start:Z,end:z,text:Q,seq:$.edits.length})}function d1($,Z){return $.lastIndexOf(`
207
+ `,Z-1)+1}function MY($,Z){if(Z>0&&$[Z-1]===`
208
208
  `)return Z;let z=$.indexOf(`
209
- `,Z);return z<0?$.length:z+1}function YY($,Z){let z=Z;if($[z-1]===`
210
- `){if(z--,$[z-1]==="\r")z--}return z}function L2($){return $!==null&&$!==void 0}function u0($){let Z=K2($)?$.range:void 0;return Z?[Z[0],Z[1],Z[2]]:void 0}function qY($,Z){let z=u0($),Q=u0(Z);return!!z&&!!Q&&z[0]===Q[0]&&z[1]===Q[1]&&z[2]===Q[2]&&$.constructor===Z.constructor}function KY($){if(T0($))return $.type==="BLOCK_LITERAL"||$.type==="BLOCK_FOLDED";return w6($)&&!$.flow}function B5($,Z){return $.anchor===Z.anchor&&$.tag===Z.tag&&$.comment===Z.comment&&$.commentBefore===Z.commentBefore&&!!$.spaceBefore===!!Z.spaceBefore}function BY($,Z){return Object.is($.value,Z.value)&&$.type===Z.type&&$.format===Z.format&&$.minFractionDigits===Z.minFractionDigits&&B5($,Z)}function MY($,Z,z,Q){let X=new J5(void 0,K5);X.contents=Z(X);let Y=X.toString($.piece).replace(/\n+$/,"").slice(z),W=Y.startsWith(" ")&&!Y.includes(`
209
+ `,Z);return z<0?$.length:z+1}function VY($,Z){let z=Z;if($[z-1]===`
210
+ `){if(z--,$[z-1]==="\r")z--}return z}function L2($){return $!==null&&$!==void 0}function u0($){let Z=K2($)?$.range:void 0;return Z?[Z[0],Z[1],Z[2]]:void 0}function LY($,Z){let z=u0($),Q=u0(Z);return!!z&&!!Q&&z[0]===Q[0]&&z[1]===Q[1]&&z[2]===Q[2]&&$.constructor===Z.constructor}function NY($){if(T0($))return $.type==="BLOCK_LITERAL"||$.type==="BLOCK_FOLDED";return x6($)&&!$.flow}function N5($,Z){return $.anchor===Z.anchor&&$.tag===Z.tag&&$.comment===Z.comment&&$.commentBefore===Z.commentBefore&&!!$.spaceBefore===!!Z.spaceBefore}function OY($,Z){return Object.is($.value,Z.value)&&$.type===Z.type&&$.format===Z.format&&$.minFractionDigits===Z.minFractionDigits&&N5($,Z)}function DY($,Z,z,Q){let X=new U5(void 0,L5);X.contents=Z(X);let Y=X.toString($.piece).replace(/\n+$/,"").slice(z),W=Y.startsWith(" ")&&!Y.includes(`
211
211
  `),U=" ".repeat(Q),G=Y.replace(/\n(?=.)/g,`
212
- ${U}`).replace(/\n/g,$.eol);return{inline:W,text:W?Y.slice(1):G}}function V3($,Z,z){return MY($,(Q)=>{let X=new L$;return X.items.push(Q.createPair("k",Z)),X},2,z)}function eT($,Z,z){let Q=MY($,()=>{let X=new b1;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 $A($){if(!K2($)||!L2($.comment))return $;let Z=$.clone();return Z.comment=void 0,Z}function ZA($,Z){if(!K2($)||!K2(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 zA($,Z){let z=u0(Z);if(!z)return-1;let Q=z[2];while($[Q]===" "||$[Q]==="\t")Q++;return $[Q]===":"?Q+1:-1}function QA($,Z,z){let Q=$[Z-1]===" "||$[Z-1]==="\t"?"":" ",X=$[Z]==="#"?" ":"";return`${Q}${z}${X}`}function WY($,Z,z,Q,X=!1){let J=u0(Z);if(!J||Q.kind==="root")return null;let Y=Z.comment,W=K2(z)?z.comment:void 0,U=!L2(Y)||Y===W,G=U?$A(z):z,V=X?G:ZA(Z,G),H=Q.kind==="value"?V3($,V,Q.col):eT($,V,Q.col);return H?{range:J,keepTail:U,newComment:W,piece:H}:null}function XA($,Z,z,Q){if(!Q)return YY($,HY($,z[2]));return KY(Z)?YY($,z[1]):z[1]}function p1($,Z,z,Q,X){let J=WY($,Z,z,Q);if(!J)return!1;let Y=XA($.src,Z,J.range,J.keepTail);if(J.piece.inline&&(!KY(Z)||Q.kind==="item"))return JA($,J,Y,Q,X),!0;let W=J.keepTail?Z.comment:J.newComment;if(X!==void 0||L2(W))return!1;let U=Q.kind==="value"?WY($,Z,z,Q,!0):J;return U!==null&&YA($,U.range[0],Y,U.piece,Q)}function JA($,Z,z,Q,X){let[J,Y]=Z.range,U=J===Y&&Q.kind==="value"?QA($.src,J,Z.piece.text):Z.piece.text;g6($,J,z,U+(X===void 0?"":` #${X}`))}function YA($,Z,z,Q,X){if(X.kind==="item")return g6($,Z,z,Q.text),!0;if(X.kind!=="value")return!1;let J=zA($.src,X.key);if(J<0)return!1;return g6($,J,z,Q.inline?` ${Q.text}`:Q.text),!0}function WA($,Z){return B5({...$,comment:void 0},{...Z,comment:void 0})}function UA($,Z){if(L2($.comment)||typeof Z.comment!=="string")return;return Z.comment.includes(`
213
- `)?void 0:Z.comment}function GA($,Z,z,Q){if(BY(Z,z))return!0;if(!WA(Z,z))return!1;let X=UA(Z,z);if(Z.comment!==z.comment&&X===void 0)return!1;return p1($,Z,z,Q,X)}function VA($,Z,z,Q){if(!B5(Z,z)||!!Z.flow!==!!z.flow)return!1;if(Z.flow)return V3($,Z,0).text===V3($,z,0).text||p1($,Z,z,Q);if(z.items.length===0)return p1($,Z,z,Q);return q0(Z)?BA($,Z,z):LA($,Z,z)}function B3($,Z,z,Q){if(!qY(Z,z))return p1($,Z,z,Q);if(T0(Z))return GA($,Z,z,Q);if(x2(Z))return x2(z)&&Z.source===z.source&&B5(Z,z)||p1($,Z,z,Q);if(!w6(Z)||!w6(z))return!1;return VA($,Z,z,Q)}function LY($,Z){return Z-c1($,Z)}function M3($,Z,z){let Q=$.slice(c1($,Z),Z);return z?/^ *- +$/.test(Q)||/^ *$/.test(Q):/^ *$/.test(Q)}function H3($){return K2($)&&(L2($.commentBefore)||!!$.spaceBefore)}function L3($,Z,z){let Q=u0(Z)??u0(z);return Q?HY($.src,Q[2]):-1}function NY($,Z,z){let Q=new J5(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 HA($,Z,z){let Q=Z===$.src.length&&Z>0&&!$.src.endsWith(`
215
- `);g6($,Z,Z,Q?$.eol+z.slice(0,-$.eol.length):z)}function OY($,Z,z,Q,X,J){let Y=z;if(Y<0){let W=u0(Z);if(!W||H3(Z)||!M3($.src,W[0],J))return!1;Y=c1($.src,W[0])}return HA($,Y,NY($,Q,X)),!0}function qA($,Z,z){let Q=c1($,z),X=Z,J=L2(X.commentBefore),Y=!!X.spaceBefore;while(Q>0){let W=c1($,Q-1),U=$.slice(W,Q).trim();if(J&&U.startsWith("#"))Q=W;else if(Y&&U==="")Q=W,Y=!1;else break}return Q}function DY($,Z,z,Q){let X=u0(Z);if(!X||!M3($.src,X[0],Q))return!1;let J=L3($,z,Z);if(J<0)return!1;return g6($,qA($.src,Z,X[0]),J,""),!0}function IY($,Z){let z=new Map,Q=(X)=>{let J=u0(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&&qY(Z($[Y]),Z(X))?Y:-1}}function KA($,Z){return T0($)&&T0(Z)?BY($,Z):$===Z}function BA($,Z,z){let Q=Z.items[0]?.key,X=u0(Q);if(!X)return!1;let J=LY($.src,X[0]),Y=new Set,W=(H,q)=>{if(H.length===0)return!0;let K=new L$;K.items.push(...H);let L=q<0?-1:L3($,Z.items[q].value,Z.items[q].key);return OY($,Q,L,K,J,!1)},U=IY(Z.items,(H)=>H.key),G=-1,V=[];for(let H of z.items){let q=U(H);if(q<0){V.push(H);continue}if(q<=G||!W(V,G)||!KA(Z.items[q].key,H.key))return!1;if(V=[],!B3($,Z.items[q].value,H.value,{kind:"value",key:Z.items[q].key,col:J}))return!1;Y.add(q),G=q}if(!W(V,G))return!1;return Z.items.every((H,q)=>Y.has(q)||MA($,Z,q))}function MA($,Z,z){let Q=Z.items[z],X=u0(Q.key);if(!X)return!1;if(M3($.src,X[0],!1))return DY($,Q.key,Q.value,!1);let J=Z.items[z+1],Y=u0(J?.key);if(z!==0||!Y||H3(Q.key)||H3(J.key))return!1;return g6($,X[0],Y[0],""),!0}function LA($,Z,z){let Q=u0(Z);if(!Q||Z.items.length===0)return!1;let X=LY($.src,Q[0]),J=new Set,Y=(V,H)=>{if(V.length===0)return!0;let q=new b1;q.items.push(...V);let K=H<0?-1:L3($,Z.items[H]);return OY($,Z.items[0],K,q,X,!0)},W=IY(Z.items,(V)=>V),U=-1,G=[];for(let V of z.items){let H=W(V);if(H<0){G.push(V);continue}if(H<=U||!Y(G,U))return!1;if(G=[],!B3($,Z.items[H],V,{kind:"item",col:X}))return!1;J.add(H),U=H}if(!Y(G,U))return!1;return Z.items.every((V,H)=>J.has(H)||DY($,V,V,!0))}function NA($,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 OA($,Z,z){if(!q0(z)&&!y2(z))return!1;let Q=$.src.length>0&&!$.src.endsWith(`
216
- `)?$.eol:"",X=Z.commentBefore?$.eol:"";return g6($,$.src.length,$.src.length,Q+X+NY($,z,0)),!0}function DA($,Z,z){if(Z.commentBefore!==z.commentBefore||Z.comment!==z.comment)return!1;let Q=Z.contents,X=z.contents;if(!L2(Q))return!L2(X)||OA($,Z,X);return L2(X)&&B3($,Q,X,{kind:"root"})}function IA($,Z,z,Q,X){let J={src:$,eol:Q,edits:[],piece:X};if(!DA(J,Z,z))return null;return NA($,J.edits)}var UY=($)=>$.replace(/^[ \t]*\n/gm,"");function TA($,Z,z,Q){let X=x6($,K5);if(X.errors.length>0||!K0(X.toJS(),Z.toJS()))return!1;let J=X.toString(Q);return J===z||UY(J)===UY(z)}function M5($,Z,z="YAML"){let{text:Q,changed:X}=AA($,Z,z);return{text:Q,changed:X}}function AA($,Z,z="YAML"){let Q=$.startsWith("\uFEFF")?"\uFEFF":"",X=$.slice(Q.length),J=K3(X,z),Y=CA(J);Z(Y);let W={text:$,changed:!1,spliced:!1};if(K0(Y.toJS(),J.toJS()))return W;let U={lineWidth:0,...tT(X)},G=Y.toString(U);if(G===J.toString(U))return W;let V=X.includes(`\r
212
+ ${U}`).replace(/\n/g,$.eol);return{inline:W,text:W?Y.slice(1):G}}function K3($,Z,z){return DY($,(Q)=>{let X=new N$;return X.items.push(Q.createPair("k",Z)),X},2,z)}function YA($,Z,z){let Q=DY($,()=>{let X=new h1;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 WA($){if(!K2($)||!L2($.comment))return $;let Z=$.clone();return Z.comment=void 0,Z}function UA($,Z){if(!K2($)||!K2(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 GA($,Z){let z=u0(Z);if(!z)return-1;let Q=z[2];while($[Q]===" "||$[Q]==="\t")Q++;return $[Q]===":"?Q+1:-1}function VA($,Z,z){let Q=$[Z-1]===" "||$[Z-1]==="\t"?"":" ",X=$[Z]==="#"?" ":"";return`${Q}${z}${X}`}function qY($,Z,z,Q,X=!1){let J=u0(Z);if(!J||Q.kind==="root")return null;let Y=Z.comment,W=K2(z)?z.comment:void 0,U=!L2(Y)||Y===W,G=U?WA(z):z,V=X?G:UA(Z,G),q=Q.kind==="value"?K3($,V,Q.col):YA($,V,Q.col);return q?{range:J,keepTail:U,newComment:W,piece:q}:null}function qA($,Z,z,Q){if(!Q)return VY($,MY($,z[2]));return NY(Z)?VY($,z[1]):z[1]}function i1($,Z,z,Q,X){let J=qY($,Z,z,Q);if(!J)return!1;let Y=qA($.src,Z,J.range,J.keepTail);if(J.piece.inline&&(!NY(Z)||Q.kind==="item"))return HA($,J,Y,Q,X),!0;let W=J.keepTail?Z.comment:J.newComment;if(X!==void 0||L2(W))return!1;let U=Q.kind==="value"?qY($,Z,z,Q,!0):J;return U!==null&&KA($,U.range[0],Y,U.piece,Q)}function HA($,Z,z,Q,X){let[J,Y]=Z.range,U=J===Y&&Q.kind==="value"?VA($.src,J,Z.piece.text):Z.piece.text;h6($,J,z,U+(X===void 0?"":` #${X}`))}function KA($,Z,z,Q,X){if(X.kind==="item")return h6($,Z,z,Q.text),!0;if(X.kind!=="value")return!1;let J=GA($.src,X.key);if(J<0)return!1;return h6($,J,z,Q.inline?` ${Q.text}`:Q.text),!0}function BA($,Z){return N5({...$,comment:void 0},{...Z,comment:void 0})}function MA($,Z){if(L2($.comment)||typeof Z.comment!=="string")return;return Z.comment.includes(`
213
+ `)?void 0:Z.comment}function LA($,Z,z,Q){if(OY(Z,z))return!0;if(!BA(Z,z))return!1;let X=MA(Z,z);if(Z.comment!==z.comment&&X===void 0)return!1;return i1($,Z,z,Q,X)}function NA($,Z,z,Q){if(!N5(Z,z)||!!Z.flow!==!!z.flow)return!1;if(Z.flow)return K3($,Z,0).text===K3($,z,0).text||i1($,Z,z,Q);if(z.items.length===0)return i1($,Z,z,Q);return H0(Z)?TA($,Z,z):CA($,Z,z)}function N3($,Z,z,Q){if(!LY(Z,z))return i1($,Z,z,Q);if(T0(Z))return LA($,Z,z,Q);if(x2(Z))return x2(z)&&Z.source===z.source&&N5(Z,z)||i1($,Z,z,Q);if(!x6(Z)||!x6(z))return!1;return NA($,Z,z,Q)}function IY($,Z){return Z-d1($,Z)}function O3($,Z,z){let Q=$.slice(d1($,Z),Z);return z?/^ *- +$/.test(Q)||/^ *$/.test(Q):/^ *$/.test(Q)}function B3($){return K2($)&&(L2($.commentBefore)||!!$.spaceBefore)}function D3($,Z,z){let Q=u0(Z)??u0(z);return Q?MY($.src,Q[2]):-1}function TY($,Z,z){let Q=new U5(void 0,L5);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 OA($,Z,z){let Q=Z===$.src.length&&Z>0&&!$.src.endsWith(`
215
+ `);h6($,Z,Z,Q?$.eol+z.slice(0,-$.eol.length):z)}function AY($,Z,z,Q,X,J){let Y=z;if(Y<0){let W=u0(Z);if(!W||B3(Z)||!O3($.src,W[0],J))return!1;Y=d1($.src,W[0])}return OA($,Y,TY($,Q,X)),!0}function DA($,Z,z){let Q=d1($,z),X=Z,J=L2(X.commentBefore),Y=!!X.spaceBefore;while(Q>0){let W=d1($,Q-1),U=$.slice(W,Q).trim();if(J&&U.startsWith("#"))Q=W;else if(Y&&U==="")Q=W,Y=!1;else break}return Q}function CY($,Z,z,Q){let X=u0(Z);if(!X||!O3($.src,X[0],Q))return!1;let J=D3($,z,Z);if(J<0)return!1;return h6($,DA($.src,Z,X[0]),J,""),!0}function _Y($,Z){let z=new Map,Q=(X)=>{let J=u0(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&&LY(Z($[Y]),Z(X))?Y:-1}}function IA($,Z){return T0($)&&T0(Z)?OY($,Z):$===Z}function TA($,Z,z){let Q=Z.items[0]?.key,X=u0(Q);if(!X)return!1;let J=IY($.src,X[0]),Y=new Set,W=(q,H)=>{if(q.length===0)return!0;let K=new N$;K.items.push(...q);let L=H<0?-1:D3($,Z.items[H].value,Z.items[H].key);return AY($,Q,L,K,J,!1)},U=_Y(Z.items,(q)=>q.key),G=-1,V=[];for(let q of z.items){let H=U(q);if(H<0){V.push(q);continue}if(H<=G||!W(V,G)||!IA(Z.items[H].key,q.key))return!1;if(V=[],!N3($,Z.items[H].value,q.value,{kind:"value",key:Z.items[H].key,col:J}))return!1;Y.add(H),G=H}if(!W(V,G))return!1;return Z.items.every((q,H)=>Y.has(H)||AA($,Z,H))}function AA($,Z,z){let Q=Z.items[z],X=u0(Q.key);if(!X)return!1;if(O3($.src,X[0],!1))return CY($,Q.key,Q.value,!1);let J=Z.items[z+1],Y=u0(J?.key);if(z!==0||!Y||B3(Q.key)||B3(J.key))return!1;return h6($,X[0],Y[0],""),!0}function CA($,Z,z){let Q=u0(Z);if(!Q||Z.items.length===0)return!1;let X=IY($.src,Q[0]),J=new Set,Y=(V,q)=>{if(V.length===0)return!0;let H=new h1;H.items.push(...V);let K=q<0?-1:D3($,Z.items[q]);return AY($,Z.items[0],K,H,X,!0)},W=_Y(Z.items,(V)=>V),U=-1,G=[];for(let V of z.items){let q=W(V);if(q<0){G.push(V);continue}if(q<=U||!Y(G,U))return!1;if(G=[],!N3($,Z.items[q],V,{kind:"item",col:X}))return!1;J.add(q),U=q}if(!Y(G,U))return!1;return Z.items.every((V,q)=>J.has(q)||CY($,V,V,!0))}function _A($,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 RA($,Z,z){if(!H0(z)&&!y2(z))return!1;let Q=$.src.length>0&&!$.src.endsWith(`
216
+ `)?$.eol:"",X=Z.commentBefore?$.eol:"";return h6($,$.src.length,$.src.length,Q+X+TY($,z,0)),!0}function FA($,Z,z){if(Z.commentBefore!==z.commentBefore||Z.comment!==z.comment)return!1;let Q=Z.contents,X=z.contents;if(!L2(Q))return!L2(X)||RA($,Z,X);return L2(X)&&N3($,Q,X,{kind:"root"})}function PA($,Z,z,Q,X){let J={src:$,eol:Q,edits:[],piece:X};if(!FA(J,Z,z))return null;return _A($,J.edits)}var HY=($)=>$.replace(/^[ \t]*\n/gm,"");function SA($,Z,z,Q){let X=y6($,L5);if(X.errors.length>0||!K0(X.toJS(),Z.toJS()))return!1;let J=X.toString(Q);return J===z||HY(J)===HY(z)}function O5($,Z,z="YAML"){let{text:Q,changed:X}=EA($,Z,z);return{text:Q,changed:X}}function EA($,Z,z="YAML"){let Q=$.startsWith("\uFEFF")?"\uFEFF":"",X=$.slice(Q.length),J=L3(X,z),Y=jA(J);Z(Y);let W={text:$,changed:!1,spliced:!1};if(K0(Y.toJS(),J.toJS()))return W;let U={lineWidth:0,...JA(X)},G=Y.toString(U);if(G===J.toString(U))return W;let V=X.includes(`\r
217
217
  `)?`\r
218
218
  `:`
219
- `,H=IA(X,J,Y,V,{...U,verifyAliasOrder:!1}),q=H!==null&&TA(H,Y,G,U),K=q&&H!==null?H:G.replace(/\r?\n/g,V);return{text:Q+K,changed:Q+K!==$,spliced:q}}function CA($){let Z=$.clone();if($.directives&&Z.directives)Z.directives.docEnd=$.directives.docEnd;return Z}function K0($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>K0(z,Z[Q]));if($0($)&&$0(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&K0($[Q],Z[Q]))}return!1}function d1($){let Z=T0($.key)?$.key.value:$.key;return typeof Z==="string"||typeof Z==="number"||typeof Z==="boolean"?String(Z):void 0}function U6($,Z){return $.items.find((z)=>d1(z)===Z)}function TY($,Z){return K2(Z)?Z.toJS($):Z}function _A($,Z,z,Q){return Q.keepAliases===!0&&x2(Z)||K0(TY($,Z),z)}function L5($,Z,z,Q={}){if(_A($,Z,z,Q))return Z;if($0(z)&&q0(Z))return FA($,Z,z,Q),Z;if(Array.isArray(z)&&y2(Z))return EA($,Z,z,Q),Z;if(!$0(z)&&!Array.isArray(z)&&T0(Z))return Z.value=z,Z;return RA(Z,$.createNode(z))}function RA($,Z){if(!T0($)&&!x2($))return Z;let z=$,Q=Z;if(w6(Z)&&Z.items.length>0&&!Z.flow)return Q.commentBefore=G3(Q.commentBefore,z.commentBefore,z.comment),Z;if(w6(Z))Z.flow=!0;return Q.comment=G3(Q.comment??z.comment),Q.commentBefore=G3(Q.commentBefore??z.commentBefore),Z}function G3(...$){let Z=$.filter(L2);return Z.length>0?Z.join(`
220
- `):void 0}function FA($,Z,z,Q={}){for(let[X,J]of Object.entries(z)){if(J===void 0)continue;let Y=U6(Z,X);if(Y)Y.value=L5($,Y.value,J,Q);else Z.items.push($.createPair(X,J))}if(!Q.prune)return;Z.items=Z.items.filter((X)=>{let J=d1(X);return J===void 0||z[J]!==void 0})}function N3($,Z,z,Q){let X=$0(z)?z:{};for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let W=U6(Z,J);if(!W)Z.items.push($.createPair(J,Y));else if(Object.prototype.hasOwnProperty.call(X,J)&&K0(X[J],Y))continue;else if($0(Y)&&$0(X[J])&&q0(W.value))N3($,W.value,X[J],Y);else W.value=L5($,W.value,Y,{keepAliases:!0})}}function l1($,Z,z){if(x2($))z.push({path:[...Z],node:$});else if(q0($))for(let Q of $.items){let X=d1(Q);if(X!==void 0)l1(Q.value,[...Z,X],z)}else if(y2($))$.items.forEach((Q,X)=>l1(Q,[...Z,X],z))}function GY($,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 AY($,Z,z){let Q=[];return l1($.contents,[],Q),Q.filter(({path:X,node:J})=>{let Y=GY(Z,X);return Y!==void 0&&!K0(GY(z,X),Y)&&!K0(J.toJS($),Y)}).map(({path:X,node:J})=>({path:X.join("."),alias:`*${J.source}`}))}function CY($,Z){let z=$.contents;for(let X=0;X<Z.length-1&&z!==void 0;X++)z=PA(z,Z[X]);let Q=Z[Z.length-1];if(q0(z)&&typeof Q==="string"){let X=U6(z,Q);return X?{node:X.value,put:(J)=>(X.value=J,!0)}:null}if(y2(z)&&typeof Q==="number"&&Q<z.items.length){let X=z,J=X.items[Q];return{node:J,put:(Y)=>u0(J)===void 0?(X.items[Q]=Y,!0):!1}}return null}function PA($,Z){if(q0($)&&typeof Z==="string")return U6($,Z)?.value;if(y2($)&&typeof Z==="number")return $.items[Z];return}function _Y($,Z){let z=[];l1($.contents,[],z);let Q=[];for(let{path:X,node:J}of z){let Y=CY(Z,X);if(!Y||x2(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 q3($,Z,z,Q){if(!K2($)||x2($))return;let X=$.anchor;if(X&&z.has(X))Q.push({path:[...Z],node:$});if(q0($))for(let J of $.items){let Y=d1(J);if(Y!==void 0)q3(J.value,[...Z,Y],z,Q)}else if(y2($))$.items.forEach((J,Y)=>q3(J,[...Z,Y],z,Q))}function RY($,Z){let z=[];l1($.contents,[],z);let Q=new Set(z.map((Y)=>Y.node.source));if(Q.size===0)return[];let X=[];q3($.contents,[],Q,X);let J=[];for(let{path:Y,node:W}of X){let U=CY(Z,Y);if(!U)continue;let G=W.anchor;if(K2(U.node)&&U.node.anchor===G&&K0(W.toJS($),U.node.toJS(Z))||!U.put(W.clone()))continue;J.push({path:Y.join("."),alias:`&${G}`,kind:"anchor"})}return J}function SA($,Z){let z=$.length,Q=Z.length,X=Array.from({length:z+1},()=>Array(Q+1).fill(0));for(let Y=z-1;Y>=0;Y--)for(let W=Q-1;W>=0;W--)X[Y][W]=K0($[Y],Z[W])?X[Y+1][W+1]+1:Math.max(X[Y+1][W],X[Y][W+1]);let J=[];for(let Y=0,W=0;Y<z&&W<Q;)if(K0($[Y],Z[W]))J.push([Y,W]),Y++,W++;else if(X[Y+1][W]>=X[Y][W+1])Y++;else W++;return J}function EA($,Z,z,Q){let X=Z.items,J=X.map((G)=>TY($,G)),Y=[],W=0,U=0;for(let[G,V]of[...SA(J,z),[X.length,z.length]]){for(;W<G&&U<V;W++,U++)Y.push(L5($,X[W],z[U],Q));for(;U<V;U++)Y.push($.createNode(z[U]));if(G<X.length)Y.push(X[G]);W=G+1,U=V+1}Z.items=Y}function i1($,Z,z,Q){if(K0(z,Q))return Z;if(!$0(z)||!$0(Q)||!q0(Z))return L5($,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=d1(J);return Y===void 0||!X.has(Y)});for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let W=U6(Z,J);if(!W)Z.items.push($.createPair(J,Y));else if(!K0(z[J],Y))W.value=i1($,W.value,z[J],Y)}return Z}function FY($,Z,z){let Q=$.contents;if(Q===null||Q===void 0)$.contents=new L$,Q=$.contents;if(!q0(Q))throw Error(`${z}: the document is not a mapping — faf left it unchanged.`);let X=Q;for(let J of Z){let Y=U6(X,J);if(Y&&q0(Y.value)){X=Y.value;continue}if(Y&&!EY(Y.value))throw Error(`${z}: ${J} is not a mapping — faf left it unchanged.`);let W=new L$;if(Y)Y.value=SY(Y.value,W);else X.items.push($.createPair(J,W));X=W}return X}function N5($,Z,z,Q,X){if(K0(z,Q))return;let J=FY($,Z.slice(0,-1),X),Y=Z[Z.length-1],W=U6(J,Y);if(Q===void 0)J.items=J.items.filter((U)=>U!==W);else if(!W)J.items.push($.createPair(Y,Q));else W.value=i1($,W.value,z,Q)}function PY($,Z,z){let Q=FY($,Z.slice(0,-1),z),X=Z[Z.length-1],J=U6(Q,X);if(J&&y2(J.value))return J.value;if(J&&!EY(J.value))throw Error(`${z}: ${Z.join(".")} is not a list — faf left it unchanged.`);let Y=new b1;if(J)J.value=SY(J.value,Y);else Q.items.push($.createPair(X,Y));return Y}function SY($,Z){if(!T0($))return Z;let z=[$.commentBefore,$.comment].filter(L2);if(z.length>0)Z.commentBefore=z.join(`
221
- `);return Z}function EY($){if($===null||$===void 0)return!0;return T0($)&&($.value===null||$.value===void 0)}var O3=new WeakMap;function n1($){return typeof $==="object"&&$!==null?O3.get($):void 0}function O5($,Z){O3.set($,Z)}function jY($,Z){let z=n1($);if(z)O3.set(Z,z);return Z}var wY=new WeakSet;function xY($){return wY.add($),$}function yY($){return typeof $==="object"&&$!==null&&wY.has($)}function I5($){let Z=C$($);return l(D5(Z),Z,{read:!0})}function D3($){if($ instanceof Y5)return $;let Z=$?.cause;return Z instanceof Y5?Z:null}function I3($,Z){let z=Z.message.split(`
222
- `)[0].replace(/ at line \d+, column \d+:?\s*$/,"").replace(/:\s*$/,""),Q=Z.linePos?.[0]?.line,X=C$($);return new b("not-yaml",X,`${X} is not valid YAML (${z}${Q===void 0?"":`, line ${Q}`}) — faf left it unchanged`,{cause:Z})}function n($,Z){try{return Z()}catch(z){if(z instanceof b)throw z;let Q=(z instanceof Error?z.message:String(z)).split(`
223
- `)[0].trim(),X=C$($);throw new b("not-yaml",X,`${X}: faf's scoring kernel could not read it (${Q}) — faf left it unchanged`,{cause:z})}}function r($){let Z=I5($),z=J0(Z),Q;try{Q=i0(z)}catch(J){let Y=D3(J);if(Y)throw I3($,Y);throw J}let X=f1(Q,$);return O5(X,{real:Z,text:z}),X}function T3($){let Z=$._meta,z={...$};delete z._meta;let Q=N$(z,{lineWidth:0});if(Z?.found&&Z.found.length>0){let X=Z.found.join(" + ");Q=Q.replace(/^(\s+type:\s+\S+)(\s*)$/m,(J,Y,W)=>{if(W.includes("#"))return J;return`${Y} # found: ${X}`})}return Q}function xA($,Z,z,Q,X=!1){let J=I5($),Y=J0(J),W=[],U;try{U=M5(Y,(G)=>{hY(G,$);let V=G.clone();if(Z(G),W=_Y(V,G),X)W=[...W,...RY(V,G)];if(Q)W=[...W,...Q(G,V.toJS()).filter((H)=>!W.some((q)=>q.path===H.path))]},$)}catch(G){let V=D3(G);if(V)throw I3($,V);throw G}if(!U.changed)return{written:!1,text:Y,keptAliases:W};return a($,U.text,{expect:z&&z.real===J?z.text:Y}),{written:!0,text:U.text,keptAliases:W}}function m0($){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 bY($){try{return gY($),!0}catch{return!1}}function yA($){let Z=$.getIn(["project","type"],!0);return T0(Z)?Z.value:Z}function hY($,Z){let z=$.contents;if(z!==null&&z!==void 0&&!q0(z))throw new b("not-yaml",C$(Z),`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${k6($.toJS())}. faf left it unchanged — fix it by hand.`)}function kA($,Z,z){hY($,z);let Q=$.contents,X=q0(Q)&&Q.items.some((V)=>T0(V.key)&&V.key.value==="_meta"),{_meta:J,...Y}=Z,W=yA($),U=q0(Q)?$.toJS():{},G=q0(Q)?Q:$.createNode({});if($.contents=G,N3($,G,U,X?{...Z}:Y),!X)vA($,J?.found,W)}function bA($,Z){let z=$.contents;if(q0(z)&&z.items.some((J)=>T0(J.key)&&J.key.value==="_meta"))return Z;let{_meta:Q,...X}=Z;return X}function vA($,Z,z){if(!Z||Z.length===0||!U0(z))return;let Q=$.getIn(["project","type"],!0);if(T0(Q)&&!U0(Q.value)&&(Q.comment===null||Q.comment===void 0))Q.comment=` found: ${Z.join(" + ")}`}function B0($,Z,z={}){if(!z.replace&&bY($)){let W=xA($,(U)=>kA(U,Z,$),n1(Z),(U,G)=>AY(U,bA(U,Z),G),yY(Z));O5(Z,{real:I5($),text:W.text});for(let U of W.keptAliases??[])z.onAliasKept?.(U);return W.written}let Q=C$($),X=T3(Z),J=bY($)?j0(l(D5(Q),Q)):null,Y=a($,X,{expect:J});return O5(Z,{real:Y,text:X}),!0}function p($){return J0(I5($))}function z2($,Z){let z;try{z=i0($)}catch(Q){let X=D3(Q);if(Z!==void 0&&X)throw I3(Z,X);throw Q}return Z===void 0?z:f1(z,Z)}function vY($,Z){let z;try{z=gY(Z)}catch{return!1}if(!z.isSymbolicLink()&&!z.isFile())return!1;return l($,C$(Z),{read:!0}),!0}function u($=process.cwd()){let Z=["project.faf",".faf"];for(let Q of Z){let X=kY($,Q);if(vY($,X))return X}let z=D5($);if(z!==$)for(let Q of Z){let X=kY(z,Q);if(vY(z,X))return X}return null}function _$($,Z=process.cwd()){return wA("git",["-C",D5($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+jA($)}d();var R$=[{name:"TROPHY",indicator:`${_0("✪")} ${_0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${_0(C("★"))} ${_0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${I("◆")} ${I("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${T5("◇")} ${T5("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 N2($){return $.indicator}function G6($){for(let Z of R$)if($>=Z.threshold)return Z;return R$[R$.length-1]}var C3=null;function s1(){if(C3)return C3;try{let $=d0("faf-scoring-kernel");return C3=$,$}catch{throw Error(`faf-scoring-kernel not installed.
219
+ `,q=PA(X,J,Y,V,{...U,verifyAliasOrder:!1}),H=q!==null&&SA(q,Y,G,U),K=H&&q!==null?q:G.replace(/\r?\n/g,V);return{text:Q+K,changed:Q+K!==$,spliced:H}}function jA($){let Z=$.clone();if($.directives&&Z.directives)Z.directives.docEnd=$.directives.docEnd;return Z}function K0($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>K0(z,Z[Q]));if($0($)&&$0(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&K0($[Q],Z[Q]))}return!1}function r1($){let Z=T0($.key)?$.key.value:$.key;return typeof Z==="string"||typeof Z==="number"||typeof Z==="boolean"?String(Z):void 0}function U6($,Z){return $.items.find((z)=>r1(z)===Z)}function RY($,Z){return K2(Z)?Z.toJS($):Z}function wA($,Z,z,Q){return Q.keepAliases===!0&&x2(Z)||K0(RY($,Z),z)}function D5($,Z,z,Q={}){if(wA($,Z,z,Q))return Z;if($0(z)&&H0(Z))return yA($,Z,z,Q),Z;if(Array.isArray(z)&&y2(Z))return vA($,Z,z,Q),Z;if(!$0(z)&&!Array.isArray(z)&&T0(Z))return Z.value=z,Z;return xA(Z,$.createNode(z))}function xA($,Z){if(!T0($)&&!x2($))return Z;let z=$,Q=Z;if(x6(Z)&&Z.items.length>0&&!Z.flow)return Q.commentBefore=H3(Q.commentBefore,z.commentBefore,z.comment),Z;if(x6(Z))Z.flow=!0;return Q.comment=H3(Q.comment??z.comment),Q.commentBefore=H3(Q.commentBefore??z.commentBefore),Z}function H3(...$){let Z=$.filter(L2);return Z.length>0?Z.join(`
220
+ `):void 0}function yA($,Z,z,Q={}){for(let[X,J]of Object.entries(z)){if(J===void 0)continue;let Y=U6(Z,X);if(Y)Y.value=D5($,Y.value,J,Q);else Z.items.push($.createPair(X,J))}if(!Q.prune)return;Z.items=Z.items.filter((X)=>{let J=r1(X);return J===void 0||z[J]!==void 0})}function I3($,Z,z,Q){let X=$0(z)?z:{};for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let W=U6(Z,J);if(!W)Z.items.push($.createPair(J,Y));else if(Object.prototype.hasOwnProperty.call(X,J)&&K0(X[J],Y))continue;else if($0(Y)&&$0(X[J])&&H0(W.value))I3($,W.value,X[J],Y);else W.value=D5($,W.value,Y,{keepAliases:!0})}}function n1($,Z,z){if(x2($))z.push({path:[...Z],node:$});else if(H0($))for(let Q of $.items){let X=r1(Q);if(X!==void 0)n1(Q.value,[...Z,X],z)}else if(y2($))$.items.forEach((Q,X)=>n1(Q,[...Z,X],z))}function KY($,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 FY($,Z,z){let Q=[];return n1($.contents,[],Q),Q.filter(({path:X,node:J})=>{let Y=KY(Z,X);return Y!==void 0&&!K0(KY(z,X),Y)&&!K0(J.toJS($),Y)}).map(({path:X,node:J})=>({path:X.join("."),alias:`*${J.source}`}))}function PY($,Z){let z=$.contents;for(let X=0;X<Z.length-1&&z!==void 0;X++)z=kA(z,Z[X]);let Q=Z[Z.length-1];if(H0(z)&&typeof Q==="string"){let X=U6(z,Q);return X?{node:X.value,put:(J)=>(X.value=J,!0)}:null}if(y2(z)&&typeof Q==="number"&&Q<z.items.length){let X=z,J=X.items[Q];return{node:J,put:(Y)=>u0(J)===void 0?(X.items[Q]=Y,!0):!1}}return null}function kA($,Z){if(H0($)&&typeof Z==="string")return U6($,Z)?.value;if(y2($)&&typeof Z==="number")return $.items[Z];return}function SY($,Z){let z=[];n1($.contents,[],z);let Q=[];for(let{path:X,node:J}of z){let Y=PY(Z,X);if(!Y||x2(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 M3($,Z,z,Q){if(!K2($)||x2($))return;let X=$.anchor;if(X&&z.has(X))Q.push({path:[...Z],node:$});if(H0($))for(let J of $.items){let Y=r1(J);if(Y!==void 0)M3(J.value,[...Z,Y],z,Q)}else if(y2($))$.items.forEach((J,Y)=>M3(J,[...Z,Y],z,Q))}function EY($,Z){let z=[];n1($.contents,[],z);let Q=new Set(z.map((Y)=>Y.node.source));if(Q.size===0)return[];let X=[];M3($.contents,[],Q,X);let J=[];for(let{path:Y,node:W}of X){let U=PY(Z,Y);if(!U)continue;let G=W.anchor;if(K2(U.node)&&U.node.anchor===G&&K0(W.toJS($),U.node.toJS(Z))||!U.put(W.clone()))continue;J.push({path:Y.join("."),alias:`&${G}`,kind:"anchor"})}return J}function bA($,Z){let z=$.length,Q=Z.length,X=Array.from({length:z+1},()=>Array(Q+1).fill(0));for(let Y=z-1;Y>=0;Y--)for(let W=Q-1;W>=0;W--)X[Y][W]=K0($[Y],Z[W])?X[Y+1][W+1]+1:Math.max(X[Y+1][W],X[Y][W+1]);let J=[];for(let Y=0,W=0;Y<z&&W<Q;)if(K0($[Y],Z[W]))J.push([Y,W]),Y++,W++;else if(X[Y+1][W]>=X[Y][W+1])Y++;else W++;return J}function vA($,Z,z,Q){let X=Z.items,J=X.map((G)=>RY($,G)),Y=[],W=0,U=0;for(let[G,V]of[...bA(J,z),[X.length,z.length]]){for(;W<G&&U<V;W++,U++)Y.push(D5($,X[W],z[U],Q));for(;U<V;U++)Y.push($.createNode(z[U]));if(G<X.length)Y.push(X[G]);W=G+1,U=V+1}Z.items=Y}function s1($,Z,z,Q){if(K0(z,Q))return Z;if(!$0(z)||!$0(Q)||!H0(Z))return D5($,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=r1(J);return Y===void 0||!X.has(Y)});for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let W=U6(Z,J);if(!W)Z.items.push($.createPair(J,Y));else if(!K0(z[J],Y))W.value=s1($,W.value,z[J],Y)}return Z}function jY($,Z,z){let Q=$.contents;if(Q===null||Q===void 0)$.contents=new N$,Q=$.contents;if(!H0(Q))throw Error(`${z}: the document is not a mapping — faf left it unchanged.`);let X=Q;for(let J of Z){let Y=U6(X,J);if(Y&&H0(Y.value)){X=Y.value;continue}if(Y&&!yY(Y.value))throw Error(`${z}: ${J} is not a mapping — faf left it unchanged.`);let W=new N$;if(Y)Y.value=xY(Y.value,W);else X.items.push($.createPair(J,W));X=W}return X}function I5($,Z,z,Q,X){if(K0(z,Q))return;let J=jY($,Z.slice(0,-1),X),Y=Z[Z.length-1],W=U6(J,Y);if(Q===void 0)J.items=J.items.filter((U)=>U!==W);else if(!W)J.items.push($.createPair(Y,Q));else W.value=s1($,W.value,z,Q)}function wY($,Z,z){let Q=jY($,Z.slice(0,-1),z),X=Z[Z.length-1],J=U6(Q,X);if(J&&y2(J.value))return J.value;if(J&&!yY(J.value))throw Error(`${z}: ${Z.join(".")} is not a list — faf left it unchanged.`);let Y=new h1;if(J)J.value=xY(J.value,Y);else Q.items.push($.createPair(X,Y));return Y}function xY($,Z){if(!T0($))return Z;let z=[$.commentBefore,$.comment].filter(L2);if(z.length>0)Z.commentBefore=z.join(`
221
+ `);return Z}function yY($){if($===null||$===void 0)return!0;return T0($)&&($.value===null||$.value===void 0)}var T3=new WeakMap;function o1($){return typeof $==="object"&&$!==null?T3.get($):void 0}function T5($,Z){T3.set($,Z)}function kY($,Z){let z=o1($);if(z)T3.set(Z,z);return Z}var bY=new WeakSet;function vY($){return bY.add($),$}function gY($){return typeof $==="object"&&$!==null&&bY.has($)}function C5($){let Z=_$($);return l(A5(Z),Z,{read:!0})}function A3($){if($ instanceof G5)return $;let Z=$?.cause;return Z instanceof G5?Z:null}function C3($,Z){let z=Z.message.split(`
222
+ `)[0].replace(/ at line \d+, column \d+:?\s*$/,"").replace(/:\s*$/,""),Q=Z.linePos?.[0]?.line,X=_$($);return new b("not-yaml",X,`${X} is not valid YAML (${z}${Q===void 0?"":`, line ${Q}`}) — faf left it unchanged`,{cause:Z})}function n($,Z){try{return Z()}catch(z){if(z instanceof b)throw z;let Q=(z instanceof Error?z.message:String(z)).split(`
223
+ `)[0].trim(),X=_$($);throw new b("not-yaml",X,`${X}: faf's scoring kernel could not read it (${Q}) — faf left it unchanged`,{cause:z})}}function r($){let Z=C5($),z=z0(Z),Q;try{Q=i0(z)}catch(J){let Y=A3(J);if(Y)throw C3($,Y);throw J}let X=c1(Q,$);return T5(X,{real:Z,text:z}),X}function _3($){let Z=$._meta,z={...$};delete z._meta;let Q=O$(z,{lineWidth:0});if(Z?.found&&Z.found.length>0){let X=Z.found.join(" + ");Q=Q.replace(/^(\s+type:\s+\S+)(\s*)$/m,(J,Y,W)=>{if(W.includes("#"))return J;return`${Y} # found: ${X}`})}return Q}function fA($,Z,z,Q,X=!1){let J=C5($),Y=z0(J),W=[],U;try{U=O5(Y,(G)=>{cY(G,$);let V=G.clone();if(Z(G),W=SY(V,G),X)W=[...W,...EY(V,G)];if(Q)W=[...W,...Q(G,V.toJS()).filter((q)=>!W.some((H)=>H.path===q.path))]},$)}catch(G){let V=A3(G);if(V)throw C3($,V);throw G}if(!U.changed)return{written:!1,text:Y,keptAliases:W};return a($,U.text,{expect:z&&z.real===J?z.text:Y}),{written:!0,text:U.text,keptAliases:W}}function m0($){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 fY($){try{return mY($),!0}catch{return!1}}function uA($){let Z=$.getIn(["project","type"],!0);return T0(Z)?Z.value:Z}function cY($,Z){let z=$.contents;if(z!==null&&z!==void 0&&!H0(z))throw new b("not-yaml",_$(Z),`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${b6($.toJS())}. faf left it unchanged — fix it by hand.`)}function mA($,Z,z){cY($,z);let Q=$.contents,X=H0(Q)&&Q.items.some((V)=>T0(V.key)&&V.key.value==="_meta"),{_meta:J,...Y}=Z,W=uA($),U=H0(Q)?$.toJS():{},G=H0(Q)?Q:$.createNode({});if($.contents=G,I3($,G,U,X?{...Z}:Y),!X)pA($,J?.found,W)}function cA($,Z){let z=$.contents;if(H0(z)&&z.items.some((J)=>T0(J.key)&&J.key.value==="_meta"))return Z;let{_meta:Q,...X}=Z;return X}function pA($,Z,z){if(!Z||Z.length===0||!U0(z))return;let Q=$.getIn(["project","type"],!0);if(T0(Q)&&!U0(Q.value)&&(Q.comment===null||Q.comment===void 0))Q.comment=` found: ${Z.join(" + ")}`}function B0($,Z,z={}){if(!z.replace&&fY($)){let W=fA($,(U)=>mA(U,Z,$),o1(Z),(U,G)=>FY(U,cA(U,Z),G),gY(Z));T5(Z,{real:C5($),text:W.text});for(let U of W.keptAliases??[])z.onAliasKept?.(U);return W.written}let Q=_$($),X=_3(Z),J=fY($)?w0(l(A5(Q),Q)):null,Y=a($,X,{expect:J});return T5(Z,{real:Y,text:X}),!0}function p($){return z0(C5($))}function z2($,Z){let z;try{z=i0($)}catch(Q){let X=A3(Q);if(Z!==void 0&&X)throw C3(Z,X);throw Q}return Z===void 0?z:c1(z,Z)}function uY($,Z){let z;try{z=mY(Z)}catch{return!1}if(!z.isSymbolicLink()&&!z.isFile())return!1;return l($,_$(Z),{read:!0}),!0}function u($=process.cwd()){let Z=["project.faf",".faf"];for(let Q of Z){let X=hY($,Q);if(uY($,X))return X}let z=A5($);if(z!==$)for(let Q of Z){let X=hY(z,Q);if(uY(z,X))return X}return null}function R$($,Z=process.cwd()){return hA("git",["-C",A5($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+gA($)}d();var F$=[{name:"TROPHY",indicator:`${_0("✪")} ${_0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${_0(C("★"))} ${_0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${I("◆")} ${I("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${_5("◇")} ${_5("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 N2($){return $.indicator}function G6($){for(let Z of F$)if($>=Z.threshold)return Z;return F$[F$.length-1]}var F3=null;function t1(){if(F3)return F3;try{let $=d0("faf-scoring-kernel");return F3=$,$}catch{throw Error(`faf-scoring-kernel not installed.
224
224
 
225
225
  Run: npm install faf-scoring-kernel
226
- `)}}var _3=($)=>$.startsWith("\uFEFF")?$.slice(1):$;function R0($){return JSON.parse(s1().score_faf(_3($)))}function uY($){return s1().validate_faf(_3($))}function A5($){return s1().compile_fafb(_3($))}function mY($){return JSON.parse(s1().decompile_fafb($))}function cY(){return s1().sdk_version()}var pY=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function lY($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function dY($){let Z=$.match(/^about:\s*\n((?:[ \t]+.*\n?)*)/m);if(!Z)return null;let z=Z[1]??"",Q=z.match(/^[ \t]+represents:\s*(\S+)\s*$/m);if(!Q)return null;let X=Q[1],J=z.match(/^[ \t]+source_score:\s*(\d+)\s*$/m),Y=-1;if(J){let W=parseInt(J[1],10);if(W>=0&&W<=100)Y=W}return{represents:X,sourceScore:Y}}function R3($){return $.unknown?"unknown (—)":`${$.score}%`}function x0($){return{score:$.score,tier:G6($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function L0($){let Z=dY($);if(Z){let z=Z.sourceScore;return{score:z,tier:z>=0?G6(z):R$[R$.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Z.represents,...z<0?{unknown:!0}:{}}}return x0(R0($))}function hA($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)?X[Q]:void 0}function F3($){try{let Z=x6($,{logLevel:"error"}).getIn(["project","type"],!0);return T0(Z)&&typeof Z.comment==="string"&&Z.comment.includes(A$)}catch{return!1}}function fA($,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 uA($){try{let Z=x6($,{logLevel:"error"});if(Z.errors.length>0)return null;let z=Z.toJS();return $0(z)?z:null}catch{return null}}function C5($,Z,z={}){let Q=uA($);if(Q===null)return[];let X=$0(Q.project)&&!F3($)?Q.project.type:void 0,J=[];for(let Y of Q0){let W=hA(Q,Y.path);if(Z.slots[Y.path]!=="empty"||!T$(W))continue;let U=b6.library.includes(Y.category),G=fA(Y.path,String(W).trim(),v6(X,Y),U,z.outOfType!==!1);if(G!==null)J.push(G)}return J}d();d();import{existsSync as mA,readFileSync as cA}from"fs";import{join as iY}from"path";import{homedir as pA}from"os";var lA=95,dA=30,iA=3,P3=iY(pA(),".config","faf"),S3=iY(P3,"star-nudge"),nA="github.com/Wolfe-Jam/faf-cli";function rA($){if($.score<lA)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??iA))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??dA)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function sA(){try{if(!mA(S3))return{shown:0,lastShownMs:null};let $=cA(S3,"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 oA($){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 aA($,Z){try{w0(P3),F2(S3,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}),{root:P3,owns:oA,mark:"faf star-nudge state"})}catch{}}function nY($){let Z=Date.now(),z=sA();if(!rA({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:")} ${nA}`),aA(z.shown,Z)}function F0($,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=N2($.tier),J=C(`${$.score}%`);if(console.log(`${X} ${J} ${M(`${$.populated}/${$.active} slots`)} ${M("—")} ${Z}`),$.tier.name==="TROPHY")console.log(M(" Trophy. AI never has to guess."));else if($.empty>0){let Y=Object.entries($.slots).filter(([,V])=>V==="empty").map(([V])=>V),W=Y.slice(0,3).join(", "),U=Y.length>3?`, +${Y.length-3} more`:"",G=$.empty===1?"slot":"slots";console.log(M(` ${$.empty} ${G} from Trophy: ${W}${U}`))}if(tA(Q),z)console.log(""),eA($);nY($.score)}function tA($){for(let Z of $)console.log(M(` ${Z}`))}function eA($){for(let[Z,z]of Object.entries($.slots)){let Q=z==="populated"?I("●"):z==="slotignored"?M("—"):M("○");console.log(` ${Q} ${z==="slotignored"?M(`${Z}: slotignored`):Z}`)}}d();function _5($,Z={}){let z=$??u();if(!z)console.error(`Error: project.faf not found
227
-
228
- Run 'faf init' to create one.`),process.exit(2);let Q=p(z);z2(Q,z);let X=n(z,()=>L0(Q));if(Z.json){let J=r(z),Y={faf_version:J.faf_version??"unknown",project:J.project?.name??"unknown",source:z,...X};console.log(JSON.stringify(Y,null,2));return}if(Z.status){console.log(X.unknown?`— ${C(R3(X))}`:`${N2(X.tier)} ${C(R3(X))}`);return}F0(X,z,Z.verbose,C5(Q,X))}import{existsSync as jF}from"fs";import{join as bW}from"path";var V6="3.0";import{join as WW}from"path";var rY=[{name:"Next.js",slug:"nextjs",category:"frontend",signals:[{type:"dependency",key:"next"},{type:"file",pattern:"next.config.*"}]},{name:"React",slug:"react",category:"frontend",signals:[{type:"dependency",key:"react"}]},{name:"SvelteKit",slug:"sveltekit",category:"frontend",signals:[{type:"dependency",key:"@sveltejs/kit"},{type:"file",pattern:"svelte.config.*"}]},{name:"Svelte",slug:"svelte",category:"frontend",signals:[{type:"dependency",key:"svelte"},{type:"devDependency",key:"svelte"}]},{name:"Vue.js",slug:"vue",category:"frontend",signals:[{type:"dependency",key:"vue"}]},{name:"Nuxt",slug:"nuxt",category:"frontend",signals:[{type:"dependency",key:"nuxt"},{type:"file",pattern:"nuxt.config.*"}]},{name:"Angular",slug:"angular",category:"frontend",signals:[{type:"dependency",key:"@angular/core"},{type:"file",pattern:"angular.json"}]},{name:"Astro",slug:"astro",category:"frontend",signals:[{type:"dependency",key:"astro"},{type:"file",pattern:"astro.config.*"}]},{name:"Solid",slug:"solid",category:"frontend",signals:[{type:"dependency",key:"solid-js"}]},{name:"Remix",slug:"remix",category:"frontend",signals:[{type:"dependency",key:"@remix-run/react"}]},{name:"Gatsby",slug:"gatsby",category:"frontend",signals:[{type:"dependency",key:"gatsby"},{type:"file",pattern:"gatsby-config.*"}]},{name:"Qwik",slug:"qwik",category:"frontend",signals:[{type:"dependency",key:"@builder.io/qwik"}]},{name:"Vercel (SvelteKit)",slug:"adapter-vercel",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-vercel"},{type:"devDependency",key:"@sveltejs/adapter-vercel"}]},{name:"Node (SvelteKit)",slug:"adapter-node",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-node"},{type:"devDependency",key:"@sveltejs/adapter-node"}]},{name:"Static (SvelteKit)",slug:"adapter-static",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-static"},{type:"devDependency",key:"@sveltejs/adapter-static"}]},{name:"Cloudflare (SvelteKit)",slug:"adapter-cloudflare",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-cloudflare"},{type:"devDependency",key:"@sveltejs/adapter-cloudflare"}]},{name:"Netlify (SvelteKit)",slug:"adapter-netlify",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-netlify"},{type:"devDependency",key:"@sveltejs/adapter-netlify"}]},{name:"Tailwind CSS",slug:"tailwind",category:"css",signals:[{type:"dependency",key:"tailwindcss"},{type:"devDependency",key:"tailwindcss"},{type:"file",pattern:"tailwind.config.*"}]},{name:"Bootstrap",slug:"bootstrap",category:"css",signals:[{type:"dependency",key:"bootstrap"}]},{name:"Styled Components",slug:"styled-components",category:"css",signals:[{type:"dependency",key:"styled-components"}]},{name:"shadcn/ui",slug:"shadcn",category:"ui",signals:[{type:"file",pattern:"components.json"},{type:"dependency",key:"@radix-ui/react-dialog"}]},{name:"Material UI",slug:"mui",category:"ui",signals:[{type:"dependency",key:"@mui/material"}]},{name:"Chakra UI",slug:"chakra",category:"ui",signals:[{type:"dependency",key:"@chakra-ui/react"}]},{name:"Ant Design",slug:"antd",category:"ui",signals:[{type:"dependency",key:"antd"}]},{name:"Redux",slug:"redux",category:"state",signals:[{type:"dependency",key:"@reduxjs/toolkit"}]},{name:"Zustand",slug:"zustand",category:"state",signals:[{type:"dependency",key:"zustand"}]},{name:"Jotai",slug:"jotai",category:"state",signals:[{type:"dependency",key:"jotai"}]},{name:"Pinia",slug:"pinia",category:"state",signals:[{type:"dependency",key:"pinia"}]},{name:"Express",slug:"express",category:"backend",signals:[{type:"dependency",key:"express"}]},{name:"Fastify",slug:"fastify",category:"backend",signals:[{type:"dependency",key:"fastify"}]},{name:"Hono",slug:"hono",category:"backend",signals:[{type:"dependency",key:"hono"}]},{name:"Elysia",slug:"elysia",category:"backend",signals:[{type:"dependency",key:"elysia"}]},{name:"NestJS",slug:"nestjs",category:"backend",signals:[{type:"dependency",key:"@nestjs/core"}]},{name:"Koa",slug:"koa",category:"backend",signals:[{type:"dependency",key:"koa"}]},{name:"Django",slug:"django",category:"backend",signals:[{type:"file",pattern:"manage.py"},{type:"file",pattern:"settings.py"}]},{name:"Flask",slug:"flask",category:"backend",signals:[{type:"content",pattern:"app.py",key:"flask"}]},{name:"FastAPI",slug:"fastapi",category:"backend",signals:[{type:"content",pattern:"main.py",key:"fastapi"}]},{name:"Rails",slug:"rails",category:"backend",signals:[{type:"content",pattern:"Gemfile",key:"rails"},{type:"content",pattern:"Gemfile.lock",key:"rails ("},{type:"file",pattern:"config/application.rb"},{type:"file",pattern:"config/routes.rb"}]},{name:"Spring Boot",slug:"spring",category:"backend",signals:[{type:"content",pattern:"pom.xml",key:"spring-boot"},{type:"content",pattern:"build.gradle",key:"springframework.boot"},{type:"content",pattern:"build.gradle.kts",key:"springframework.boot"},{type:"content",pattern:"gradle/libs.versions.toml",key:"springframework.boot"}]},{name:"Vapor",slug:"vapor",category:"backend",signals:[{type:"content",pattern:"Package.swift",key:"vapor/vapor"},{type:"content",pattern:"Package.swift",key:'product(name: "Vapor"'},{type:"content",pattern:"Package.swift",key:"product(name: 'Vapor'"},{type:"file",pattern:"Sources/App/configure.swift"}]},{name:"Hummingbird",slug:"hummingbird",category:"backend",signals:[{type:"content",pattern:"Package.swift",key:"hummingbird-project/hummingbird"},{type:"content",pattern:"Package.swift",key:'product(name: "Hummingbird"'},{type:"content",pattern:"Package.swift",key:"product(name: 'Hummingbird'"}]},{name:"Prisma",slug:"prisma",category:"database",signals:[{type:"dependency",key:"prisma"},{type:"devDependency",key:"prisma"},{type:"file",pattern:"prisma/schema.prisma"}]},{name:"Drizzle",slug:"drizzle",category:"database",signals:[{type:"dependency",key:"drizzle-orm"},{type:"file",pattern:"drizzle.config.*"}]},{name:"TypeORM",slug:"typeorm",category:"database",signals:[{type:"dependency",key:"typeorm"}]},{name:"Mongoose",slug:"mongoose",category:"database",signals:[{type:"dependency",key:"mongoose"}]},{name:"Vite",slug:"vite",category:"build",signals:[{type:"dependency",key:"vite"},{type:"devDependency",key:"vite"},{type:"file",pattern:"vite.config.*"}]},{name:"webpack",slug:"webpack",category:"build",signals:[{type:"dependency",key:"webpack"},{type:"devDependency",key:"webpack"},{type:"file",pattern:"webpack.config.*"}]},{name:"esbuild",slug:"esbuild",category:"build",signals:[{type:"dependency",key:"esbuild"},{type:"devDependency",key:"esbuild"}]},{name:"Turbopack",slug:"turbopack",category:"build",signals:[{type:"file",pattern:"turbo.json"}]},{name:"Jest",slug:"jest",category:"testing",signals:[{type:"devDependency",key:"jest"},{type:"file",pattern:"jest.config.*"}]},{name:"Vitest",slug:"vitest",category:"testing",signals:[{type:"devDependency",key:"vitest"}]},{name:"Playwright",slug:"playwright",category:"testing",signals:[{type:"devDependency",key:"@playwright/test"},{type:"file",pattern:"playwright.config.*"}]},{name:"Cypress",slug:"cypress",category:"testing",signals:[{type:"devDependency",key:"cypress"},{type:"file",pattern:"cypress.config.*"}]},{name:"Turborepo",slug:"turborepo",category:"monorepo",signals:[{type:"devDependency",key:"turbo"},{type:"file",pattern:"turbo.json"}]},{name:"Nx",slug:"nx",category:"monorepo",signals:[{type:"devDependency",key:"nx"},{type:"file",pattern:"nx.json"}]},{name:"Lerna",slug:"lerna",category:"monorepo",signals:[{type:"devDependency",key:"lerna"},{type:"file",pattern:"lerna.json"}]},{name:"MCP SDK",slug:"mcp",category:"ai",signals:[{type:"dependency",key:"@modelcontextprotocol/sdk"}]},{name:"Anthropic SDK",slug:"anthropic",category:"ai",signals:[{type:"dependency",key:"@anthropic-ai/sdk"}]},{name:"OpenAI SDK",slug:"openai",category:"ai",signals:[{type:"dependency",key:"openai"}]},{name:"LangChain",slug:"langchain",category:"ai",signals:[{type:"dependency",key:"langchain"}]},{name:"Vercel",slug:"vercel",category:"hosting",signals:[{type:"file",pattern:"vercel.json"}]},{name:"Netlify",slug:"netlify",category:"hosting",signals:[{type:"file",pattern:"netlify.toml"}]},{name:"Docker",slug:"docker",category:"hosting",signals:[{type:"file",pattern:"Dockerfile"},{type:"file",pattern:"docker-compose.yml"}]},{name:"Cloudflare Workers",slug:"cloudflare",category:"hosting",signals:[{type:"file",pattern:"wrangler.toml"},{type:"dependency",key:"wrangler"}]},{name:"GitHub Actions",slug:"github-actions",category:"cicd",signals:[{type:"file",pattern:".github/workflows/*.yml"}]},{name:"Commander.js",slug:"commander",category:"cli",signals:[{type:"dependency",key:"commander"}]}];import{join as ZC}from"path";var F$={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 zC=F$.flutterDeps,QC=F$.mcpDeps,XC=F$.serverFrameworks,JC=F$.stateManagement,YC=F$.routing;function WC($){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 R5($){let Z=f($,"pubspec.yaml");if(Z===null)return null;let z=WC(Z),Q=(R)=>z.has(R.toLowerCase()),X=zC.some(Q)||/^flutter:\s*$/m.test(Z)||/\bsdk:\s*flutter\b/.test(Z),J=QC.find(Q),Y=XC.find(([R])=>Q(R)),W=JC.find(([R])=>Q(R)),U=W?W[1]:"",G=YC.find(([R])=>Q(R)),V=G?G[1]:"",H=Q("flutter_test")?"flutter_test":Q("test")?"test":"",q=/^executables:\s*$/m.test(Z),K=(z0($,"bin")??[]).some((R)=>R.name.endsWith(".dart")),L=q||K,B,N="",T;if(X)if(N="Flutter",A($,ZC("lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(Z))B="mobile",T="pubspec.yaml (Flutter app)";else B="library",T="pubspec.yaml (Flutter package)";else if(J)B="mcp",T=`pubspec.yaml + ${J} (Dart MCP server)`;else if(Y)B="backend",N=Y[1],T=`pubspec.yaml + ${Y[0]} (Dart backend)`;else if(L)B="cli",T=q?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else B="library",T="pubspec.yaml (Dart package)";return{appType:B,isFlutter:X,framework:N,stateManagement:U,routing:V,testing:H,found:T}}import{join as GC}from"path";var F5={version:1,_doc:"SINGLE SOURCE of Go detection KNOWLEDGE (A+B hybrid, Truth-is-faf-cli). faf-cli imports this directly; SDKs/MCPs compose it. Bolster Go by editing THIS file. Logic stays in go.ts. Content-aware: go.mod ≠ one bucket — backend · CLI · MCP · library. 2026-08-01 initial (Dart composition pattern).",mcpModules:["github.com/mark3labs/mcp-go","github.com/modelcontextprotocol/go-sdk","github.com/metoro-io/mcp-golang","github.com/ThinkInAIXYZ/go-mcp"],serverFrameworks:[["github.com/gin-gonic/gin","Gin"],["github.com/labstack/echo","Echo"],["github.com/labstack/echo/v4","Echo"],["github.com/gofiber/fiber","Fiber"],["github.com/gofiber/fiber/v2","Fiber"],["github.com/go-chi/chi","Chi"],["github.com/go-chi/chi/v5","Chi"],["github.com/gorilla/mux","Gorilla Mux"],["github.com/gofiber/fiber/v3","Fiber"],["google.golang.org/grpc","gRPC"],["connectrpc.com/connect","Connect"],["github.com/go-kratos/kratos","Kratos"],["github.com/go-kratos/kratos/v2","Kratos"],["github.com/zeromicro/go-zero","go-zero"],["github.com/cloudwego/hertz","Hertz"]],cliFrameworks:[["github.com/spf13/cobra","Cobra"],["github.com/urfave/cli","urfave/cli"],["github.com/urfave/cli/v2","urfave/cli"],["github.com/alecthomas/kingpin","Kingpin"],["github.com/alecthomas/kong","Kong"]]};var VC=F5.mcpModules,HC=F5.serverFrameworks,qC=F5.cliFrameworks;function KC($){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 oY($,Z){let z=Z.toLowerCase();for(let Q of $)if(Q===z||Q.startsWith(`${z}/`))return!0;return!1}function sY($,Z){let z;for(let Q of Z){if(!oY($,Q[0]))continue;if(!z||Q[0].length>z[0].length)z=Q}return z}function BC($,Z){let z;for(let Q of Z){if(!oY($,Q))continue;if(!z||Q.length>z.length)z=Q}return z}function MC($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function LC($){for(let{name:Z}of z0($,"cmd")??[]){let z=GC("cmd",Z),Q=M2($,z);if(Q?.isDirectory()){if((z0($,z)??[]).some((X)=>X.name.endsWith(".go")))return!0}else if(Q&&Z.endsWith(".go"))return!0}return!1}function NC($){let Z=f($,"main.go");return Z!==null&&/^package\s+main\b/m.test(Z)}function P5($){let Z=f($,"go.mod");if(Z===null)return null;let z=MC(Z),Q=KC(Z),X=BC(Q,VC),J=sY(Q,HC),Y=sY(Q,qC),W=LC($),U=NC($),G,V="",H;if(X)G="mcp",H=`go.mod + ${X} (Go MCP server)`;else if(J)G="backend",V=J[1],H=`go.mod + ${J[0]} (Go backend)`;else if(Y)G="cli",V=Y[1],H=`go.mod + ${Y[0]} (Go CLI)`;else if(W)G="cli",H="go.mod + cmd/ (Go CLI layout)";else if(U&&!J)G="cli",H="go.mod + main.go package main (Go CLI)";else G="library",H="go.mod (Go module)";return{appType:G,modulePath:z,framework:V,found:H}}var h6={version:1,_doc:"SINGLE SOURCE of C# /.NET detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Bolster C# by editing THIS file. Logic stays in csharp.ts. Content-aware: .csproj alone ≠ type — Sdk first, then props/packages. Kill line: .csproj alone ≠ type. 2026-08-01 initial.",mcpPackages:["ModelContextProtocol","ModelContextProtocol.AspNetCore","ModelContextProtocol.Core","ModelContextProtocol.Extensions.Tasks","ModelContextProtocol.Extensions.Apps"],cliPackages:[["System.CommandLine","System.CommandLine"],["Spectre.Console.Cli","Spectre.Console"],["Spectre.Console","Spectre.Console"],["McMaster.Extensions.CommandLineUtils","McMaster"]],testPackages:[["Microsoft.NET.Test.Sdk","VSTest"],["xunit.v3","xUnit"],["xunit","xUnit"],["NUnit","NUnit"],["MSTest.TestFramework","MSTest"],["MSTest","MSTest"]],grpcServerPackages:["Grpc.AspNetCore"],specializedSdks:[["Microsoft.NET.Sdk.Web","web","ASP.NET Core"],["Microsoft.NET.Sdk.Worker","worker","Worker"],["Microsoft.NET.Sdk.BlazorWebAssembly","blazor-wasm","Blazor WebAssembly"],["Microsoft.NET.Sdk.Razor","razor-lib","Razor Class Library"],["MSTest.Sdk","test","MSTest"],["Aspire.AppHost.Sdk","aspire","Aspire AppHost"]],baseSdk:"Microsoft.NET.Sdk"};var DC=h6.mcpPackages.map(($)=>$.toLowerCase()),IC=h6.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),TC=h6.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),AC=h6.grpcServerPackages.map(($)=>$.toLowerCase()),CC=h6.specializedSdks,aY=h6.baseSdk.toLowerCase();function _C($){let Z=$.match(/<Project\b[^>]*\bSdk\s*=\s*"([^"/]+)(?:\/[^"]*)?"/i),z=$.match(/<Sdk\b[^>]*\bName\s*=\s*"([^"]+)"/i),Q=(Z?.[1]||z?.[1]||"").trim(),X=($.match(/<OutputType>\s*([^<]+?)\s*<\/OutputType>/i)?.[1]||"").trim(),J=$.match(/<TargetFramework>\s*([^<]+?)\s*<\/TargetFramework>/i)?.[1],W=($.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i)?.[1]||J||"").trim(),U=/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test($),G=/<UseMaui>\s*true\s*<\/UseMaui>/i.test($),V=/<UseWPF>\s*true\s*<\/UseWPF>/i.test($),H=/<UseWindowsForms>\s*true\s*<\/UseWindowsForms>/i.test($),q=new Set;for(let L of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))q.add(L[1].toLowerCase());for(let L of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))q.add(L[1].toLowerCase());let K=new Set;for(let L of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))K.add(L[1].toLowerCase());return{sdk:Q,outputType:X,targetFramework:W,isTestProject:U,useMaui:G,useWpf:V,useWindowsForms:H,packages:q,frameworkRefs:K}}function E3($,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 tY($,Z){let z;for(let[Q,X]of Z){if(!E3($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function RC($){let Z;for(let z of DC){if(!E3($,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 FC($){let Z=$.toLowerCase();if(!Z)return;let z;for(let Q of CC){let X=Q[0].toLowerCase();if(Z===X||Z.startsWith(`${X}/`)){if(!z||X.length>z[0].length)z=Q}}return z}function S5($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function PC($,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 SC($,Z){let z=Z.replace(/\.csproj$/i,""),{sdk:Q,packages:X,frameworkRefs:J,outputType:Y}=$,W,U="",G,V=RC(X),H=FC(Q),q=tY(X,TC),K=tY(X,IC),L=AC.some((N)=>E3(X,N)),B=J.has("microsoft.aspnetcore.app");if(V)W="mcp",U="MCP",G=`${Z} + ${V} (C# MCP server)`;else if($.isTestProject||H?.[1]==="test"||q)W="library",U=q?.[1]||(H?.[1]==="test"?H[2]:"Test"),G=`${Z} + test (${U})`;else if($.useMaui)W="mobile",U="MAUI",G=`${Z} + UseMaui (MAUI)`;else if($.useWpf||$.useWindowsForms)W="backend",U=$.useWpf&&$.useWindowsForms?"WPF+WinForms":$.useWpf?"WPF":"Windows Forms",G=`${Z} + ${U}`;else if(H?.[1]==="web")W="backend",U=L?"gRPC":H[2],G=`${Z} + Sdk=${H[0]}${L?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(H?.[1]==="worker")W="backend",U=H[2],G=`${Z} + Sdk=${H[0]} (Worker)`;else if(H?.[1]==="blazor-wasm")W="backend",U=H[2],G=`${Z} + Sdk=${H[0]} (Blazor WASM)`;else if(H?.[1]==="aspire")W="backend",U=H[2],G=`${Z} + Sdk=${H[0]} (Aspire)`;else if(H?.[1]==="razor-lib")W="library",U=H[2],G=`${Z} + Sdk=${H[0]} (Razor class library)`;else if(B&&S5(Y))W="backend",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(B&&!S5(Y))W="library",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(K&&(S5(Y)||!Y))W="cli",U=K[1],G=`${Z} + ${K[0]} (C# CLI)`;else if(S5(Y))W="cli",G=`${Z} + OutputType=Exe (C# console)`;else{W="library";let N=Q?` Sdk=${Q}`:"";if(G=`${Z}${N} (C# class library)`.replace(" Sdk=Microsoft.NET.Sdk",""),!Q||Q.toLowerCase()===aY||Q.toLowerCase().startsWith(`${aY}/`))G=`${Z} (C# class library)`}return{appType:W,projectName:z,targetFramework:$.targetFramework,sdk:Q||"Microsoft.NET.Sdk",framework:U,found:G}}function P$($){return(z0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}function E5($){let Z=P$($);if(Z.length===0)return null;let z=null,Q=999;for(let X of Z){let J=f($,X);if(J===null)continue;let Y=_C(J),W=SC(Y,X),U=PC(W.appType,W.framework);if(!z||U<Q)z=W,Q=U}return z}import{join as f6}from"path";var O2={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 jC=O2.mcpArtifacts.map(($)=>$.toLowerCase()),wC=O2.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),xC=O2.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),yC=O2.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),gb=O2.androidPlugins.map(($)=>$.toLowerCase()),kC=O2.kmpPlugins.map(($)=>$.toLowerCase()),bC=O2.jvmKotlinPlugins.map(($)=>$.toLowerCase()),vC=O2.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),gC=O2.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),hC=O2.libraryPlugins.map(($)=>$.toLowerCase()),fC=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function j3($){return fC.some((Z)=>A($,Z))}function uC($){let Z=new Map,z=new Map,Q="";for(let X of $.split(`
231
- `)){let J=X.replace(/#.*$/,"").trim();if(!J)continue;let Y=J.match(/^\[([^\]]+)\]$/);if(Y){Q=Y[1].trim().toLowerCase();continue}let W=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bid\s*=\s*"([^"]+)"/);if(W&&(Q==="plugins"||Q.endsWith(".plugins"))){Z.set(W[1].replace(/-/g,".").toLowerCase(),W[2].toLowerCase()),Z.set(W[1].toLowerCase(),W[2].toLowerCase());continue}let U=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bmodule\s*=\s*"([^"]+)"/);if(U&&(Q==="libraries"||Q.endsWith(".libraries"))){let H=U[1].toLowerCase();z.set(H,U[2].toLowerCase()),z.set(H.replace(/-/g,"."),U[2].toLowerCase());continue}let G=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bgroup\s*=\s*"([^"]+)"[^}]*\bname\s*=\s*"([^"]+)"/);if(G&&(Q==="libraries"||Q.endsWith(".libraries"))){let H=`${G[2]}:${G[3]}`.toLowerCase(),q=G[1].toLowerCase();z.set(q,H),z.set(q.replace(/-/g,"."),H);continue}let V=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(V){let H=V[1].toLowerCase(),q=V[2];if(Q==="plugins"||Q.endsWith(".plugins")){let K=q.split(":")[0].toLowerCase();Z.set(H,K),Z.set(H.replace(/-/g,"."),K)}else if(Q==="libraries"||Q.endsWith(".libraries")){let K=q.split(":");if(K.length>=2){let L=`${K[0]}:${K[1]}`.toLowerCase();z.set(H,L),z.set(H.replace(/-/g,"."),L)}}}}return{plugins:Z,libraries:z}}function mC($){let Z=f($,f6("gradle","libs.versions.toml"));if(!Z)return{plugins:new Map,libraries:new Map};return uC(Z)}function cC($){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 pC($,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 lC($,Z){let z=new Set;for(let Q of $.matchAll(/["']([A-Za-z0-9_.-]+:[A-Za-z0-9_.-]+)(?::[^"']+)?["']/g))z.add(Q[1].toLowerCase());for(let Q of $.matchAll(/libs\.([A-Za-z0-9_.]+)/g)){let X=Q[1].toLowerCase();if(X.startsWith("plugins."))continue;let J=[X,X.replace(/\./g,"-"),X.replace(/-/g,".")];for(let Y of J){let W=Z.libraries.get(Y);if(W){z.add(W.includes(":")?W.split(":").slice(0,2).join(":"):W);break}}}return z}function ZW($){let Z=($.match(/<packaging>\s*([^<]+?)\s*<\/packaging>/i)?.[1]||"jar").trim().toLowerCase(),z=new Set,Q=$.match(/<parent>([\s\S]*?)<\/parent>/i);if(Q){let Y=Q[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),W=Q[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(Y&&W)z.add(`${Y}:${W}`.toLowerCase())}let X=new Set;for(let Y of $.matchAll(/<dependency>([\s\S]*?)<\/dependency>/gi)){let W=Y[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),U=Y[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(W&&U)X.add(`${W}:${U}`.toLowerCase())}let J=[];for(let Y of $.matchAll(/<module>\s*([^<]+?)\s*<\/module>/gi))J.push(Y[1].trim());return{packaging:Z,parents:z,artifacts:X,modules:J}}function b2($,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 o1($,Z,z){let Q;for(let[X,J]of Z){let Y=!1;if(z==="plugin")Y=b2($,X);else if(Y=$.has(X)||[...$].some((W)=>W===X||W.startsWith(`${X}:`)||W.startsWith(`${X}.`)),!Y&&z==="artifact")Y=[...$].some((W)=>W===X||W.startsWith(`${X}`));if(!Y)continue;if(!Q||X.length>Q[0].length)Q=[X,J]}return Q}function dC($){let Z;for(let z of jC)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 zW($,Z){let z=new Set,Q=!1,X=!1,J=[f6(Z,"src"),f6(Z,"src","main")],Y=(W,U)=>{if(U>4)return;let G=z0($,W);if(!G)return;for(let{name:V}of G){if(V==="androidMain"||V==="commonMain"||V==="jvmMain"||V==="iosMain")z.add(V);let H=f6(W,V),q=M2($,H);if(!q)continue;if(q.isDirectory())Y(H,U+1);else if(V.endsWith(".kt")||V.endsWith(".kts"))Q=!0;else if(V.endsWith(".java"))X=!0}};for(let W of J)Y(W,0);return{kotlin:Q,java:X,hints:z}}function iC($){let Z=[],z=$.plugins,Q=$.artifacts,X=kC.some((j)=>b2(z,j))||$.sourceHints.has("commonMain"),J=b2(z,"com.android.application"),Y=b2(z,"com.android.library")||b2(z,"com.android.kotlin.multiplatform.library");if(J||Y)Z.push("android");if(X)Z.push("multiplatform");let W=dC(Q),U=o1(z,wC,"plugin"),G=o1($.parents,xC,"parent"),V=o1(Q,yC,"artifact"),H=o1(z,vC,"plugin"),q=o1(Q,gC,"artifact"),K=hC.some((j)=>b2(z,j)),L=$.packaging==="pom",B,N="",T;if(J)B="mobile",N=X?"Android+KMP":"Android",T=`${$.path||"root"} + com.android.application (${N})`;else if(W)B="mcp",N="MCP",Z.push("mcp"),T=`${$.path||"root"} + ${W} (JVM MCP server)`;else if(U||G||V){B="backend",N=U?.[1]||G?.[1]||V?.[1]||"JVM";let j=U?.[0]||G?.[0]||V?.[0]||"web";T=`${$.path||"root"} + ${j} (JVM backend)`}else if(X&&!Y)B="library",N="Kotlin Multiplatform",T=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(Y)B="library",N=X?"Android+KMP":"Android",T=`${$.path||"root"} + android library (${N})`;else if(q||$.hasApplicationPlugin&&($.hasMainClass||H)||H&&$.hasMainClass)B="cli",N=q?.[1]||"application",T=q?`${$.path||"root"} + ${q[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!K)B="cli",N="application",T=`${$.path||"root"} + application plugin (JVM CLI)`;else if(L)B="library",T=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{B="library";let j=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(T=`${$.path||"root"} (${j} library)`,K)T=`${$.path||"root"} + java-library (JVM library)`}let R="Java";if($.kotlinSources&&$.javaSources)R="Java/Kotlin";else if($.kotlinSources||bC.some((j)=>b2(z,j))||X)R="Kotlin";let w=[...new Set(Z)];return{appType:B,framework:N,facets:w,found:T,buildTool:$.buildTool,mainLanguage:R}}function nC($,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 eY($,Z,z){let Q=f6(Z,"build.gradle.kts"),X=f6(Z,"build.gradle"),J=A($,Q)?Q:A($,X)?X:null;if(!J)return null;let Y=f($,J);if(!Y)return null;let W=pC(Y,z),U=lC(Y,z),G=zW($,Z),V=/mainClass\s*[.=]/.test(Y)||/mainClassName\s*=/.test(Y)||/Main-Class/.test(Y),H=b2(W,"application")||b2(W,"org.gradle.application");return{path:Z||"build.gradle",plugins:W,artifacts:U,packaging:"jar",parents:new Set,hasMainClass:V,hasApplicationPlugin:H,sourceHints:G.hints,kotlinSources:G.kotlin||J.endsWith(".kts"),javaSources:G.java,buildTool:"gradle"}}function $W($,Z){let z=f($,f6(Z,"pom.xml"));if(!z)return null;let{packaging:Q,parents:X,artifacts:J}=ZW(z),Y=zW($,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 a1($){if(!j3($))return null;let Z=mC($),z=[],Q=null;for(let G of["settings.gradle.kts","settings.gradle"])if(A($,G)){Q=f($,G);break}let X=Q?cC(Q):[],J=eY($,"",Z);if(J)z.push(J);for(let G of X){let V=eY($,G,Z);if(V)z.push(V)}let Y=$W($,"");if(Y){z.push(Y);let G=f($,"pom.xml");if(G){let{modules:V}=ZW(G);for(let H of V){let q=$W($,H);if(q)z.push(q)}}}if(z.length===0&&Q)return{appType:"library",framework:"",buildTool:"gradle",mainLanguage:"Java/Kotlin",facets:[],found:"settings.gradle (Gradle multi-project root)"};if(z.length===0)return null;let W=null,U=999;for(let G of z){let V=iC(G),H=nC(V.appType,V.facets);if(!W||H<U)W={appType:V.appType,framework:V.framework,buildTool:V.buildTool,mainLanguage:V.mainLanguage,facets:V.facets,found:V.found},U=H}if(W&&X.length>0&&!W.found.includes("multi-project"));return W}import{join as sC}from"path";var t1={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 oC=t1.mcpGems.map(($)=>$.toLowerCase()),aC=t1.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),QW=t1.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),tC=t1.railsLayoutFiles;function eC($){return A($,"Gemfile")||A($,"gems.rb")||$_($)}function $_($){return(z0($)??[]).some((Z)=>Z.name.endsWith(".gemspec"))}function Z_($){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 z_($){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 Q_($){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 X_($){let Z=new Set,z=[];for(let X of["Gemfile","gems.rb"]){let J=f($,X);if(J){for(let Y of Z_(J))Z.add(Y);z.push(X)}}let Q=f($,"Gemfile.lock")||f($,"gems.locked");if(Q){for(let X of z_(Q))Z.add(X);z.push("Gemfile.lock")}for(let{name:X}of z0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=f($,X);if(J){for(let Y of Q_(J))Z.add(Y);z.push(X)}}return{gems:Z,sources:z}}function e1($,Z){let z=Z.toLowerCase();if($.has(z))return!0;return!1}function w3($,Z){let z;for(let[Q,X]of Z){if(!e1($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function J_($){let Z;for(let z of oC)if(e1($,z)&&(!Z||z.length>Z.length))Z=z;return Z}function XW($){for(let Z of tC)if(A($,Z))return Z;return}function Y_($,Z){let z=w3(Z,QW);if(z)return{hit:!0,why:z[0]};for(let{name:X}of z0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=f($,X);if(J&&/executables\s*=/.test(J)&&!/executables\s*=\s*\[\s*\]/.test(J))return{hit:!0,why:`${X} executables`}}let Q=z0($,"bin");if(Q){let J=Q.map((Y)=>Y.name).filter((Y)=>{if(Y==="setup"||Y==="console"||Y==="rake")return!1;return M2($,sC("bin",Y))?.isFile()===!0}).filter((Y)=>Y!=="rails");if(J.length>0&&!e1(Z,"rails")&&!XW($))return{hit:!0,why:`bin/${J[0]}`}}return{hit:!1,why:""}}function j5($){if(!eC($))return null;let{gems:Z,sources:z}=X_($),Q=z[0]||"Gemfile",X=z.some((N)=>N==="Gemfile"||N==="gems.rb"||N.includes("lock"))?"bundler":"rubygems",J=J_(Z),Y=w3(Z,aC),W=XW($),U=e1(Z,"rails")||e1(Z,"railties"),G=Y_($,Z),V=A($,"config.ru"),H=U||!!W,q=Y&&Y[1]!=="Rails"&&!(Y[0]==="rack"&&!V)?Y:void 0,K,L="",B;if(J)K="mcp",L="MCP",B=`${Q} + gem ${J} (Ruby MCP)`;else if(H)if(K="backend",L="Rails",U&&W)B=`${Q} + rails + ${W} (Rails)`;else if(U)B=`${Q} + gem rails (Rails)`;else B=`${W} (Rails layout)`;else if(q)K="backend",L=q[1],B=`${Q} + gem ${q[0]} (Ruby backend)`;else if(G.hit)K="cli",L=w3(Z,QW)?.[1]||"",B=`${Q} + ${G.why} (Ruby CLI)`;else K="library",B=`${Q} (Ruby library)`;return{appType:K,framework:L,packageManager:X,found:B}}import{join as U_}from"path";var P2={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 G_=P2.mcpPackageUrls.map(($)=>$.toLowerCase()),V_=P2.mcpProducts.map(($)=>$.toLowerCase()),H_=P2.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),q_=P2.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),K_=P2.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),B_=P2.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),M_=P2.appProductTypes,L_=P2.cliProductTypes,N_=P2.vaporLayoutFiles;function O_($){return A($,"Package.swift")||x3($).length>0}function x3($){return(z0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.endsWith(".xcodeproj")&&M2($,Z)?.isDirectory()===!0)}function D_($){let Z=I_($),z=Z.toLowerCase(),Q=[],X=/\.package\s*\(\s*url\s*:\s*"([^"]+)"/gi,J;while((J=X.exec(Z))!==null)Q.push(J[1]);let Y=/\.package\s*\(\s*url\s*:\s*'([^']+)'/gi;while((J=Y.exec(Z))!==null)Q.push(J[1]);let W=[],U=/\.product\s*\(\s*name\s*:\s*"([^"]+)"/gi;while((J=U.exec(Z))!==null)W.push(J[1]);let G=/\.product\s*\(\s*name\s*:\s*'([^']+)'/gi;while((J=G.exec(Z))!==null)W.push(J[1]);let V=/\.library\s*\(/.test(z),H=/\.executable\s*\(/.test(z),q=/\.plugin\s*\(/.test(z)&&!V&&!H?!0:/\bproducts\s*:\s*\[[\s\S]*?\.plugin\s*\(/.test(z),K=/\.executabletarget\s*\(/.test(z),L=/\.target\s*\(/.test(z)&&!K?!0:(z.match(/\.target\s*\(/g)||[]).length>(z.match(/\.executabletarget\s*\(/g)||[]).length+(z.match(/\.testtarget\s*\(/g)||[]).length;return{packageUrls:Q,productNames:W,hasLibraryProduct:V,hasExecutableProduct:H,hasPluginProduct:!!q,hasExecutableTarget:K,hasLibraryTarget:L}}function I_($){let Z="",z=0;while(z<$.length){if($[z]==='"'||$[z]==="'"){let Q=$[z];Z+=Q,z++;while(z<$.length){if($[z]==="\\"&&z+1<$.length){Z+=$[z]+$[z+1],z+=2;continue}if(Z+=$[z],$[z]===Q){z++;break}z++}continue}if($[z]==="/"&&$[z+1]==="/"){z+=2;while(z<$.length&&$[z]!==`
235
- `)z++;continue}if($[z]==="/"&&$[z+1]==="*"){z+=2;while(z<$.length&&!($[z]==="*"&&$[z+1]==="/"))z++;z+=2;continue}Z+=$[z],z++}return Z}function T_($,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 JW($,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 YW($,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 A_($){let Z=$.map((z)=>z.toLowerCase());return V_.some((z)=>Z.includes(z))}function C_($){let Z=!1,z=!1,Q;for(let X of x3($)){let J=f($,U_(X,"project.pbxproj"));if(!J)continue;for(let Y of M_)if(J.includes(Y))Z=!0,Q=Y;for(let Y of L_)if(J.includes(Y)){if(z=!0,!Q)Q=Y}}return{hasApplication:Z,hasTool:z,hit:Q}}function __($){for(let Z of N_)if(A($,Z))return Z;return}function $4($){if(!O_($))return null;let Z=A($,"Package.swift"),z=x3($),Q=z.length>0,X=null;if(Z){let E=f($,"Package.swift");if(E)X=D_(E)}let J=Q?C_($):{hasApplication:!1,hasTool:!1},Y=__($),W=X?.packageUrls??[],U=X?.productNames??[],G=T_(W,G_),V=A_(U),H=JW(W,H_),q=YW(U,q_),K=JW(W,K_),L=YW(U,B_),B=!!(G||V),N=!!(H||q||Y),T=!!(X?.hasExecutableProduct||X?.hasExecutableTarget),R=!!(K||L),w=J.hasApplication,j=Z&&Q?"spm+xcode":Z?"spm":"xcode",y,x="",h;if(B)if(y="mcp",x="MCP",V)h="Package.swift + product MCP (Swift MCP)";else h=`Package.swift + ${G} (Swift MCP)`;else if(N)if(y="backend",x=q?.[1]||H?.[1]||(Y?"Vapor":""),q)h=`Package.swift + product ${q[1]} (Swift backend)`;else if(H)h=`Package.swift + ${H[1]} (Swift backend)`;else h=`${Y} (Swift backend layout)`;else if(w)y="app",x="",h=`${z[0]} + ${J.hit||"application"} (Swift app)`;else if(R||T&&!N&&!B)if(y="cli",x=L?.[1]||K?.[1]||"",L)h=`Package.swift + product ${L[1]} (Swift CLI)`;else if(K)h=`Package.swift + ${K[1]} (Swift CLI)`;else if(X?.hasExecutableProduct)h="Package.swift + .executable product (Swift CLI)";else h="Package.swift + .executableTarget (Swift CLI)";else if(J.hasTool&&!Z)y="cli",h=`${z[0]} + tool productType (Swift CLI)`;else if(Z)if(y="library",X?.hasLibraryProduct)h="Package.swift + .library product (Swift library)";else h="Package.swift (Swift library)";else y="library",h=`${z[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:y,framework:x,packageManager:j,found:h}}function R_($){let Z=f($,"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 F_($){let Z=f($,"Cargo.toml");return Z!==null&&/^\s*\[\[bin\]\]/m.test(Z)}function P_($,Z){if(Z?.keywords?.some((Q)=>/^sdk(?:\s|-|$)|-sdk$/i.test(Q)))return'package.json keywords contains "sdk"';if(Z?.name&&/(?:^|[-_/])sdk(?:[-_/]|$)/i.test(Z.name))return`package.json name "${Z.name}" → sdk`;let z=R_($);if(z&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(z))return`Cargo.toml name "${z}" → sdk`;return null}function S_($){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=f($,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 E_($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,z=f($,"pyproject.toml");if(z!==null){let X=z.match(Z);if(X)return`pyproject.toml depends on ${X[1]}`}let Q=f($,"requirements.txt");if(Q!==null){let X=Q.match(Z);if(X)return`requirements.txt contains ${X[1]}`}return null}function j_($,Z){let z=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let Q of z)if(Z.dependencies?.[Q]||Z.devDependencies?.[Q])return`${Q} dependency`}if(A($,"ios")&&A($,"android"))return"ios/ + android/ dirs";return null}function w_($,Z){let z=f($,"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=f($,"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 x_($,Z){if(!A($,"index.html"))return null;if(Z?.dependencies||Z?.devDependencies){let z={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((X)=>z[X]))return null}return"index.html (vanilla, no frontend framework)"}function y_($,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 k_($,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 b_($,Z){if(!Z)return null;let z={...Z.dependencies??{},...Z.devDependencies??{}},Q=["@clerk/nextjs","@clerk/clerk-react","next-auth","@auth/core","auth0","@auth0/nextjs-auth0"],X=["stripe","@stripe/stripe-js","lemonsqueezy"],J=Q.some((W)=>z[W]),Y=X.some((W)=>z[W]);if(J&&Y)return"auth + payment dependencies";return null}function v_($,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 g_($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||A($,"pnpm-workspace.yaml")))return null;return"private workspace + multi-package"}var h_=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"]),UW=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,f_=new Set(["frontend","backend","database","css","ui","state"]);function u_($){if(A($,"pyproject.toml")||A($,"manage.py")||A($,"setup.py")||w5($,"requirements*.txt"))return!0;if(A($,"go.mod"))return!0;if(A($,"Cargo.toml"))return!0;if(A($,"Gemfile"))return!0;if(A($,"pom.xml")||w5($,"build.gradle*"))return!0;if(P$($).length>0)return!0;let Z=D2($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function x5($){return I$($,()=>m_($))}function m_($){let Z=z0($)??[],z=[];for(let Q of Z){if(!Q.isDirectory()||Q.name.startsWith(".")||h_.has(Q.name))continue;let X=WW($,Q.name);if(!u_(X))continue;let J=k5(X);if(!J)continue;let Y=y5(X).filter((V)=>f_.has(V.category)),W=Y.find((V)=>V.category==="frontend"),U=Y.find((V)=>V.category==="backend"),G=W??U??Y[0]??null;z.push({name:Q.name,language:J,topFramework:G?.name??null,frontend:!!W,backend:!!U||UW.test(J),hasFramework:!!G,appRoot:A(X,"manage.py")||A(X,"config.ru")||A(X,"bin/rails")||A(X,"artisan")})}return z}function c_($,Z){if(Z?.workspaces||A($,"pnpm-workspace.yaml"))return null;let z=x5($),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 GW($){let Z=x5($);if(Z.length<2)return null;let z=(Y)=>(Y.appRoot?2:0)+(UW.test(Y.language)?2:0)+(Y.hasFramework?1:0)+(Y.frontend?0.5:0),Q=[...Z].sort((Y,W)=>z(W)-z(Y)),X=new Set,J=[];for(let Y of Q){if(X.has(Y.language))continue;X.add(Y.language);let W=Y.frontend?"frontend":Y.backend?"backend":"service";J.push(Y.topFramework?`${Y.language} (${Y.topFramework} · ${W})`:`${Y.language} (${W})`)}return J.join("; ")}function D2($){let Z=f($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function w5($,Z){if(!Z.includes("*"))return A($,Z);let z=Z.split("/");if(z.length===1){let W=Z.split("*")[0];return(z0($)??[]).some((U)=>U.name.startsWith(W))}let Q=WW(...z.slice(0,-1)),X=z[z.length-1],J=X.split("*")[0],Y=X.split("*")[1]||"";return(z0($,Q)??[]).some((W)=>W.name.startsWith(J)&&W.name.endsWith(Y))}function p_($,Z,z){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return w5(z,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!w5(z,$.pattern))return!1;let Q=f(z,$.pattern);return Q!==null&&Q.toLowerCase().includes($.key.toLowerCase())}default:return!1}}function y5($){let Z=D2($);return rY.map((z)=>{let X=z.signals.filter((J)=>p_(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 k5($){let Z=D2($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(A($,"tsconfig.json"))return"TypeScript";if(A($,"Cargo.toml"))return"Rust";if(A($,"go.mod"))return"Go";if(P$($).length>0)return"C#";if(A($,"pyproject.toml")||A($,"setup.py"))return"Python";if(A($,"Gemfile"))return"Ruby";if(j3($)){let z=a1($);if(z)return z.mainLanguage==="Java/Kotlin"?"Kotlin":z.mainLanguage;return"Java"}if(A($,"Package.swift"))return"Swift";if(A($,"build.zig"))return"Zig";if(A($,"pubspec.yaml"))return"Dart";if(Z)return"JavaScript";return""}function VW($){let Z=D2($),z=y5($),Q=[],X=y_($,Z);if(X)return Q.push(X),{type:"documentation",found:Q};let J=P_($,Z);if(J)return Q.push(J),{type:"sdk",found:Q};let Y=S_($);if(Y)return Q.push(Y),{type:"extension",found:Q};let W=v_($,Z,z);if(W)return Q.push(W),{type:"mcpaas",found:Q};let U=b_($,Z);if(U)return Q.push(U),{type:"saas",found:Q};let G=w_($,Z);if(G)return Q.push(G),{type:"wasm",found:Q};let V=R5($);if(V)return Q.push(V.found),{type:V.appType,found:Q};let H=P5($);if(H)return Q.push(H.found),{type:H.appType,found:Q};let q=E5($);if(q)return Q.push(q.found),{type:q.appType,found:Q};let K=a1($);if(K)return Q.push(K.found),{type:K.appType,found:Q};let L=j5($);if(L)return Q.push(L.found),{type:L.appType,found:Q};let B=$4($);if(B)return Q.push(B.found),{type:B.appType,found:Q};let N=j_($,Z);if(N)return Q.push(N),{type:"mobile",found:Q};if(z.some((t)=>t.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(F_($))return Q.push("Cargo.toml [[bin]]"),{type:"cli",found:Q};if(A($,"build.zig")){if(Q.push("build.zig"),A($,"src/main.zig"))return Q.push("src/main.zig"),{type:"cli",found:Q};if(A($,"src/root.zig"))return Q.push("src/root.zig"),{type:"library",found:Q}}let R=z.some((t)=>t.slug==="svelte"||t.slug==="sveltekit");if(Z?.private===!0&&(A($,"pnpm-workspace.yaml")||Z?.workspaces!==void 0)&&R)return Q.push("private workspace","Svelte"),{type:"framework",found:Q};if(R)return Q.push("Svelte/SvelteKit"),{type:"svelte",found:Q};let j=z.some((t)=>t.category==="frontend"),y=z.some((t)=>t.category==="backend");if(Z?.private&&(Z.workspaces||A($,"pnpm-workspace.yaml"))&&j&&y)return Q.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:Q};let x=g_($,Z);if(x)return Q.push(x),{type:"monorepo-root",found:Q};let h=k_($,Z,z);if(h)return Q.push(h),{type:"website",found:Q};if(z.some((t)=>t.slug==="nextjs"||t.slug==="nuxt"))return Q.push(z.find((t)=>t.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:Q};let c=z.some((t)=>t.category==="frontend"),D0=z.some((t)=>t.category==="backend");if(c&&D0)return Q.push("frontend framework","backend framework"),{type:"fullstack",found:Q};if(c)return Q.push("frontend framework"),{type:"frontend",found:Q};if(D0)return Q.push("backend framework"),{type:"backend",found:Q};let b0=E_($);if(b0)return Q.push(b0),{type:"data-science",found:Q};let F=x_($,Z);if(F)return Q.push(F),{type:"html",found:Q};let i=c_($,Z);if(i)return Q.push(i),{type:"fullstack",found:Q};if(Z?.main&&!Z?.bin)return Q.push("package.json main (no bin)"),{type:"library",found:Q};return Q.push(A$),{type:"library",found:Q}}function HW($){if(A($,"bunfig.toml"))return"Bun";if(A($,"deno.json")||A($,"deno.jsonc"))return"Deno";if(D2($))return"Node.js";if(A($,"Cargo.toml"))return"Rust";if(A($,"go.mod"))return"Go";if(P$($).length>0)return".NET";if(A($,"pubspec.yaml"))return"Dart";return""}var l_=new Set(["npm","pnpm","yarn","bun"]);function d_($){let Z=D2($)?.packageManager;if(typeof Z!=="string")return"";let z=/^([a-z]+)@/i.exec(Z.trim())?.[1]?.toLowerCase()??"";return l_.has(z)?z:""}function i_($){if(A($,"pubspec.yaml"))return"pub";if(A($,"go.mod"))return"go modules";if(P$($).length>0)return"NuGet";if(A($,"pom.xml"))return"maven";return["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"].some((z)=>A($,z))?"gradle":""}var n_=[["bun.lockb","bun"],["bun.lock","bun"],["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"]];function qW($){return i_($)||d_($)||(n_.find(([Z])=>A($,Z))?.[1]??"")}function KW($){if(A($,".github/workflows"))return"GitHub Actions";if(A($,".gitlab-ci.yml"))return"GitLab CI";if(A($,".circleci"))return"CircleCI";if(A($,"Jenkinsfile"))return"Jenkins";return null}function BW($){if(A($,"vercel.json"))return"Vercel";if(A($,"netlify.toml"))return"Netlify";if(A($,"wrangler.toml"))return"Cloudflare";if(A($,"fly.toml"))return"Fly.io";if(A($,"render.yaml"))return"Render";return null}function MW($){let Z=f($,"svelte.config.js");if(Z===null)return null;let z=Z.match(/@sveltejs\/adapter-(\w+)/);if(z){let Q=z[1];switch(Q){case"vercel":return"Vercel";case"node":return"Node";case"static":return"Static";case"cloudflare":return"Cloudflare";case"netlify":return"Netlify";case"auto":return"Auto";default:return Q}}return null}function LW($){let Z=D2($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return"Vite";if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(A($,"tsconfig.json")&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function b5($){return["package.json","Cargo.toml","pyproject.toml","go.mod","build.zig","build.zig.zon","src/index.ts","src/index.js","src/main.ts","src/cli.ts","src/main.rs","src/lib.rs","src/main.zig","src/root.zig","src/__init__.py","main.py","__main__.py","main.go","cmd/main.go","README.md","SPECIFICATION.md","BINARY-FORMAT.md","tsconfig.json","wrangler.toml","vercel.json"].filter((z)=>A($,z))}function v5($,Z){let z={};if(Z?.scripts){for(let Q of["build","test","lint","dev","start"])if(Z.scripts[Q]){let X=A($,"bun.lock")||A($,"bun.lockb")?"bun run":"npm run";z[Q]=`${X} ${Q}`}}if(A($,"Cargo.toml")){if(!z.build)z.build="cargo build --release";if(!z.test)z.test="cargo test";if(!z.lint&&r_($))z.lint="cargo clippy"}if(A($,"build.zig")){if(!z.build)z.build="zig build";if(!z.test&&/\.step\(\s*"test"/.test(y3($,"build.zig")))z.test="zig build test"}if(A($,"go.mod")){if(!z.build)z.build="go build ./...";if(!z.test)z.test="go test ./..."}if(!z.test&&s_($))z.test="pytest";return z}function y3($,Z){return f($,Z)??""}function r_($){if(A($,"clippy.toml")||A($,".clippy.toml"))return!0;return/^\s*\[(workspace\.)?lints\.clippy\]/m.test(y3($,"Cargo.toml"))}function s_($){if(A($,"pytest.ini")||A($,"conftest.py"))return!0;return["pyproject.toml","setup.cfg","tox.ini"].some((Z)=>/\bpytest\b/.test(y3($,Z)))}function NW($,Z,z,Q){let X=[];if(Q&&Q!=="Unknown")X.push(Q);let J=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let Y of z)if(J.has(Y.category))X.push(Y.name);if(A($,"bunfig.toml"))X.push("Bun");else if(A($,"deno.json")||A($,"deno.jsonc"))X.push("Deno");if(X.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let W of Y)if(!X.some((U)=>U.toLowerCase().includes(W.toLowerCase())))X.push(W)}return X}function o_($){let Z=$?.dependencies?.svelte??$?.devDependencies?.svelte,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?NaN:Number(z)}function OW($){return k3($).data}function k3($){let Z=D2($),z=y5($),Q=VW($),X=Q.type,J=Q.found.some((s)=>s.startsWith("polyglot:")),Y=J&&GW($)||k5($),W=HW($),U=qW($),G=KW($),V=BW($),H=LW($),q=z.find((s)=>s.category==="frontend"),K=z.find((s)=>s.category==="css"),L=z.find((s)=>s.category==="ui"),B=z.find((s)=>s.category==="state"),N=z.find((s)=>s.category==="backend"),T=z.find((s)=>s.category==="database"),R=(s)=>v6(X,s)??v6("library",s)===!0,w=X==="framework",j=z.some((s)=>s.slug==="svelte"||s.slug==="sveltekit"),y=w&&j?"svelte":w?null:null,x=X==="svelte"||y==="svelte",h=x?MW($):null,E=x&&z.some((s)=>s.slug==="sveltekit"),c={},D0=Q0.filter((s)=>s.path.startsWith("stack."));for(let s of D0){let X0=s.path.replace("stack.","");switch(X0){case"frontend":c[X0]=q?.name??"";break;case"css_framework":c[X0]=K?.name??"";break;case"ui_library":c[X0]=L?.name??"";break;case"state_management":c[X0]=B?.name??(x&&o_(Z)>=5?"Runes":"");break;case"backend":c[X0]=x?E?"SvelteKit":N?.name??"":N?.name??"";break;case"api_type":c[X0]=E?"Server Routes":"";break;case"runtime":c[X0]=W;break;case"database":c[X0]=T?.name??"";break;case"connection":c[X0]=T?.name??"";break;case"hosting":if(x&&h)c[X0]=h;else c[X0]=V??"";break;case"build":c[X0]=E?"Vite":H??"";break;case"cicd":c[X0]=G??"";break;case"package_manager":c[X0]=U;break;default:c[X0]="";break}}let b0={};for(let s of D0){let X0=s.path.replace("stack.","");b0[X0]=R(s)?c[X0]:"slotignored"}let F={},i=Q0.filter((s)=>s.path.startsWith("monorepo."));for(let s of i){let X0=s.path.replace("monorepo.","");if(!R(s))F[X0]="slotignored";else F[X0]=""}let t={name:Z?.name??$.split("/").pop()??"project",goal:J?"":Z?.description??"",main_language:Y,type:X};if(w&&y)t.framework=y;let V2=NW($,Z,z,J?k5($):Y);if(J){for(let s of x5($))for(let X0 of[s.language,s.topFramework])if(X0&&!V2.includes(X0))V2.push(X0)}let BQ=b5($),MQ=v5($,Z),K8={faf_version:V6,project:t,stack:b0,human_context:{who:"",what:J?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:F,_meta:{found:Q.found}};if(V2.length>0)K8.tech_stack=V2;if(BQ.length>0)K8.key_files=BQ;if(Object.keys(MQ).length>0)K8.commands=MQ;return{data:K8,facts:c}}var DW={MIN_LENGTH:8,MAX_LENGTH:280},a_=[/^(see|see\s+the?)\s+readme/i,/^(tbd|todo|fixme|coming\s+soon)\b/i,/^(software|application|app|project|tool|library|framework)\.?$/i,/^(for\s+users|for\s+developers)\.?$/i,/^(description|goal|name|title)\.?$/i,/^lorem\s+ipsum/i,/^example(\s+\w+)?\.?$/i];function I2($){let Z=$.trim();if(Z.length<DW.MIN_LENGTH)return!1;if(Z.length>DW.MAX_LENGTH)return!1;if(a_.some((z)=>z.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
236
- `).length>4)return!1;return!0}function t_($){let Z=$.split(`
226
+ `)}}var P3=($)=>$.startsWith("\uFEFF")?$.slice(1):$;function dA($){let Z={};for(let[z,Q]of Object.entries($.slots??{}))Z[UY.get(z)??z]=Q;return{...$,slots:Z}}function R0($){return dA(JSON.parse(t1().score_faf(P3($))))}function lY($){return t1().validate_faf(P3($))}function R5($){return t1().compile_fafb(P3($))}function dY($){return JSON.parse(t1().decompile_fafb($))}function iY(){return t1().sdk_version()}var nY=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function rY($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function sY($){let Z=$.match(/^about:\s*\n((?:[ \t]+.*\n?)*)/m);if(!Z)return null;let z=Z[1]??"",Q=z.match(/^[ \t]+represents:\s*(\S+)\s*$/m);if(!Q)return null;let X=Q[1],J=z.match(/^[ \t]+source_score:\s*(\d+)\s*$/m),Y=-1;if(J){let W=parseInt(J[1],10);if(W>=0&&W<=100)Y=W}return{represents:X,sourceScore:Y}}function S3($){return $.unknown?"unknown (—)":`${$.score}%`}function x0($){return{score:$.score,tier:G6($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function L0($){let Z=sY($);if(Z){let z=Z.sourceScore;return{score:z,tier:z>=0?G6(z):F$[F$.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Z.represents,...z<0?{unknown:!0}:{}}}return x0(R0($))}function iA($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)?X[Q]:void 0}function E3($){try{let Z=y6($,{logLevel:"error"}).getIn(["project","type"],!0);return T0(Z)&&typeof Z.comment==="string"&&Z.comment.includes(C$)}catch{return!1}}function nA($,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 rA($){try{let Z=y6($,{logLevel:"error"});if(Z.errors.length>0)return null;let z=Z.toJS();return $0(z)?z:null}catch{return null}}function F5($,Z,z={}){let Q=rA($);if(Q===null)return[];let X=$0(Q.project)&&!E3($)?Q.project.type:void 0,J=[];for(let Y of X0){let W=iA(Q,Y.path);if(Z.slots[Y.path]!=="empty"||!A$(W))continue;let U=v6.library.includes(Y.category),G=nA(Y.path,String(W).trim(),g6(X,Y),U,z.outOfType!==!1);if(G!==null)J.push(G)}return J}d();d();import{existsSync as sA,readFileSync as oA}from"fs";import{join as oY}from"path";import{homedir as aA}from"os";var tA=95,eA=30,$C=3,j3=oY(aA(),".config","faf"),w3=oY(j3,"star-nudge"),ZC="github.com/Wolfe-Jam/faf-cli";function zC($){if($.score<tA)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??$C))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??eA)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function QC(){try{if(!sA(w3))return{shown:0,lastShownMs:null};let $=oA(w3,"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 XC($){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 JC($,Z){try{S0(j3),F2(w3,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}),{root:j3,owns:XC,mark:"faf star-nudge state"})}catch{}}function aY($){let Z=Date.now(),z=QC();if(!zC({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:")} ${ZC}`),JC(z.shown,Z)}function F0($,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=N2($.tier),J=C(`${$.score}%`);if(console.log(`${X} ${J} ${M(`${$.populated}/${$.active} slots`)} ${M("—")} ${Z}`),$.tier.name==="TROPHY")console.log(M(" Trophy. AI never has to guess."));else if($.empty>0){let Y=Object.entries($.slots).filter(([,V])=>V==="empty").map(([V])=>V),W=Y.slice(0,3).join(", "),U=Y.length>3?`, +${Y.length-3} more`:"",G=$.empty===1?"slot":"slots";console.log(M(` ${$.empty} ${G} from Trophy: ${W}${U}`))}if(YC(Q),z)console.log(""),WC($);aY($.score)}function YC($){for(let Z of $)console.log(M(` ${Z}`))}function WC($){for(let[Z,z]of Object.entries($.slots)){let Q=z==="populated"?I("●"):z==="slotignored"?M("—"):M("○");console.log(` ${Q} ${z==="slotignored"?M(`${Z}: slotignored`):Z}`)}}d();function P5($,Z={}){let z=$??u();if(!z)console.error(`Error: project.faf not found
227
+
228
+ Run 'faf init' to create one.`),process.exit(2);let Q=p(z);z2(Q,z);let X=n(z,()=>L0(Q));if(Z.json){let J=r(z),Y={faf_version:J.faf_version??"unknown",project:J.project?.name??"unknown",source:z,...X};console.log(JSON.stringify(Y,null,2));return}if(Z.status){console.log(X.unknown?`— ${C(S3(X))}`:`${N2(X.tier)} ${C(S3(X))}`);return}F0(X,z,Z.verbose,F5(Q,X))}import{existsSync as hF}from"fs";import{join as fW}from"path";var V6="3.0";import{join as qW}from"path";var tY=[{name:"Next.js",slug:"nextjs",category:"frontend",signals:[{type:"dependency",key:"next"},{type:"file",pattern:"next.config.*"}]},{name:"React",slug:"react",category:"frontend",signals:[{type:"dependency",key:"react"}]},{name:"SvelteKit",slug:"sveltekit",category:"frontend",signals:[{type:"dependency",key:"@sveltejs/kit"},{type:"file",pattern:"svelte.config.*"}]},{name:"Svelte",slug:"svelte",category:"frontend",signals:[{type:"dependency",key:"svelte"},{type:"devDependency",key:"svelte"}]},{name:"Vue.js",slug:"vue",category:"frontend",signals:[{type:"dependency",key:"vue"}]},{name:"Nuxt",slug:"nuxt",category:"frontend",signals:[{type:"dependency",key:"nuxt"},{type:"file",pattern:"nuxt.config.*"}]},{name:"Angular",slug:"angular",category:"frontend",signals:[{type:"dependency",key:"@angular/core"},{type:"file",pattern:"angular.json"}]},{name:"Astro",slug:"astro",category:"frontend",signals:[{type:"dependency",key:"astro"},{type:"file",pattern:"astro.config.*"}]},{name:"Solid",slug:"solid",category:"frontend",signals:[{type:"dependency",key:"solid-js"}]},{name:"Remix",slug:"remix",category:"frontend",signals:[{type:"dependency",key:"@remix-run/react"}]},{name:"Gatsby",slug:"gatsby",category:"frontend",signals:[{type:"dependency",key:"gatsby"},{type:"file",pattern:"gatsby-config.*"}]},{name:"Qwik",slug:"qwik",category:"frontend",signals:[{type:"dependency",key:"@builder.io/qwik"}]},{name:"Vercel (SvelteKit)",slug:"adapter-vercel",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-vercel"},{type:"devDependency",key:"@sveltejs/adapter-vercel"}]},{name:"Node (SvelteKit)",slug:"adapter-node",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-node"},{type:"devDependency",key:"@sveltejs/adapter-node"}]},{name:"Static (SvelteKit)",slug:"adapter-static",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-static"},{type:"devDependency",key:"@sveltejs/adapter-static"}]},{name:"Cloudflare (SvelteKit)",slug:"adapter-cloudflare",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-cloudflare"},{type:"devDependency",key:"@sveltejs/adapter-cloudflare"}]},{name:"Netlify (SvelteKit)",slug:"adapter-netlify",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-netlify"},{type:"devDependency",key:"@sveltejs/adapter-netlify"}]},{name:"Tailwind CSS",slug:"tailwind",category:"css",signals:[{type:"dependency",key:"tailwindcss"},{type:"devDependency",key:"tailwindcss"},{type:"file",pattern:"tailwind.config.*"}]},{name:"Bootstrap",slug:"bootstrap",category:"css",signals:[{type:"dependency",key:"bootstrap"}]},{name:"Styled Components",slug:"styled-components",category:"css",signals:[{type:"dependency",key:"styled-components"}]},{name:"shadcn/ui",slug:"shadcn",category:"ui",signals:[{type:"file",pattern:"components.json"},{type:"dependency",key:"@radix-ui/react-dialog"}]},{name:"Material UI",slug:"mui",category:"ui",signals:[{type:"dependency",key:"@mui/material"}]},{name:"Chakra UI",slug:"chakra",category:"ui",signals:[{type:"dependency",key:"@chakra-ui/react"}]},{name:"Ant Design",slug:"antd",category:"ui",signals:[{type:"dependency",key:"antd"}]},{name:"Redux",slug:"redux",category:"state",signals:[{type:"dependency",key:"@reduxjs/toolkit"}]},{name:"Zustand",slug:"zustand",category:"state",signals:[{type:"dependency",key:"zustand"}]},{name:"Jotai",slug:"jotai",category:"state",signals:[{type:"dependency",key:"jotai"}]},{name:"Pinia",slug:"pinia",category:"state",signals:[{type:"dependency",key:"pinia"}]},{name:"Express",slug:"express",category:"backend",signals:[{type:"dependency",key:"express"}]},{name:"Fastify",slug:"fastify",category:"backend",signals:[{type:"dependency",key:"fastify"}]},{name:"Hono",slug:"hono",category:"backend",signals:[{type:"dependency",key:"hono"}]},{name:"Elysia",slug:"elysia",category:"backend",signals:[{type:"dependency",key:"elysia"}]},{name:"NestJS",slug:"nestjs",category:"backend",signals:[{type:"dependency",key:"@nestjs/core"}]},{name:"Koa",slug:"koa",category:"backend",signals:[{type:"dependency",key:"koa"}]},{name:"Django",slug:"django",category:"backend",signals:[{type:"file",pattern:"manage.py"},{type:"file",pattern:"settings.py"}]},{name:"Flask",slug:"flask",category:"backend",signals:[{type:"content",pattern:"app.py",key:"flask"}]},{name:"FastAPI",slug:"fastapi",category:"backend",signals:[{type:"content",pattern:"main.py",key:"fastapi"}]},{name:"Rails",slug:"rails",category:"backend",signals:[{type:"content",pattern:"Gemfile",key:"rails"},{type:"content",pattern:"Gemfile.lock",key:"rails ("},{type:"file",pattern:"config/application.rb"},{type:"file",pattern:"config/routes.rb"}]},{name:"Spring Boot",slug:"spring",category:"backend",signals:[{type:"content",pattern:"pom.xml",key:"spring-boot"},{type:"content",pattern:"build.gradle",key:"springframework.boot"},{type:"content",pattern:"build.gradle.kts",key:"springframework.boot"},{type:"content",pattern:"gradle/libs.versions.toml",key:"springframework.boot"}]},{name:"Vapor",slug:"vapor",category:"backend",signals:[{type:"content",pattern:"Package.swift",key:"vapor/vapor"},{type:"content",pattern:"Package.swift",key:'product(name: "Vapor"'},{type:"content",pattern:"Package.swift",key:"product(name: 'Vapor'"},{type:"file",pattern:"Sources/App/configure.swift"}]},{name:"Hummingbird",slug:"hummingbird",category:"backend",signals:[{type:"content",pattern:"Package.swift",key:"hummingbird-project/hummingbird"},{type:"content",pattern:"Package.swift",key:'product(name: "Hummingbird"'},{type:"content",pattern:"Package.swift",key:"product(name: 'Hummingbird'"}]},{name:"Prisma",slug:"prisma",category:"database",signals:[{type:"dependency",key:"prisma"},{type:"devDependency",key:"prisma"},{type:"file",pattern:"prisma/schema.prisma"}]},{name:"Drizzle",slug:"drizzle",category:"database",signals:[{type:"dependency",key:"drizzle-orm"},{type:"file",pattern:"drizzle.config.*"}]},{name:"TypeORM",slug:"typeorm",category:"database",signals:[{type:"dependency",key:"typeorm"}]},{name:"Mongoose",slug:"mongoose",category:"database",signals:[{type:"dependency",key:"mongoose"}]},{name:"Vite",slug:"vite",category:"build",signals:[{type:"dependency",key:"vite"},{type:"devDependency",key:"vite"},{type:"file",pattern:"vite.config.*"}]},{name:"webpack",slug:"webpack",category:"build",signals:[{type:"dependency",key:"webpack"},{type:"devDependency",key:"webpack"},{type:"file",pattern:"webpack.config.*"}]},{name:"esbuild",slug:"esbuild",category:"build",signals:[{type:"dependency",key:"esbuild"},{type:"devDependency",key:"esbuild"}]},{name:"Turbopack",slug:"turbopack",category:"build",signals:[{type:"file",pattern:"turbo.json"}]},{name:"Jest",slug:"jest",category:"testing",signals:[{type:"devDependency",key:"jest"},{type:"file",pattern:"jest.config.*"}]},{name:"Vitest",slug:"vitest",category:"testing",signals:[{type:"devDependency",key:"vitest"}]},{name:"Playwright",slug:"playwright",category:"testing",signals:[{type:"devDependency",key:"@playwright/test"},{type:"file",pattern:"playwright.config.*"}]},{name:"Cypress",slug:"cypress",category:"testing",signals:[{type:"devDependency",key:"cypress"},{type:"file",pattern:"cypress.config.*"}]},{name:"Turborepo",slug:"turborepo",category:"monorepo",signals:[{type:"devDependency",key:"turbo"},{type:"file",pattern:"turbo.json"}]},{name:"Nx",slug:"nx",category:"monorepo",signals:[{type:"devDependency",key:"nx"},{type:"file",pattern:"nx.json"}]},{name:"Lerna",slug:"lerna",category:"monorepo",signals:[{type:"devDependency",key:"lerna"},{type:"file",pattern:"lerna.json"}]},{name:"MCP SDK",slug:"mcp",category:"ai",signals:[{type:"dependency",key:"@modelcontextprotocol/sdk"}]},{name:"Anthropic SDK",slug:"anthropic",category:"ai",signals:[{type:"dependency",key:"@anthropic-ai/sdk"}]},{name:"OpenAI SDK",slug:"openai",category:"ai",signals:[{type:"dependency",key:"openai"}]},{name:"LangChain",slug:"langchain",category:"ai",signals:[{type:"dependency",key:"langchain"}]},{name:"Vercel",slug:"vercel",category:"hosting",signals:[{type:"file",pattern:"vercel.json"}]},{name:"Netlify",slug:"netlify",category:"hosting",signals:[{type:"file",pattern:"netlify.toml"}]},{name:"Docker",slug:"docker",category:"hosting",signals:[{type:"file",pattern:"Dockerfile"},{type:"file",pattern:"docker-compose.yml"}]},{name:"Cloudflare Workers",slug:"cloudflare",category:"hosting",signals:[{type:"file",pattern:"wrangler.toml"},{type:"dependency",key:"wrangler"}]},{name:"GitHub Actions",slug:"github-actions",category:"cicd",signals:[{type:"file",pattern:".github/workflows/*.yml"}]},{name:"Commander.js",slug:"commander",category:"cli",signals:[{type:"dependency",key:"commander"}]}];import{join as GC}from"path";var P$={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 VC=P$.flutterDeps,qC=P$.mcpDeps,HC=P$.serverFrameworks,KC=P$.stateManagement,BC=P$.routing;function MC($){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 S5($){let Z=f($,"pubspec.yaml");if(Z===null)return null;let z=MC(Z),Q=(R)=>z.has(R.toLowerCase()),X=VC.some(Q)||/^flutter:\s*$/m.test(Z)||/\bsdk:\s*flutter\b/.test(Z),J=qC.find(Q),Y=HC.find(([R])=>Q(R)),W=KC.find(([R])=>Q(R)),U=W?W[1]:"",G=BC.find(([R])=>Q(R)),V=G?G[1]:"",q=Q("flutter_test")?"flutter_test":Q("test")?"test":"",H=/^executables:\s*$/m.test(Z),K=(Q0($,"bin")??[]).some((R)=>R.name.endsWith(".dart")),L=H||K,B,N="",T;if(X)if(N="Flutter",A($,GC("lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(Z))B="mobile",T="pubspec.yaml (Flutter app)";else B="library",T="pubspec.yaml (Flutter package)";else if(J)B="mcp",T=`pubspec.yaml + ${J} (Dart MCP server)`;else if(Y)B="backend",N=Y[1],T=`pubspec.yaml + ${Y[0]} (Dart backend)`;else if(L)B="cli",T=H?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else B="library",T="pubspec.yaml (Dart package)";return{appType:B,isFlutter:X,framework:N,stateManagement:U,routing:V,testing:q,found:T}}import{join as NC}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 OC=E5.mcpModules,DC=E5.serverFrameworks,IC=E5.cliFrameworks;function TC($){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 $W($,Z){let z=Z.toLowerCase();for(let Q of $)if(Q===z||Q.startsWith(`${z}/`))return!0;return!1}function eY($,Z){let z;for(let Q of Z){if(!$W($,Q[0]))continue;if(!z||Q[0].length>z[0].length)z=Q}return z}function AC($,Z){let z;for(let Q of Z){if(!$W($,Q))continue;if(!z||Q.length>z.length)z=Q}return z}function CC($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function _C($){for(let{name:Z}of Q0($,"cmd")??[]){let z=NC("cmd",Z),Q=M2($,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 RC($){let Z=f($,"main.go");return Z!==null&&/^package\s+main\b/m.test(Z)}function j5($){let Z=f($,"go.mod");if(Z===null)return null;let z=CC(Z),Q=TC(Z),X=AC(Q,OC),J=eY(Q,DC),Y=eY(Q,IC),W=_C($),U=RC($),G,V="",q;if(X)G="mcp",q=`go.mod + ${X} (Go MCP server)`;else if(J)G="backend",V=J[1],q=`go.mod + ${J[0]} (Go backend)`;else if(Y)G="cli",V=Y[1],q=`go.mod + ${Y[0]} (Go CLI)`;else if(W)G="cli",q="go.mod + cmd/ (Go CLI layout)";else if(U&&!J)G="cli",q="go.mod + main.go package main (Go CLI)";else G="library",q="go.mod (Go module)";return{appType:G,modulePath:z,framework:V,found:q}}var f6={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 PC=f6.mcpPackages.map(($)=>$.toLowerCase()),SC=f6.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),EC=f6.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),jC=f6.grpcServerPackages.map(($)=>$.toLowerCase()),wC=f6.specializedSdks,ZW=f6.baseSdk.toLowerCase();function xC($){let Z=$.match(/<Project\b[^>]*\bSdk\s*=\s*"([^"/]+)(?:\/[^"]*)?"/i),z=$.match(/<Sdk\b[^>]*\bName\s*=\s*"([^"]+)"/i),Q=(Z?.[1]||z?.[1]||"").trim(),X=($.match(/<OutputType>\s*([^<]+?)\s*<\/OutputType>/i)?.[1]||"").trim(),J=$.match(/<TargetFramework>\s*([^<]+?)\s*<\/TargetFramework>/i)?.[1],W=($.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i)?.[1]||J||"").trim(),U=/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test($),G=/<UseMaui>\s*true\s*<\/UseMaui>/i.test($),V=/<UseWPF>\s*true\s*<\/UseWPF>/i.test($),q=/<UseWindowsForms>\s*true\s*<\/UseWindowsForms>/i.test($),H=new Set;for(let L of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))H.add(L[1].toLowerCase());for(let L of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))H.add(L[1].toLowerCase());let K=new Set;for(let L of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))K.add(L[1].toLowerCase());return{sdk:Q,outputType:X,targetFramework:W,isTestProject:U,useMaui:G,useWpf:V,useWindowsForms:q,packages:H,frameworkRefs:K}}function x3($,Z){let z=Z.toLowerCase();if($.has(z))return!0;for(let Q of $)if(Q===z||Q.startsWith(`${z}.`))return!0;return!1}function zW($,Z){let z;for(let[Q,X]of Z){if(!x3($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function yC($){let Z;for(let z of PC){if(!x3($,z))continue;if(!Z||z.length>Z.length)Z=z}for(let z of $)if(z==="modelcontextprotocol"||z.startsWith("modelcontextprotocol.")){if(!Z||z.length>Z.length)Z=z}return Z}function kC($){let Z=$.toLowerCase();if(!Z)return;let z;for(let Q of wC){let X=Q[0].toLowerCase();if(Z===X||Z.startsWith(`${X}/`)){if(!z||X.length>z[0].length)z=Q}}return z}function w5($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function bC($,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 vC($,Z){let z=Z.replace(/\.csproj$/i,""),{sdk:Q,packages:X,frameworkRefs:J,outputType:Y}=$,W,U="",G,V=yC(X),q=kC(Q),H=zW(X,EC),K=zW(X,SC),L=jC.some((N)=>x3(X,N)),B=J.has("microsoft.aspnetcore.app");if(V)W="mcp",U="MCP",G=`${Z} + ${V} (C# MCP server)`;else if($.isTestProject||q?.[1]==="test"||H)W="library",U=H?.[1]||(q?.[1]==="test"?q[2]:"Test"),G=`${Z} + test (${U})`;else if($.useMaui)W="mobile",U="MAUI",G=`${Z} + UseMaui (MAUI)`;else if($.useWpf||$.useWindowsForms)W="backend",U=$.useWpf&&$.useWindowsForms?"WPF+WinForms":$.useWpf?"WPF":"Windows Forms",G=`${Z} + ${U}`;else if(q?.[1]==="web")W="backend",U=L?"gRPC":q[2],G=`${Z} + Sdk=${q[0]}${L?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(q?.[1]==="worker")W="backend",U=q[2],G=`${Z} + Sdk=${q[0]} (Worker)`;else if(q?.[1]==="blazor-wasm")W="backend",U=q[2],G=`${Z} + Sdk=${q[0]} (Blazor WASM)`;else if(q?.[1]==="aspire")W="backend",U=q[2],G=`${Z} + Sdk=${q[0]} (Aspire)`;else if(q?.[1]==="razor-lib")W="library",U=q[2],G=`${Z} + Sdk=${q[0]} (Razor class library)`;else if(B&&w5(Y))W="backend",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(B&&!w5(Y))W="library",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(K&&(w5(Y)||!Y))W="cli",U=K[1],G=`${Z} + ${K[0]} (C# CLI)`;else if(w5(Y))W="cli",G=`${Z} + OutputType=Exe (C# console)`;else{W="library";let N=Q?` Sdk=${Q}`:"";if(G=`${Z}${N} (C# class library)`.replace(" Sdk=Microsoft.NET.Sdk",""),!Q||Q.toLowerCase()===ZW||Q.toLowerCase().startsWith(`${ZW}/`))G=`${Z} (C# class library)`}return{appType:W,projectName:z,targetFramework:$.targetFramework,sdk:Q||"Microsoft.NET.Sdk",framework:U,found:G}}function S$($){return(Q0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}function x5($){let Z=S$($);if(Z.length===0)return null;let z=null,Q=999;for(let X of Z){let J=f($,X);if(J===null)continue;let Y=xC(J),W=vC(Y,X),U=bC(W.appType,W.framework);if(!z||U<Q)z=W,Q=U}return z}import{join as u6}from"path";var O2={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 hC=O2.mcpArtifacts.map(($)=>$.toLowerCase()),fC=O2.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),uC=O2.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),mC=O2.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),ib=O2.androidPlugins.map(($)=>$.toLowerCase()),cC=O2.kmpPlugins.map(($)=>$.toLowerCase()),pC=O2.jvmKotlinPlugins.map(($)=>$.toLowerCase()),lC=O2.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),dC=O2.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),iC=O2.libraryPlugins.map(($)=>$.toLowerCase()),nC=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function y3($){return nC.some((Z)=>A($,Z))}function rC($){let Z=new Map,z=new Map,Q="";for(let X of $.split(`
231
+ `)){let J=X.replace(/#.*$/,"").trim();if(!J)continue;let Y=J.match(/^\[([^\]]+)\]$/);if(Y){Q=Y[1].trim().toLowerCase();continue}let W=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bid\s*=\s*"([^"]+)"/);if(W&&(Q==="plugins"||Q.endsWith(".plugins"))){Z.set(W[1].replace(/-/g,".").toLowerCase(),W[2].toLowerCase()),Z.set(W[1].toLowerCase(),W[2].toLowerCase());continue}let U=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bmodule\s*=\s*"([^"]+)"/);if(U&&(Q==="libraries"||Q.endsWith(".libraries"))){let q=U[1].toLowerCase();z.set(q,U[2].toLowerCase()),z.set(q.replace(/-/g,"."),U[2].toLowerCase());continue}let G=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bgroup\s*=\s*"([^"]+)"[^}]*\bname\s*=\s*"([^"]+)"/);if(G&&(Q==="libraries"||Q.endsWith(".libraries"))){let q=`${G[2]}:${G[3]}`.toLowerCase(),H=G[1].toLowerCase();z.set(H,q),z.set(H.replace(/-/g,"."),q);continue}let V=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(V){let q=V[1].toLowerCase(),H=V[2];if(Q==="plugins"||Q.endsWith(".plugins")){let K=H.split(":")[0].toLowerCase();Z.set(q,K),Z.set(q.replace(/-/g,"."),K)}else if(Q==="libraries"||Q.endsWith(".libraries")){let K=H.split(":");if(K.length>=2){let L=`${K[0]}:${K[1]}`.toLowerCase();z.set(q,L),z.set(q.replace(/-/g,"."),L)}}}}return{plugins:Z,libraries:z}}function sC($){let Z=f($,u6("gradle","libs.versions.toml"));if(!Z)return{plugins:new Map,libraries:new Map};return rC(Z)}function oC($){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 aC($,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 tC($,Z){let z=new Set;for(let Q of $.matchAll(/["']([A-Za-z0-9_.-]+:[A-Za-z0-9_.-]+)(?::[^"']+)?["']/g))z.add(Q[1].toLowerCase());for(let Q of $.matchAll(/libs\.([A-Za-z0-9_.]+)/g)){let X=Q[1].toLowerCase();if(X.startsWith("plugins."))continue;let J=[X,X.replace(/\./g,"-"),X.replace(/-/g,".")];for(let Y of J){let W=Z.libraries.get(Y);if(W){z.add(W.includes(":")?W.split(":").slice(0,2).join(":"):W);break}}}return z}function JW($){let Z=($.match(/<packaging>\s*([^<]+?)\s*<\/packaging>/i)?.[1]||"jar").trim().toLowerCase(),z=new Set,Q=$.match(/<parent>([\s\S]*?)<\/parent>/i);if(Q){let Y=Q[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),W=Q[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(Y&&W)z.add(`${Y}:${W}`.toLowerCase())}let X=new Set;for(let Y of $.matchAll(/<dependency>([\s\S]*?)<\/dependency>/gi)){let W=Y[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),U=Y[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(W&&U)X.add(`${W}:${U}`.toLowerCase())}let J=[];for(let Y of $.matchAll(/<module>\s*([^<]+?)\s*<\/module>/gi))J.push(Y[1].trim());return{packaging:Z,parents:z,artifacts:X,modules:J}}function b2($,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 e1($,Z,z){let Q;for(let[X,J]of Z){let Y=!1;if(z==="plugin")Y=b2($,X);else if(Y=$.has(X)||[...$].some((W)=>W===X||W.startsWith(`${X}:`)||W.startsWith(`${X}.`)),!Y&&z==="artifact")Y=[...$].some((W)=>W===X||W.startsWith(`${X}`));if(!Y)continue;if(!Q||X.length>Q[0].length)Q=[X,J]}return Q}function eC($){let Z;for(let z of hC)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 YW($,Z){let z=new Set,Q=!1,X=!1,J=[u6(Z,"src"),u6(Z,"src","main")],Y=(W,U)=>{if(U>4)return;let G=Q0($,W);if(!G)return;for(let{name:V}of G){if(V==="androidMain"||V==="commonMain"||V==="jvmMain"||V==="iosMain")z.add(V);let q=u6(W,V),H=M2($,q);if(!H)continue;if(H.isDirectory())Y(q,U+1);else if(V.endsWith(".kt")||V.endsWith(".kts"))Q=!0;else if(V.endsWith(".java"))X=!0}};for(let W of J)Y(W,0);return{kotlin:Q,java:X,hints:z}}function $_($){let Z=[],z=$.plugins,Q=$.artifacts,X=cC.some((j)=>b2(z,j))||$.sourceHints.has("commonMain"),J=b2(z,"com.android.application"),Y=b2(z,"com.android.library")||b2(z,"com.android.kotlin.multiplatform.library");if(J||Y)Z.push("android");if(X)Z.push("multiplatform");let W=eC(Q),U=e1(z,fC,"plugin"),G=e1($.parents,uC,"parent"),V=e1(Q,mC,"artifact"),q=e1(z,lC,"plugin"),H=e1(Q,dC,"artifact"),K=iC.some((j)=>b2(z,j)),L=$.packaging==="pom",B,N="",T;if(J)B="mobile",N=X?"Android+KMP":"Android",T=`${$.path||"root"} + com.android.application (${N})`;else if(W)B="mcp",N="MCP",Z.push("mcp"),T=`${$.path||"root"} + ${W} (JVM MCP server)`;else if(U||G||V){B="backend",N=U?.[1]||G?.[1]||V?.[1]||"JVM";let j=U?.[0]||G?.[0]||V?.[0]||"web";T=`${$.path||"root"} + ${j} (JVM backend)`}else if(X&&!Y)B="library",N="Kotlin Multiplatform",T=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(Y)B="library",N=X?"Android+KMP":"Android",T=`${$.path||"root"} + android library (${N})`;else if(H||$.hasApplicationPlugin&&($.hasMainClass||q)||q&&$.hasMainClass)B="cli",N=H?.[1]||"application",T=H?`${$.path||"root"} + ${H[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!K)B="cli",N="application",T=`${$.path||"root"} + application plugin (JVM CLI)`;else if(L)B="library",T=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{B="library";let j=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(T=`${$.path||"root"} (${j} library)`,K)T=`${$.path||"root"} + java-library (JVM library)`}let R="Java";if($.kotlinSources&&$.javaSources)R="Java/Kotlin";else if($.kotlinSources||pC.some((j)=>b2(z,j))||X)R="Kotlin";let w=[...new Set(Z)];return{appType:B,framework:N,facets:w,found:T,buildTool:$.buildTool,mainLanguage:R}}function Z_($,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 QW($,Z,z){let Q=u6(Z,"build.gradle.kts"),X=u6(Z,"build.gradle"),J=A($,Q)?Q:A($,X)?X:null;if(!J)return null;let Y=f($,J);if(!Y)return null;let W=aC(Y,z),U=tC(Y,z),G=YW($,Z),V=/mainClass\s*[.=]/.test(Y)||/mainClassName\s*=/.test(Y)||/Main-Class/.test(Y),q=b2(W,"application")||b2(W,"org.gradle.application");return{path:Z||"build.gradle",plugins:W,artifacts:U,packaging:"jar",parents:new Set,hasMainClass:V,hasApplicationPlugin:q,sourceHints:G.hints,kotlinSources:G.kotlin||J.endsWith(".kts"),javaSources:G.java,buildTool:"gradle"}}function XW($,Z){let z=f($,u6(Z,"pom.xml"));if(!z)return null;let{packaging:Q,parents:X,artifacts:J}=JW(z),Y=YW($,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 $4($){if(!y3($))return null;let Z=sC($),z=[],Q=null;for(let G of["settings.gradle.kts","settings.gradle"])if(A($,G)){Q=f($,G);break}let X=Q?oC(Q):[],J=QW($,"",Z);if(J)z.push(J);for(let G of X){let V=QW($,G,Z);if(V)z.push(V)}let Y=XW($,"");if(Y){z.push(Y);let G=f($,"pom.xml");if(G){let{modules:V}=JW(G);for(let q of V){let H=XW($,q);if(H)z.push(H)}}}if(z.length===0&&Q)return{appType:"library",framework:"",buildTool:"gradle",mainLanguage:"Java/Kotlin",facets:[],found:"settings.gradle (Gradle multi-project root)"};if(z.length===0)return null;let W=null,U=999;for(let G of z){let V=$_(G),q=Z_(V.appType,V.facets);if(!W||q<U)W={appType:V.appType,framework:V.framework,buildTool:V.buildTool,mainLanguage:V.mainLanguage,facets:V.facets,found:V.found},U=q}if(W&&X.length>0&&!W.found.includes("multi-project"));return W}import{join as Q_}from"path";var Z4={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 X_=Z4.mcpGems.map(($)=>$.toLowerCase()),J_=Z4.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),WW=Z4.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),Y_=Z4.railsLayoutFiles;function W_($){return A($,"Gemfile")||A($,"gems.rb")||U_($)}function U_($){return(Q0($)??[]).some((Z)=>Z.name.endsWith(".gemspec"))}function G_($){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 V_($){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 q_($){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 H_($){let Z=new Set,z=[];for(let X of["Gemfile","gems.rb"]){let J=f($,X);if(J){for(let Y of G_(J))Z.add(Y);z.push(X)}}let Q=f($,"Gemfile.lock")||f($,"gems.locked");if(Q){for(let X of V_(Q))Z.add(X);z.push("Gemfile.lock")}for(let{name:X}of Q0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=f($,X);if(J){for(let Y of q_(J))Z.add(Y);z.push(X)}}return{gems:Z,sources:z}}function z4($,Z){let z=Z.toLowerCase();if($.has(z))return!0;return!1}function k3($,Z){let z;for(let[Q,X]of Z){if(!z4($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function K_($){let Z;for(let z of X_)if(z4($,z)&&(!Z||z.length>Z.length))Z=z;return Z}function UW($){for(let Z of Y_)if(A($,Z))return Z;return}function B_($,Z){let z=k3(Z,WW);if(z)return{hit:!0,why:z[0]};for(let{name:X}of Q0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=f($,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 M2($,Q_("bin",Y))?.isFile()===!0}).filter((Y)=>Y!=="rails");if(J.length>0&&!z4(Z,"rails")&&!UW($))return{hit:!0,why:`bin/${J[0]}`}}return{hit:!1,why:""}}function y5($){if(!W_($))return null;let{gems:Z,sources:z}=H_($),Q=z[0]||"Gemfile",X=z.some((N)=>N==="Gemfile"||N==="gems.rb"||N.includes("lock"))?"bundler":"rubygems",J=K_(Z),Y=k3(Z,J_),W=UW($),U=z4(Z,"rails")||z4(Z,"railties"),G=B_($,Z),V=A($,"config.ru"),q=U||!!W,H=Y&&Y[1]!=="Rails"&&!(Y[0]==="rack"&&!V)?Y:void 0,K,L="",B;if(J)K="mcp",L="MCP",B=`${Q} + gem ${J} (Ruby MCP)`;else if(q)if(K="backend",L="Rails",U&&W)B=`${Q} + rails + ${W} (Rails)`;else if(U)B=`${Q} + gem rails (Rails)`;else B=`${W} (Rails layout)`;else if(H)K="backend",L=H[1],B=`${Q} + gem ${H[0]} (Ruby backend)`;else if(G.hit)K="cli",L=k3(Z,WW)?.[1]||"",B=`${Q} + ${G.why} (Ruby CLI)`;else K="library",B=`${Q} (Ruby library)`;return{appType:K,framework:L,packageManager:X,found:B}}import{join as L_}from"path";var P2={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 N_=P2.mcpPackageUrls.map(($)=>$.toLowerCase()),O_=P2.mcpProducts.map(($)=>$.toLowerCase()),D_=P2.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),I_=P2.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),T_=P2.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),A_=P2.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),C_=P2.appProductTypes,__=P2.cliProductTypes,R_=P2.vaporLayoutFiles;function F_($){return A($,"Package.swift")||b3($).length>0}function b3($){return(Q0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.endsWith(".xcodeproj")&&M2($,Z)?.isDirectory()===!0)}function P_($){let Z=S_($),z=Z.toLowerCase(),Q=[],X=/\.package\s*\(\s*url\s*:\s*"([^"]+)"/gi,J;while((J=X.exec(Z))!==null)Q.push(J[1]);let Y=/\.package\s*\(\s*url\s*:\s*'([^']+)'/gi;while((J=Y.exec(Z))!==null)Q.push(J[1]);let W=[],U=/\.product\s*\(\s*name\s*:\s*"([^"]+)"/gi;while((J=U.exec(Z))!==null)W.push(J[1]);let G=/\.product\s*\(\s*name\s*:\s*'([^']+)'/gi;while((J=G.exec(Z))!==null)W.push(J[1]);let V=/\.library\s*\(/.test(z),q=/\.executable\s*\(/.test(z),H=/\.plugin\s*\(/.test(z)&&!V&&!q?!0:/\bproducts\s*:\s*\[[\s\S]*?\.plugin\s*\(/.test(z),K=/\.executabletarget\s*\(/.test(z),L=/\.target\s*\(/.test(z)&&!K?!0:(z.match(/\.target\s*\(/g)||[]).length>(z.match(/\.executabletarget\s*\(/g)||[]).length+(z.match(/\.testtarget\s*\(/g)||[]).length;return{packageUrls:Q,productNames:W,hasLibraryProduct:V,hasExecutableProduct:q,hasPluginProduct:!!H,hasExecutableTarget:K,hasLibraryTarget:L}}function S_($){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 E_($,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 GW($,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 VW($,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 j_($){let Z=$.map((z)=>z.toLowerCase());return O_.some((z)=>Z.includes(z))}function w_($){let Z=!1,z=!1,Q;for(let X of b3($)){let J=f($,L_(X,"project.pbxproj"));if(!J)continue;for(let Y of C_)if(J.includes(Y))Z=!0,Q=Y;for(let Y of __)if(J.includes(Y)){if(z=!0,!Q)Q=Y}}return{hasApplication:Z,hasTool:z,hit:Q}}function x_($){for(let Z of R_)if(A($,Z))return Z;return}function Q4($){if(!F_($))return null;let Z=A($,"Package.swift"),z=b3($),Q=z.length>0,X=null;if(Z){let E=f($,"Package.swift");if(E)X=P_(E)}let J=Q?w_($):{hasApplication:!1,hasTool:!1},Y=x_($),W=X?.packageUrls??[],U=X?.productNames??[],G=E_(W,N_),V=j_(U),q=GW(W,D_),H=VW(U,I_),K=GW(W,T_),L=VW(U,A_),B=!!(G||V),N=!!(q||H||Y),T=!!(X?.hasExecutableProduct||X?.hasExecutableTarget),R=!!(K||L),w=J.hasApplication,j=Z&&Q?"spm+xcode":Z?"spm":"xcode",y,x="",h;if(B)if(y="mcp",x="MCP",V)h="Package.swift + product MCP (Swift MCP)";else h=`Package.swift + ${G} (Swift MCP)`;else if(N)if(y="backend",x=H?.[1]||q?.[1]||(Y?"Vapor":""),H)h=`Package.swift + product ${H[1]} (Swift backend)`;else if(q)h=`Package.swift + ${q[1]} (Swift backend)`;else h=`${Y} (Swift backend layout)`;else if(w)y="app",x="",h=`${z[0]} + ${J.hit||"application"} (Swift app)`;else if(R||T&&!N&&!B)if(y="cli",x=L?.[1]||K?.[1]||"",L)h=`Package.swift + product ${L[1]} (Swift CLI)`;else if(K)h=`Package.swift + ${K[1]} (Swift CLI)`;else if(X?.hasExecutableProduct)h="Package.swift + .executable product (Swift CLI)";else h="Package.swift + .executableTarget (Swift CLI)";else if(J.hasTool&&!Z)y="cli",h=`${z[0]} + tool productType (Swift CLI)`;else if(Z)if(y="library",X?.hasLibraryProduct)h="Package.swift + .library product (Swift library)";else h="Package.swift (Swift library)";else y="library",h=`${z[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:y,framework:x,packageManager:j,found:h}}function y_($){let Z=f($,"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 k_($){let Z=f($,"Cargo.toml");return Z!==null&&/^\s*\[\[bin\]\]/m.test(Z)}function b_($,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=y_($);if(z&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(z))return`Cargo.toml name "${z}" → sdk`;return null}function v_($){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=f($,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 g_($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,z=f($,"pyproject.toml");if(z!==null){let X=z.match(Z);if(X)return`pyproject.toml depends on ${X[1]}`}let Q=f($,"requirements.txt");if(Q!==null){let X=Q.match(Z);if(X)return`requirements.txt contains ${X[1]}`}return null}function h_($,Z){let z=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let Q of z)if(Z.dependencies?.[Q]||Z.devDependencies?.[Q])return`${Q} dependency`}if(A($,"ios")&&A($,"android"))return"ios/ + android/ dirs";return null}function f_($,Z){let z=f($,"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=f($,"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 u_($,Z){if(!A($,"index.html"))return null;if(Z?.dependencies||Z?.devDependencies){let z={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((X)=>z[X]))return null}return"index.html (vanilla, no frontend framework)"}function m_($,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 c_($,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 p_($,Z){if(!Z)return null;let z={...Z.dependencies??{},...Z.devDependencies??{}},Q=["@clerk/nextjs","@clerk/clerk-react","next-auth","@auth/core","auth0","@auth0/nextjs-auth0"],X=["stripe","@stripe/stripe-js","lemonsqueezy"],J=Q.some((W)=>z[W]),Y=X.some((W)=>z[W]);if(J&&Y)return"auth + payment dependencies";return null}function l_($,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 d_($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||A($,"pnpm-workspace.yaml")))return null;return"private workspace + multi-package"}var i_=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)$/,n_=new Set(["frontend","backend","database","css","ui","state"]);function r_($){if(A($,"pyproject.toml")||A($,"manage.py")||A($,"setup.py")||k5($,"requirements*.txt"))return!0;if(A($,"go.mod"))return!0;if(A($,"Cargo.toml"))return!0;if(A($,"Gemfile"))return!0;if(A($,"pom.xml")||k5($,"build.gradle*"))return!0;if(S$($).length>0)return!0;let Z=D2($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function b5($){return T$($,()=>s_($))}function s_($){let Z=Q0($)??[],z=[];for(let Q of Z){if(!Q.isDirectory()||Q.name.startsWith(".")||i_.has(Q.name))continue;let X=qW($,Q.name);if(!r_(X))continue;let J=g5(X);if(!J)continue;let Y=v5(X).filter((V)=>n_.has(V.category)),W=Y.find((V)=>V.category==="frontend"),U=Y.find((V)=>V.category==="backend"),G=W??U??Y[0]??null;z.push({name:Q.name,language:J,topFramework:G?.name??null,frontend:!!W,backend:!!U||HW.test(J),hasFramework:!!G,appRoot:A(X,"manage.py")||A(X,"config.ru")||A(X,"bin/rails")||A(X,"artisan")})}return z}function o_($,Z){if(Z?.workspaces||A($,"pnpm-workspace.yaml"))return null;let z=b5($),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 KW($){let Z=b5($);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,W)=>z(W)-z(Y)),X=new Set,J=[];for(let Y of Q){if(X.has(Y.language))continue;X.add(Y.language);let W=Y.frontend?"frontend":Y.backend?"backend":"service";J.push(Y.topFramework?`${Y.language} (${Y.topFramework} · ${W})`:`${Y.language} (${W})`)}return J.join("; ")}function D2($){let Z=f($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function k5($,Z){if(!Z.includes("*"))return A($,Z);let z=Z.split("/");if(z.length===1){let W=Z.split("*")[0];return(Q0($)??[]).some((U)=>U.name.startsWith(W))}let Q=qW(...z.slice(0,-1)),X=z[z.length-1],J=X.split("*")[0],Y=X.split("*")[1]||"";return(Q0($,Q)??[]).some((W)=>W.name.startsWith(J)&&W.name.endsWith(Y))}function a_($,Z,z){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return k5(z,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!k5(z,$.pattern))return!1;let Q=f(z,$.pattern);return Q!==null&&Q.toLowerCase().includes($.key.toLowerCase())}default:return!1}}function v5($){let Z=D2($);return tY.map((z)=>{let X=z.signals.filter((J)=>a_(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 g5($){let Z=D2($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(A($,"tsconfig.json"))return"TypeScript";if(A($,"Cargo.toml"))return"Rust";if(A($,"go.mod"))return"Go";if(S$($).length>0)return"C#";if(A($,"pyproject.toml")||A($,"setup.py"))return"Python";if(A($,"Gemfile"))return"Ruby";if(y3($)){let z=$4($);if(z)return z.mainLanguage==="Java/Kotlin"?"Kotlin":z.mainLanguage;return"Java"}if(A($,"Package.swift"))return"Swift";if(A($,"build.zig"))return"Zig";if(A($,"pubspec.yaml"))return"Dart";if(Z)return"JavaScript";return""}function BW($){let Z=D2($),z=v5($),Q=[],X=m_($,Z);if(X)return Q.push(X),{type:"documentation",found:Q};let J=b_($,Z);if(J)return Q.push(J),{type:"sdk",found:Q};let Y=v_($);if(Y)return Q.push(Y),{type:"extension",found:Q};let W=l_($,Z,z);if(W)return Q.push(W),{type:"mcpaas",found:Q};let U=p_($,Z);if(U)return Q.push(U),{type:"saas",found:Q};let G=f_($,Z);if(G)return Q.push(G),{type:"wasm",found:Q};let V=S5($);if(V)return Q.push(V.found),{type:V.appType,found:Q};let q=j5($);if(q)return Q.push(q.found),{type:q.appType,found:Q};let H=x5($);if(H)return Q.push(H.found),{type:H.appType,found:Q};let K=$4($);if(K)return Q.push(K.found),{type:K.appType,found:Q};let L=y5($);if(L)return Q.push(L.found),{type:L.appType,found:Q};let B=Q4($);if(B)return Q.push(B.found),{type:B.appType,found:Q};let N=h_($,Z);if(N)return Q.push(N),{type:"mobile",found:Q};if(z.some((t)=>t.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(k_($))return Q.push("Cargo.toml [[bin]]"),{type:"cli",found:Q};if(A($,"build.zig")){if(Q.push("build.zig"),A($,"src/main.zig"))return Q.push("src/main.zig"),{type:"cli",found:Q};if(A($,"src/root.zig"))return Q.push("src/root.zig"),{type:"library",found:Q}}let R=z.some((t)=>t.slug==="svelte"||t.slug==="sveltekit");if(Z?.private===!0&&(A($,"pnpm-workspace.yaml")||Z?.workspaces!==void 0)&&R)return Q.push("private workspace","Svelte"),{type:"framework",found:Q};if(R)return Q.push("Svelte/SvelteKit"),{type:"svelte",found:Q};let j=z.some((t)=>t.category==="frontend"),y=z.some((t)=>t.category==="backend");if(Z?.private&&(Z.workspaces||A($,"pnpm-workspace.yaml"))&&j&&y)return Q.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:Q};let x=d_($,Z);if(x)return Q.push(x),{type:"monorepo-root",found:Q};let h=c_($,Z,z);if(h)return Q.push(h),{type:"website",found:Q};if(z.some((t)=>t.slug==="nextjs"||t.slug==="nuxt"))return Q.push(z.find((t)=>t.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:Q};let c=z.some((t)=>t.category==="frontend"),D0=z.some((t)=>t.category==="backend");if(c&&D0)return Q.push("frontend framework","backend framework"),{type:"fullstack",found:Q};if(c)return Q.push("frontend framework"),{type:"frontend",found:Q};if(D0)return Q.push("backend framework"),{type:"backend",found:Q};let b0=g_($);if(b0)return Q.push(b0),{type:"data-science",found:Q};let F=u_($,Z);if(F)return Q.push(F),{type:"html",found:Q};let i=o_($,Z);if(i)return Q.push(i),{type:"fullstack",found:Q};if(Z?.main&&!Z?.bin)return Q.push("package.json main (no bin)"),{type:"library",found:Q};return Q.push(C$),{type:"library",found:Q}}function MW($){if(A($,"bunfig.toml"))return"Bun";if(A($,"deno.json")||A($,"deno.jsonc"))return"Deno";if(D2($))return"Node.js";if(A($,"Cargo.toml"))return"Rust";if(A($,"go.mod"))return"Go";if(S$($).length>0)return".NET";if(A($,"pubspec.yaml"))return"Dart";return""}var t_=new Set(["npm","pnpm","yarn","bun"]);function e_($){let Z=D2($)?.packageManager;if(typeof Z!=="string")return"";let z=/^([a-z]+)@/i.exec(Z.trim())?.[1]?.toLowerCase()??"";return t_.has(z)?z:""}function $R($){if(A($,"pubspec.yaml"))return"pub";if(A($,"go.mod"))return"go modules";if(S$($).length>0)return"NuGet";if(A($,"pom.xml"))return"maven";return["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"].some((z)=>A($,z))?"gradle":""}var ZR=[["bun.lockb","bun"],["bun.lock","bun"],["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"]];function LW($){return $R($)||e_($)||(ZR.find(([Z])=>A($,Z))?.[1]??"")}function NW($){if(A($,".github/workflows"))return"GitHub Actions";if(A($,".gitlab-ci.yml"))return"GitLab CI";if(A($,".circleci"))return"CircleCI";if(A($,"Jenkinsfile"))return"Jenkins";return null}function OW($){if(A($,"vercel.json"))return"Vercel";if(A($,"netlify.toml"))return"Netlify";if(A($,"wrangler.toml"))return"Cloudflare";if(A($,"fly.toml"))return"Fly.io";if(A($,"render.yaml"))return"Render";return null}function DW($){let Z=f($,"svelte.config.js");if(Z===null)return null;let z=Z.match(/@sveltejs\/adapter-(\w+)/);if(z){let Q=z[1];switch(Q){case"vercel":return"Vercel";case"node":return"Node";case"static":return"Static";case"cloudflare":return"Cloudflare";case"netlify":return"Netlify";case"auto":return"Auto";default:return Q}}return null}function IW($){let Z=D2($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return"Vite";if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(A($,"tsconfig.json")&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function h5($){return["package.json","Cargo.toml","pyproject.toml","go.mod","build.zig","build.zig.zon","src/index.ts","src/index.js","src/main.ts","src/cli.ts","src/main.rs","src/lib.rs","src/main.zig","src/root.zig","src/__init__.py","main.py","__main__.py","main.go","cmd/main.go","README.md","SPECIFICATION.md","BINARY-FORMAT.md","tsconfig.json","wrangler.toml","vercel.json"].filter((z)=>A($,z))}function f5($,Z){let z={};if(Z?.scripts){for(let Q of["build","test","lint","dev","start"])if(Z.scripts[Q]){let X=A($,"bun.lock")||A($,"bun.lockb")?"bun run":"npm run";z[Q]=`${X} ${Q}`}}if(A($,"Cargo.toml")){if(!z.build)z.build="cargo build --release";if(!z.test)z.test="cargo test";if(!z.lint&&zR($))z.lint="cargo clippy"}if(A($,"build.zig")){if(!z.build)z.build="zig build";if(!z.test&&/\.step\(\s*"test"/.test(v3($,"build.zig")))z.test="zig build test"}if(A($,"go.mod")){if(!z.build)z.build="go build ./...";if(!z.test)z.test="go test ./..."}if(!z.test&&QR($))z.test="pytest";return z}function v3($,Z){return f($,Z)??""}function zR($){if(A($,"clippy.toml")||A($,".clippy.toml"))return!0;return/^\s*\[(workspace\.)?lints\.clippy\]/m.test(v3($,"Cargo.toml"))}function QR($){if(A($,"pytest.ini")||A($,"conftest.py"))return!0;return["pyproject.toml","setup.cfg","tox.ini"].some((Z)=>/\bpytest\b/.test(v3($,Z)))}function TW($,Z,z,Q){let X=[];if(Q&&Q!=="Unknown")X.push(Q);let J=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let Y of z)if(J.has(Y.category))X.push(Y.name);if(A($,"bunfig.toml"))X.push("Bun");else if(A($,"deno.json")||A($,"deno.jsonc"))X.push("Deno");if(X.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let W of Y)if(!X.some((U)=>U.toLowerCase().includes(W.toLowerCase())))X.push(W)}return X}function XR($){let Z=$?.dependencies?.svelte??$?.devDependencies?.svelte,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?NaN:Number(z)}function AW($){return g3($).data}function g3($){let Z=D2($),z=v5($),Q=BW($),X=Q.type,J=Q.found.some((s)=>s.startsWith("polyglot:")),Y=J&&KW($)||g5($),W=MW($),U=LW($),G=NW($),V=OW($),q=IW($),H=z.find((s)=>s.category==="frontend"),K=z.find((s)=>s.category==="css"),L=z.find((s)=>s.category==="ui"),B=z.find((s)=>s.category==="state"),N=z.find((s)=>s.category==="backend"),T=z.find((s)=>s.category==="database"),R=(s)=>g6(X,s)??g6("library",s)===!0,w=X==="framework",j=z.some((s)=>s.slug==="svelte"||s.slug==="sveltekit"),y=w&&j?"svelte":w?null:null,x=X==="svelte"||y==="svelte",h=x?DW($):null,E=x&&z.some((s)=>s.slug==="sveltekit"),c={},D0=X0.filter((s)=>s.path.startsWith("stack."));for(let s of D0){let J0=s.path.replace("stack.","");switch(J0){case"frontend":c[J0]=H?.name??"";break;case"css_framework":c[J0]=K?.name??"";break;case"ui_library":c[J0]=L?.name??"";break;case"state_management":c[J0]=B?.name??(x&&XR(Z)>=5?"Runes":"");break;case"backend":c[J0]=x?E?"SvelteKit":N?.name??"":N?.name??"";break;case"api_type":c[J0]=E?"Server Routes":"";break;case"runtime":c[J0]=W;break;case"database":c[J0]=T?.name??"";break;case"connection":c[J0]=T?.name??"";break;case"hosting":if(x&&h)c[J0]=h;else c[J0]=V??"";break;case"build":c[J0]=E?"Vite":q??"";break;case"cicd":c[J0]=G??"";break;case"package_manager":c[J0]=U;break;default:c[J0]="";break}}let b0={};for(let s of D0){let J0=s.path.replace("stack.","");b0[J0]=R(s)?c[J0]:"slotignored"}let F={},i=X0.filter((s)=>s.path.startsWith("monorepo."));for(let s of i){let J0=s.path.replace("monorepo.","");if(!R(s))F[J0]="slotignored";else F[J0]=""}let t={name:Z?.name??$.split("/").pop()??"project",goal:J?"":Z?.description??"",main_language:Y,type:X};if(w&&y)t.framework=y;let V2=TW($,Z,z,J?g5($):Y);if(J){for(let s of b5($))for(let J0 of[s.language,s.topFramework])if(J0&&!V2.includes(J0))V2.push(J0)}let NQ=h5($),OQ=f5($,Z),L8={faf_version:V6,project:t,stack:b0,human_context:{who:"",what:J?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:F,_meta:{found:Q.found}};if(V2.length>0)L8.tech_stack=V2;if(NQ.length>0)L8.key_files=NQ;if(Object.keys(OQ).length>0)L8.commands=OQ;return{data:L8,facts:c}}var CW={MIN_LENGTH:8,MAX_LENGTH:280},JR=[/^(see|see\s+the?)\s+readme/i,/^(tbd|todo|fixme|coming\s+soon)\b/i,/^(software|application|app|project|tool|library|framework)\.?$/i,/^(for\s+users|for\s+developers)\.?$/i,/^(description|goal|name|title)\.?$/i,/^lorem\s+ipsum/i,/^example(\s+\w+)?\.?$/i];function I2($){let Z=$.trim();if(Z.length<CW.MIN_LENGTH)return!1;if(Z.length>CW.MAX_LENGTH)return!1;if(JR.some((z)=>z.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
236
+ `).length>4)return!1;return!0}function YR($){let Z=$.split(`
237
237
  `),z=0;while(z<Z.length&&/^(#\s|$)/.test(Z[z].trim()))z++;while(z<Z.length){let Q=Z[z].trim();if(/^\[!\[/.test(Q)){z++;continue}if(/^!\[/.test(Q)){z++;continue}if(/^<img\s/i.test(Q)){z++;continue}if(Q===""){z++;continue}break}return Z.slice(z).join(`
238
- `)}function e_($){let z=t_($).split(`
239
- `),Q=[];for(let X of z){let J=X.trim();if(J===""){if(Q.length>0)break;continue}if(/^(#|>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(J))break;if(/^\*\*[^*]+\*\*\s*$/.test(J)&&Q.length===0)continue;Q.push(J)}if(Q.length===0)return null;return Q.join(" ").trim()}function u6($,Z){let z=$.split(`
240
- `),Q=0;while(Q<z.length){let J=z[Q].trim().match(/^(#{1,6})\s+(.+)$/);if(J&&Z.test(J[2])){let Y=J[1].length,W=[];Q++;while(Q<z.length){let U=z[Q].trim(),G=U.match(/^(#{1,6})\s+/);if(G&&G[1].length<=Y)break;if(U===""){if(W.length>0)break;Q++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(U))break;W.push(U),Q++}if(W.length===0)return null;return W.join(" ").trim()}Q++}return null}function $R($){let Z=u6($,/^(use\s+cases?|goal)\b/i);if(Z&&I2(Z))return Z;let z=e_($);if(z&&I2(z))return z;return}function ZR($){let Z=u6($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&I2(Z))return Z;return}function zR($){let Z=u6($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&I2(Z))return Z;return}function QR($){let Z=u6($,/^(why|motivation|problem|rationale)\b/i);if(Z&&I2(Z))return Z;return}function XR($){let Z=u6($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&I2(Z))return Z;return}function JR($){let Z=u6($,/^(status|history|timeline|since|launched)\b/i);if(Z&&I2(Z))return Z;return}function YR($){let Z=u6($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&I2(Z))return Z;return}function b3($){let Z=["README.md","README.MD","Readme.md","readme.md"],z=null;for(let K of Z)if(A($,K)){z=K;break}if(!z)return{};let Q=f($,z);if(Q===null)return{};Q=Q.replace(/<!--[\s\S]*?-->/g,"");let X={},J=$R(Q);if(J)X.project={goal:J};let Y={},W=ZR(Q);if(W)Y.what=W;let U=zR(Q);if(U)Y.who=U;let G=QR(Q);if(G)Y.why=G;let V=XR(Q);if(V)Y.where=V;let H=JR(Q);if(H)Y.when=H;let q=YR(Q);if(q)Y.how=q;if(Object.keys(Y).length>0)X.human_context=Y;return X}function WR($,Z){let z=$.split(`
241
- `),Q=!1;for(let X of z){let J=X.trim();if(/^\[/.test(J)){Q=J==="[package]";continue}if(!Q)continue;let Y=J.match(new RegExp(`^${Z}\\s*=\\s*(.+)$`));if(Y){let W=Y[1].trim();W=W.replace(/\s*#.*$/,"").trim();let U=W.match(/^"((?:[^"\\]|\\.)*)"$/)||W.match(/^'((?:[^'\\]|\\.)*)'$/);if(U)return U[1];return W}}return null}function v3($){let Z=f($,"Cargo.toml");if(Z===null)return{};let z=WR(Z,"description");if(z&&I2(z))return{project:{goal:z}};return{}}import{join as IW}from"path";var UR=[{re:/^postgres|postgis|pgvector/,slot:"database",label:"PostgreSQL"},{re:/^mysql/,slot:"database",label:"MySQL"},{re:/^mariadb/,slot:"database",label:"MariaDB"},{re:/^mongo/,slot:"database",label:"MongoDB"},{re:/clickhouse/,slot:"database",label:"ClickHouse"},{re:/^cockroach/,slot:"database",label:"CockroachDB"},{re:/^redis|^valkey/,slot:"cache",label:"Redis"},{re:/^memcached/,slot:"cache",label:"Memcached"},{re:/elasticsearch/,slot:"search",label:"Elasticsearch"},{re:/opensearch/,slot:"search",label:"OpenSearch"},{re:/meilisearch/,slot:"search",label:"Meilisearch"},{re:/typesense/,slot:"search",label:"Typesense"},{re:/qdrant/,slot:"search",label:"Qdrant (vector)"},{re:/weaviate/,slot:"search",label:"Weaviate (vector)"},{re:/^minio/,slot:"storage",label:"MinIO (S3-compatible)"},{re:/localstack/,slot:"storage",label:"LocalStack (AWS)"},{re:/rabbitmq/,slot:"runtime",label:"RabbitMQ"},{re:/kafka/,slot:"runtime",label:"Kafka"},{re:/nats/,slot:"runtime",label:"NATS"},{re:/temporalio\/|temporal-server|temporal:/,slot:"runtime",label:"Temporal"}],GR=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function VR($){let Z=[],z=(Q,X)=>{for(let J of z0($,Q)??[])if(J.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(J.name))Z.push(IW(Q,J.name));else if(J.isDirectory()&&X>0&&!J.name.startsWith(".")&&!GR.has(J.name))z(IW(Q,J.name),X-1)};return z(".",1),Z}function Z4($){return[...$].join(" · ")}function g3($){let Z=VR($);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=f($,X);if(J===null)continue;for(let Y of J.matchAll(/^\s*image:\s*["']?([^\s"'#]+)/gm)){let W=Y[1].toLowerCase(),U=W.replace(/:[^/]*$/,"").split("/").pop()??W,G=W.replace(/:[^/]*$/,"");for(let{re:V,slot:H,label:q}of UR)if(V.test(U)||V.test(G))z[H].add(q)}}let Q={};if(z.database.size)Q.database=Z4(z.database);if(z.cache.size)Q.cache=Z4(z.cache);if(z.search.size)Q.search=Z4(z.search);if(z.storage.size)Q.storage=Z4(z.storage);if(z.runtime.size)Q.runtime=`Docker Compose (${Z4(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 HR}from"path";var qR=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),KR=[{file:"Makefile",runner:"make",targets:($)=>[...$.matchAll(/^([a-zA-Z][\w-]*)\s*:(?!=)/gm)].map((Z)=>Z[1])},{file:"justfile",runner:"just",targets:($)=>[...$.matchAll(/^([a-zA-Z][\w-]*)\s*(?:\([^)]*\))?\s*:/gm)].map((Z)=>Z[1])},{file:"Taskfile.yml",runner:"task",targets:($)=>{let Z=$.indexOf("tasks:");if(Z===-1)return[];return[...$.slice(Z).matchAll(/^\s{2}([a-zA-Z][\w-]*):/gm)].map((z)=>z[1])}}];function h3($,Z){for(let z of Z){let Q=$.find((X)=>z.test(X));if(Q)return Q}return null}function BR($){let Z=[$];for(let z of z0($)??[])if(z.isDirectory()&&!z.name.startsWith(".")&&!qR.has(z.name))Z.push(HR($,z.name));return Z}function MR($){let Z=0;if(A($,"manage.py")||A($,"pyproject.toml")||A($,"Gemfile"))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function f3($){return I$($,()=>LR($))}function LR($){let Z=[];for(let Q of BR($)){let X=Q===$,J=X?"":`cd ${Q.slice($.length+1)} && `;for(let Y of KR){let W=f(Q,Y.file);if(W===null)continue;let U=Y.targets(W);if(U.length===0)continue;let G={},V=h3(U,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),H=h3(U,[/^build$/i,/^compile$/i,/^build/i]),q=h3(U,[/^check-all$/i,/^check$/i,/^lint$/i,/^lint/i,/^fmt$/i,/^format$/i]);if(V)G.test=`${J}${Y.runner} ${V}`;if(H)G.build=`${J}${Y.runner} ${H}`;if(q)G.lint=`${J}${Y.runner} ${q}`;if(Object.keys(G).length===0)continue;Z.push({score:Object.keys(G).length+(X?10:MR(Q)),commands:G})}}let z=Z.sort((Q,X)=>X.score-Q.score)[0];return z?{commands:z.commands}:{}}var NR=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function u3($){for(let Z of NR)if(A($,Z))return{security:{secrets:".env",example:Z}};return{}}function OR($,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 m3($){return[b3($),v3($),g3($),f3($),u3($)].reduce(OR,{})}import{join as DR,extname as IR,resolve as TR}from"path";var c3={"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 AR=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),CR=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),_R={mainLanguage:["project","main_language"],main_language:["project","main_language"],framework:["stack","frontend"],cssFramework:["stack","css_framework"],css:["stack","css_framework"],uiLibrary:["stack","ui_library"],ui_library:["stack","ui_library"],stateManagement:["stack","state_management"],state:["stack","state_management"],backend:["stack","backend"],apiType:["stack","api_type"],api:["stack","api_type"],runtime:["stack","runtime"],database:["stack","database"],db:["stack","database"],connection:["stack","connection"],hosting:["stack","hosting"],buildTool:["stack","build"],build_tool:["stack","build"],build:["stack","build"],packageManager:["stack","package_manager"],pkg_manager:["stack","package_manager"],cicd:["stack","cicd"]},RR=[["packageManager","package-manager"],["pkg_manager","package-manager"],["mainLanguage","language"],["main_language","language"],["framework","framework"],["backend","backend"],["database","database"],["db","database"],["cicd","ci-cd"],["hosting","hosting"],["buildTool","build"],["build_tool","build"],["build","build"],["runtime","runtime"],["cssFramework","css"],["css","css"],["uiLibrary","ui-library"],["stateManagement","state-management"],["apiType","api"],["api","api"]];function FR($,Z){for(let[z,Q]of RR)if(z in $)return Q;return Z.length>0?"framework":"config"}function PR($,Z){try{let z=JSON.parse(f($,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 SR($,Z){if(Z.isFile())return!0;if(!Z.isSymbolicLink())return!1;return M2($,Z.name)?.isFile()===!0}function ER($,Z){if(Z.isDirectory())return!0;if(!Z.isSymbolicLink())return!1;return M2($,Z.name)?.isDirectory()===!0}function jR($){let Z=[],z=TR($),Q=new Set,X=z0(z);if(!X)return Z;for(let J of X){let Y=J.name;if(Y.endsWith(".xcodeproj")?!ER(z,J):!SR(z,J))continue;if(Y.toLowerCase().endsWith(".csproj")){let U=E5(z);if(U){let G={mainLanguage:"C#",packageManager:"NuGet",buildTool:"dotnet"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="mobile"&&U.framework)G.framework=U.framework;if(U.targetFramework)G.runtime=U.targetFramework;let V=U.framework?[U.framework,"C#",".NET"]:["C#",".NET"];Z.push({slots:G,priority:36,frameworks:V,fileName:Y})}continue}if(Y.endsWith(".xcodeproj")){let U=$4(z);if(U){let G={mainLanguage:"Swift",packageManager:U.packageManager==="spm"?"spm":"Xcode",buildTool:U.packageManager.includes("spm")?"swift build":"xcodebuild"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="app"&&U.framework)G.framework=U.framework;let V=U.framework?[U.framework,"Swift"]:["Swift"];Z.push({slots:G,priority:36,frameworks:V,fileName:Y})}continue}let W=c3[Y];if(!W)continue;if(Y==="manifest.json"&&PR(z,Y)!=="chrome")continue;if(Y==="pubspec.yaml"){let U=R5(z);if(U){let G={mainLanguage:"Dart",packageManager:"pub"};if(U.isFlutter){if(G.framework="Flutter",U.stateManagement)G.stateManagement=U.stateManagement}else if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="mcp")G.apiType="MCP";Z.push({slots:G,priority:W.priority,frameworks:U.isFlutter?["Flutter","Dart"]:["Dart"],fileName:Y});continue}}if(Y==="go.mod"){let U=P5(z);if(U){let G={mainLanguage:"Go",packageManager:"go modules",buildTool:"go build"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";let V=U.framework?[U.framework,"Go"]:["Go"];Z.push({slots:G,priority:W.priority,frameworks:V,fileName:Y});continue}}if(Y==="Gemfile"||Y==="Gemfile.lock"||Y==="gems.rb"){let U=j5(z);if(U){let G={mainLanguage:"Ruby",packageManager:U.packageManager};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";let V=U.framework?[U.framework,"Ruby"]:["Ruby"];Z.push({slots:G,priority:W.priority??35,frameworks:V,fileName:Y});continue}}if(Y==="Package.swift"){let U=$4(z);if(U){let G={mainLanguage:"Swift",packageManager:U.packageManager==="xcode"?"Xcode":"spm",buildTool:"swift build"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="app"&&U.framework)G.framework=U.framework;let V=U.framework?[U.framework,"Swift"]:["Swift"];Z.push({slots:G,priority:W.priority??36,frameworks:V,fileName:Y});continue}}if(Y==="pom.xml"||Y==="build.gradle"||Y==="build.gradle.kts"||Y==="settings.gradle"||Y==="settings.gradle.kts"){if(Q.has(z))continue;Q.add(z);let U=a1(z);if(U){let G={mainLanguage:U.mainLanguage==="Java/Kotlin"?"Kotlin":U.mainLanguage,packageManager:U.buildTool==="maven"?"maven":"gradle",buildTool:U.buildTool};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="mobile")G.framework=U.framework||"Android";if(U.facets.includes("multiplatform"))G.framework=U.framework||"Kotlin Multiplatform";let V=U.framework?[U.framework,"JVM",U.mainLanguage==="Kotlin"?"Kotlin":"Java"]:["JVM",U.mainLanguage==="Kotlin"?"Kotlin":"Java"];Z.push({slots:G,priority:W.priority??35,frameworks:V,fileName:Y});continue}}Z.push({slots:W.slots||{},priority:W.priority,frameworks:W.frameworks,fileName:Y})}return Z}function wR($){let Z=[];for(let z of I$($,()=>TW($,2,{count:0}))){let Q=c3[`*${z}`],X=Q?.slots?.mainLanguage;if(X)Z.push({slots:{mainLanguage:X},priority:Q.priority,frameworks:Q.frameworks})}return Z}function xR($){let Z=[...jR($),...wR($)],z={},Q={},X=new Set;for(let G of Z){G.frameworks.forEach((V)=>X.add(V));for(let[V,H]of Object.entries(G.slots))if(H&&!H.includes("/")&&(!(V in z)||G.priority>Q[V]))z[V]=H,Q[V]=G.priority}let J=new Map;for(let G of Z){if(!G.fileName)continue;if(!J.has(G.fileName))J.set(G.fileName,{fileName:G.fileName,category:FR(G.slots,G.frameworks),priority:G.priority})}let Y=[...J.values()].sort((G,V)=>V.priority-G.priority||G.fileName.localeCompare(V.fileName)),W=[];if(z.mainLanguage)W.push(z.mainLanguage.toLowerCase());if(z.framework)W.push(z.framework.toLowerCase());let U=W.length>0?W.join("-"):"unknown-stack";return{slotFills:z,frameworks:[...X],confirmedCount:Z.length,discoveredFormats:Y,stackSignature:U}}function p3($){let{slotFills:Z}=xR($),z={};for(let[Q,X]of Object.entries(Z)){let J=_R[Q];if(!J||!X)continue;let[Y,W]=J;if(Y==="project")(z.project??={})[W]=X;else(z.stack??={})[W]=X}return z}function TW($,Z,z){let Q=new Set;if(Z<0||z.count>400)return Q;let X=z0($);if(!X)return Q;for(let J of X){if(z.count++>400)break;if(!J.isDirectory()){let Y=IR(J.name);if(CR.has(Y))Q.add(Y);continue}if(AR.has(J.name)||J.name.startsWith("."))continue;for(let Y of TW(DR($,J.name),Z-1,z))Q.add(Y)}return Q}var y0=($,Z,z)=>({value:$,source:Z,confidence:z});function yR($,Z={}){let z=Z.toolingRoot?null:kR($),Q=bR($),X={},J=(Y,W)=>{if(W)X[Y]=W};return J("what",hR(z,Q)),J("who",fR(Q)),J("why",uR(Q)),J("where",mR(z,Q)),J("when",cR(Q)),J("how",pR(z,Q)),X}function l3($,Z={}){let z=yR($,Z),Q={};return Object.keys(z).forEach((X)=>{let J=z[X];if(J)Q[X]=J.value}),Q}function kR($){let Z=f($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function bR($){let Z=f($,"README.md");if(Z===null)return"";return Z.replace(/<!--[\s\S]*?-->/g,"").split(`
238
+ `)}function WR($){let z=YR($).split(`
239
+ `),Q=[];for(let X of z){let J=X.trim();if(J===""){if(Q.length>0)break;continue}if(/^(#|>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(J))break;if(/^\*\*[^*]+\*\*\s*$/.test(J)&&Q.length===0)continue;Q.push(J)}if(Q.length===0)return null;return Q.join(" ").trim()}function m6($,Z){let z=$.split(`
240
+ `),Q=0;while(Q<z.length){let J=z[Q].trim().match(/^(#{1,6})\s+(.+)$/);if(J&&Z.test(J[2])){let Y=J[1].length,W=[];Q++;while(Q<z.length){let U=z[Q].trim(),G=U.match(/^(#{1,6})\s+/);if(G&&G[1].length<=Y)break;if(U===""){if(W.length>0)break;Q++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(U))break;W.push(U),Q++}if(W.length===0)return null;return W.join(" ").trim()}Q++}return null}function UR($){let Z=m6($,/^(use\s+cases?|goal)\b/i);if(Z&&I2(Z))return Z;let z=WR($);if(z&&I2(z))return z;return}function GR($){let Z=m6($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&I2(Z))return Z;return}function VR($){let Z=m6($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&I2(Z))return Z;return}function qR($){let Z=m6($,/^(why|motivation|problem|rationale)\b/i);if(Z&&I2(Z))return Z;return}function HR($){let Z=m6($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&I2(Z))return Z;return}function KR($){let Z=m6($,/^(status|history|timeline|since|launched)\b/i);if(Z&&I2(Z))return Z;return}function BR($){let Z=m6($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&I2(Z))return Z;return}function h3($){let Z=["README.md","README.MD","Readme.md","readme.md"],z=null;for(let K of Z)if(A($,K)){z=K;break}if(!z)return{};let Q=f($,z);if(Q===null)return{};Q=Q.replace(/<!--[\s\S]*?-->/g,"");let X={},J=UR(Q);if(J)X.project={goal:J};let Y={},W=GR(Q);if(W)Y.what=W;let U=VR(Q);if(U)Y.who=U;let G=qR(Q);if(G)Y.why=G;let V=HR(Q);if(V)Y.where=V;let q=KR(Q);if(q)Y.when=q;let H=BR(Q);if(H)Y.how=H;if(Object.keys(Y).length>0)X.human_context=Y;return X}function MR($,Z){let z=$.split(`
241
+ `),Q=!1;for(let X of z){let J=X.trim();if(/^\[/.test(J)){Q=J==="[package]";continue}if(!Q)continue;let Y=J.match(new RegExp(`^${Z}\\s*=\\s*(.+)$`));if(Y){let W=Y[1].trim();W=W.replace(/\s*#.*$/,"").trim();let U=W.match(/^"((?:[^"\\]|\\.)*)"$/)||W.match(/^'((?:[^'\\]|\\.)*)'$/);if(U)return U[1];return W}}return null}function f3($){let Z=f($,"Cargo.toml");if(Z===null)return{};let z=MR(Z,"description");if(z&&I2(z))return{project:{goal:z}};return{}}import{join as _W}from"path";var LR=[{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"}],NR=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function OR($){let Z=[],z=(Q,X)=>{for(let J of Q0($,Q)??[])if(J.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(J.name))Z.push(_W(Q,J.name));else if(J.isDirectory()&&X>0&&!J.name.startsWith(".")&&!NR.has(J.name))z(_W(Q,J.name),X-1)};return z(".",1),Z}function X4($){return[...$].join(" · ")}function u3($){let Z=OR($);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=f($,X);if(J===null)continue;for(let Y of J.matchAll(/^\s*image:\s*["']?([^\s"'#]+)/gm)){let W=Y[1].toLowerCase(),U=W.replace(/:[^/]*$/,"").split("/").pop()??W,G=W.replace(/:[^/]*$/,"");for(let{re:V,slot:q,label:H}of LR)if(V.test(U)||V.test(G))z[q].add(H)}}let Q={};if(z.database.size)Q.database=X4(z.database);if(z.cache.size)Q.cache=X4(z.cache);if(z.search.size)Q.search=X4(z.search);if(z.storage.size)Q.storage=X4(z.storage);if(z.runtime.size)Q.runtime=`Docker Compose (${X4(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 DR}from"path";var IR=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),TR=[{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 m3($,Z){for(let z of Z){let Q=$.find((X)=>z.test(X));if(Q)return Q}return null}function AR($){let Z=[$];for(let z of Q0($)??[])if(z.isDirectory()&&!z.name.startsWith(".")&&!IR.has(z.name))Z.push(DR($,z.name));return Z}function CR($){let Z=0;if(A($,"manage.py")||A($,"pyproject.toml")||A($,"Gemfile"))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function c3($){return T$($,()=>_R($))}function _R($){let Z=[];for(let Q of AR($)){let X=Q===$,J=X?"":`cd ${Q.slice($.length+1)} && `;for(let Y of TR){let W=f(Q,Y.file);if(W===null)continue;let U=Y.targets(W);if(U.length===0)continue;let G={},V=m3(U,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),q=m3(U,[/^build$/i,/^compile$/i,/^build/i]),H=m3(U,[/^check-all$/i,/^check$/i,/^lint$/i,/^lint/i,/^fmt$/i,/^format$/i]);if(V)G.test=`${J}${Y.runner} ${V}`;if(q)G.build=`${J}${Y.runner} ${q}`;if(H)G.lint=`${J}${Y.runner} ${H}`;if(Object.keys(G).length===0)continue;Z.push({score:Object.keys(G).length+(X?10:CR(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 p3($){for(let Z of RR)if(A($,Z))return{security:{secrets:".env",example:Z}};return{}}function FR($,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 l3($){return[h3($),f3($),u3($),c3($),p3($)].reduce(FR,{})}import{join as PR,extname as SR,resolve as ER}from"path";var d3={"package.json":{frameworks:["Node.js","JavaScript","TypeScript"],slots:{packageManager:"npm/yarn/pnpm",mainLanguage:"JavaScript/TypeScript"},priority:35,intelligence:"ultra-high"},"README.md":{frameworks:[],slots:{},priority:25,intelligence:"high"},"requirements.txt":{frameworks:["Python"],slots:{packageManager:"pip",mainLanguage:"Python"},priority:35,intelligence:"ultra-high"},Pipfile:{frameworks:["Python"],slots:{packageManager:"pipenv",mainLanguage:"Python"},priority:35,intelligence:"ultra-high"},"pyproject.toml":{frameworks:["Python"],slots:{mainLanguage:"Python",runtime:"Python"},priority:36,intelligence:"ultra-high"},Gemfile:{frameworks:["Ruby"],slots:{packageManager:"bundler",mainLanguage:"Ruby"},priority:35,intelligence:"ultra-high"},"Gemfile.lock":{frameworks:["Ruby"],slots:{packageManager:"bundler",mainLanguage:"Ruby"},priority:34,intelligence:"high"},"composer.json":{frameworks:["PHP","Laravel","Symfony"],slots:{packageManager:"composer",mainLanguage:"PHP"},priority:35,intelligence:"ultra-high"},"Cargo.toml":{frameworks:["Rust"],slots:{packageManager:"cargo",mainLanguage:"Rust",buildTool:"cargo"},priority:36,intelligence:"ultra-high"},"go.mod":{frameworks:["Go"],slots:{packageManager:"go modules",mainLanguage:"Go",buildTool:"go build"},priority:36,intelligence:"ultra-high"},"Package.swift":{frameworks:["Swift"],slots:{packageManager:"spm",mainLanguage:"Swift",buildTool:"swift build"},priority:36,intelligence:"ultra-high"},"*.csproj":{frameworks:["C#",".NET"],slots:{packageManager:"NuGet",mainLanguage:"C#",buildTool:"dotnet"},priority:36,intelligence:"ultra-high"},"pubspec.yaml":{frameworks:["Dart"],slots:{packageManager:"pub",mainLanguage:"Dart"},priority:35,intelligence:"ultra-high"},"pom.xml":{frameworks:["Java"],slots:{packageManager:"maven",mainLanguage:"Java",buildTool:"maven"},priority:35,intelligence:"ultra-high"},"build.gradle":{frameworks:["Java","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Java",buildTool:"gradle"},priority:35,intelligence:"ultra-high"},"settings.gradle":{frameworks:["Java","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Java",buildTool:"gradle"},priority:34,intelligence:"high"},"settings.gradle.kts":{frameworks:["Kotlin","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Kotlin",buildTool:"gradle"},priority:34,intelligence:"high"},"next.config.js":{frameworks:["Next.js"],slots:{framework:"Next.js",buildTool:"Next.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"next.config.mjs":{frameworks:["Next.js"],slots:{framework:"Next.js",buildTool:"Next.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"next.config.ts":{frameworks:["Next.js 13+"],slots:{framework:"Next.js 13+",buildTool:"Next.js",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.js":{frameworks:["Nuxt 2"],slots:{framework:"Nuxt 2",buildTool:"Nuxt",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.ts":{frameworks:["Nuxt 3"],slots:{framework:"Nuxt 3",buildTool:"Nuxt",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"svelte.config.js":{frameworks:["SvelteKit"],slots:{framework:"SvelteKit",buildTool:"Vite",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"angular.json":{frameworks:["Angular"],slots:{framework:"Angular",buildTool:"Angular CLI",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"manifest.json":{frameworks:["Chrome Extension","Browser Extension"],slots:{framework:"Chrome Extension",runtime:"Chrome/Browser",mainLanguage:"JavaScript",hosting:"Chrome Web Store",apiType:"Chrome APIs"},priority:35,intelligence:"ultra-high",confirmWith:["popup.html","background.js","content.js"]},"vue.config.js":{frameworks:["Vue"],slots:{framework:"Vue",buildTool:"Vue CLI",mainLanguage:"JavaScript"},priority:30,intelligence:"high"},"remix.config.js":{frameworks:["Remix"],slots:{framework:"Remix",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"gatsby-config.js":{frameworks:["Gatsby"],slots:{framework:"Gatsby",buildTool:"Gatsby",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"gatsby-config.ts":{frameworks:["Gatsby"],slots:{framework:"Gatsby",buildTool:"Gatsby",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"astro.config.mjs":{frameworks:["Astro"],slots:{framework:"Astro",buildTool:"Vite",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"redwood.toml":{frameworks:["RedwoodJS"],slots:{framework:"RedwoodJS",buildTool:"Webpack",mainLanguage:"JavaScript/TypeScript",server:"Node.js",database:"Prisma"},priority:30,intelligence:"high"},"blitz.config.ts":{frameworks:["Blitz.js"],slots:{framework:"Blitz.js",buildTool:"Next.js",mainLanguage:"TypeScript",server:"Node.js",database:"Prisma"},priority:30,intelligence:"high"},"qwik.config.ts":{frameworks:["Qwik"],slots:{framework:"Qwik",buildTool:"Vite",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"manage.py":{frameworks:["Django"],slots:{framework:"Django",backend:"Django",mainLanguage:"Python",server:"Django",apiType:"Django Views"},priority:30,intelligence:"high"},artisan:{frameworks:["Laravel"],slots:{framework:"Laravel",backend:"Laravel",mainLanguage:"PHP",server:"PHP",apiType:"Laravel Routes"},priority:30,intelligence:"high"},"mix.exs":{frameworks:["Phoenix","Elixir"],slots:{framework:"Phoenix",backend:"Phoenix",mainLanguage:"Elixir",server:"BEAM"},priority:30,intelligence:"high"},"nest-cli.json":{frameworks:["NestJS"],slots:{framework:"NestJS",backend:"NestJS",mainLanguage:"TypeScript",server:"Node.js",apiType:"REST API"},priority:30,intelligence:"high"},"strapi.config.js":{frameworks:["Strapi"],slots:{backend:"Strapi",apiType:"REST API",server:"Node.js"},priority:30,intelligence:"high"},Dockerfile:{frameworks:["Docker"],slots:{},priority:30,intelligence:"high"},"docker-compose.yml":{frameworks:["Docker Compose"],slots:{hosting:"Docker"},priority:30,intelligence:"high"},"docker-compose.yaml":{frameworks:["Docker Compose"],slots:{hosting:"Docker"},priority:30,intelligence:"high"},"kubernetes.yml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes"},priority:30,intelligence:"high"},"k8s.yaml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes"},priority:30,intelligence:"high"},"vercel.json":{frameworks:["Vercel"],slots:{hosting:"Vercel",cicd:"Vercel"},priority:30,intelligence:"high"},"netlify.toml":{frameworks:["Netlify"],slots:{hosting:"Netlify",cicd:"Netlify"},priority:30,intelligence:"high"},"render.yaml":{frameworks:["Render"],slots:{hosting:"Render",cicd:"Render"},priority:30,intelligence:"high"},"fly.toml":{frameworks:["Fly.io"],slots:{hosting:"Fly.io",cicd:"Fly.io"},priority:30,intelligence:"high"},"railway.json":{frameworks:["Railway"],slots:{hosting:"Railway",cicd:"Railway"},priority:30,intelligence:"high"},"railway.toml":{frameworks:["Railway"],slots:{hosting:"Railway",cicd:"Railway"},priority:30,intelligence:"high"},"app.yaml":{frameworks:["Google App Engine"],slots:{hosting:"Google Cloud",cicd:"Google Cloud"},priority:30,intelligence:"high"},Procfile:{frameworks:["Heroku"],slots:{hosting:"Heroku",cicd:"Heroku"},priority:30,intelligence:"high"},"vite.config.js":{frameworks:["Vite"],slots:{buildTool:"Vite"},priority:25,intelligence:"medium"},"vite.config.ts":{frameworks:["Vite"],slots:{buildTool:"Vite",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"webpack.config.js":{frameworks:["Webpack"],slots:{buildTool:"Webpack"},priority:25,intelligence:"medium"},"rollup.config.js":{frameworks:["Rollup"],slots:{buildTool:"Rollup"},priority:25,intelligence:"medium"},"esbuild.config.js":{frameworks:["esbuild"],slots:{buildTool:"esbuild"},priority:25,intelligence:"medium"},"parcel.config.js":{frameworks:["Parcel"],slots:{buildTool:"Parcel"},priority:25,intelligence:"medium"},"snowpack.config.js":{frameworks:["Snowpack"],slots:{buildTool:"Snowpack"},priority:25,intelligence:"medium"},"tsconfig.json":{frameworks:["TypeScript"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"jsconfig.json":{frameworks:["JavaScript"],slots:{mainLanguage:"JavaScript"},priority:20,intelligence:"medium"},"babel.config.js":{frameworks:["Babel"],slots:{buildTool:"Babel"},priority:20,intelligence:"medium"},".babelrc":{frameworks:["Babel"],slots:{buildTool:"Babel"},priority:20,intelligence:"medium"},"jest.config.js":{frameworks:["Jest"],slots:{},priority:25,intelligence:"medium"},"jest.config.ts":{frameworks:["Jest"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"vitest.config.ts":{frameworks:["Vitest"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"cypress.config.js":{frameworks:["Cypress"],slots:{},priority:25,intelligence:"medium"},"playwright.config.ts":{frameworks:["Playwright"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"karma.conf.js":{frameworks:["Karma"],slots:{},priority:20,intelligence:"medium"},"mocha.opts":{frameworks:["Mocha"],slots:{},priority:20,intelligence:"medium"},".rspec":{frameworks:["RSpec"],slots:{mainLanguage:"Ruby"},priority:25,intelligence:"medium"},"pytest.ini":{frameworks:["Pytest"],slots:{mainLanguage:"Python"},priority:25,intelligence:"medium"},"phpunit.xml":{frameworks:["PHPUnit"],slots:{mainLanguage:"PHP"},priority:25,intelligence:"medium"},"schema.prisma":{frameworks:["Prisma"],slots:{database:"Prisma ORM",connection:"Prisma"},priority:25,intelligence:"medium"},"drizzle.config.ts":{frameworks:["Drizzle"],slots:{database:"Drizzle ORM",connection:"Drizzle",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"ormconfig.js":{frameworks:["TypeORM"],slots:{database:"TypeORM",connection:"TypeORM"},priority:25,intelligence:"medium"},"knexfile.js":{frameworks:["Knex.js"],slots:{database:"Knex.js",connection:"Knex.js"},priority:25,intelligence:"medium"},"sequelize.config.js":{frameworks:["Sequelize"],slots:{database:"Sequelize",connection:"Sequelize"},priority:25,intelligence:"medium"},"alembic.ini":{frameworks:["Alembic"],slots:{database:"Alembic",mainLanguage:"Python"},priority:25,intelligence:"medium"},".github/workflows":{frameworks:["GitHub Actions"],slots:{cicd:"GitHub Actions"},priority:25,intelligence:"medium"},".gitlab-ci.yml":{frameworks:["GitLab CI"],slots:{cicd:"GitLab CI"},priority:25,intelligence:"medium"},Jenkinsfile:{frameworks:["Jenkins"],slots:{cicd:"Jenkins"},priority:25,intelligence:"medium"},".circleci/config.yml":{frameworks:["CircleCI"],slots:{cicd:"CircleCI"},priority:25,intelligence:"medium"},".travis.yml":{frameworks:["Travis CI"],slots:{cicd:"Travis CI"},priority:25,intelligence:"medium"},"azure-pipelines.yml":{frameworks:["Azure DevOps"],slots:{cicd:"Azure DevOps"},priority:25,intelligence:"medium"},"bitbucket-pipelines.yml":{frameworks:["Bitbucket Pipelines"],slots:{cicd:"Bitbucket Pipelines"},priority:25,intelligence:"medium"},"tailwind.config.js":{frameworks:["Tailwind CSS"],slots:{cssFramework:"Tailwind CSS"},priority:20,intelligence:"medium"},"tailwind.config.ts":{frameworks:["Tailwind CSS"],slots:{cssFramework:"Tailwind CSS",mainLanguage:"TypeScript"},priority:20,intelligence:"medium"},"postcss.config.js":{frameworks:["PostCSS"],slots:{cssFramework:"PostCSS"},priority:20,intelligence:"medium"},"uno.config.ts":{frameworks:["UnoCSS"],slots:{cssFramework:"UnoCSS",mainLanguage:"TypeScript"},priority:20,intelligence:"medium"},"styled-components.config.js":{frameworks:["styled-components"],slots:{cssFramework:"styled-components",uiLibrary:"styled-components"},priority:20,intelligence:"medium"},"emotion.config.js":{frameworks:["Emotion"],slots:{cssFramework:"Emotion",uiLibrary:"Emotion"},priority:20,intelligence:"medium"},"metro.config.js":{frameworks:["React Native"],slots:{framework:"React Native",mainLanguage:"JavaScript"},priority:25,intelligence:"medium"},"expo.config.js":{frameworks:["Expo"],slots:{framework:"React Native",buildTool:"Expo"},priority:25,intelligence:"medium"},"app.json":{frameworks:["React Native","Expo"],slots:{framework:"React Native"},priority:20,intelligence:"medium",confirmWith:["expo"]},"capacitor.config.ts":{frameworks:["Capacitor"],slots:{framework:"Capacitor",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"ionic.config.json":{frameworks:["Ionic"],slots:{framework:"Ionic",uiLibrary:"Ionic"},priority:25,intelligence:"medium"},"nx.json":{frameworks:["Nx"],slots:{buildTool:"Nx"},priority:25,intelligence:"medium"},"turbo.json":{frameworks:["Turborepo"],slots:{buildTool:"Turborepo"},priority:25,intelligence:"medium"},"lerna.json":{frameworks:["Lerna"],slots:{buildTool:"Lerna"},priority:25,intelligence:"medium"},"rush.json":{frameworks:["Rush"],slots:{buildTool:"Rush"},priority:25,intelligence:"medium"},"pnpm-workspace.yaml":{frameworks:["pnpm workspaces"],slots:{packageManager:"pnpm",buildTool:"pnpm workspaces"},priority:25,intelligence:"medium"},"*.svelte":{frameworks:["Svelte","SvelteKit"],slots:{framework:"Svelte"},priority:15,intelligence:"low"},"*.vue":{frameworks:["Vue"],slots:{framework:"Vue"},priority:15,intelligence:"low"},"*.jsx":{frameworks:["React"],slots:{framework:"React",mainLanguage:"JavaScript"},priority:15,intelligence:"low"},"*.ts":{frameworks:["TypeScript"],slots:{mainLanguage:"TypeScript"},priority:15,intelligence:"low"},"*.tsx":{frameworks:["React","TypeScript"],slots:{framework:"React",mainLanguage:"TypeScript"},priority:15,intelligence:"low"},"*.py":{frameworks:["Python"],slots:{mainLanguage:"Python"},priority:15,intelligence:"low"},"*.rb":{frameworks:["Ruby"],slots:{mainLanguage:"Ruby"},priority:15,intelligence:"low"},"*.php":{frameworks:["PHP"],slots:{mainLanguage:"PHP"},priority:15,intelligence:"low"},"*.java":{frameworks:["Java"],slots:{mainLanguage:"Java"},priority:15,intelligence:"low"},"*.kt":{frameworks:["Kotlin"],slots:{mainLanguage:"Kotlin"},priority:15,intelligence:"low"},"*.swift":{frameworks:["Swift"],slots:{mainLanguage:"Swift"},priority:15,intelligence:"low"},"*.go":{frameworks:["Go"],slots:{mainLanguage:"Go"},priority:15,intelligence:"low"},"*.rs":{frameworks:["Rust"],slots:{mainLanguage:"Rust"},priority:15,intelligence:"low"},"*.dart":{frameworks:["Flutter","Dart"],slots:{mainLanguage:"Dart"},priority:15,intelligence:"low"},"*.ex":{frameworks:["Elixir"],slots:{mainLanguage:"Elixir"},priority:15,intelligence:"low"},"*.exs":{frameworks:["Elixir"],slots:{mainLanguage:"Elixir"},priority:15,intelligence:"low"},"*.scala":{frameworks:["Scala"],slots:{mainLanguage:"Scala"},priority:15,intelligence:"low"},"*.clj":{frameworks:["Clojure"],slots:{mainLanguage:"Clojure"},priority:15,intelligence:"low"},"*.lua":{frameworks:["Lua"],slots:{mainLanguage:"Lua"},priority:15,intelligence:"low"},"*.r":{frameworks:["R"],slots:{mainLanguage:"R"},priority:15,intelligence:"low"},"*.R":{frameworks:["R"],slots:{mainLanguage:"R"},priority:15,intelligence:"low"},"*.jl":{frameworks:["Julia"],slots:{mainLanguage:"Julia"},priority:15,intelligence:"low"},"*.nim":{frameworks:["Nim"],slots:{mainLanguage:"Nim"},priority:15,intelligence:"low"},"*.zig":{frameworks:["Zig"],slots:{mainLanguage:"Zig"},priority:15,intelligence:"low"},"build.zig":{frameworks:["Zig"],slots:{packageManager:"Zig Package Manager",mainLanguage:"Zig",buildTool:"zig build",build:"zig build"},priority:35,intelligence:"ultra-high"},"openapi.json":{frameworks:["OpenAPI"],slots:{apiType:"REST API"},priority:30,intelligence:"high"},"openapi.yaml":{frameworks:["OpenAPI"],slots:{apiType:"REST API"},priority:30,intelligence:"high"},"swagger.json":{frameworks:["Swagger"],slots:{apiType:"REST API"},priority:30,intelligence:"high"},"graphql.schema":{frameworks:["GraphQL"],slots:{apiType:"GraphQL"},priority:30,intelligence:"high"},"schema.graphql":{frameworks:["GraphQL"],slots:{apiType:"GraphQL"},priority:30,intelligence:"high"},".graphqlconfig":{frameworks:["GraphQL"],slots:{apiType:"GraphQL"},priority:25,intelligence:"medium"},"redux.config.js":{frameworks:["Redux"],slots:{stateManagement:"Redux"},priority:20,intelligence:"medium"},"mobx.config.js":{frameworks:["MobX"],slots:{stateManagement:"MobX"},priority:20,intelligence:"medium"},"vuex.config.js":{frameworks:["Vuex"],slots:{stateManagement:"Vuex",framework:"Vue"},priority:20,intelligence:"medium"},"pinia.config.js":{frameworks:["Pinia"],slots:{stateManagement:"Pinia",framework:"Vue"},priority:20,intelligence:"medium"},"zustand.config.js":{frameworks:["Zustand"],slots:{stateManagement:"Zustand"},priority:20,intelligence:"medium"},".eslintrc.js":{frameworks:["ESLint"],slots:{},priority:15,intelligence:"low"},".eslintrc.json":{frameworks:["ESLint"],slots:{},priority:15,intelligence:"low"},".prettierrc":{frameworks:["Prettier"],slots:{},priority:15,intelligence:"low"},".prettierrc.json":{frameworks:["Prettier"],slots:{},priority:15,intelligence:"low"},"biome.json":{frameworks:["Biome"],slots:{},priority:15,intelligence:"low"},".editorconfig":{frameworks:["EditorConfig"],slots:{},priority:10,intelligence:"low"},"serverless.yml":{frameworks:["Serverless Framework"],slots:{hosting:"AWS Lambda/Azure/GCP",backend:"Serverless",apiType:"API Gateway"},priority:30,intelligence:"high"},"serverless.yaml":{frameworks:["Serverless Framework"],slots:{hosting:"AWS Lambda/Azure/GCP",backend:"Serverless",apiType:"API Gateway"},priority:30,intelligence:"high"},"sam.yaml":{frameworks:["AWS SAM"],slots:{hosting:"AWS Lambda",backend:"AWS SAM",cicd:"AWS SAM CLI"},priority:30,intelligence:"high"},"template.yaml":{frameworks:["AWS SAM","CloudFormation"],slots:{hosting:"AWS",backend:"AWS SAM/CloudFormation",cicd:"AWS"},priority:25,intelligence:"medium",confirmWith:["samconfig.toml"]},"amplify.yml":{frameworks:["AWS Amplify"],slots:{hosting:"AWS Amplify",backend:"AWS Amplify",cicd:"AWS Amplify"},priority:30,intelligence:"high"},Podfile:{frameworks:["CocoaPods","Swift"],slots:{packageManager:"CocoaPods",mainLanguage:"Swift/Objective-C"},priority:30,intelligence:"high"},"build.gradle.kts":{frameworks:["Kotlin","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Kotlin",buildTool:"gradle"},priority:35,intelligence:"ultra-high"},"*.ipynb":{frameworks:["Jupyter","Python"],slots:{mainLanguage:"Python",framework:"Jupyter Notebook"},priority:30,intelligence:"high"},MLproject:{frameworks:["MLflow"],slots:{mainLanguage:"Python",backend:"MLflow"},priority:30,intelligence:"high"},"dvc.yaml":{frameworks:["DVC","Data Version Control"],slots:{mainLanguage:"Python",cicd:"DVC Pipelines"},priority:30,intelligence:"high"},"dvc.lock":{frameworks:["DVC"],slots:{},priority:20,intelligence:"medium"},"wrangler.toml":{frameworks:["Cloudflare Workers","Cloudflare"],slots:{hosting:"Cloudflare Workers",backend:"Cloudflare Workers",runtime:"V8 Isolates"},priority:30,intelligence:"high"},"deno.json":{frameworks:["Deno"],slots:{runtime:"Deno",mainLanguage:"TypeScript",packageManager:"Deno"},priority:30,intelligence:"high"},"bun.lockb":{frameworks:["Bun"],slots:{runtime:"Bun",packageManager:"Bun",mainLanguage:"TypeScript/JavaScript"},priority:30,intelligence:"high"},"codecov.yml":{frameworks:["Codecov"],slots:{},priority:25,intelligence:"high"},"dependabot.yml":{frameworks:["Dependabot","GitHub"],slots:{},priority:25,intelligence:"high"},"renovate.json":{frameworks:["Renovate"],slots:{},priority:25,intelligence:"high"},Makefile:{frameworks:["Make","GNU Make"],slots:{buildTool:"Make"},priority:30,intelligence:"high"},"CMakeLists.txt":{frameworks:["CMake","C","C++"],slots:{buildTool:"CMake",mainLanguage:"C/C++"},priority:30,intelligence:"high"},"meson.build":{frameworks:["Meson","C","C++"],slots:{buildTool:"Meson",mainLanguage:"C/C++"},priority:30,intelligence:"high"},"*.c":{frameworks:["C"],slots:{mainLanguage:"C"},priority:30,intelligence:"high"},"*.cpp":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:30,intelligence:"high"},"*.cc":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:30,intelligence:"high"},"*.cxx":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:25,intelligence:"high"},"*.h":{frameworks:["C","C++"],slots:{mainLanguage:"C/C++"},priority:25,intelligence:"high"},"*.hpp":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:25,intelligence:"high"},"*.hxx":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:20,intelligence:"medium"},".env":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.example":{frameworks:[],slots:{},priority:25,intelligence:"high"},".env.local":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.development":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.production":{frameworks:[],slots:{},priority:20,intelligence:"medium"},"skaffold.yaml":{frameworks:["Skaffold","Kubernetes"],slots:{hosting:"Kubernetes",cicd:"Skaffold"},priority:30,intelligence:"high"},"Chart.yaml":{frameworks:["Helm","Kubernetes"],slots:{hosting:"Kubernetes"},priority:30,intelligence:"high"},"values.yaml":{frameworks:["Helm","Kubernetes"],slots:{hosting:"Kubernetes"},priority:25,intelligence:"high",confirmWith:["Chart.yaml"]},"pulumi.yaml":{frameworks:["Pulumi"],slots:{cicd:"Pulumi"},priority:30,intelligence:"high"},"Pulumi.yaml":{frameworks:["Pulumi"],slots:{cicd:"Pulumi"},priority:30,intelligence:"high"},"terragrunt.hcl":{frameworks:["Terragrunt","Terraform"],slots:{cicd:"Terragrunt"},priority:30,intelligence:"high"},"ansible.yml":{frameworks:["Ansible"],slots:{cicd:"Ansible"},priority:30,intelligence:"high"},"playbook.yml":{frameworks:["Ansible"],slots:{cicd:"Ansible"},priority:25,intelligence:"high"},"*.cs":{frameworks:["C#",".NET","Unity"],slots:{mainLanguage:"C#"},priority:30,intelligence:"high"},"*.m":{frameworks:["Objective-C","iOS"],slots:{mainLanguage:"Objective-C"},priority:25,intelligence:"high"},".nvmrc":{frameworks:["Node.js","nvm"],slots:{runtime:"Node.js"},priority:25,intelligence:"high"},".tool-versions":{frameworks:["asdf"],slots:{},priority:25,intelligence:"high"},".ruby-version":{frameworks:["Ruby","rbenv"],slots:{mainLanguage:"Ruby",runtime:"Ruby"},priority:25,intelligence:"high"},".python-version":{frameworks:["Python","pyenv"],slots:{mainLanguage:"Python",runtime:"Python"},priority:25,intelligence:"high"},".dockerignore":{frameworks:["Docker"],slots:{},priority:20,intelligence:"medium"},".gitattributes":{frameworks:["Git"],slots:{},priority:15,intelligence:"low"},".npmrc":{frameworks:["npm","Node.js"],slots:{packageManager:"npm"},priority:20,intelligence:"medium"},"sonar-project.properties":{frameworks:["SonarQube","SonarCloud"],slots:{},priority:25,intelligence:"high"},"*.fs":{frameworks:["F#",".NET"],slots:{mainLanguage:"F#"},priority:25,intelligence:"high"},"*.mm":{frameworks:["Objective-C++","iOS","macOS"],slots:{mainLanguage:"Objective-C++"},priority:25,intelligence:"high"},"build.zig.zon":{frameworks:["Zig"],slots:{mainLanguage:"Zig",packageManager:"Zig Package Manager",buildTool:"zig build"},priority:35,intelligence:"ultra-high"},"gleam.toml":{frameworks:["Gleam","BEAM","Erlang"],slots:{mainLanguage:"Gleam",runtime:"BEAM",packageManager:"Gleam"},priority:30,intelligence:"high"},"bunfig.toml":{frameworks:["Bun"],slots:{runtime:"Bun",packageManager:"Bun",buildTool:"Bun"},priority:30,intelligence:"high"},"mise.toml":{frameworks:["mise"],slots:{},priority:25,intelligence:"high"},".mise.toml":{frameworks:["mise"],slots:{},priority:25,intelligence:"high"},"manifest.toml":{frameworks:["Flox","Nix"],slots:{},priority:25,intelligence:"high",confirmWith:[".flox"]},justfile:{frameworks:["Just"],slots:{buildTool:"Just"},priority:25,intelligence:"high"},".pre-commit-config.yaml":{frameworks:["pre-commit"],slots:{},priority:25,intelligence:"high"},"CLAUDE.md":{frameworks:["Claude Code"],slots:{},priority:30,intelligence:"high",confirmWith:[".claude"]}};var jR=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),wR=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),xR={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"]},yR=[["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 kR($,Z){for(let[z,Q]of yR)if(z in $)return Q;return Z.length>0?"framework":"config"}function bR($,Z){try{let z=JSON.parse(f($,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 vR($,Z){if(Z.isFile())return!0;if(!Z.isSymbolicLink())return!1;return M2($,Z.name)?.isFile()===!0}function gR($,Z){if(Z.isDirectory())return!0;if(!Z.isSymbolicLink())return!1;return M2($,Z.name)?.isDirectory()===!0}function hR($){let Z=[],z=ER($),Q=new Set,X=Q0(z);if(!X)return Z;for(let J of X){let Y=J.name;if(Y.endsWith(".xcodeproj")?!gR(z,J):!vR(z,J))continue;if(Y.toLowerCase().endsWith(".csproj")){let U=x5(z);if(U){let G={mainLanguage:"C#",packageManager:"NuGet",buildTool:"dotnet"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="mobile"&&U.framework)G.framework=U.framework;if(U.targetFramework)G.runtime=U.targetFramework;let V=U.framework?[U.framework,"C#",".NET"]:["C#",".NET"];Z.push({slots:G,priority:36,frameworks:V,fileName:Y})}continue}if(Y.endsWith(".xcodeproj")){let U=Q4(z);if(U){let G={mainLanguage:"Swift",packageManager:U.packageManager==="spm"?"spm":"Xcode",buildTool:U.packageManager.includes("spm")?"swift build":"xcodebuild"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="app"&&U.framework)G.framework=U.framework;let V=U.framework?[U.framework,"Swift"]:["Swift"];Z.push({slots:G,priority:36,frameworks:V,fileName:Y})}continue}let W=d3[Y];if(!W)continue;if(Y==="manifest.json"&&bR(z,Y)!=="chrome")continue;if(Y==="pubspec.yaml"){let U=S5(z);if(U){let G={mainLanguage:"Dart",packageManager:"pub"};if(U.isFlutter){if(G.framework="Flutter",U.stateManagement)G.stateManagement=U.stateManagement}else if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="mcp")G.apiType="MCP";Z.push({slots:G,priority:W.priority,frameworks:U.isFlutter?["Flutter","Dart"]:["Dart"],fileName:Y});continue}}if(Y==="go.mod"){let U=j5(z);if(U){let G={mainLanguage:"Go",packageManager:"go modules",buildTool:"go build"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";let V=U.framework?[U.framework,"Go"]:["Go"];Z.push({slots:G,priority:W.priority,frameworks:V,fileName:Y});continue}}if(Y==="Gemfile"||Y==="Gemfile.lock"||Y==="gems.rb"){let U=y5(z);if(U){let G={mainLanguage:"Ruby",packageManager:U.packageManager};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";let V=U.framework?[U.framework,"Ruby"]:["Ruby"];Z.push({slots:G,priority:W.priority??35,frameworks:V,fileName:Y});continue}}if(Y==="Package.swift"){let U=Q4(z);if(U){let G={mainLanguage:"Swift",packageManager:U.packageManager==="xcode"?"Xcode":"spm",buildTool:"swift build"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="app"&&U.framework)G.framework=U.framework;let V=U.framework?[U.framework,"Swift"]:["Swift"];Z.push({slots:G,priority:W.priority??36,frameworks:V,fileName:Y});continue}}if(Y==="pom.xml"||Y==="build.gradle"||Y==="build.gradle.kts"||Y==="settings.gradle"||Y==="settings.gradle.kts"){if(Q.has(z))continue;Q.add(z);let U=$4(z);if(U){let G={mainLanguage:U.mainLanguage==="Java/Kotlin"?"Kotlin":U.mainLanguage,packageManager:U.buildTool==="maven"?"maven":"gradle",buildTool:U.buildTool};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="mobile")G.framework=U.framework||"Android";if(U.facets.includes("multiplatform"))G.framework=U.framework||"Kotlin Multiplatform";let V=U.framework?[U.framework,"JVM",U.mainLanguage==="Kotlin"?"Kotlin":"Java"]:["JVM",U.mainLanguage==="Kotlin"?"Kotlin":"Java"];Z.push({slots:G,priority:W.priority??35,frameworks:V,fileName:Y});continue}}Z.push({slots:W.slots||{},priority:W.priority,frameworks:W.frameworks,fileName:Y})}return Z}function fR($){let Z=[];for(let z of T$($,()=>RW($,2,{count:0}))){let Q=d3[`*${z}`],X=Q?.slots?.mainLanguage;if(X)Z.push({slots:{mainLanguage:X},priority:Q.priority,frameworks:Q.frameworks})}return Z}function uR($){let Z=[...hR($),...fR($)],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:kR(G.slots,G.frameworks),priority:G.priority})}let Y=[...J.values()].sort((G,V)=>V.priority-G.priority||G.fileName.localeCompare(V.fileName)),W=[];if(z.mainLanguage)W.push(z.mainLanguage.toLowerCase());if(z.framework)W.push(z.framework.toLowerCase());let U=W.length>0?W.join("-"):"unknown-stack";return{slotFills:z,frameworks:[...X],confirmedCount:Z.length,discoveredFormats:Y,stackSignature:U}}function i3($){let{slotFills:Z}=uR($),z={};for(let[Q,X]of Object.entries(Z)){let J=xR[Q];if(!J||!X)continue;let[Y,W]=J;if(Y==="project")(z.project??={})[W]=X;else(z.stack??={})[W]=X}return z}function RW($,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=SR(J.name);if(wR.has(Y))Q.add(Y);continue}if(jR.has(J.name)||J.name.startsWith("."))continue;for(let Y of RW(PR($,J.name),Z-1,z))Q.add(Y)}return Q}var y0=($,Z,z)=>({value:$,source:Z,confidence:z});function mR($,Z={}){let z=Z.toolingRoot?null:cR($),Q=pR($),X={},J=(Y,W)=>{if(W)X[Y]=W};return J("what",iR(z,Q)),J("who",nR(Q)),J("why",rR(Q)),J("where",sR(z,Q)),J("when",oR(Q)),J("how",aR(z,Q)),X}function n3($,Z={}){let z=mR($,Z),Q={};return Object.keys(z).forEach((X)=>{let J=z[X];if(J)Q[X]=J.value}),Q}function cR($){let Z=f($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function pR($){let Z=f($,"README.md");if(Z===null)return"";return Z.replace(/<!--[\s\S]*?-->/g,"").split(`
242
242
  `).filter((z)=>!/^\s*\[!\[/.test(z)&&!/^\s*!\[/.test(z)).join(`
243
- `).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function m6($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function vR($){if(!$)return 0;return($.match(/\[[^\]]*\]\([^)]*\)/g)??[]).join("").length/$.length}function S$($,Z){let z=new RegExp(`##?\\s+(${Z})\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n##?|$)`,"i"),Q=$.match(z);if(!Q||!Q[2]||Q[2].trim().length<=20||vR(Q[2])>0.4)return null;return{body:m6(Q[2]),heading:Q[1].trim()}}function gR($){let Z=$.trim();if(/^>/.test(Z))return!0;if(/\b(nightly (release|build)|pre-?release|work[-\s]in[-\s]progress|rough edges|early (access|testing|preview)|use at your own risk|not (yet )?production[-\s]?ready|expect (rough|breaking)|experimental release)\b/i.test(Z))return!0;let z=Z.split(/[·|]/).map((Q)=>Q.trim()).filter(Boolean);if(z.length>=3&&z.every((Q)=>Q.length<=24))return!0;return!1}function z4($,Z,z=30){for(let Q of Z){let X=$.match(Q);if(X&&X[1]&&X[1].trim().length>=z)return m6(X[1])}return null}function hR($,Z){if($?.description&&$.description.length>20)return y0(m6($.description),"package.json:description",0.95);let z=S$(Z,"Purpose|What|About|Overview|Description");if(z)return y0(z.body,`README:## ${z.heading}`,0.8);let Q=Z.split(/\n\s*\n/).map((J)=>J.replace(/\s+/g," ").trim()).find((J)=>J.length>30&&!J.startsWith("#")&&!gR(J));if(Q)return y0(m6(Q),"README:first-paragraph",0.5);let X=z4(Z,[/(?:core|main|primary)\s+(?:problem|challenge)(?:\s+is)?\s*:?\s*([^.\n]{30,})/i,/solves?\s+(?:the\s+)?(?:problem\s+of\s+)?([^.\n]{30,})/i]);return X?y0(X,"README:problem-heuristic",0.6):null}function fR($){let Z=S$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return y0(Z.body,`README:## ${Z.heading}`,0.8);let z=z4($,[/\b(?:designed|built|made)\s+for\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i,/\bfor\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i],8);return z?y0(z,"README:audience-heuristic",0.6):null}function uR($){let Z=S$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return y0(Z.body,`README:## ${Z.heading}`,0.8);let z=z4($,[/(?:our\s+|the\s+)?(?:mission|purpose|goal)\s+is\s+([^.\n]{30,})/i,/\b(?:mission|purpose|goal)\s*:\s*([^.\n]{30,})/i,/(?:built|created|designed)\s+(?:because|to)\s+([^.\n]{30,})/i]);return z?y0(z,"README:mission-heuristic",0.6):null}function mR($,Z){let z=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(z)return y0(m6(z.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return y0(m6($.homepage),"package.json:homepage",0.9);let Q=z4(Z,[/\b(?:deployed|hosted|available|published)\s+(?:on|at|via)\s+([^.\n]{3,80})/i],3);return Q?y0(Q,"README:deploy-heuristic",0.6):null}function cR($){let Z=S$($,"Timeline|Status|Release|Roadmap");if(Z)return y0(Z.body,`README:## ${Z.heading}`,0.8);let z=z4($,[/\b(production\s+since\s+[^.\n]{4,60})/i,/\b((?:in\s+)?(?:production|beta|alpha|development)\s+since\s+[^.\n]{4,60})/i,/\bsince\s+((?:[A-Z][a-z]+\s+)?\d{4}[^.\n]{0,40})/],4);return z?y0(z,"README:since-heuristic",0.6):null}function pR($,Z){let z=$?.scripts?Object.keys($.scripts):[],Q=["start","dev","build"].filter((Y)=>z.includes(Y));if(Q.length)return y0(m6(Q.map((Y)=>`npm run ${Y}`).join(", ")),"package.json:scripts",0.9);let X=S$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(X)return y0(X.body,`README:## ${X.heading}`,0.8);let J=S$(Z,"Architecture|Approach|How it works|Methodology|How");return J?y0(J.body,`README:## ${J.heading}`,0.7):null}function E$($){let Z=OW($),z=m3($),Q={};if(z.stack)Q.stack=z.stack;if(z.commands)Q.commands=z.commands;if(z.security)Q.security=z.security;let X={};if(z.project)X.project=z.project;if(z.human_context)X.human_context=z.human_context;let J=H6(H6(Q,Z),X);tR(J);let W=(Z._meta?.found??[]).some((G)=>G.startsWith("polyglot:")),U=H6(J,p3($));return H6(U,{human_context:l3($,{toolingRoot:W})})}function CW($,Z){let z=aR(f1(Z,"updateExistingFaf: the existing .faf")),{data:Q,facts:X}=k3($),J=Q,Y=H6(z,m3($)),W=H6(Y,J),U=H6(W,p3($)),G=iR(H6(U,{human_context:l3($)}),z),V=nR(lR(Z,z,J)?rR(AW(G,z),z,X):AW(G,z),z);return xY(jY(Z,V))}function lR($,Z,z){if(!U0(c0(Z,"project.type"))){let X=n1($)?.text;return X===void 0||!F3(X)}return!(z._meta?.found??[]).includes(A$)}function d3($){return $.canonical?[$.path,$.canonical]:[$.path]}function c0($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)?X[Q]:void 0}function c6($,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 p6=($)=>typeof $==="string"&&$.trim()===m1;function dR($,Z){let z=Z.map((Q)=>c0($,Q));return z.some(p6)&&z.every((Q)=>U0(Q)||p6(Q))}function AW($,Z){let z={...$};for(let Q of Q0){let X=d3(Q);if(!dR(Z,X))continue;for(let J of X){let Y=c0(Z,J);if(c0(z,J)!==Y)c6(z,J,Y)}}return z}function l6($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)&&Object.prototype.hasOwnProperty.call(X,Q)}function iR($,Z){let z={...$};for(let Q of Q0){if(!Q.canonical||!l6(Z,Q.canonical)||l6(Z,Q.path))continue;let X=c0(z,Q.path);c6(z,Q.path,void 0);let J=c0(z,Q.canonical);if(g5(X)&&U0(J))c6(z,Q.canonical,X)}return z}function nR($,Z){let z={...$};for(let Q of Q0){if(!Q.canonical||!l6(Z,Q.canonical)||l6(Z,Q.path))continue;let X=c0(z,Q.canonical);if(g5(X)||p6(X))c6(z,Q.path,X)}return z}function rR($,Z,z={}){let Q=$.project,X=$0(Q)?Q.type:void 0,J={...$};for(let Y of Q0){if(Y.category==="human"||Y.category==="project")continue;let W=v6(X,Y);if(W===null)return $;if(W)sR(J,Z,Y,Y.path.startsWith("stack.")?z[Y.path.slice(6)]:void 0);else oR(J,Y)}return J}function sR($,Z,z,Q){let X=d3(z);for(let Y of X)if(p6(c0($,Y))&&!p6(c0(Z,Y)))c6($,Y,l6(Z,Y)?c0(Z,Y):"");if(!g5(Q))return;let J=X.filter((Y)=>l6($,Y));if(J.some((Y)=>!U0(c0($,Y))))return;for(let Y of J.length>0?J:[z.path])c6($,Y,Q)}function oR($,Z){let z=d3(Z).filter((X)=>l6($,X)),Q=(X)=>!U0(c0($,X))&&!p6(c0($,X));if(z.some(Q))return;for(let X of z.length>0?z:[Z.path])if(U0(c0($,X)))c6($,X,m1)}function aR($){let Z=$.project;if(Z===null||Z===void 0||$0(Z)||Array.isArray(Z))return $;return{...$,project:{name:String(Z)}}}function tR($){let Z=$.project?.type??"library",z=b6[Z]||b6.library;for(let Q of Q0){if(z.includes(Q.category))continue;let[X,J]=Q.path.split(".");if(X==="stack"&&$.stack)$.stack[J]="slotignored";if(X==="monorepo"&&$.monorepo)$.monorepo[J]="slotignored"}}function H6($,Z){return _W($,Z,"")}function eR($){let Z=W6.get($);return Z!==void 0&&Z.category!=="human"}function g5($){if(typeof $==="number"||typeof $==="boolean")return!0;return typeof $==="string"&&$.trim()!==""&&!U0($)&&!p6($)}function $F($,Z){return eR($)&&g5(Z)}function _W($,Z,z){let Q={...$};for(let[X,J]of Object.entries(Z)){let Y=Q[X],W=z?`${z}.${X}`:X;if(W==="_meta"&&Y!==void 0)continue;if(T$(Y)){if($F(W,J))Q[X]=J;continue}if(U0(Y))Q[X]=J;else if($0(J)&&$0(Y))Q[X]=_W(Y,J,W)}return Q}import{existsSync as RW,lstatSync as ZF}from"fs";import{join as zF,basename as QF}from"path";import{createHash as XF}from"crypto";var T2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($),q6=($)=>typeof $==="number"&&Number.isFinite($),v2=($)=>typeof $==="string",JF=/^v?\d+\.\d+\.\d+$/,YF=new Set(["birth","doubled","peak","current"]);function SW($){return T2($)&&v2($.version)&&JF.test($.version)&&q6($.score)}var WF=($)=>T2($)&&q6($.birthDNA)&&v2($.born),UF=($)=>Array.isArray($)&&$.length>0&&$.every(SW),GF=($)=>T2($)&&q6($.score)&&v2($.version),VF=($)=>T2($)&&Array.isArray($.milestones)&&$.milestones.every(T2);function FW($){return T2($)&&WF($.birthCertificate)&&UF($.versions)&&GF($.current)&&VF($.growth)}function i3($){try{return ZF($),!0}catch{return!1}}var n3=($)=>`${JSON.stringify($,null,2)}
244
- `,HF=new Set(["version","score","lastSync"]),qF=new Set(["type","score","date","version","label","emoji"]),PW=($,Z)=>Object.keys($).every((z)=>Z.has(z)),r3={birth:{label:"Birth",emoji:"\uD83D\uDC23"},doubled:{label:"Doubled",emoji:"2️⃣"},peak:{label:"Peak",emoji:"\uD83C\uDFD4️"},current:{label:"Current",emoji:"\uD83D\uDCCD"}},EW=($)=>$.growth.milestones.filter((Z)=>Z.type==="peak"||Z.type==="current"),jW=($)=>PW($.current,HF)&&EW($).every((Z)=>PW(Z,qF)),KF=($)=>EW($).every((Z)=>Z.label===r3[Z.type].label&&Z.emoji===r3[Z.type].emoji);function BF($){return jW($)&&KF($)}var MF=".faf-dna is not in faf's shape: faf reads it and leaves it as it is.",LF=".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.",NF=".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.",OF=".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.",DF=".faf-dna has no birth certificate faf can read: faf leaves it as it is.";function IF($){if(!Array.isArray($))return[];return $.filter((Z)=>T2(Z)&&v2(Z.type)&&YF.has(Z.type)&&q6(Z.score))}var d6=($,Z="")=>v2($)?$:Z;function TF($,Z){if(!Array.isArray($))return[];return $.filter(SW).map((z)=>({version:z.version,timestamp:d6(z.timestamp),score:z.score,changes:Array.isArray(z.changes)?z.changes.filter(v2):[],growth:q6(z.growth)?z.growth:z.score-Z}))}function AF($,Z,z,Q){return{version:d6($.version,Z?.version??"v1.0.0"),score:q6($.score)?$.score:Z?.score??z,lastSync:d6($.lastSync,Q)}}function CF($){if(!T2($)||!T2($.birthCertificate)||!q6($.birthCertificate.birthDNA))return null;let Z=$.birthCertificate,z=Z.birthDNA,Q=d6(Z.born),X=TF($.versions,z),J=AF(T2($.current)?$.current:{},X[X.length-1],z,Q),Y=T2($.growth)?$.growth:{};return{birthCertificate:{born:Q,birthDNA:z,birthDNASource:Z.birthDNASource==="legacy"?"legacy":"init",projectDNA:d6(Z.projectDNA),certificate:d6(Z.certificate)},versions:X,current:J,growth:{totalGrowth:J.score-z,daysActive:q6(Y.daysActive)?Y.daysActive:0,milestones:IF(Array.isArray(Y.milestones)?Y.milestones:$.milestones)},lastModified:d6($.lastModified,Q),format:"faf-dna-v1"}}class g2{projectPath;dnaPath;dna=null;own=!1;text;reason=null;sawNoFile=!1;constructor($){this.projectPath=$,this.dnaPath=zF($,".faf-dna")}exists(){let $=RW(this.dnaPath);if(!$&&!i3(this.dnaPath))this.sawNoFile=!0;return $}birth($){if(!i3(this.dnaPath))this.sawNoFile=!0;let Z=new Date().toISOString();return this.own=!0,this.dna={birthCertificate:{born:Z,birthDNA:$,birthDNASource:"init",projectDNA:this.generateProjectDNA(),certificate:this.generateCertificate()},versions:[{version:"v1.0.0",timestamp:Z,score:$,changes:["Birth — initial context"],growth:0}],current:{version:"v1.0.0",score:$,lastSync:Z},growth:{totalGrowth:0,daysActive:0,milestones:[{type:"birth",score:$,date:Z,version:"v1.0.0",label:"Birth",emoji:"\uD83D\uDC23"}]},lastModified:Z,format:"faf-dna-v1"},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:v2($.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=v2($.timestamp)?$.timestamp.split("T")[0]:"",Q=Array.isArray($.changes)?$.changes.filter(v2).join(", "):"";return`${$.version} — ${$.score}% ${Z} (${z}) ${Q}`})}load(){if(this.dna)return this.dna;if(!RW(this.dnaPath)){if(!i3(this.dnaPath))this.sawNoFile=!0;return null}let $=this.read();if($===null)return null;let{text:Z,raw:z}=$;if(FW(z)&&n3(z)===Z&&BF(z))this.own=!0,this.reason=null,this.dna=z;else this.own=!1,this.dna=CF(z),this.reason=!this.dna?DF:!FW(z)?MF:n3(z)!==Z?LF:jW(z)?OF:NF;return this.text=Z,this.dna}read(){let $;try{$=J0(l(this.projectPath,".faf-dna"))}catch(Z){return this.reason=Z instanceof Error?Z.message:String(Z),null}try{return{text:$,raw:JSON.parse($)}}catch{return this.reason=".faf-dna is not JSON: faf leaves it as it is.",null}}save(){if(!this.dna)return;this.dna.lastModified=new Date().toISOString();let $=n3(this.dna),Z=this.text??(this.sawNoFile?null:j0(l(this.projectPath,".faf-dna")));a(this.dnaPath,$,{root:this.projectPath,expect:Z}),this.text=$,this.sawNoFile=!1}generateProjectDNA(){return XF("sha256").update([this.projectPath,Date.now().toString(),Math.random().toString(36)].join(":")).digest("hex").substring(0,16)}generateCertificate(){let $=new Date().getFullYear(),Z=Math.random().toString(36).substring(2,6).toUpperCase(),z=QF(this.projectPath).replace(/[^A-Z0-9]/gi,"").toUpperCase().substring(0,8).padEnd(4,"X");return`FAF-${$}-${z}-${Z}`}incrementVersion($){let[Z,z,Q]=$.replace("v","").split(".").map(Number);return`v${Z}.${z}.${Q+1}`}daysSince($){return Math.floor((Date.now()-new Date($).getTime())/86400000)}updateMilestones($,Z,z){if(!this.dna)return;let Q=this.dna.growth.milestones,X=(U)=>Q.some((G)=>G.type===U),J=(U)=>Q.push({type:U,score:$,date:z,version:Z,...r3[U]});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!X("doubled"))J("doubled");let Y=Q.find((U)=>U.type==="peak");if(!Y||$>Y.score){if(Y)Q.splice(Q.indexOf(Y),1);J("peak")}let W=Q.findIndex((U)=>U.type==="current");if(W>=0)Q.splice(W,1);J("current")}}d();d();import{statSync as wW}from"fs";import{homedir as _F}from"os";import{parse as RF,resolve as xW}from"path";function yW($,Z){try{let z=wW($,{bigint:!0}),Q=wW(Z,{bigint:!0});return z.isDirectory()&&z.ino!==0n&&z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function FF($){let Z=xW($),z=xW(_F()),Q=RF(Z).root;if(Z===z)return"home";if(Z===Q||Z==="/"||/^[A-Za-z]:[\\/]?$/.test(Z))return"root";if(yW(Z,z))return"home";if(yW(Z,Q))return"root";return null}function j$($=process.cwd(),Z="faf"){let z=FF($);if(z===null)return;let Q=z==="home"?"your home directory (~)":"the filesystem root";console.error(`${I("faf")}: ${Q} is not a project.`),console.error(""),console.error(` ${C("cd")} into a real repo (or any folder you mean to own), then run again:`),console.error(M(" cd /path/to/your-project")),console.error(M(` ${Z}`)),console.error(""),console.error(M(" Home will never be a git repo for this. project.faf belongs with the code.")),process.exit(1)}import{statSync as PF}from"fs";import{dirname as SF,resolve as kW}from"path";function EF($,Z){if($.reason==="not-utf8"||$.reason==="changed"||$.reason==="not-yaml"||$.reason==="unplaceable")return"";if($.reason==="not-owned")return Z&&!$.message.includes("--force")?" Use --force to replace it.":"";return $.onWrite?" Nothing was written to it.":" Nothing was read from or written to it."}function w$($){return $ instanceof b||$ instanceof k2}function K6($,Z){return $ instanceof b?`faf: ${$.message}${EF($,Z)}`:`faf: ${$.message}`}function X2($){if($===void 0)return;let Z=SF(kW($)),z;try{z=PF(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 k2(kW($),`${Z} ${z} — nothing written`)}function s3($={}){j$(process.cwd(),"faf init");let Z=process.cwd(),z=$.output?$.output.endsWith(".faf")?$.output:bW(Z,$.output):bW(Z,"project.faf");if(jF(z)&&!$.force)console.error(`project.faf already exists. Use ${C("--force")} to overwrite.`),process.exit(1);X2($.output);let Q=E$(Z);B0(z,Q,{replace:$.force===!0});let X=p(z),J=n(z,()=>L0(X)),Y=new g2(Z);if(!Y.exists()||$.force)Y.birth(J.score);if(console.log(`${I("created")} ${z}`),F0(J,z),console.log(M(` \uD83E\uDDEC Birth DNA ${J.score}% — your journey starts here (faf dna)`)),J.score<100)console.log(M(`
245
- run ${C("'faf go'")} to fill empty slots`))}d();function h5($){let Z=$.readOnlyReason();if(Z)console.error(`faf: ${Z}`)}function vW(){let $=new g2(process.cwd());if(!$.load()){let Y=$.readOnlyReason();console.error(Y?`${C("×")} ${Y}`:`${C("×")} No FAF DNA found. Run ${C("'faf init'")} to start your journey.`),process.exit(1)}let Z=$.getJourney(),z=$.getBirthDNADisplay(),Q=z.born.split("T")[0]||"unknown";console.log(),console.log(_0(C("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${I(C(Z))}`),console.log(),console.log(M(` Birth DNA ${z.birthDNA}% (born ${Q}) · current ${z.current}% · growth ${z.growth>=0?"+":""}${z.growth}%`));let X=$.readOnlyReason();if(X)console.log(M(` ${X} ${C("'faf init --force'")} starts a fresh lineage.`));let J=$.getLog();if(J.length>1){console.log(),console.log(M(" history:"));for(let Y of J)console.log(M(` ${Y}`))}console.log()}import{existsSync as wF}from"fs";import{join as xF}from"path";d();function f5(){j$(process.cwd(),"faf auto");let $=process.cwd(),Z=xF($,"project.faf");if(wF(Z)){let J=r(Z);n(Z,()=>R0(p(Z)));let Y=[],W=B0(Z,CW($,J),{onAliasKept:(U)=>Y.push(m0(U))});console.log(`${W?I("updated"):M("unchanged")} ${Z}`);for(let U of Y)console.log(M(` ${U}`))}else B0(Z,E$($)),console.log(`${I("created")} ${Z}`);let z=p(Z),Q=n(Z,()=>x0(R0(z))),X=new g2($);if(X.exists())X.recordGrowth(Q.score,["faf auto"]),h5(X);if(F0(Q,Z,!1,C5(z,Q,{outOfType:!1})),Q.score<100)console.log(M(`
246
- run ${C("'faf go'")} to reach ✪ Trophy`))}import{existsSync as uF}from"fs";import{join as mF}from"path";var x$="(terse — 3-4 words)",yF=[{path:"project.name",question:"What is the name of this project?",header:"Name",type:"text",required:!0},{path:"project.goal",question:"What does this project do? (one sentence)",header:"Goal",type:"text",required:!0},{path:"human_context.who",question:`Who is this for? ${x$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${x$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${x$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${x$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${x$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${x$}`,header:"How",type:"text",required:!0}],kF=[{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}],u5=[...yF,...kF],bF=new Map(u5.map(($)=>[$.path,$])),dg=Object.fromEntries(u5.map(($)=>[$.path,$]));function m5($){let Z=bF.get($);if(Z)return Z.question;let z=W6.get($)??Q0.find((Q)=>Q.canonical===$);return z?`${z.description}?`.replace(/\?\?$/,"?"):`${$}?`}function a3($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||U0(Z)}return!1}function vF($,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 gF($){if($==="project.goal")return!0;return W6.get($)?.category==="human"}function hF($,Z=a3){let z=[],Q=[];for(let X of u5){let J=vF($,X.path);if(J==="slotignored")continue;if(!Z(J))continue;(gF(X.path)?z:Q).push(X.path)}return{human:z,sourceable:Q}}function fF($,Z,z=a3){let Q=hF(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"?o3(Q):[];return{status:X,score:$,gaps:Q,ask:J}}function o3($){return $.human.map((Z)=>({path:Z,question:m5(Z)}))}function gW($,Z={}){let z=Math.max(1,Z.maxRounds??5),Q=Z.isEmpty??a3,X=[],J=0;for(let W=0;W<=z;W++){let U=$.read();if(!U)return{status:"no-faf",score:0,rounds:J,history:X,ask:[]};let G=$.score(U.yaml);X.push(G);let V=fF(G,U.data,Q);if(V.status==="done")return{status:"done",score:G,rounds:J,history:X,ask:[]};if(V.status==="needs-human")return{status:"needs-human",score:G,rounds:J,history:X,ask:V.ask};if(X.length>=2&&G<=X[X.length-2])return V.gaps.human.length?{status:"needs-human",score:G,rounds:J,history:X,ask:o3(V.gaps)}:{status:"stuck",score:G,rounds:J,history:X,ask:[]};if(J>=z)return{status:"capped",score:G,rounds:J,history:X,ask:o3(V.gaps)};$.runAuto(),J++}return{status:"capped",score:X[X.length-1]??0,rounds:J,history:X,ask:[]}}d();function hW($={}){let Z=process.cwd(),z=mF(Z,"project.faf"),Q=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;cF(gW({read:()=>uF(z)?{data:r(z),yaml:p(z)}:{data:{},yaml:""},score:(J)=>J?n(z,()=>x0(R0(J))).score:0,runAuto:()=>f5()},{maxRounds:Q}))}function cF($){if($.history.length>1)console.log(M(`
243
+ `).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function c6($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function lR($){if(!$)return 0;return($.match(/\[[^\]]*\]\([^)]*\)/g)??[]).join("").length/$.length}function E$($,Z){let z=new RegExp(`##?\\s+(${Z})\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n##?|$)`,"i"),Q=$.match(z);if(!Q||!Q[2]||Q[2].trim().length<=20||lR(Q[2])>0.4)return null;return{body:c6(Q[2]),heading:Q[1].trim()}}function dR($){let Z=$.trim();if(/^>/.test(Z))return!0;if(/\b(nightly (release|build)|pre-?release|work[-\s]in[-\s]progress|rough edges|early (access|testing|preview)|use at your own risk|not (yet )?production[-\s]?ready|expect (rough|breaking)|experimental release)\b/i.test(Z))return!0;let z=Z.split(/[·|]/).map((Q)=>Q.trim()).filter(Boolean);if(z.length>=3&&z.every((Q)=>Q.length<=24))return!0;return!1}function J4($,Z,z=30){for(let Q of Z){let X=$.match(Q);if(X&&X[1]&&X[1].trim().length>=z)return c6(X[1])}return null}function iR($,Z){if($?.description&&$.description.length>20)return y0(c6($.description),"package.json:description",0.95);let z=E$(Z,"Purpose|What|About|Overview|Description");if(z)return y0(z.body,`README:## ${z.heading}`,0.8);let Q=Z.split(/\n\s*\n/).map((J)=>J.replace(/\s+/g," ").trim()).find((J)=>J.length>30&&!J.startsWith("#")&&!dR(J));if(Q)return y0(c6(Q),"README:first-paragraph",0.5);let X=J4(Z,[/(?:core|main|primary)\s+(?:problem|challenge)(?:\s+is)?\s*:?\s*([^.\n]{30,})/i,/solves?\s+(?:the\s+)?(?:problem\s+of\s+)?([^.\n]{30,})/i]);return X?y0(X,"README:problem-heuristic",0.6):null}function nR($){let Z=E$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return y0(Z.body,`README:## ${Z.heading}`,0.8);let z=J4($,[/\b(?:designed|built|made)\s+for\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i,/\bfor\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i],8);return z?y0(z,"README:audience-heuristic",0.6):null}function rR($){let Z=E$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return y0(Z.body,`README:## ${Z.heading}`,0.8);let z=J4($,[/(?:our\s+|the\s+)?(?:mission|purpose|goal)\s+is\s+([^.\n]{30,})/i,/\b(?:mission|purpose|goal)\s*:\s*([^.\n]{30,})/i,/(?:built|created|designed)\s+(?:because|to)\s+([^.\n]{30,})/i]);return z?y0(z,"README:mission-heuristic",0.6):null}function sR($,Z){let z=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(z)return y0(c6(z.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return y0(c6($.homepage),"package.json:homepage",0.9);let Q=J4(Z,[/\b(?:deployed|hosted|available|published)\s+(?:on|at|via)\s+([^.\n]{3,80})/i],3);return Q?y0(Q,"README:deploy-heuristic",0.6):null}function oR($){let Z=E$($,"Timeline|Status|Release|Roadmap");if(Z)return y0(Z.body,`README:## ${Z.heading}`,0.8);let z=J4($,[/\b(production\s+since\s+[^.\n]{4,60})/i,/\b((?:in\s+)?(?:production|beta|alpha|development)\s+since\s+[^.\n]{4,60})/i,/\bsince\s+((?:[A-Z][a-z]+\s+)?\d{4}[^.\n]{0,40})/],4);return z?y0(z,"README:since-heuristic",0.6):null}function aR($,Z){let z=$?.scripts?Object.keys($.scripts):[],Q=["start","dev","build"].filter((Y)=>z.includes(Y));if(Q.length)return y0(c6(Q.map((Y)=>`npm run ${Y}`).join(", ")),"package.json:scripts",0.9);let X=E$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(X)return y0(X.body,`README:## ${X.heading}`,0.8);let J=E$(Z,"Architecture|Approach|How it works|Methodology|How");return J?y0(J.body,`README:## ${J.heading}`,0.7):null}function j$($){let Z=AW($),z=l3($),Q={};if(z.stack)Q.stack=z.stack;if(z.commands)Q.commands=z.commands;if(z.security)Q.security=z.security;let X={};if(z.project)X.project=z.project;if(z.human_context)X.human_context=z.human_context;let J=q6(q6(Q,Z),X);YF(J);let W=(Z._meta?.found??[]).some((G)=>G.startsWith("polyglot:")),U=q6(J,i3($));return q6(U,{human_context:n3($,{toolingRoot:W})})}function PW($,Z){let z=JF(c1(Z,"updateExistingFaf: the existing .faf")),{data:Q,facts:X}=g3($),J=Q,Y=q6(z,l3($)),W=q6(Y,J),U=q6(W,i3($)),G=$F(q6(U,{human_context:n3($)}),z),V=ZF(tR(Z,z,J)?zF(FW(G,z),z,X):FW(G,z),z);return vY(kY(Z,V))}function tR($,Z,z){if(!U0(c0(Z,"project.type"))){let X=o1($)?.text;return X===void 0||!E3(X)}return!(z._meta?.found??[]).includes(C$)}function r3($){return $.canonical?[$.path,$.canonical]:[$.path]}function c0($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)?X[Q]:void 0}function p6($,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 l6=($)=>typeof $==="string"&&$.trim()===l1;function eR($,Z){let z=Z.map((Q)=>c0($,Q));return z.some(l6)&&z.every((Q)=>U0(Q)||l6(Q))}function FW($,Z){let z={...$};for(let Q of X0){let X=r3(Q);if(!eR(Z,X))continue;for(let J of X){let Y=c0(Z,J);if(c0(z,J)!==Y)p6(z,J,Y)}}return z}function d6($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)&&Object.prototype.hasOwnProperty.call(X,Q)}function $F($,Z){let z={...$};for(let Q of X0){if(!Q.canonical||!d6(Z,Q.canonical)||d6(Z,Q.path))continue;let X=c0(z,Q.path);p6(z,Q.path,void 0);let J=c0(z,Q.canonical);if(u5(X)&&U0(J))p6(z,Q.canonical,X)}return z}function ZF($,Z){let z={...$};for(let Q of X0){if(!Q.canonical||!d6(Z,Q.canonical)||d6(Z,Q.path))continue;let X=c0(z,Q.canonical);if(u5(X)||l6(X))p6(z,Q.path,X)}return z}function zF($,Z,z={}){let Q=$.project,X=$0(Q)?Q.type:void 0,J={...$};for(let Y of X0){if(Y.category==="human"||Y.category==="project")continue;let W=g6(X,Y);if(W===null)return $;if(W)QF(J,Z,Y,Y.path.startsWith("stack.")?z[Y.path.slice(6)]:void 0);else XF(J,Y)}return J}function QF($,Z,z,Q){let X=r3(z);for(let Y of X)if(l6(c0($,Y))&&!l6(c0(Z,Y)))p6($,Y,d6(Z,Y)?c0(Z,Y):"");if(!u5(Q))return;let J=X.filter((Y)=>d6($,Y));if(J.some((Y)=>!U0(c0($,Y))))return;for(let Y of J.length>0?J:[z.path])p6($,Y,Q)}function XF($,Z){let z=r3(Z).filter((X)=>d6($,X)),Q=(X)=>!U0(c0($,X))&&!l6(c0($,X));if(z.some(Q))return;for(let X of z.length>0?z:[Z.path])if(U0(c0($,X)))p6($,X,l1)}function JF($){let Z=$.project;if(Z===null||Z===void 0||$0(Z)||Array.isArray(Z))return $;return{...$,project:{name:String(Z)}}}function YF($){let Z=$.project?.type??"library",z=v6[Z]||v6.library;for(let Q of X0){if(z.includes(Q.category))continue;let[X,J]=Q.path.split(".");if(X==="stack"&&$.stack)$.stack[J]="slotignored";if(X==="monorepo"&&$.monorepo)$.monorepo[J]="slotignored"}}function q6($,Z){return SW($,Z,"")}function WF($){let Z=W6.get($);return Z!==void 0&&Z.category!=="human"}function u5($){if(typeof $==="number"||typeof $==="boolean")return!0;return typeof $==="string"&&$.trim()!==""&&!U0($)&&!l6($)}function UF($,Z){return WF($)&&u5(Z)}function SW($,Z,z){let Q={...$};for(let[X,J]of Object.entries(Z)){let Y=Q[X],W=z?`${z}.${X}`:X;if(W==="_meta"&&Y!==void 0)continue;if(A$(Y)){if(UF(W,J))Q[X]=J;continue}if(U0(Y))Q[X]=J;else if($0(J)&&$0(Y))Q[X]=SW(Y,J,W)}return Q}import{existsSync as EW,lstatSync as GF}from"fs";import{join as VF,basename as qF}from"path";import{createHash as HF}from"crypto";var T2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($),H6=($)=>typeof $==="number"&&Number.isFinite($),v2=($)=>typeof $==="string",KF=/^v?\d+\.\d+\.\d+$/,BF=new Set(["birth","doubled","peak","current"]);function xW($){return T2($)&&v2($.version)&&KF.test($.version)&&H6($.score)}var MF=($)=>T2($)&&H6($.birthDNA)&&v2($.born),LF=($)=>Array.isArray($)&&$.length>0&&$.every(xW),NF=($)=>T2($)&&H6($.score)&&v2($.version),OF=($)=>T2($)&&Array.isArray($.milestones)&&$.milestones.every(T2);function jW($){return T2($)&&MF($.birthCertificate)&&LF($.versions)&&NF($.current)&&OF($.growth)}function s3($){try{return GF($),!0}catch{return!1}}var o3=($)=>`${JSON.stringify($,null,2)}
244
+ `,DF=new Set(["version","score","lastSync"]),IF=new Set(["type","score","date","version","label","emoji"]),wW=($,Z)=>Object.keys($).every((z)=>Z.has(z)),a3={birth:{label:"Birth",emoji:"\uD83D\uDC23"},doubled:{label:"Doubled",emoji:"2️⃣"},peak:{label:"Peak",emoji:"\uD83C\uDFD4️"},current:{label:"Current",emoji:"\uD83D\uDCCD"}},yW=($)=>$.growth.milestones.filter((Z)=>Z.type==="peak"||Z.type==="current"),kW=($)=>wW($.current,DF)&&yW($).every((Z)=>wW(Z,IF)),TF=($)=>yW($).every((Z)=>Z.label===a3[Z.type].label&&Z.emoji===a3[Z.type].emoji);function AF($){return kW($)&&TF($)}var CF=".faf-dna is not in faf's shape: faf reads it and leaves it as it is.",_F=".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.",RF=".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.",FF=".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.",PF=".faf-dna has no birth certificate faf can read: faf leaves it as it is.";function SF($){if(!Array.isArray($))return[];return $.filter((Z)=>T2(Z)&&v2(Z.type)&&BF.has(Z.type)&&H6(Z.score))}var i6=($,Z="")=>v2($)?$:Z;function EF($,Z){if(!Array.isArray($))return[];return $.filter(xW).map((z)=>({version:z.version,timestamp:i6(z.timestamp),score:z.score,changes:Array.isArray(z.changes)?z.changes.filter(v2):[],growth:H6(z.growth)?z.growth:z.score-Z}))}function jF($,Z,z,Q){return{version:i6($.version,Z?.version??"v1.0.0"),score:H6($.score)?$.score:Z?.score??z,lastSync:i6($.lastSync,Q)}}function wF($){if(!T2($)||!T2($.birthCertificate)||!H6($.birthCertificate.birthDNA))return null;let Z=$.birthCertificate,z=Z.birthDNA,Q=i6(Z.born),X=EF($.versions,z),J=jF(T2($.current)?$.current:{},X[X.length-1],z,Q),Y=T2($.growth)?$.growth:{};return{birthCertificate:{born:Q,birthDNA:z,birthDNASource:Z.birthDNASource==="legacy"?"legacy":"init",projectDNA:i6(Z.projectDNA),certificate:i6(Z.certificate)},versions:X,current:J,growth:{totalGrowth:J.score-z,daysActive:H6(Y.daysActive)?Y.daysActive:0,milestones:SF(Array.isArray(Y.milestones)?Y.milestones:$.milestones)},lastModified:i6($.lastModified,Q),format:"faf-dna-v1"}}class g2{projectPath;dnaPath;dna=null;own=!1;text;reason=null;sawNoFile=!1;constructor($){this.projectPath=$,this.dnaPath=VF($,".faf-dna")}exists(){let $=EW(this.dnaPath);if(!$&&!s3(this.dnaPath))this.sawNoFile=!0;return $}birth($){if(!s3(this.dnaPath))this.sawNoFile=!0;let Z=new Date().toISOString();return this.own=!0,this.dna={birthCertificate:{born:Z,birthDNA:$,birthDNASource:"init",projectDNA:this.generateProjectDNA(),certificate:this.generateCertificate()},versions:[{version:"v1.0.0",timestamp:Z,score:$,changes:["Birth — initial context"],growth:0}],current:{version:"v1.0.0",score:$,lastSync:Z},growth:{totalGrowth:0,daysActive:0,milestones:[{type:"birth",score:$,date:Z,version:"v1.0.0",label:"Birth",emoji:"\uD83D\uDC23"}]},lastModified:Z,format:"faf-dna-v1"},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:v2($.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=v2($.timestamp)?$.timestamp.split("T")[0]:"",Q=Array.isArray($.changes)?$.changes.filter(v2).join(", "):"";return`${$.version} — ${$.score}% ${Z} (${z}) ${Q}`})}load(){if(this.dna)return this.dna;if(!EW(this.dnaPath)){if(!s3(this.dnaPath))this.sawNoFile=!0;return null}let $=this.read();if($===null)return null;let{text:Z,raw:z}=$;if(jW(z)&&o3(z)===Z&&AF(z))this.own=!0,this.reason=null,this.dna=z;else this.own=!1,this.dna=wF(z),this.reason=!this.dna?PF:!jW(z)?CF:o3(z)!==Z?_F:kW(z)?FF:RF;return this.text=Z,this.dna}read(){let $;try{$=z0(l(this.projectPath,".faf-dna"))}catch(Z){return this.reason=Z instanceof Error?Z.message:String(Z),null}try{return{text:$,raw:JSON.parse($)}}catch{return this.reason=".faf-dna is not JSON: faf leaves it as it is.",null}}save(){if(!this.dna)return;this.dna.lastModified=new Date().toISOString();let $=o3(this.dna),Z=this.text??(this.sawNoFile?null:w0(l(this.projectPath,".faf-dna")));a(this.dnaPath,$,{root:this.projectPath,expect:Z}),this.text=$,this.sawNoFile=!1}generateProjectDNA(){return HF("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=qF(this.projectPath).replace(/[^A-Z0-9]/gi,"").toUpperCase().substring(0,8).padEnd(4,"X");return`FAF-${$}-${z}-${Z}`}incrementVersion($){let[Z,z,Q]=$.replace("v","").split(".").map(Number);return`v${Z}.${z}.${Q+1}`}daysSince($){return Math.floor((Date.now()-new Date($).getTime())/86400000)}updateMilestones($,Z,z){if(!this.dna)return;let Q=this.dna.growth.milestones,X=(U)=>Q.some((G)=>G.type===U),J=(U)=>Q.push({type:U,score:$,date:z,version:Z,...a3[U]});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!X("doubled"))J("doubled");let Y=Q.find((U)=>U.type==="peak");if(!Y||$>Y.score){if(Y)Q.splice(Q.indexOf(Y),1);J("peak")}let W=Q.findIndex((U)=>U.type==="current");if(W>=0)Q.splice(W,1);J("current")}}d();d();import{statSync as bW}from"fs";import{homedir as xF}from"os";import{parse as yF,resolve as vW}from"path";function gW($,Z){try{let z=bW($,{bigint:!0}),Q=bW(Z,{bigint:!0});return z.isDirectory()&&z.ino!==0n&&z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function kF($){let Z=vW($),z=vW(xF()),Q=yF(Z).root;if(Z===z)return"home";if(Z===Q||Z==="/"||/^[A-Za-z]:[\\/]?$/.test(Z))return"root";if(gW(Z,z))return"home";if(gW(Z,Q))return"root";return null}function w$($=process.cwd(),Z="faf"){let z=kF($);if(z===null)return;let Q=z==="home"?"your home directory (~)":"the filesystem root";console.error(`${I("faf")}: ${Q} is not a project.`),console.error(""),console.error(` ${C("cd")} into a real repo (or any folder you mean to own), then run again:`),console.error(M(" cd /path/to/your-project")),console.error(M(` ${Z}`)),console.error(""),console.error(M(" Home will never be a git repo for this. project.faf belongs with the code.")),process.exit(1)}import{statSync as bF}from"fs";import{dirname as vF,resolve as hW}from"path";function gF($,Z){if($.reason==="not-utf8"||$.reason==="changed"||$.reason==="not-yaml"||$.reason==="unplaceable")return"";if($.reason==="not-owned")return Z&&!$.message.includes("--force")?" Use --force to replace it.":"";return $.onWrite?" Nothing was written to it.":" Nothing was read from or written to it."}function x$($){return $ instanceof b||$ instanceof k2}function K6($,Z){return $ instanceof b?`faf: ${$.message}${gF($,Z)}`:`faf: ${$.message}`}function X2($){if($===void 0)return;let Z=vF(hW($)),z;try{z=bF(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 k2(hW($),`${Z} ${z} — nothing written`)}function t3($={}){w$(process.cwd(),"faf init");let Z=process.cwd(),z=$.output?$.output.endsWith(".faf")?$.output:fW(Z,$.output):fW(Z,"project.faf");if(hF(z)&&!$.force)console.error(`project.faf already exists. Use ${C("--force")} to overwrite.`),process.exit(1);X2($.output);let Q=j$(Z);B0(z,Q,{replace:$.force===!0});let X=p(z),J=n(z,()=>L0(X)),Y=new g2(Z);if(!Y.exists()||$.force)Y.birth(J.score);if(console.log(`${I("created")} ${z}`),F0(J,z),console.log(M(` \uD83E\uDDEC Birth DNA ${J.score}% — your journey starts here (faf dna)`)),J.score<100)console.log(M(`
245
+ run ${C("'faf go'")} to fill empty slots`))}d();function m5($){let Z=$.readOnlyReason();if(Z)console.error(`faf: ${Z}`)}function uW(){let $=new g2(process.cwd());if(!$.load()){let Y=$.readOnlyReason();console.error(Y?`${C("×")} ${Y}`:`${C("×")} No FAF DNA found. Run ${C("'faf init'")} to start your journey.`),process.exit(1)}let Z=$.getJourney(),z=$.getBirthDNADisplay(),Q=z.born.split("T")[0]||"unknown";console.log(),console.log(_0(C("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${I(C(Z))}`),console.log(),console.log(M(` Birth DNA ${z.birthDNA}% (born ${Q}) · current ${z.current}% · growth ${z.growth>=0?"+":""}${z.growth}%`));let X=$.readOnlyReason();if(X)console.log(M(` ${X} ${C("'faf init --force'")} starts a fresh lineage.`));let J=$.getLog();if(J.length>1){console.log(),console.log(M(" history:"));for(let Y of J)console.log(M(` ${Y}`))}console.log()}import{existsSync as fF}from"fs";import{join as uF}from"path";d();function c5(){w$(process.cwd(),"faf auto");let $=process.cwd(),Z=uF($,"project.faf");if(fF(Z)){let J=r(Z);n(Z,()=>R0(p(Z)));let Y=[],W=B0(Z,PW($,J),{onAliasKept:(U)=>Y.push(m0(U))});console.log(`${W?I("updated"):M("unchanged")} ${Z}`);for(let U of Y)console.log(M(` ${U}`))}else B0(Z,j$($)),console.log(`${I("created")} ${Z}`);let z=p(Z),Q=n(Z,()=>x0(R0(z))),X=new g2($);if(X.exists())X.recordGrowth(Q.score,["faf auto"]),m5(X);if(F0(Q,Z,!1,F5(z,Q,{outOfType:!1})),Q.score<100)console.log(M(`
246
+ run ${C("'faf go'")} to reach ✪ Trophy`))}import{existsSync as rF}from"fs";import{join as sF}from"path";var y$="(terse — 3-4 words)",mF=[{path:"project.name",question:"What is the name of this project?",header:"Name",type:"text",required:!0},{path:"project.goal",question:"What does this project do? (one sentence)",header:"Goal",type:"text",required:!0},{path:"human_context.who",question:`Who is this for? ${y$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${y$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${y$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${y$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${y$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${y$}`,header:"How",type:"text",required:!0}],cF=[{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}],p5=[...mF,...cF],pF=new Map(p5.map(($)=>[$.path,$])),$h=Object.fromEntries(p5.map(($)=>[$.path,$]));function l5($){let Z=pF.get($);if(Z)return Z.question;let z=W6.get($)??X0.find((Q)=>Q.canonical===$);return z?`${z.description}?`.replace(/\?\?$/,"?"):`${$}?`}function $9($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||U0(Z)}return!1}function lF($,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 dF($){if($==="project.goal")return!0;return W6.get($)?.category==="human"}function iF($,Z=$9){let z=[],Q=[];for(let X of p5){let J=lF($,X.path);if(J==="slotignored")continue;if(!Z(J))continue;(dF(X.path)?z:Q).push(X.path)}return{human:z,sourceable:Q}}function nF($,Z,z=$9){let Q=iF(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"?e3(Q):[];return{status:X,score:$,gaps:Q,ask:J}}function e3($){return $.human.map((Z)=>({path:Z,question:l5(Z)}))}function mW($,Z={}){let z=Math.max(1,Z.maxRounds??5),Q=Z.isEmpty??$9,X=[],J=0;for(let W=0;W<=z;W++){let U=$.read();if(!U)return{status:"no-faf",score:0,rounds:J,history:X,ask:[]};let G=$.score(U.yaml);X.push(G);let V=nF(G,U.data,Q);if(V.status==="done")return{status:"done",score:G,rounds:J,history:X,ask:[]};if(V.status==="needs-human")return{status:"needs-human",score:G,rounds:J,history:X,ask:V.ask};if(X.length>=2&&G<=X[X.length-2])return V.gaps.human.length?{status:"needs-human",score:G,rounds:J,history:X,ask:e3(V.gaps)}:{status:"stuck",score:G,rounds:J,history:X,ask:[]};if(J>=z)return{status:"capped",score:G,rounds:J,history:X,ask:e3(V.gaps)};$.runAuto(),J++}return{status:"capped",score:X[X.length-1]??0,rounds:J,history:X,ask:[]}}d();function cW($={}){let Z=process.cwd(),z=sF(Z,"project.faf"),Q=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;oF(mW({read:()=>rF(z)?{data:r(z),yaml:p(z)}:{data:{},yaml:""},score:(J)=>J?n(z,()=>x0(R0(J))).score:0,runAuto:()=>c5()},{maxRounds:Q}))}function oF($){if($.history.length>1)console.log(M(`
247
247
  climb: ${$.history.join("% → ")}%`));switch(console.log(""),$.status){case"done":console.log(`${I("done")} — ✪ 100% AI-readiness. The .faf is complete.`);break;case"needs-human":{let Z=$.ask.length;console.log(`${C("Sourced everything detection can.")} ${Z} question${Z===1?"":"s"} only you can answer:`);for(let z of $.ask)console.log(` ${M("•")} ${z.question}`);console.log(M(`
248
- Answer with ${C("'faf go'")}, or fill them in project.faf directly.`));break}case"stuck":console.log(`${C(`Stopped at ${$.score}%.`)} The remaining gaps need evidence detection couldn't find, and there's nothing only you can answer. Add the missing manifests/README, then re-run.`);break;case"capped":console.log(`${C(`Stopped at ${$.score}% after ${$.rounds} rounds (the cap).`)} Re-run ${C("'faf loop'")} to continue, or raise ${M("--rounds")}.`);break;case"no-faf":console.log(`No project.faf, and none could be created here. Run ${C("'faf init'")} first.`);break}}import{existsSync as wP}from"fs";import{join as UU,dirname as xP}from"path";import{existsSync as KP,statSync as qh}from"fs";import{join as sW}from"path";import{dirname as lW,resolve as dW}from"path";var uW=100;var pF="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",lF=[/^<(script|pre|style|textarea)(?=\s|>|$)/i,/^<!--/,/^<\?/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp(`^</?(?:${pF})(?=\\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")],dF=[/<\/(?:script|pre|style|textarea)>/i,/-->/,/\?>/,/>/,/\]\]>/],iF=["","-->","?>",">","]]>"],nF=/[#`~*+_=<>0-9-]/,rF=/(\d{1,9})([.)])/y,sF=/#{1,6}(?:[ \t]+|$)/y,oF=/`{3,}(?!.*`)|~{3,}/y,aF=/(?:`{3,}|~{3,})(?=[ \t]*$)/y,tF=/(?:=+|-+)[ \t]*$/y,eF=/[^ \t\f\v\r\n]/;function Q4($,Z,z){return $.lastIndex=z,$.exec(Z)}var $P=($)=>$==="quote"||$==="list"||$==="item";function ZP($){let Z=new Uint8Array($.length),z="*-_",Q=[0,0,0],X=[!0,!0,!0];for(let J=$.length-1;J>=0;J--){let Y=$[J],W=Y===" "||Y==="\t";for(let G=0;G<3;G++)if(Y==="*-_"[G])Q[G]++;else if(!W)X[G]=!1;let U="*-_".indexOf(Y);Z[J]=U>=0&&X[U]&&Q[U]>=3?1:0}return Z}var y$=($)=>$===" "||$==="\t";function zP($,Z){if($==="document"||$==="quote"||$==="item")return Z!=="item";return $==="list"&&Z==="item"}var fW=($)=>$==="paragraph"||$==="code"||$==="html";function QP($){if($.kind==="list"||$.kind==="item")return{...$,list:{...$.list}};if($.kind==="code")return{...$,fence:$.fence&&{...$.fence}};return{...$}}class h2{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 h2(this.containers);return $.stack=this.stack.map(QP),$.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}>`:iF[$.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"&&fW(Z.kind);while(!z&&!this.deep){this.findNextNonspace();let Q=this.nextNonspace;if(!this.indented&&!nF.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(!fW($.kind)&&this.offset<this.ln.length&&!this.blank)this.addChild({kind:"paragraph"})}addHtmlLine($){if($.type>5)return;let Z=dF[$.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),y$(this.ln[this.offset]))this.advanceOffset(1,!0);return 0}continueItem($){let Z=$.list.markerOffset+$.list.padding;if(this.blank){if(!$.hasChild)return 1;this.advanceNextNonspace()}else if(this.indent>=Z)this.advanceOffset(Z,!0);else return 1;return 0}continueFence($,Z){let z=this.indent<=3&&this.ch===$.char?Q4(aF,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&&y$(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??=ZP(this.ln),this.breaks[this.nextNonspace]===1}startQuote(){if(!this.containers||this.indented||this.ch!==">")return 0;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),y$(this.ln[this.offset]))this.advanceOffset(1,!0);return this.closeUnmatched(),this.addChild({kind:"quote"}),1}startHeading(){if(this.indented||this.ch!=="#"||!Q4(sF,this.ln,this.nextNonspace))return 0;return this.closeUnmatched(),this.addChild({kind:"heading"}),this.offset=this.ln.length,2}startFence(){let $=this.ch,Z=this.indented||$!=="`"&&$!=="~"?null:Q4(oF,this.ln,this.nextNonspace);if(!Z)return 0;return this.closeUnmatched(),this.addChild({kind:"code",fence:{char:Z[0][0],len:Z[0].length,offset:this.indent}}),this.advanceNextNonspace(),this.advanceOffset(Z[0].length,!1),2}startHtml($){if(this.indented||this.ch!=="<")return 0;let Z=!this.allClosed&&!this.blank&&this.tip.kind==="paragraph",z=$.kind!=="paragraph"&&!Z,Q=this.ln.slice(this.nextNonspace);for(let X=1;X<=(z?7:6);X++){let J=lF[X-1].exec(Q);if(J)return this.closeUnmatched(),this.addChild({kind:"html",type:X,tag:X===1?J[1].toLowerCase():""}),this.htmlStarted=!0,2}return 0}startSetext($){let Z=this.ch;if(this.indented||$.kind!=="paragraph"||Z!=="="&&Z!=="-"||!Q4(tF,this.ln,this.nextNonspace))return 0;return this.closeUnmatched(),this.stack[this.stack.length-1]={kind:"heading"},this.offset=this.ln.length,2}startBreak(){if(this.indented||!this.breakAhead())return 0;return this.closeUnmatched(),this.addChild({kind:"break"}),this.offset=this.ln.length,2}startItem($){if(!this.containers||this.indented&&$.kind!=="list")return 0;let Z=this.listMarker($);if(!Z)return 0;this.closeUnmatched();let z=this.tip;if(z.kind!=="list"||z.list.bullet!==Z.bullet||z.list.delimiter!==Z.delimiter)this.addChild({kind:"list",list:Z});return this.addChild({kind:"item",list:Z,hasChild:!1}),1}startIndentedCode(){if(!this.indented||this.tip.kind==="paragraph"||this.blank)return 0;return this.advanceOffset(4,!0),this.closeUnmatched(),this.addChild({kind:"code",fence:null}),2}listMarker($){if(this.indent>=4)return null;let Z=this.markerAt($);if(!Z)return null;let z=this.indent;return this.advanceNextNonspace(),this.advanceOffset(Z.width,!0),{...Z.kind,markerOffset:z,padding:this.paddingAfter(Z.width)}}markerAt($){let Z=$.kind==="paragraph",z=this.markerKind(Z);if(!z)return null;let Q=this.ln[this.nextNonspace+z.width];if(!(Q===void 0||y$(Q)))return null;if(Z&&!eF.test(this.ln.slice(this.nextNonspace+z.width)))return null;return z}markerKind($){let Z=this.ch;if(Z==="*"||Z==="+"||Z==="-")return{width:1,kind:{bullet:Z,delimiter:null}};let z=Z>="0"&&Z<="9"?Q4(rF,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&&y$(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,y$(this.ln[this.offset]))this.advanceOffset(1,!0);return $+1}addChild($){while(!zP(this.tip.kind,$.kind))this.stack.pop();if(this.tip.hasChild=!0,this.stack.push($),$P($.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 f2="<!-- faf:start -->",u2="<!-- faf:end -->",mW="\uFEFF";function i6($){return $.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter((Z,z,Q)=>Z!==""||z<Q.length-1)??[]}var J2=($)=>$.replace(/\r?\n$|\r$/,""),iW=($)=>J2($).replace(/^\uFEFF/,"").trimEnd();function*nW($){let Z=0;for(let z of i6($)){let Q=J2(z),X=Z===0&&Q.charCodeAt(0)===65279?1:0;yield{offset:Z,from:Z+X,to:Z+Q.length,content:Q.slice(X)},Z+=z.length}}function XP($,Z,z,Q){let X=$.some((Y)=>Y.start!==-1)&&Q(Z.content),J=z(Z.content);for(let Y of $)if(Y.start!==-1&&X)Y.found={start:Y.start,end:Z.to};else if(J)Y.start=Z.from}function t3($,Z,z){let[Q,X]=[new h2(!0),new h2(!1)].map((J)=>({reader:J,start:-1,found:null}));for(let J of nW($)){let Y=[Q,X].map((U)=>U.reader.line(J.content));if(Q.reader.tooDeep)return null;let W=[Q,X].filter((U,G)=>Y[G]===null);if(W.length>0)XP(W,J,Z,z);if(Q.found||X.found)return Q.found&&X.found&&Q.found.start===X.found.start?Q.found:null}return null}var cW=($)=>(Z)=>Z===$;function J4($,Z=f2,z=u2){return t3($,cW(Z),cW(z))}function pW($,Z){let z=[];for(let Q of[!0,!1]){let X=new h2(Q);for(let J of i6($))X.line(J2(J));if(X.clone().line(Z)!==null)z.push(X.closer())}return z}var JP=16;function YP($){let Z=new h2(!0);return $.map((z)=>{let Q=Z.overflowAt(J2(z),JP),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(J2(X)),X})}function WP($,Z,z){let X=YP(i6($).map((Y)=>{let W=iW(Y);return W===Z||W===z?` ${Y}`:Y})).join(""),J=pW(X,z);while(J.length>0&&J[0]!==null){let Y=`${X}
249
- ${J[0]}`,W=pW(Y,z);if(W.length>=J.length)break;X=Y,J=W}return X}function UP($,Z,z){let Q=$.slice(Z.length+1,$.length-z.length-1),X=i6(Q).map((J)=>J2(J)===""?`>${J}`:`> ${J}`).join("");return`${Z}
248
+ Answer with ${C("'faf go'")}, or fill them in project.faf directly.`));break}case"stuck":console.log(`${C(`Stopped at ${$.score}%.`)} The remaining gaps need evidence detection couldn't find, and there's nothing only you can answer. Add the missing manifests/README, then re-run.`);break;case"capped":console.log(`${C(`Stopped at ${$.score}% after ${$.rounds} rounds (the cap).`)} Re-run ${C("'faf loop'")} to continue, or raise ${M("--rounds")}.`);break;case"no-faf":console.log(`No project.faf, and none could be created here. Run ${C("'faf init'")} first.`);break}}import{existsSync as fP}from"fs";import{join as HU,dirname as uP}from"path";import{existsSync as TP,statSync as Th}from"fs";import{join as eW}from"path";import{dirname as rW,resolve as sW}from"path";var lW=100;var aF="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",tF=[/^<(script|pre|style|textarea)(?=\s|>|$)/i,/^<!--/,/^<\?/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp(`^</?(?:${aF})(?=\\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")],eF=[/<\/(?:script|pre|style|textarea)>/i,/-->/,/\?>/,/>/,/\]\]>/],$P=["","-->","?>",">","]]>"],ZP=/[#`~*+_=<>0-9-]/,zP=/(\d{1,9})([.)])/y,QP=/#{1,6}(?:[ \t]+|$)/y,XP=/`{3,}(?!.*`)|~{3,}/y,JP=/(?:`{3,}|~{3,})(?=[ \t]*$)/y,YP=/(?:=+|-+)[ \t]*$/y,WP=/[^ \t\f\v\r\n]/;function Y4($,Z,z){return $.lastIndex=z,$.exec(Z)}var UP=($)=>$==="quote"||$==="list"||$==="item";function GP($){let Z=new Uint8Array($.length),z="*-_",Q=[0,0,0],X=[!0,!0,!0];for(let J=$.length-1;J>=0;J--){let Y=$[J],W=Y===" "||Y==="\t";for(let G=0;G<3;G++)if(Y==="*-_"[G])Q[G]++;else if(!W)X[G]=!1;let U="*-_".indexOf(Y);Z[J]=U>=0&&X[U]&&Q[U]>=3?1:0}return Z}var k$=($)=>$===" "||$==="\t";function VP($,Z){if($==="document"||$==="quote"||$==="item")return Z!=="item";return $==="list"&&Z==="item"}var pW=($)=>$==="paragraph"||$==="code"||$==="html";function qP($){if($.kind==="list"||$.kind==="item")return{...$,list:{...$.list}};if($.kind==="code")return{...$,fence:$.fence&&{...$.fence}};return{...$}}class h2{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 h2(this.containers);return $.stack=this.stack.map(qP),$.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}>`:$P[$.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"&&pW(Z.kind);while(!z&&!this.deep){this.findNextNonspace();let Q=this.nextNonspace;if(!this.indented&&!ZP.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(!pW($.kind)&&this.offset<this.ln.length&&!this.blank)this.addChild({kind:"paragraph"})}addHtmlLine($){if($.type>5)return;let Z=eF[$.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),k$(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?Y4(JP,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&&k$(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??=GP(this.ln),this.breaks[this.nextNonspace]===1}startQuote(){if(!this.containers||this.indented||this.ch!==">")return 0;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),k$(this.ln[this.offset]))this.advanceOffset(1,!0);return this.closeUnmatched(),this.addChild({kind:"quote"}),1}startHeading(){if(this.indented||this.ch!=="#"||!Y4(QP,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:Y4(XP,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=tF[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!=="-"||!Y4(YP,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||k$(Q)))return null;if(Z&&!WP.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"?Y4(zP,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&&k$(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,k$(this.ln[this.offset]))this.advanceOffset(1,!0);return $+1}addChild($){while(!VP(this.tip.kind,$.kind))this.stack.pop();if(this.tip.hasChild=!0,this.stack.push($),UP($.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 f2="<!-- faf:start -->",u2="<!-- faf:end -->",dW="\uFEFF";function n6($){return $.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter((Z,z,Q)=>Z!==""||z<Q.length-1)??[]}var J2=($)=>$.replace(/\r?\n$|\r$/,""),oW=($)=>J2($).replace(/^\uFEFF/,"").trimEnd();function*aW($){let Z=0;for(let z of n6($)){let Q=J2(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 HP($,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 Z9($,Z,z){let[Q,X]=[new h2(!0),new h2(!1)].map((J)=>({reader:J,start:-1,found:null}));for(let J of aW($)){let Y=[Q,X].map((U)=>U.reader.line(J.content));if(Q.reader.tooDeep)return null;let W=[Q,X].filter((U,G)=>Y[G]===null);if(W.length>0)HP(W,J,Z,z);if(Q.found||X.found)return Q.found&&X.found&&Q.found.start===X.found.start?Q.found:null}return null}var iW=($)=>(Z)=>Z===$;function U4($,Z=f2,z=u2){return Z9($,iW(Z),iW(z))}function nW($,Z){let z=[];for(let Q of[!0,!1]){let X=new h2(Q);for(let J of n6($))X.line(J2(J));if(X.clone().line(Z)!==null)z.push(X.closer())}return z}var KP=16;function BP($){let Z=new h2(!0);return $.map((z)=>{let Q=Z.overflowAt(J2(z),KP),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(J2(X)),X})}function MP($,Z,z){let X=BP(n6($).map((Y)=>{let W=oW(Y);return W===Z||W===z?` ${Y}`:Y})).join(""),J=nW(X,z);while(J.length>0&&J[0]!==null){let Y=`${X}
249
+ ${J[0]}`,W=nW(Y,z);if(W.length>=J.length)break;X=Y,J=W}return X}function LP($,Z,z){let Q=$.slice(Z.length+1,$.length-z.length-1),X=n6(Q).map((J)=>J2(J)===""?`>${J}`:`> ${J}`).join("");return`${Z}
250
250
  ${X}
251
- ${z}`}function X4($,Z,z,Q=f2,X=u2,J="the file"){let Y=(U)=>{let G=`${$}${U}${z}`,V=J4(G,Q,X);return V&&V.start===$.length&&V.end===$.length+U.length?G:null},W=Y(Z)??Y(UP(Z,Q,X));if(W===null)throw new b("unplaceable",J,`${J}: faf could not place its block where the next run finds it again — faf left it unchanged`,{onWrite:!0});return W}function e3($,Z=f2,z=u2){return`${Z}
252
- ${WP($.trim(),Z,z)}
253
- ${z}`}function c5($,Z,z=f2,Q=u2,X){if($===null)return X4("",Z,`
254
- `,z,Q,X);let J=J4($,z,Q);if(J)return X4($.slice(0,J.start),Z,$.slice(J.end),z,Q,X);let Y=$.startsWith(mW)?mW:"";return X4(Y,Z,`
251
+ ${z}`}function W4($,Z,z,Q=f2,X=u2,J="the file"){let Y=(U)=>{let G=`${$}${U}${z}`,V=U4(G,Q,X);return V&&V.start===$.length&&V.end===$.length+U.length?G:null},W=Y(Z)??Y(LP(Z,Q,X));if(W===null)throw new b("unplaceable",J,`${J}: faf could not place its block where the next run finds it again — faf left it unchanged`,{onWrite:!0});return W}function z9($,Z=f2,z=u2){return`${Z}
252
+ ${MP($.trim(),Z,z)}
253
+ ${z}`}function d5($,Z,z=f2,Q=u2,X){if($===null)return W4("",Z,`
254
+ `,z,Q,X);let J=U4($,z,Q);if(J)return W4($.slice(0,J.start),Z,$.slice(J.end),z,Q,X);let Y=$.startsWith(dW)?dW:"";return W4(Y,Z,`
255
255
 
256
- ${$.slice(Y.length)}`,z,Q,X)}function B6($){try{return J0($)}catch(Z){if(Z.code==="ENOENT")return null;throw Z}}function Y2($,Z,z=f2,Q=u2,X={}){let J=e3(Z,z,Q),Y=dW($),W=X.root??lW(Y),U=l(W,Y),G=B6(U);a(U,c5(G,J,z,Q,Y),{root:W,expect:G})}var GP="<!-- faf:";function VP($){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 HP($,Z){let z=[new h2(!0),new h2(!1)],Q=!1;for(let{content:X}of nW($)){if(Q){if(X===Z)return"too deep";continue}let[J,Y]=z.map((U)=>U.line(X));Q=z[0].tooDeep;let W=J??Y;if(X===Z&&(Q||W!==null))return Q?"too deep":W}return null}function $9($,Z,z=f2,Q=u2){if(Z===null||J4(Z,z,Q))return null;let X=iW(i6(Z)[0]??"");if(X.startsWith(GP)&&X!==z&&X!==Q)return`${$}: faf's block is now on top; the old faf text below it is left as you had it — delete it by hand if you no longer want it.`;let J=HP(Z,z);if(J===null)return null;if(J==="too deep")return`${$}: faf's block is now on top; the file nests more than ${uW} 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.`;return`${$}: faf's block is now on top; an older faf block below sits inside ${VP(J)} and is left as you had it — delete it by hand if you no longer want it.`}function p5($,Z,z=f2,Q=u2,X={}){try{let J=dW($);return $9(Z,B6(l(X.root??lW(J),J)),z,Q)}catch{return null}}var qP=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 Z9($){return $.split("_").map((Z)=>{if(!Z)return Z;let z=Z.toUpperCase();return qP.has(z)?z:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function G0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function v0($){let Z=W6.get($);if(Z?.label)return Z.label;let z=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return Z9(z)}var z9=E0.claude,BP="STATUS: SYNC ACTIVE";function oW($){let Z=sW($,z9);if(!KP(Z))return null;return J0(l($,z9))}function aW($,Z){Y2(sW($,z9),Z)}function m2($,Z={}){let z=String($.project?.name??"").trim(),Q=String($.project?.main_language??"").trim(),X=String($.project?.type??"").trim(),J=String($.project?.goal??"").trim(),Y=`<!-- faf: ${[z,Q,X,J].join(" | ")} -->`,W=[];if(Z.doc)W.push(`doc=${Z.doc}`);else W.push(`claim=${Z.claim??"project.faf"}`);if(typeof Z.score==="number")W.push(`score=${Z.score}`);if(W.push(`family=${Z.family??"FAF"}`),Z.siblings&&Z.siblings.length>0)W.push(`siblings=${Z.siblings.join(",")}`);let U=`<!-- faf: ${W.join(" | ")} -->`;return`${Y}
257
- ${U}`}function tW($){let Z=[],z=$.project?.name??"Project",Q=$.project?.main_language??"",X=$.project?.goal??"";if(Z.push(m2($)),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(`**${v0(`stack.${G}`)}:** ${V}`);if(Y.length>0){Z.push("## Stack"),Z.push("");for(let G of Y)Z.push(`- ${G}`);Z.push("")}let W=$.human_context??{},U=[["who",W.who],["what",W.what],["why",W.why],["where",W.where],["when",W.when],["how",W.how]].filter(([,G])=>G&&String(G).trim()).map(([G,V])=>`- **${v0(`human_context.${G}`)}:** ${V}`);if(U.length>0)Z.push("## Context"),Z.push(""),Z.push(...U),Z.push("");return Z.push("---"),Z.push(""),Z.push(`*${BP} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
258
- `)}function rW($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function l5($){let Z={project:{}},z=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(z)Z.project.name=rW(z[1].trim());if(!Z.project.name){let J=$.match(/\*\*Name:\*\*\s*(.+)/);if(J)Z.project.name=rW(J[1].trim())}let Q=$.match(/## What This Is\s*\n\s*\n(.+)/);if(Q)Z.project.goal=Q[1].trim();if(!Z.project.goal){let J=$.match(/\*\*What Building:\*\*\s*(.+)/);if(J)Z.project.goal=J[1].trim()}let X=$.match(/\*\*Language:\*\*\s*(.+)/);if(X)Z.project.main_language=X[1].trim();if(!Z.project.main_language){let J=$.match(/\*\*Main Language:\*\*\s*(.+)/);if(J)Z.project.main_language=J[1].trim()}return Z}import{existsSync as Dh,lstatSync as JU,readFileSync as i5,realpathSync as Q9,statSync as MP}from"fs";import{homedir as LP}from"os";import{basename as NP,dirname as X9,join as c2,resolve as n6}from"path";var eW=200,$U=200,ZU=12,OP="# Project Context (from project.faf)",DP="*This section is managed by tri-sync.";function IP($){let Z=0;for(let z=0;z<$.length;z++)Z=(Z<<5)-Z+$.charCodeAt(z)|0;return Z}function TP($){let Z=$.replace(/[^a-zA-Z0-9]/g,"-");if(Z.length<=eW)return Z;return`${Z.slice(0,eW)}-${Math.abs(IP($)).toString(36)}`}function YU($){try{let Z=JU($);if(Z.isSymbolicLink()){let z=MP($);return z.isDirectory()||z.isFile()}return Z.isDirectory()||Z.isFile()}catch{return!1}}function zU($){try{return JU($).isFile()}catch{return!1}}function AP($){let Z=$;for(;;){if(YU(c2(Z,".git")))return Z;let z=X9(Z);if(z===Z)return null;Z=z}}function CP($){let Z;try{Z=i5(c2($,".git"),"utf-8").trim()}catch{return $}try{if(!Z.startsWith("gitdir:"))return $;let z=n6($,Z.slice(7).trim()),Q=c2(z,"commondir");if(!zU(Q))return $;let X=n6(z,i5(Q,"utf-8").trim());if(n6(X9(z))!==c2(X,"worktrees"))return $;let J=c2(z,"gitdir");if(!zU(J))return $;let Y=i5(J,"utf-8").trim();if(Q9(n6(z,Y))!==c2(Q9($),".git"))return $;if(NP(X)!==".git")return YU(c2(X,".git"))?$:X;return X9(X)}catch{return $}}function _P($){let Z=n6($);try{Z=Q9.native(Z)}catch{}let z=AP(Z);return(z?CP(z):Z).normalize("NFC")}function RP($,Z={}){if(Z.memoryDir)return n6(Z.memoryDir);let z=Z.configDir||process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR||process.env.CLAUDE_CONFIG_DIR||c2(LP(),".claude");return c2(n6(z),"projects",TP(_P($)),"memory").normalize("NFC")}var FP=new Set(["target_user","core_problem","mission_purpose"]),PP=["who","what","why","where","when","how"];function SP($){let Z=$.project??{},z=[["Goal",Z.goal],["Language",Z.main_language],["Type",Z.type]],Q=$.human_context??{},X=Array.isArray($.key_files)?$.key_files:[];return["## Project context — from project.faf","",`- **Name:** ${G0(Z.name)?Z.name:"Project"}`,...z.filter(([,Y])=>G0(Y)).map(([Y,W])=>`- **${Y}:** ${W}`),...d5("Stack",Object.entries($.stack??{}).filter(([Y,W])=>!FP.has(Y)&&G0(W)).map(([Y,W])=>`- **${v0(`stack.${Y}`)}:** ${W}`)),...d5("Context",PP.filter((Y)=>G0(Q[Y])).map((Y)=>`- **${v0(`human_context.${Y}`)}:** ${Q[Y]}`)),...d5("Commands",Object.entries($.commands??{}).filter(([,Y])=>G0(Y)).slice(0,ZU).map(([Y,W])=>`- ${Y}: \`${W}\``)),...d5("Key files",X.filter(G0).slice(0,ZU).map((Y)=>`- ${Y}`)),"","*faf keeps this block in step with project.faf. Everything outside it is Claude's own and is kept as written.*"].join(`
259
- `)}function d5($,Z){return Z.length>0?["",`### ${$}`,...Z]:[]}function EP($){return t3($,(Z)=>Z.trimEnd()===OP,(Z)=>Z.startsWith(DP))}function QU($){if($==="")return 0;let Z=$.match(/\r\n|\r|\n/g)?.length??0;return/(\r\n|\r|\n)$/.test($)?Z:Z+1}function jP($,Z,z){if($===null)return{text:c5(null,Z,void 0,void 0,z),action:"created",head:"",tail:""};let Q=J4($),X=Q??EP($);if(X){let Y=$.slice(0,X.start),W=$.slice(X.end);return{text:X4(Y,Z,W,void 0,void 0,z),action:Q?"updated":"migrated",head:Y,tail:W}}let J=$.startsWith("\uFEFF")?"\uFEFF":"";return{text:c5($,Z,void 0,void 0,z),action:"added",head:J,tail:$.slice(J.length)}}function XU($){return $>$U?[`MEMORY.md is ${$} lines. Claude Code loads the first ${$U}; lines after that are kept in the file but not loaded.`]:[]}function WU($,Z,z={}){let Q=RP($,z);w0(Q);let X=l(Q,E0.memory),J=B6(X),Y=jP(J,e3(SP(Z)),X);if(Y.text===J){let q=QU(J);return{path:X,action:"unchanged",written:!1,preserved:!0,lines:q,warnings:XU(q)}}let W=a(X,Y.text,{root:Q,expect:J}),U=i5(W,"utf-8"),G=U===Y.text&&U.startsWith(Y.head)&&U.endsWith(Y.tail),V=QU(U),H=Y.action==="added"?$9(E0.memory,J):null;return{path:W,action:Y.action,written:!0,preserved:G,lines:V,warnings:[...H?[H]:[],...XU(V)]}}d();function Y4(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function J9($={}){let Z=process.cwd(),z=u(Z);if(!z)console.error(`Error: project.faf not found
256
+ ${$.slice(Y.length)}`,z,Q,X)}function B6($){try{return z0($)}catch(Z){if(Z.code==="ENOENT")return null;throw Z}}function Y2($,Z,z=f2,Q=u2,X={}){let J=z9(Z,z,Q),Y=sW($),W=X.root??rW(Y),U=l(W,Y),G=B6(U);a(U,d5(G,J,z,Q,Y),{root:W,expect:G})}var NP="<!-- faf:";function OP($){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 DP($,Z){let z=[new h2(!0),new h2(!1)],Q=!1;for(let{content:X}of aW($)){if(Q){if(X===Z)return"too deep";continue}let[J,Y]=z.map((U)=>U.line(X));Q=z[0].tooDeep;let W=J??Y;if(X===Z&&(Q||W!==null))return Q?"too deep":W}return null}function Q9($,Z,z=f2,Q=u2){if(Z===null||U4(Z,z,Q))return null;let X=oW(n6(Z)[0]??"");if(X.startsWith(NP)&&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=DP(Z,z);if(J===null)return null;if(J==="too deep")return`${$}: faf's block is now on top; the file nests more than ${lW} 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.`;return`${$}: faf's block is now on top; an older faf block below sits inside ${OP(J)} and is left as you had it — delete it by hand if you no longer want it.`}function i5($,Z,z=f2,Q=u2,X={}){try{let J=sW($);return Q9(Z,B6(l(X.root??rW(J),J)),z,Q)}catch{return null}}var IP=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 X9($){return $.split("_").map((Z)=>{if(!Z)return Z;let z=Z.toUpperCase();return IP.has(z)?z:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function G0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function v0($){let Z=W6.get($);if(Z?.label)return Z.label;let z=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return X9(z)}var J9=j0.claude,AP="STATUS: SYNC ACTIVE";function $U($){let Z=eW($,J9);if(!TP(Z))return null;return z0(l($,J9))}function ZU($,Z){Y2(eW($,J9),Z)}function m2($,Z={}){let z=String($.project?.name??"").trim(),Q=String($.project?.main_language??"").trim(),X=String($.project?.type??"").trim(),J=String($.project?.goal??"").trim(),Y=`<!-- faf: ${[z,Q,X,J].join(" | ")} -->`,W=[];if(Z.doc)W.push(`doc=${Z.doc}`);else W.push(`claim=${Z.claim??"project.faf"}`);if(typeof Z.score==="number")W.push(`score=${Z.score}`);if(W.push(`family=${Z.family??"FAF"}`),Z.siblings&&Z.siblings.length>0)W.push(`siblings=${Z.siblings.join(",")}`);let U=`<!-- faf: ${W.join(" | ")} -->`;return`${Y}
257
+ ${U}`}function zU($){let Z=[],z=$.project?.name??"Project",Q=$.project?.main_language??"",X=$.project?.goal??"";if(Z.push(m2($)),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(`**${v0(`stack.${G}`)}:** ${V}`);if(Y.length>0){Z.push("## Stack"),Z.push("");for(let G of Y)Z.push(`- ${G}`);Z.push("")}let W=$.human_context??{},U=[["who",W.who],["what",W.what],["why",W.why],["where",W.where],["when",W.when],["how",W.how]].filter(([,G])=>G&&String(G).trim()).map(([G,V])=>`- **${v0(`human_context.${G}`)}:** ${V}`);if(U.length>0)Z.push("## Context"),Z.push(""),Z.push(...U),Z.push("");return Z.push("---"),Z.push(""),Z.push(`*${AP} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
258
+ `)}function tW($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function n5($){let Z={project:{}},z=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(z)Z.project.name=tW(z[1].trim());if(!Z.project.name){let J=$.match(/\*\*Name:\*\*\s*(.+)/);if(J)Z.project.name=tW(J[1].trim())}let Q=$.match(/## What This Is\s*\n\s*\n(.+)/);if(Q)Z.project.goal=Q[1].trim();if(!Z.project.goal){let J=$.match(/\*\*What Building:\*\*\s*(.+)/);if(J)Z.project.goal=J[1].trim()}let X=$.match(/\*\*Language:\*\*\s*(.+)/);if(X)Z.project.main_language=X[1].trim();if(!Z.project.main_language){let J=$.match(/\*\*Main Language:\*\*\s*(.+)/);if(J)Z.project.main_language=J[1].trim()}return Z}import{existsSync as Sh,lstatSync as GU,readFileSync as s5,realpathSync as Y9,statSync as CP}from"fs";import{homedir as _P}from"os";import{basename as RP,dirname as W9,join as c2,resolve as r6}from"path";var QU=200,XU=200,JU=12,FP="# Project Context (from project.faf)",PP="*This section is managed by tri-sync.";function SP($){let Z=0;for(let z=0;z<$.length;z++)Z=(Z<<5)-Z+$.charCodeAt(z)|0;return Z}function EP($){let Z=$.replace(/[^a-zA-Z0-9]/g,"-");if(Z.length<=QU)return Z;return`${Z.slice(0,QU)}-${Math.abs(SP($)).toString(36)}`}function VU($){try{let Z=GU($);if(Z.isSymbolicLink()){let z=CP($);return z.isDirectory()||z.isFile()}return Z.isDirectory()||Z.isFile()}catch{return!1}}function YU($){try{return GU($).isFile()}catch{return!1}}function jP($){let Z=$;for(;;){if(VU(c2(Z,".git")))return Z;let z=W9(Z);if(z===Z)return null;Z=z}}function wP($){let Z;try{Z=s5(c2($,".git"),"utf-8").trim()}catch{return $}try{if(!Z.startsWith("gitdir:"))return $;let z=r6($,Z.slice(7).trim()),Q=c2(z,"commondir");if(!YU(Q))return $;let X=r6(z,s5(Q,"utf-8").trim());if(r6(W9(z))!==c2(X,"worktrees"))return $;let J=c2(z,"gitdir");if(!YU(J))return $;let Y=s5(J,"utf-8").trim();if(Y9(r6(z,Y))!==c2(Y9($),".git"))return $;if(RP(X)!==".git")return VU(c2(X,".git"))?$:X;return W9(X)}catch{return $}}function xP($){let Z=r6($);try{Z=Y9.native(Z)}catch{}let z=jP(Z);return(z?wP(z):Z).normalize("NFC")}function yP($,Z={}){if(Z.memoryDir)return r6(Z.memoryDir);let z=Z.configDir||process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR||process.env.CLAUDE_CONFIG_DIR||c2(_P(),".claude");return c2(r6(z),"projects",EP(xP($)),"memory").normalize("NFC")}var kP=new Set(["target_user","core_problem","mission_purpose"]),bP=["who","what","why","where","when","how"];function vP($){let Z=$.project??{},z=[["Goal",Z.goal],["Language",Z.main_language],["Type",Z.type]],Q=$.human_context??{},X=Array.isArray($.key_files)?$.key_files:[];return["## Project context — from project.faf","",`- **Name:** ${G0(Z.name)?Z.name:"Project"}`,...z.filter(([,Y])=>G0(Y)).map(([Y,W])=>`- **${Y}:** ${W}`),...r5("Stack",Object.entries($.stack??{}).filter(([Y,W])=>!kP.has(Y)&&G0(W)).map(([Y,W])=>`- **${v0(`stack.${Y}`)}:** ${W}`)),...r5("Context",bP.filter((Y)=>G0(Q[Y])).map((Y)=>`- **${v0(`human_context.${Y}`)}:** ${Q[Y]}`)),...r5("Commands",Object.entries($.commands??{}).filter(([,Y])=>G0(Y)).slice(0,JU).map(([Y,W])=>`- ${Y}: \`${W}\``)),...r5("Key files",X.filter(G0).slice(0,JU).map((Y)=>`- ${Y}`)),"","*faf keeps this block in step with project.faf. Everything outside it is Claude's own and is kept as written.*"].join(`
259
+ `)}function r5($,Z){return Z.length>0?["",`### ${$}`,...Z]:[]}function gP($){return Z9($,(Z)=>Z.trimEnd()===FP,(Z)=>Z.startsWith(PP))}function WU($){if($==="")return 0;let Z=$.match(/\r\n|\r|\n/g)?.length??0;return/(\r\n|\r|\n)$/.test($)?Z:Z+1}function hP($,Z,z){if($===null)return{text:d5(null,Z,void 0,void 0,z),action:"created",head:"",tail:""};let Q=U4($),X=Q??gP($);if(X){let Y=$.slice(0,X.start),W=$.slice(X.end);return{text:W4(Y,Z,W,void 0,void 0,z),action:Q?"updated":"migrated",head:Y,tail:W}}let J=$.startsWith("\uFEFF")?"\uFEFF":"";return{text:d5($,Z,void 0,void 0,z),action:"added",head:J,tail:$.slice(J.length)}}function UU($){return $>XU?[`MEMORY.md is ${$} lines. Claude Code loads the first ${XU}; lines after that are kept in the file but not loaded.`]:[]}function qU($,Z,z={}){let Q=yP($,z);S0(Q);let X=l(Q,j0.memory),J=B6(X),Y=hP(J,z9(vP(Z)),X);if(Y.text===J){let H=WU(J);return{path:X,action:"unchanged",written:!1,preserved:!0,lines:H,warnings:UU(H)}}let W=a(X,Y.text,{root:Q,expect:J}),U=s5(W,"utf-8"),G=U===Y.text&&U.startsWith(Y.head)&&U.endsWith(Y.tail),V=WU(U),q=Y.action==="added"?Q9(j0.memory,J):null;return{path:W,action:Y.action,written:!0,preserved:G,lines:V,warnings:[...q?[q]:[],...UU(V)]}}d();function G4(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function U9($={}){let Z=process.cwd(),z=u(Z);if(!z)console.error(`Error: project.faf not found
260
260
 
261
- Run 'faf init' to create one.`),process.exit(2);let Q=UU(Z,"CLAUDE.md"),X=$.direction??"auto";if(X==="auto")GU(z,Q,Z);else if(X==="push")VU(z,Z);else if(X==="pull")yP(z,Q);if(Y4())HU(z,Z);if($.watch)console.log(M("watching for changes... (Ctrl+C to stop)")),bP(z,Q,Z)}function GU($,Z,z){VU($,z)}function VU($,Z){let z=r($),Q=tW(z),X=p5(UU(Z,"CLAUDE.md"),"CLAUDE.md");if(aW(Z,Q),console.log(`${I("◆")} sync .faf → CLAUDE.md`),X)console.log(M(` ${X}`));let J=n($,()=>x0(R0(p($))));F0(J,$)}function yP($,Z){let z=r($),Q=n($,()=>x0(R0(p($))));if(Q.tier.name!=="TROPHY")console.error(`${C("×")} sync --pull blocked: requires ✪ Trophy (currently ${Q.score}%)`),console.error(M(" MD → .faf backfill only runs at 100%. Reach Trophy with 'faf go', then retry.")),process.exit(1);let X=oW(xP(Z));if(!X){console.error("CLAUDE.md not found.");return}let J=l5(X);if(J.project?.name)z.project={...z.project,name:J.project.name};if(J.project?.goal)z.project={...z.project,goal:J.project.goal};if(J.project?.main_language)z.project={...z.project,main_language:J.project.main_language};B0($,z,{onAliasKept:(W)=>console.log(M(` ${m0(W)}`))}),console.log(`${I("◆")} sync CLAUDE.md → .faf ${M("(Trophy-gated)")}`);let Y=n($,()=>x0(R0(p($))));F0(Y,$)}var kP={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 HU($,Z){try{let z=WU(Z,r($));console.log(`${I("◆")} sync .faf → MEMORY.md ${M(`${kP[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 bP($,Z,z){let{watch:Q}=d0("fs"),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{if(console.log(M("change detected...")),GU($,Z,z),Y4())HU($,z)},200)};if(Q($,J),wP(Z))Q(Z,J)}import{statSync as qU}from"fs";import{dirname as KU,resolve as W4}from"path";d();function Y9($){return $.length>=4&&$[0]===70&&$[1]===65&&$[2]===70&&$[3]===66}var W9="FAFB header (a .fafb faf compiled)";function U9($){return/\.faf$/i.test($)?$.replace(/\.faf$/i,".fafb"):`${$}.fafb`}function G9($,Z){if(W4($)===W4(Z))return!0;try{let z=qU($),Q=qU(Z);return z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function BU($,Z={}){let z=$??u();if(!z)console.error(`Error: project.faf not found
261
+ Run 'faf init' to create one.`),process.exit(2);let Q=HU(Z,"CLAUDE.md"),X=$.direction??"auto";if(X==="auto")KU(z,Q,Z);else if(X==="push")BU(z,Z);else if(X==="pull")mP(z,Q);if(G4())MU(z,Z);if($.watch)console.log(M("watching for changes... (Ctrl+C to stop)")),pP(z,Q,Z)}function KU($,Z,z){BU($,z)}function BU($,Z){let z=r($),Q=zU(z),X=i5(HU(Z,"CLAUDE.md"),"CLAUDE.md");if(ZU(Z,Q),console.log(`${I("◆")} sync .faf → CLAUDE.md`),X)console.log(M(` ${X}`));let J=n($,()=>x0(R0(p($))));F0(J,$)}function mP($,Z){let z=r($),Q=n($,()=>x0(R0(p($))));if(Q.tier.name!=="TROPHY")console.error(`${C("×")} sync --pull blocked: requires ✪ Trophy (currently ${Q.score}%)`),console.error(M(" MD → .faf backfill only runs at 100%. Reach Trophy with 'faf go', then retry.")),process.exit(1);let X=$U(uP(Z));if(!X){console.error("CLAUDE.md not found.");return}let J=n5(X);if(J.project?.name)z.project={...z.project,name:J.project.name};if(J.project?.goal)z.project={...z.project,goal:J.project.goal};if(J.project?.main_language)z.project={...z.project,main_language:J.project.main_language};B0($,z,{onAliasKept:(W)=>console.log(M(` ${m0(W)}`))}),console.log(`${I("◆")} sync CLAUDE.md → .faf ${M("(Trophy-gated)")}`);let Y=n($,()=>x0(R0(p($))));F0(Y,$)}var cP={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 MU($,Z){try{let z=qU(Z,r($));console.log(`${I("◆")} sync .faf → MEMORY.md ${M(`${cP[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 pP($,Z,z){let{watch:Q}=d0("fs"),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{if(console.log(M("change detected...")),KU($,Z,z),G4())MU($,z)},200)};if(Q($,J),fP(Z))Q(Z,J)}import{statSync as LU}from"fs";import{dirname as NU,resolve as V4}from"path";d();function G9($){return $.length>=4&&$[0]===70&&$[1]===65&&$[2]===70&&$[3]===66}var V9="FAFB header (a .fafb faf compiled)";function q9($){return/\.faf$/i.test($)?$.replace(/\.faf$/i,".fafb"):`${$}.fafb`}function H9($,Z){if(V4($)===V4(Z))return!0;try{let z=LU($),Q=LU(Z);return z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function OU($,Z={}){let z=$??u();if(!z)console.error(`Error: project.faf not found
262
262
 
263
- Run 'faf init' to create one.`),process.exit(2);let Q=p(z);z2(Q,z);let X=n(z,()=>A5(Q)),J=Z.output??U9(z);if(G9(J,z))console.error(`faf: ${W4(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);X2(Z.output);let Y=Z.output?KU(W4(J)):KU(W4(z));F2(J,X,{root:Y,owns:Y9,mark:W9,force:Z.force}),console.log(`${I("compiled")} ${J} ${M(`(${X.length} bytes)`)}`)}import{readFileSync as $S}from"fs";import{dirname as ZS,resolve as _U}from"path";import{createHash as uP}from"crypto";import{resolve as mP}from"path";class g0 extends Error{constructor($){super($);this.name="JsonEditError"}}var vP=new Set([" ","\t",`
264
- `,"\r"]);class q9{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 g0(`not valid JSON (${$} at offset ${this.i})`)}ws(){while(this.i<this.s.length&&vP.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 V9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function H9($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>H9(z,Z[Q]));if(V9($)&&V9(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&H9($[Q],Z[Q]))}return!1}class K9{s;style;after;edits=[];constructor($,Z,z){this.s=$;this.style=Z;this.after=z}startsLine($){let Z=this.s.lastIndexOf(`
263
+ Run 'faf init' to create one.`),process.exit(2);let Q=p(z);z2(Q,z);let X=n(z,()=>R5(Q)),J=Z.output??q9(z);if(H9(J,z))console.error(`faf: ${V4(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);X2(Z.output);let Y=Z.output?NU(V4(J)):NU(V4(z));F2(J,X,{root:Y,owns:G9,mark:V9,force:Z.force}),console.log(`${I("compiled")} ${J} ${M(`(${X.length} bytes)`)}`)}import{readFileSync as US}from"fs";import{dirname as GS,resolve as SU}from"path";import{createHash as rP}from"crypto";import{resolve as sP}from"path";class g0 extends Error{constructor($){super($);this.name="JsonEditError"}}var lP=new Set([" ","\t",`
264
+ `,"\r"]);class M9{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 g0(`not valid JSON (${$} at offset ${this.i})`)}ws(){while(this.i<this.s.length&&lP.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 K9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function B9($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>B9(z,Z[Q]));if(K9($)&&K9(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&B9($[Q],Z[Q]))}return!1}class L9{s;style;after;edits=[];constructor($,Z,z){this.s=$;this.style=Z;this.after=z}startsLine($){let Z=this.s.lastIndexOf(`
265
265
  `,$-1);return Z>=0&&/^[ \t]*$/.test(this.s.slice(Z+1,$))}indentOf($){return this.startsLine($)?this.s.slice(this.s.lastIndexOf(`
266
266
  `,$-1)+1,$):""}render($,Z,z){if(!z)return JSON.stringify($);return JSON.stringify($,null,this.style.unit).split(`
267
- `).join(this.style.eol+Z)}apply($,Z,z,Q){let X={};for(let[J,Y]of Object.entries(Z)){if(Y===void 0)continue;let W=z?`${z}.${J}`:J,U=$.members.filter((q)=>q.key===J);if(U.length>1)throw new g0(`the key "${W}" is there more than once`);let G=U[0];if(!G){if($.members.length===0)X[J]=Y;else this.insert($,J,Y,z);continue}let V=this.startsLine(G.keyStart);if(V9(Y)){if(G.value.kind!=="object")throw new g0(`"${W}" is not an object, so faf cannot add its keys to it`);this.apply(G.value,Y,W,V||this.s.slice(G.value.start,G.value.end).includes(`
268
- `));continue}let H=JSON.parse(this.s.slice(G.value.start,G.value.end));if(H9(H,Y))continue;if(G.value.kind==="object"||G.value.kind==="array")throw new g0(`"${W}" is ${G.value.kind==="object"?"an object":"an array"}, so faf will not replace it with a value`);this.edits.push({start:G.value.start,end:G.value.end,text:this.render(Y,this.indentOf(G.keyStart),V)})}if(Object.keys(X).length>0)this.fillEmpty($,X,Q)}fillEmpty($,Z,z){let Q=this.indentOf(this.lineLead($.start)),X=z?this.render(Z,Q,!0):JSON.stringify(Z);this.edits.push({start:$.start,end:$.end,text:X})}insert($,Z,z,Q){let X=$.members,J=X[X.length-1],W=(this.after[Q]?.[Z]??[]).map((H)=>X.find((q)=>q.key===H)).find((H)=>H!==void 0);if(this.startsLine(X[0].keyStart)){let H=W&&W!==J?X[X.indexOf(W)+1]:J,q=this.indentOf(H.keyStart),K=this.s.slice(H.keyEnd,H.value.start),L=this.s.lastIndexOf(`
269
- `,H.keyStart-1),B=L>0&&this.s[L-1]==="\r"?L-1:L,N=`${this.style.eol}${q}${JSON.stringify(Z)}${K}${this.render(z,q,!0)},`;this.edits.push({start:B,end:B,text:N});return}let U=W??J,G=this.s.slice(U.keyEnd,U.value.start),V=X.length>1?this.s.slice(X[0].value.end,X[1].keyStart):", ";this.edits.push({start:U.value.end,end:U.value.end,text:`${V}${JSON.stringify(Z)}${G}${this.render(z,"",!1)}`})}append($,Z,z,Q){if(Z.length===0)return;if($.items.length===0){this.edits.push({start:$.start,end:$.end,text:this.render(Z,this.indentOf(z),Q)});return}let X=$.items[$.items.length-1];if(this.startsLine($.items[0].start)){let Y=this.indentOf($.items[0].start),W=Z.map((U)=>`,${this.style.eol}${Y}${this.render(U,Y,!0)}`).join("");this.edits.push({start:X.end,end:X.end,text:W});return}let J=$.items.length>1?this.s.slice($.items[0].end,$.items[1].start):", ";this.edits.push({start:X.end,end:X.end,text:Z.map((Y)=>`${J}${this.render(Y,"",!1)}`).join("")})}lineLead($){let Z=this.s.lastIndexOf(`
270
- `,$-1)+1;while(Z<$&&(this.s[Z]===" "||this.s[Z]==="\t"))Z++;return Z}}function MU($,Z){let z=$.includes(`\r
267
+ `).join(this.style.eol+Z)}apply($,Z,z,Q){let X={};for(let[J,Y]of Object.entries(Z)){if(Y===void 0)continue;let W=z?`${z}.${J}`:J,U=$.members.filter((H)=>H.key===J);if(U.length>1)throw new g0(`the key "${W}" is there more than once`);let G=U[0];if(!G){if($.members.length===0)X[J]=Y;else this.insert($,J,Y,z);continue}let V=this.startsLine(G.keyStart);if(K9(Y)){if(G.value.kind!=="object")throw new g0(`"${W}" is not an object, so faf cannot add its keys to it`);this.apply(G.value,Y,W,V||this.s.slice(G.value.start,G.value.end).includes(`
268
+ `));continue}let q=JSON.parse(this.s.slice(G.value.start,G.value.end));if(B9(q,Y))continue;if(G.value.kind==="object"||G.value.kind==="array")throw new g0(`"${W}" is ${G.value.kind==="object"?"an object":"an array"}, so faf will not replace it with a value`);this.edits.push({start:G.value.start,end:G.value.end,text:this.render(Y,this.indentOf(G.keyStart),V)})}if(Object.keys(X).length>0)this.fillEmpty($,X,Q)}fillEmpty($,Z,z){let Q=this.indentOf(this.lineLead($.start)),X=z?this.render(Z,Q,!0):JSON.stringify(Z);this.edits.push({start:$.start,end:$.end,text:X})}insert($,Z,z,Q){let X=$.members,J=X[X.length-1],W=(this.after[Q]?.[Z]??[]).map((q)=>X.find((H)=>H.key===q)).find((q)=>q!==void 0);if(this.startsLine(X[0].keyStart)){let q=W&&W!==J?X[X.indexOf(W)+1]:J,H=this.indentOf(q.keyStart),K=this.s.slice(q.keyEnd,q.value.start),L=this.s.lastIndexOf(`
269
+ `,q.keyStart-1),B=L>0&&this.s[L-1]==="\r"?L-1:L,N=`${this.style.eol}${H}${JSON.stringify(Z)}${K}${this.render(z,H,!0)},`;this.edits.push({start:B,end:B,text:N});return}let U=W??J,G=this.s.slice(U.keyEnd,U.value.start),V=X.length>1?this.s.slice(X[0].value.end,X[1].keyStart):", ";this.edits.push({start:U.value.end,end:U.value.end,text:`${V}${JSON.stringify(Z)}${G}${this.render(z,"",!1)}`})}append($,Z,z,Q){if(Z.length===0)return;if($.items.length===0){this.edits.push({start:$.start,end:$.end,text:this.render(Z,this.indentOf(z),Q)});return}let X=$.items[$.items.length-1];if(this.startsLine($.items[0].start)){let Y=this.indentOf($.items[0].start),W=Z.map((U)=>`,${this.style.eol}${Y}${this.render(U,Y,!0)}`).join("");this.edits.push({start:X.end,end:X.end,text:W});return}let J=$.items.length>1?this.s.slice($.items[0].end,$.items[1].start):", ";this.edits.push({start:X.end,end:X.end,text:Z.map((Y)=>`${J}${this.render(Y,"",!1)}`).join("")})}lineLead($){let Z=this.s.lastIndexOf(`
270
+ `,$-1)+1;while(Z<$&&(this.s[Z]===" "||this.s[Z]==="\t"))Z++;return Z}}function DU($,Z){let z=$.includes(`\r
271
271
  `)?`\r
272
272
  `:`
273
273
  `,Q=Z.members[0],X=Q?$.lastIndexOf(`
274
- `,Q.keyStart-1):-1,J=Q&&X>=0?$.slice(X+1,Q.keyStart):"";return{eol:z,unit:/^[ \t]+$/.test(J)?J:" "}}function r5($,Z,z={}){let Q=new q9($).parse();if(Q.kind!=="object")throw new g0("the JSON is not an object");let X=new K9($,MU($,Q),z);return X.apply(Q,Z,"",$.slice(Q.start,Q.end).includes(`
275
- `)),n5($,X.edits)}function n5($,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 LU($){let Z=new q9($).parse();if(Z.kind!=="object")throw new g0("the JSON is not an object");return Z}function gP($,Z,z,Q){let X=Z.members.filter((Y)=>Y.key===z);if(X.length>1)throw new g0(`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 NU($,Z,z,Q){let X=LU($),J=new K9($,MU($,X),{}),Y=$.slice(X.start,X.end).includes(`
276
- `),W=X.members.filter((H)=>H.key===Z);if(W.length>1)throw new g0(`the key "${Z}" is there more than once`);if(W.length===0)return J.apply(X,{[Z]:z},"",Y),n5($,J.edits);let U=W[0],G=U.value;if(G.kind!=="array")throw new g0(`"${Z}" is not an array, so faf cannot add its rows to it`);let V=[];for(let H of z){let q=H[Q.id],K=G.items.filter((N,T)=>N.kind==="object"&&gP($,N,Q.id,`${Z}[${T}]`)===q);if(K.length>1)throw new g0(`the ${Z} row ${JSON.stringify(q)} is there more than once`);if(K.length===0){V.push(H);continue}let L=K[0],B=Object.fromEntries(Q.update.map((N)=>[N,H[N]]));J.apply(L,B,`${Z}[${G.items.indexOf(L)}]`,$.slice(L.start,L.end).includes(`
277
- `))}return J.append(G,V,U.keyStart,Y),n5($,J.edits)}function hP($,Z){let z=$.lastIndexOf(`
278
- `,Z-1);return z>=0&&/^[ \t]*$/.test($.slice(z+1,Z))}function fP($,Z,z){if(Z.members.length===1)return{start:Z.start,end:Z.end,text:"{}"};let Q=Z.members.indexOf(z);if(hP($,z.keyStart)&&$[z.value.end]===","){let X=$.lastIndexOf(`
279
- `,z.keyStart-1);return{start:X>0&&$[X-1]==="\r"?X-1:X,end:z.value.end+1,text:""}}if(Q>0)return{start:Z.members[Q-1].value.end,end:z.value.end,text:""};return{start:z.keyStart,end:Z.members[1].keyStart,text:""}}function OU($,Z){let z=[],Q=LU($);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 DU($,Z){let{count:z,chain:Q}=OU($,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 B9($,Z,z={}){let{count:Q,chain:X}=OU($,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 n5($,[fP($,J.obj,J.member)]).text}var TU="one.faf/render";function L9($){return`sha256:${uP("sha256").update($,"utf8").digest("hex")}`}var cP=/^sha256:[0-9a-f]{64}$/,pP=/^<meta name="faf-render" content="(sha256:[0-9a-f]{64})">$/,lP='<meta name="faf-render"',dP='<meta name="description" content="Visual render of project.faf.';function iP($){let Z=$.split(/(?<=\n)/),z=Z.findIndex((Q)=>Q.startsWith(dP));return Z.splice(z+1,0,`<meta name="faf-render" content="${L9($)}">
280
- `),Z.join("")}function AU($){let Z=$.split(/(?<=\n)/),z=[],Q=!1;if(Z.forEach((X,J)=>{let Y=X.replace(/\r?\n$/,""),W=pP.exec(Y);if(W)z.push({at:J,hash:W[1]});else if(Y.startsWith(lP))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 M9=["_meta",TU];function nP($){return r5($,{_meta:{[TU]:L9($)}}).text}function rP($){try{return B9($,M9,{dropEmptyParent:!0})??$}catch{return $}}function sP($){let Z;try{Z=DU($,M9)}catch{return null}if(Z.count===0)return null;if(Z.count>1||typeof Z.value!=="string"||!cP.test(Z.value))return"many";let z=B9($,M9,{dropEmptyParent:!0});return z===null?"many":{hash:Z.value,canonical:z}}function CU($,Z){return $==="html"?iP(Z):nP(Z)}function oP($,Z){if($==="json")return rP(Z);let z=AU(Z);return z===null||z==="many"?Z:z.canonical}function IU($,Z){let z=new TextDecoder().decode($),Q=Z==="html"?AU(z):sP(z);if(Q===null)return"none";if(Q==="many")return"mismatch";return Buffer.from(z,"utf-8").equals(Buffer.from($))&&Q.hash===L9(Q.canonical)&&CU(Z,Q.canonical)===z?"match":"mismatch"}function aP($){let Z=new TextDecoder().decode($);if(!Z.includes(`\r
274
+ `,Q.keyStart-1):-1,J=Q&&X>=0?$.slice(X+1,Q.keyStart):"";return{eol:z,unit:/^[ \t]+$/.test(J)?J:" "}}function b$($,Z,z={}){let Q=new M9($).parse();if(Q.kind!=="object")throw new g0("the JSON is not an object");let X=new L9($,DU($,Q),z);return X.apply(Q,Z,"",$.slice(Q.start,Q.end).includes(`
275
+ `)),o5($,X.edits)}function o5($,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 IU($){let Z=new M9($).parse();if(Z.kind!=="object")throw new g0("the JSON is not an object");return Z}function dP($,Z,z,Q){let X=Z.members.filter((Y)=>Y.key===z);if(X.length>1)throw new g0(`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 TU($,Z,z,Q){let X=IU($),J=new L9($,DU($,X),{}),Y=$.slice(X.start,X.end).includes(`
276
+ `),W=X.members.filter((q)=>q.key===Z);if(W.length>1)throw new g0(`the key "${Z}" is there more than once`);if(W.length===0)return J.apply(X,{[Z]:z},"",Y),o5($,J.edits);let U=W[0],G=U.value;if(G.kind!=="array")throw new g0(`"${Z}" is not an array, so faf cannot add its rows to it`);let V=[];for(let q of z){let H=q[Q.id],K=G.items.filter((N,T)=>N.kind==="object"&&dP($,N,Q.id,`${Z}[${T}]`)===H);if(K.length>1)throw new g0(`the ${Z} row ${JSON.stringify(H)} is there more than once`);if(K.length===0){V.push(q);continue}let L=K[0],B=Object.fromEntries(Q.update.map((N)=>[N,q[N]]));J.apply(L,B,`${Z}[${G.items.indexOf(L)}]`,$.slice(L.start,L.end).includes(`
277
+ `))}return J.append(G,V,U.keyStart,Y),o5($,J.edits)}function iP($,Z){let z=$.lastIndexOf(`
278
+ `,Z-1);return z>=0&&/^[ \t]*$/.test($.slice(z+1,Z))}function nP($,Z,z){if(Z.members.length===1)return{start:Z.start,end:Z.end,text:"{}"};let Q=Z.members.indexOf(z);if(iP($,z.keyStart)&&$[z.value.end]===","){let X=$.lastIndexOf(`
279
+ `,z.keyStart-1);return{start:X>0&&$[X-1]==="\r"?X-1:X,end:z.value.end+1,text:""}}if(Q>0)return{start:Z.members[Q-1].value.end,end:z.value.end,text:""};return{start:z.keyStart,end:Z.members[1].keyStart,text:""}}function AU($,Z){let z=[],Q=IU($);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 CU($,Z){let{count:z,chain:Q}=AU($,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 N9($,Z,z={}){let{count:Q,chain:X}=AU($,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 o5($,[nP($,J.obj,J.member)]).text}var RU="one.faf/render";function D9($){return`sha256:${rP("sha256").update($,"utf8").digest("hex")}`}var oP=/^sha256:[0-9a-f]{64}$/,aP=/^<meta name="faf-render" content="(sha256:[0-9a-f]{64})">$/,tP='<meta name="faf-render"',eP='<meta name="description" content="Visual render of project.faf.';function $S($){let Z=$.split(/(?<=\n)/),z=Z.findIndex((Q)=>Q.startsWith(eP));return Z.splice(z+1,0,`<meta name="faf-render" content="${D9($)}">
280
+ `),Z.join("")}function FU($){let Z=$.split(/(?<=\n)/),z=[],Q=!1;if(Z.forEach((X,J)=>{let Y=X.replace(/\r?\n$/,""),W=aP.exec(Y);if(W)z.push({at:J,hash:W[1]});else if(Y.startsWith(tP))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 O9=["_meta",RU];function ZS($){return b$($,{_meta:{[RU]:D9($)}}).text}function zS($){try{return N9($,O9,{dropEmptyParent:!0})??$}catch{return $}}function QS($){let Z;try{Z=CU($,O9)}catch{return null}if(Z.count===0)return null;if(Z.count>1||typeof Z.value!=="string"||!oP.test(Z.value))return"many";let z=N9($,O9,{dropEmptyParent:!0});return z===null?"many":{hash:Z.value,canonical:z}}function PU($,Z){return $==="html"?$S(Z):ZS(Z)}function XS($,Z){if($==="json")return zS(Z);let z=FU(Z);return z===null||z==="many"?Z:z.canonical}function _U($,Z){let z=new TextDecoder().decode($),Q=Z==="html"?FU(z):QS(z);if(Q===null)return"none";if(Q==="many")return"mismatch";return Buffer.from(z,"utf-8").equals(Buffer.from($))&&Q.hash===D9(Q.canonical)&&PU(Z,Q.canonical)===z?"match":"mismatch"}function JS($){let Z=new TextDecoder().decode($);if(!Z.includes(`\r
281
281
  `)||/(?:^|[^\r])\n/.test(Z)||!Buffer.from(Z,"utf-8").equals($))return null;return Buffer.from(Z.replace(/\r\n/g,`
282
- `),"utf-8")}function tP($,Z,z){let Q=IU($,z);return Q!=="match"&&Z!==null&&IU(Z,z)==="match"?"match":Q}function W2($,Z,z){let Q=mP($),X=l(z.root,Q),J=oP(z.format,Z),Y=CU(z.format,J),W=j0(X);if(W===null)return a(X,Y,{root:z.root,expect:null}),{path:X,result:"created"};if(W.equals(Buffer.from(Y,"utf-8")))return{path:X,result:"unchanged"};let U=aP(W),G=U===null?Y:Y.replace(/\r?\n/g,`\r
283
- `);if(U!==null&&W.equals(Buffer.from(G,"utf-8")))return{path:X,result:"unchanged"};if(z.force!==!0&&!eP(Q,W,U,J,z))return{path:X,result:"unchanged"};return a(X,G,{root:z.root,expect:W}),{path:X,result:"updated"}}function eP($,Z,z,Q,X){let J=tP(Z,z,X.format);if(J==="match")return!0;if(J==="mismatch")throw new b("not-owned",$,`${$} was edited since faf wrote it — faf left it unchanged. Use --force to replace it.`,{onWrite:!0});if(!X.hasMark(Z))throw new b("not-owned",$,`${$} has no ${X.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});let Y=Buffer.from(Q,"utf-8");if(Z.equals(Y)||z!==null&&z.equals(Y))return!1;throw new b("not-owned",$,`${$} has no faf render hash (written before 7.13), so faf cannot tell whether it was edited — faf left it unchanged. Use --force once to replace it; after that faf recognises its own output.`,{onWrite:!0})}d();function RU($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let z=new Uint8Array($S($));if(String.fromCharCode(z[0],z[1],z[2],z[3])!=="FAFB")console.error("Error: Not a valid .fafb file (missing FAFB magic bytes)."),process.exit(3);let Q=n($,()=>mY(z)),X=JSON.stringify(Q,null,2);if(!Z.output){console.log(X);return}if(G9(Z.output,$))console.error(`faf: ${_U(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);X2(Z.output);let{result:J}=W2(Z.output,`${X}
284
- `,{root:ZS(_U(Z.output)),format:"json",hasMark:()=>!1,mark:'faf render hash (`_meta["one.faf/render"]`)',force:Z.force});console.log(`${I("decompiled")} ${Z.output}${J==="unchanged"?` ${M("(unchanged)")}`:""}`)}function FU($){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(!lY(z)||typeof z.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!pY.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}}d();function N9($,Z={}){let z=$??u();if(!z)console.error(`Error: project.faf not found
282
+ `),"utf-8")}function YS($,Z,z){let Q=_U($,z);return Q!=="match"&&Z!==null&&_U(Z,z)==="match"?"match":Q}function W2($,Z,z){let Q=sP($),X=l(z.root,Q),J=XS(z.format,Z),Y=PU(z.format,J),W=w0(X);if(W===null)return a(X,Y,{root:z.root,expect:null}),{path:X,result:"created"};if(W.equals(Buffer.from(Y,"utf-8")))return{path:X,result:"unchanged"};let U=JS(W),G=U===null?Y:Y.replace(/\r?\n/g,`\r
283
+ `);if(U!==null&&W.equals(Buffer.from(G,"utf-8")))return{path:X,result:"unchanged"};if(z.force!==!0&&!WS(Q,W,U,J,z))return{path:X,result:"unchanged"};return a(X,G,{root:z.root,expect:W}),{path:X,result:"updated"}}function WS($,Z,z,Q,X){let J=YS(Z,z,X.format);if(J==="match")return!0;if(J==="mismatch")throw new b("not-owned",$,`${$} was edited since faf wrote it — faf left it unchanged. Use --force to replace it.`,{onWrite:!0});if(!X.hasMark(Z))throw new b("not-owned",$,`${$} has no ${X.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});let Y=Buffer.from(Q,"utf-8");if(Z.equals(Y)||z!==null&&z.equals(Y))return!1;throw new b("not-owned",$,`${$} has no faf render hash (written before 7.13), so faf cannot tell whether it was edited — faf left it unchanged. Use --force once to replace it; after that faf recognises its own output.`,{onWrite:!0})}d();function EU($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let z=new Uint8Array(US($));if(String.fromCharCode(z[0],z[1],z[2],z[3])!=="FAFB")console.error("Error: Not a valid .fafb file (missing FAFB magic bytes)."),process.exit(3);let Q=n($,()=>dY(z)),X=JSON.stringify(Q,null,2);if(!Z.output){console.log(X);return}if(H9(Z.output,$))console.error(`faf: ${SU(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);X2(Z.output);let{result:J}=W2(Z.output,`${X}
284
+ `,{root:GS(SU(Z.output)),format:"json",hasMark:()=>!1,mark:'faf render hash (`_meta["one.faf/render"]`)',force:Z.force});console.log(`${I("decompiled")} ${Z.output}${J==="unchanged"?` ${M("(unchanged)")}`:""}`)}function jU($){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(!rY(z)||typeof z.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!nY.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}}d();function I9($,Z={}){let z=$??u();if(!z)console.error(`Error: project.faf not found
285
285
 
286
- Run 'faf init' to create one.`),process.exit(2);let Q=z2(p(z),z),X=FU(Q);if(!X.valid){console.log(`${C("invalid")} ${z}`);for(let W of X.errors)console.log(` ${M("x")} ${W}`);process.exit(3)}let J=p(z);if(!uY(J))console.log(`${C("invalid yaml")} ${z}`),process.exit(3);console.log(`${I("valid")} ${z}`);let Y=n(z,()=>L0(J));if(F0(Y,z,Z.verbose),Z.strict&&Y.score<100)console.log(M(`
287
- --strict requires 100%`)),process.exit(1)}import{join as fS,resolve as uS}from"path";import{join as zS}from"path";var n0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),PU=($)=>Array.isArray($)?$.join(", "):String($),QS=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),XS=new Set(["target_user","core_problem","mission_purpose"]);function JS($){let Z=[],z=(F="")=>Z.push(F),Q=$.ai_instructions,X=$.preferences,J=$.instant_context,Y=$.security,W=$.commands,U=$.key_files??J?.key_files,G=n0($.project?.default_branch)?String($.project?.default_branch):"main",V=W?Object.entries(W).filter(([,F])=>n0(F)):[],H=V.filter(([F])=>/test/i.test(F)),q=V.filter(([F])=>/lint|check/i.test(F)&&!/test/i.test(F)),K=V.filter(([F])=>!/test|lint|check/i.test(F)),L=(F)=>{let i=F.toLowerCase();if(/install|deps/.test(i))return 0;if(/^build$|build/.test(i)&&!/rebuild/.test(i))return 1;if(/^dev$|develop/.test(i))return 2;if(/^start$|run/.test(i))return 3;return 4},B=[...K].sort((F,i)=>L(F[0])-L(i[0])||F[0].localeCompare(i[0])),N=[...H,...q],T=H[0]?.[1],R=B.find(([F])=>/build/i.test(F))?.[1];z(m2($)),z(),z(`# AGENTS.md — ${$.project?.name??"Project"}`),z();let w=[];if($.project?.main_language)w.push(String($.project.main_language));if(n0($.project?.type))w.push(`type: ${String($.project?.type)}`);if(n0($.project?.version))w.push(`v${String($.project?.version)}`);let j=$.project?.goal?String($.project.goal).trim():"";if(w.length)j+=(j?" — ":"")+w.join(" · ");if(j)z(j),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[F,i]of B)z(`${i} # ${F}`);z("```"),z()}if(N.length){z("## Run the tests"),z(),z("```bash");for(let[,F]of N)z(F);z("```"),z()}if(U&&U.length){z("## Where things live"),z();let F=U.map((i)=>{let t=String(i),V2=t.indexOf(" — ");return V2>0?{path:t.slice(0,V2),role:t.slice(V2+3)}:{path:t,role:""}});if(F.some((i)=>i.role)){z("| Path | Role |"),z("|------|------|");for(let i of F)z(`| \`${i.path}\` | ${i.role} |`)}else for(let i of F)z(`- \`${i.path}\``);z()}let y=new Map,x=(F)=>{if(!F)return;for(let[i,t]of Object.entries(F)){if(QS.has(i)||!n0(t))continue;let V2=Z9(i);if(!y.has(V2))y.set(V2,PU(t))}};x(Q?.working_style),x(X);let h=$.conventions??[];if(y.size||h.length){z("## Conventions"),z();for(let[F,i]of y)z(`- **${F}:** ${i}`);for(let F of h)if(n0(F))z(`- ${F}`);z()}let E=(Q?.warnings??[]).filter((F)=>n0(F)),c=["read the tree"];if(T)c.push(`run the tests (\`${T}\`)`);if(R)c.push("build the project");for(let[,F]of q.slice(0,1))c.push(`\`${F}\``);z("## Guardrails"),z();for(let F of E)z(`- ${F}`);z(`- **Always OK:** ${[...new Set(c)].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 D0=[];for(let[,F]of q)D0.push(`\`${F}\` exits 0`);for(let[,F]of H)D0.push(`\`${F}\` passes`);if(D0.push("changes committed with a conventional message"),z("## Definition of Done"),z(),z(`Done when: ${[...new Set(D0)].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&&(n0(Y.secrets)||(Y.never??[]).length)){if(z("## Security & secrets"),z(),n0(Y.secrets)){let F=n0(Y.example)?` (see \`${Y.example}\`)`:"";z(`- Secrets live in \`${Y.secrets}\`${F}. Never read or commit them.`)}for(let F of Y.never??[])if(n0(F))z(`- Never read or commit \`${F}\`.`);z()}if(z("## Commit & PR"),z(),X&&n0(X.commit_style))z(`- Commit style: ${PU(X.commit_style)}`);else z("- Conventional Commits preferred (`feat:`, `fix:`, `chore:`, …).");if(z(`- Branch off \`${G}\` and open a PR — never commit to \`${G}\` directly.`),z("- If build/test scripts or layout change, refresh this file in the **same PR** (`faf export --agents`)."),z(),$.stack){let F=[];for(let[i,t]of Object.entries($.stack)){if(XS.has(i))continue;if(G0(t))F.push(`- **${v0(`stack.${i}`)}:** ${t.trim()}`)}if(F.length){z("## Stack"),z();for(let i of F)z(i);z()}}let b0=$.generated;if(n0(b0))z(`*Context authored: ${String(b0)}*`);return Z.join(`
288
- `)}function SU($,Z){Y2(zS($,E0.agents),JS(Z))}function YS($,Z){let z=[],Q=(U)=>A($,U),X=(U)=>f($,U)??"";if(Q("tsconfig.json")&&/"strict"\s*:\s*true/.test(X("tsconfig.json")))z.push("TypeScript strict mode (tsconfig.json)");if(Z?.type==="module")z.push("ESM modules (`type: module`)");let J=[],Y=Z?.devDependencies??{};if(Q(".eslintrc")||Q(".eslintrc.json")||Q(".eslintrc.cjs")||Q("eslint.config.js")||Q("eslint.config.mjs")||"eslint"in Y)J.push("ESLint");if(Q(".prettierrc")||Q(".prettierrc.json")||Q("prettier.config.js")||"prettier"in Y)J.push("Prettier");let W=Q("pyproject.toml")?X("pyproject.toml"):"";if(/\[tool\.black\]/.test(W))J.push("black");if(/\[tool\.ruff\]/.test(W))J.push("ruff");if(/\[tool\.mypy\]/.test(W))J.push("mypy");if(Q("rustfmt.toml")||Q(".rustfmt.toml"))J.push("rustfmt");if(J.length)z.push(`Style enforced by ${J.join(" · ")} — obey the configs`);return z}function O9($,Z){let z={...Z},Q=null,X=f($,"package.json");if(X!==null)try{Q=JSON.parse(X)}catch{Q=null}let J=v5($,Q);if(Object.keys(J).length)z.commands={...J,...Z.commands??{}};let Y=Z.key_files??Z.instant_context?.key_files;if(!Y||Y.length===0){let W=b5($);if(W.length)z.key_files=W}if(!Z.security){let U=[".env",".env.local",".env.development"].find((G)=>A($,G));if(U){let G=[".env.example",".env.sample",".env.template"].find((V)=>A($,V));z.security={secrets:U,...G?{example:G}:{}}}}if(!Z.conventions){let W=YS($,Q);if(W.length)z.conventions=W}return z}import{join as WS}from"path";function US($){let Z=[];if(Z.push(m2($)),Z.push(""),Z.push("# .cursorrules"),Z.push(`# Authored from project.faf — ${$.project?.name??"Project"}`),Z.push(""),$.project?.main_language)Z.push(`language: ${$.project.main_language}`);if($.stack){Z.push(""),Z.push("# Stack");for(let[z,Q]of Object.entries($.stack))if(G0(Q))Z.push(`# ${v0(`stack.${z}`)}: ${Q.trim()}`)}return Z.push(""),Z.join(`
289
- `)}function EU($,Z){Y2(WS($,E0.cursorrules),US(Z),"# faf:start","# faf:end")}import{join as GS}from"path";var VS=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),HS=new Set(["target_user","core_problem","mission_purpose"]);function qS($){let Z=[],z=$.instant_context,Q=$.commands,X=$.key_files??z?.key_files,J=Q?Object.entries(Q).filter(([,q])=>VS(q)):[],Y=J.filter(([q])=>/test/i.test(q)),W=J.filter(([q])=>/lint|check/i.test(q)&&!/test/i.test(q)),U=J.filter(([q])=>!/test|lint|check/i.test(q)),G=(q)=>{let K=q.toLowerCase();if(/install|deps/.test(K))return 0;if(/^build$|build/.test(K)&&!/rebuild/.test(K))return 1;if(/^dev$|develop/.test(K))return 2;if(/^start$|run/.test(K))return 3;return 4},V=[...U].sort((q,K)=>G(q[0])-G(K[0])||q[0].localeCompare(K[0])),H=[...Y,...W];if(Z.push(m2($)),Z.push(""),Z.push(`# GEMINI.md — ${$.project?.name??"Project"}`),Z.push(""),Z.push("> Authored from project.faf — refresh with `faf export --gemini`."),Z.push(""),$.project?.name)Z.push(`Project: ${$.project.name}`);if($.project?.goal)Z.push(`Goal: ${$.project.goal}`);if($.project?.main_language)Z.push(`Language: ${$.project.main_language}`);if(V.length){Z.push(""),Z.push("## Setup & build"),Z.push(""),Z.push("```bash");for(let[q,K]of V)Z.push(`${K} # ${q}`);Z.push("```")}if(H.length){Z.push(""),Z.push("## Test & verify"),Z.push(""),Z.push("```bash");for(let[,q]of H)Z.push(q);Z.push("```")}if(X&&X.length){Z.push(""),Z.push("## Where things live"),Z.push("");for(let q of X)Z.push(`- \`${q}\``)}if($.stack){let q=[];for(let[K,L]of Object.entries($.stack)){if(HS.has(K))continue;if(G0(L))q.push(`- ${v0(`stack.${K}`)}: ${L.trim()}`)}if(q.length){Z.push(""),Z.push("## Stack");for(let K of q)Z.push(K)}}return Z.push(""),Z.push("## Before changing things"),Z.push(""),Z.push("- Ask first: dependency installs, deletions, migrations, schema changes, publish/release."),Z.push("- Never: force-push · push straight to `main` · commit secrets."),Z.push(""),Z.join(`
290
- `)}function jU($,Z){Y2(GS($,E0.gemini),qS(Z))}import{join as KS}from"path";var wU=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],BS=new Set([...wU.map(([$])=>$),"cicd"]);function MS($){let Z=[],z=$.project?.name??"Project";if(Z.push(m2($)),Z.push(""),Z.push(`# GitHub Copilot Instructions — ${z}`),Z.push(""),Z.push("> Authored from project.faf by FAF. Copilot reads these instructions on every request in this repository — keep them short and broadly applicable."),Z.push(""),G0($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let Q=$.stack??{},X=[];if(G0($.project?.main_language))X.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[G,V]of Object.entries(Q)){if(BS.has(G))continue;if(G0(V))X.push(`- **${v0(`stack.${G}`)}:** ${V.trim()}`)}if(X.length>0)Z.push("## Tech stack","",...X,"");let J=[];for(let[G,V]of wU){let H=Q[G];if(G0(H))J.push(`- ${V} \`${H.trim()}\`.`)}if(G0(Q.cicd))J.push(`- CI runs on ${Q.cicd.trim()}.`);if(J.length>0)Z.push("## Build & run","",...J,"");let Y=$.human_context??{},U=[["who",Y.who],["what",Y.what],["why",Y.why],["where",Y.where],["when",Y.when],["how",Y.how]].filter(([,G])=>G0(G)).map(([G,V])=>`- **${v0(`human_context.${G}`)}:** ${V.trim()}`);if(U.length>0)Z.push("## Project context","",...U,"");return Z.join(`
291
- `)}function xU($,Z){w0($,".github"),Y2(KS($,".github",E0.copilot),MS(Z),f2,u2,{root:$})}import{existsSync as LS}from"fs";import{join as NS}from"path";var OS="https://mcpaas.live/grok/mcp/v1",yU="mcp_servers.grok-faf-mcp";function DS($){return[`[${yU}]`,`url = "${OS}"`,""].join(`
292
- `)}function kU($,Z){let z=DS(Z);w0($,".grok");let Q=l($,NS(".grok","config.toml"));if(!LS(Q))return a(Q,`# grok-faf-mcp — wired by FAF from project.faf
286
+ Run 'faf init' to create one.`),process.exit(2);let Q=z2(p(z),z),X=jU(Q);if(!X.valid){console.log(`${C("invalid")} ${z}`);for(let W of X.errors)console.log(` ${M("x")} ${W}`);process.exit(3)}let J=p(z);if(!lY(J))console.log(`${C("invalid yaml")} ${z}`),process.exit(3);console.log(`${I("valid")} ${z}`);let Y=n(z,()=>L0(J));if(F0(Y,z,Z.verbose),Z.strict&&Y.score<100)console.log(M(`
287
+ --strict requires 100%`)),process.exit(1)}import{join as rS,resolve as sS}from"path";import{join as VS}from"path";var n0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),wU=($)=>Array.isArray($)?$.join(", "):String($),qS=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),HS=new Set(["target_user","core_problem","mission_purpose"]);function KS($){let Z=[],z=(F="")=>Z.push(F),Q=$.ai_instructions,X=$.preferences,J=$.instant_context,Y=$.security,W=$.commands,U=$.key_files??J?.key_files,G=n0($.project?.default_branch)?String($.project?.default_branch):"main",V=W?Object.entries(W).filter(([,F])=>n0(F)):[],q=V.filter(([F])=>/test/i.test(F)),H=V.filter(([F])=>/lint|check/i.test(F)&&!/test/i.test(F)),K=V.filter(([F])=>!/test|lint|check/i.test(F)),L=(F)=>{let i=F.toLowerCase();if(/install|deps/.test(i))return 0;if(/^build$|build/.test(i)&&!/rebuild/.test(i))return 1;if(/^dev$|develop/.test(i))return 2;if(/^start$|run/.test(i))return 3;return 4},B=[...K].sort((F,i)=>L(F[0])-L(i[0])||F[0].localeCompare(i[0])),N=[...q,...H],T=q[0]?.[1],R=B.find(([F])=>/build/i.test(F))?.[1];z(m2($)),z(),z(`# AGENTS.md — ${$.project?.name??"Project"}`),z();let w=[];if($.project?.main_language)w.push(String($.project.main_language));if(n0($.project?.type))w.push(`type: ${String($.project?.type)}`);if(n0($.project?.version))w.push(`v${String($.project?.version)}`);let j=$.project?.goal?String($.project.goal).trim():"";if(w.length)j+=(j?" — ":"")+w.join(" · ");if(j)z(j),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[F,i]of B)z(`${i} # ${F}`);z("```"),z()}if(N.length){z("## Run the tests"),z(),z("```bash");for(let[,F]of N)z(F);z("```"),z()}if(U&&U.length){z("## Where things live"),z();let F=U.map((i)=>{let t=String(i),V2=t.indexOf(" — ");return V2>0?{path:t.slice(0,V2),role:t.slice(V2+3)}:{path:t,role:""}});if(F.some((i)=>i.role)){z("| Path | Role |"),z("|------|------|");for(let i of F)z(`| \`${i.path}\` | ${i.role} |`)}else for(let i of F)z(`- \`${i.path}\``);z()}let y=new Map,x=(F)=>{if(!F)return;for(let[i,t]of Object.entries(F)){if(qS.has(i)||!n0(t))continue;let V2=X9(i);if(!y.has(V2))y.set(V2,wU(t))}};x(Q?.working_style),x(X);let h=$.conventions??[];if(y.size||h.length){z("## Conventions"),z();for(let[F,i]of y)z(`- **${F}:** ${i}`);for(let F of h)if(n0(F))z(`- ${F}`);z()}let E=(Q?.warnings??[]).filter((F)=>n0(F)),c=["read the tree"];if(T)c.push(`run the tests (\`${T}\`)`);if(R)c.push("build the project");for(let[,F]of H.slice(0,1))c.push(`\`${F}\``);z("## Guardrails"),z();for(let F of E)z(`- ${F}`);z(`- **Always OK:** ${[...new Set(c)].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 D0=[];for(let[,F]of H)D0.push(`\`${F}\` exits 0`);for(let[,F]of q)D0.push(`\`${F}\` passes`);if(D0.push("changes committed with a conventional message"),z("## Definition of Done"),z(),z(`Done when: ${[...new Set(D0)].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&&(n0(Y.secrets)||(Y.never??[]).length)){if(z("## Security & secrets"),z(),n0(Y.secrets)){let F=n0(Y.example)?` (see \`${Y.example}\`)`:"";z(`- Secrets live in \`${Y.secrets}\`${F}. Never read or commit them.`)}for(let F of Y.never??[])if(n0(F))z(`- Never read or commit \`${F}\`.`);z()}if(z("## Commit & PR"),z(),X&&n0(X.commit_style))z(`- Commit style: ${wU(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 F=[];for(let[i,t]of Object.entries($.stack)){if(HS.has(i))continue;if(G0(t))F.push(`- **${v0(`stack.${i}`)}:** ${t.trim()}`)}if(F.length){z("## Stack"),z();for(let i of F)z(i);z()}}let b0=$.generated;if(n0(b0))z(`*Context authored: ${String(b0)}*`);return Z.join(`
288
+ `)}function xU($,Z){Y2(VS($,j0.agents),KS(Z))}function BS($,Z){let z=[],Q=(U)=>A($,U),X=(U)=>f($,U)??"";if(Q("tsconfig.json")&&/"strict"\s*:\s*true/.test(X("tsconfig.json")))z.push("TypeScript strict mode (tsconfig.json)");if(Z?.type==="module")z.push("ESM modules (`type: module`)");let J=[],Y=Z?.devDependencies??{};if(Q(".eslintrc")||Q(".eslintrc.json")||Q(".eslintrc.cjs")||Q("eslint.config.js")||Q("eslint.config.mjs")||"eslint"in Y)J.push("ESLint");if(Q(".prettierrc")||Q(".prettierrc.json")||Q("prettier.config.js")||"prettier"in Y)J.push("Prettier");let W=Q("pyproject.toml")?X("pyproject.toml"):"";if(/\[tool\.black\]/.test(W))J.push("black");if(/\[tool\.ruff\]/.test(W))J.push("ruff");if(/\[tool\.mypy\]/.test(W))J.push("mypy");if(Q("rustfmt.toml")||Q(".rustfmt.toml"))J.push("rustfmt");if(J.length)z.push(`Style enforced by ${J.join(" · ")} — obey the configs`);return z}function T9($,Z){let z={...Z},Q=null,X=f($,"package.json");if(X!==null)try{Q=JSON.parse(X)}catch{Q=null}let J=f5($,Q);if(Object.keys(J).length)z.commands={...J,...Z.commands??{}};let Y=Z.key_files??Z.instant_context?.key_files;if(!Y||Y.length===0){let W=h5($);if(W.length)z.key_files=W}if(!Z.security){let U=[".env",".env.local",".env.development"].find((G)=>A($,G));if(U){let G=[".env.example",".env.sample",".env.template"].find((V)=>A($,V));z.security={secrets:U,...G?{example:G}:{}}}}if(!Z.conventions){let W=BS($,Q);if(W.length)z.conventions=W}return z}import{join as MS}from"path";function LS($){let Z=[];if(Z.push(m2($)),Z.push(""),Z.push("# .cursorrules"),Z.push(`# Authored from project.faf — ${$.project?.name??"Project"}`),Z.push(""),$.project?.main_language)Z.push(`language: ${$.project.main_language}`);if($.stack){Z.push(""),Z.push("# Stack");for(let[z,Q]of Object.entries($.stack))if(G0(Q))Z.push(`# ${v0(`stack.${z}`)}: ${Q.trim()}`)}return Z.push(""),Z.join(`
289
+ `)}function yU($,Z){Y2(MS($,j0.cursorrules),LS(Z),"# faf:start","# faf:end")}import{join as NS}from"path";var OS=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),DS=new Set(["target_user","core_problem","mission_purpose"]);function IS($){let Z=[],z=$.instant_context,Q=$.commands,X=$.key_files??z?.key_files,J=Q?Object.entries(Q).filter(([,H])=>OS(H)):[],Y=J.filter(([H])=>/test/i.test(H)),W=J.filter(([H])=>/lint|check/i.test(H)&&!/test/i.test(H)),U=J.filter(([H])=>!/test|lint|check/i.test(H)),G=(H)=>{let K=H.toLowerCase();if(/install|deps/.test(K))return 0;if(/^build$|build/.test(K)&&!/rebuild/.test(K))return 1;if(/^dev$|develop/.test(K))return 2;if(/^start$|run/.test(K))return 3;return 4},V=[...U].sort((H,K)=>G(H[0])-G(K[0])||H[0].localeCompare(K[0])),q=[...Y,...W];if(Z.push(m2($)),Z.push(""),Z.push(`# GEMINI.md — ${$.project?.name??"Project"}`),Z.push(""),Z.push("> Authored from project.faf — refresh with `faf export --gemini`."),Z.push(""),$.project?.name)Z.push(`Project: ${$.project.name}`);if($.project?.goal)Z.push(`Goal: ${$.project.goal}`);if($.project?.main_language)Z.push(`Language: ${$.project.main_language}`);if(V.length){Z.push(""),Z.push("## Setup & build"),Z.push(""),Z.push("```bash");for(let[H,K]of V)Z.push(`${K} # ${H}`);Z.push("```")}if(q.length){Z.push(""),Z.push("## Test & verify"),Z.push(""),Z.push("```bash");for(let[,H]of q)Z.push(H);Z.push("```")}if(X&&X.length){Z.push(""),Z.push("## Where things live"),Z.push("");for(let H of X)Z.push(`- \`${H}\``)}if($.stack){let H=[];for(let[K,L]of Object.entries($.stack)){if(DS.has(K))continue;if(G0(L))H.push(`- ${v0(`stack.${K}`)}: ${L.trim()}`)}if(H.length){Z.push(""),Z.push("## Stack");for(let K of H)Z.push(K)}}return Z.push(""),Z.push("## Before changing things"),Z.push(""),Z.push("- Ask first: dependency installs, deletions, migrations, schema changes, publish/release."),Z.push("- Never: force-push · push straight to `main` · commit secrets."),Z.push(""),Z.join(`
290
+ `)}function kU($,Z){Y2(NS($,j0.gemini),IS(Z))}import{join as TS}from"path";var bU=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],AS=new Set([...bU.map(([$])=>$),"cicd"]);function CS($){let Z=[],z=$.project?.name??"Project";if(Z.push(m2($)),Z.push(""),Z.push(`# GitHub Copilot Instructions — ${z}`),Z.push(""),Z.push("> Authored from project.faf by FAF. Copilot reads these instructions on every request in this repository — keep them short and broadly applicable."),Z.push(""),G0($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let Q=$.stack??{},X=[];if(G0($.project?.main_language))X.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[G,V]of Object.entries(Q)){if(AS.has(G))continue;if(G0(V))X.push(`- **${v0(`stack.${G}`)}:** ${V.trim()}`)}if(X.length>0)Z.push("## Tech stack","",...X,"");let J=[];for(let[G,V]of bU){let q=Q[G];if(G0(q))J.push(`- ${V} \`${q.trim()}\`.`)}if(G0(Q.cicd))J.push(`- CI runs on ${Q.cicd.trim()}.`);if(J.length>0)Z.push("## Build & run","",...J,"");let Y=$.human_context??{},U=[["who",Y.who],["what",Y.what],["why",Y.why],["where",Y.where],["when",Y.when],["how",Y.how]].filter(([,G])=>G0(G)).map(([G,V])=>`- **${v0(`human_context.${G}`)}:** ${V.trim()}`);if(U.length>0)Z.push("## Project context","",...U,"");return Z.join(`
291
+ `)}function vU($,Z){S0($,".github"),Y2(TS($,".github",j0.copilot),CS(Z),f2,u2,{root:$})}import{existsSync as _S}from"fs";import{join as RS}from"path";var FS="https://mcpaas.live/grok/mcp/v1",gU="mcp_servers.grok-faf-mcp";function PS($){return[`[${gU}]`,`url = "${FS}"`,""].join(`
292
+ `)}function hU($,Z){let z=PS(Z);S0($,".grok");let Q=l($,RS(".grok","config.toml"));if(!_S(Q))return a(Q,`# grok-faf-mcp — wired by FAF from project.faf
293
293
 
294
- `+z,{root:$,expect:null}),"created";let X=J0(Q);if(X.includes(`[${yU}]`))return"unchanged";let J=X.endsWith(`
294
+ `+z,{root:$,expect:null}),"created";let X=z0(Q);if(X.includes(`[${gU}]`))return"unchanged";let J=X.endsWith(`
295
295
 
296
296
  `)?"":X.endsWith(`
297
297
  `)?`
298
298
  `:`
299
299
 
300
- `;return a(Q,X+J+z,{root:$,expect:X}),"merged"}import{join as IS}from"path";var TS=[{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 I9($){if(!G0($))return null;let Z=$.trim();if(/^(none|n\/a)$/i.test(Z))return null;return Z}function D9($,Z){if(!$)return null;return I9($[Z])}function AS($){let Z=[],z=I9($.project?.name)??"Project",Q=I9($.project?.goal);if(Z.push(`# ${z}`),Z.push(""),Q)Z.push(`> ${Q}`),Z.push("");let X=$.human_context;for(let{key:Y,heading:W}of TS){let U=D9(X,Y);if(!U)continue;Z.push(`## ${W}`),Z.push(""),Z.push(U),Z.push("")}let J=D9($.project,"homepage")??D9($.project,"url");if(J&&/^(https?:)?\/\//i.test(J))Z.push("## Links"),Z.push(""),Z.push(`- [Homepage](${J})`),Z.push("");return`${Z.join(`
300
+ `;return a(Q,X+J+z,{root:$,expect:X}),"merged"}import{join as SS}from"path";var ES=[{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 C9($){if(!G0($))return null;let Z=$.trim();if(/^(none|n\/a)$/i.test(Z))return null;return Z}function A9($,Z){if(!$)return null;return C9($[Z])}function jS($){let Z=[],z=C9($.project?.name)??"Project",Q=C9($.project?.goal);if(Z.push(`# ${z}`),Z.push(""),Q)Z.push(`> ${Q}`),Z.push("");let X=$.human_context;for(let{key:Y,heading:W}of ES){let U=A9(X,Y);if(!U)continue;Z.push(`## ${W}`),Z.push(""),Z.push(U),Z.push("")}let J=A9($.project,"homepage")??A9($.project,"url");if(J&&/^(https?:)?\/\//i.test(J))Z.push("## Links"),Z.push(""),Z.push(`- [Homepage](${J})`),Z.push("");return`${Z.join(`
301
301
  `).trimEnd()}
302
- `}function bU($,Z){Y2(IS($,E0.llms),AS(Z))}d();import{join as CS}from"path";import{deprecate as _S}from"node:util";var vU=r1.orange,RS=r1.cyan,FS=r1.cyanDeep,PS="#FF9500",SS="#FF3B30",ES="#E6EDF3",jS="#6E7681",gU={TROPHY:{glyph:"✪",color:vU},GOLD:{glyph:"★",color:vU},SILVER:{glyph:"◆",color:RS},BRONZE:{glyph:"◇",color:FS},GREEN:{glyph:"●",color:ES},YELLOW:{glyph:"●",color:PS},RED:{glyph:"○",color:SS},WHITE:{glyph:"♡",color:jS}};function k$($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var hU=["who","what","why","where","when","how"];function s5($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,z])=>`<div class="row"><div class="k">${k$(Z)}</div><div class="v">${k$(z)}</div></div>`).join(`
303
- `)}function fU($,Z,z="project.faf"){let Q=k$($.project?.name??"Project"),X=Z.tier?.name??"WHITE",J=gU[X]??gU.WHITE,Y=Z.inherited?Z.represents?`inherited from ${k$(Z.represents)}`:"inherited":`${Z.score}%`,W=X==="TROPHY"&&!Z.inherited,U=$.human_context??{},G=hU.map((B)=>[B,U[B]]),V=Object.entries(U).filter(([B])=>!hU.includes(B)),H=[["goal",$.project?.goal],["main_language",$.project?.main_language],["type",$.project?.type],["framework",$.project?.framework],["faf_version",$.faf_version]],q=Object.entries($.stack??{}),K=q.filter(([,B])=>B&&B!=="slotignored"&&String(B).trim()!==""),L=q.filter(([,B])=>B==="slotignored").length;return`<!DOCTYPE html>
302
+ `}function fU($,Z){Y2(SS($,j0.llms),jS(Z))}d();import{join as wS}from"path";import{deprecate as xS}from"node:util";var uU=a1.orange,yS=a1.cyan,kS=a1.cyanDeep,bS="#FF9500",vS="#FF3B30",gS="#E6EDF3",hS="#6E7681",mU={TROPHY:{glyph:"✪",color:uU},GOLD:{glyph:"★",color:uU},SILVER:{glyph:"◆",color:yS},BRONZE:{glyph:"◇",color:kS},GREEN:{glyph:"●",color:gS},YELLOW:{glyph:"●",color:bS},RED:{glyph:"○",color:vS},WHITE:{glyph:"♡",color:hS}};function v$($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var cU=["who","what","why","where","when","how"];function a5($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,z])=>`<div class="row"><div class="k">${v$(Z)}</div><div class="v">${v$(z)}</div></div>`).join(`
303
+ `)}function pU($,Z,z="project.faf"){let Q=v$($.project?.name??"Project"),X=Z.tier?.name??"WHITE",J=mU[X]??mU.WHITE,Y=Z.inherited?Z.represents?`inherited from ${v$(Z.represents)}`:"inherited":`${Z.score}%`,W=X==="TROPHY"&&!Z.inherited,U=$.human_context??{},G=cU.map((B)=>[B,U[B]]),V=Object.entries(U).filter(([B])=>!cU.includes(B)),q=[["goal",$.project?.goal],["main_language",$.project?.main_language],["type",$.project?.type],["framework",$.project?.framework],["faf_version",$.faf_version]],H=Object.entries($.stack??{}),K=H.filter(([,B])=>B&&B!=="slotignored"&&String(B).trim()!==""),L=H.filter(([,B])=>B==="slotignored").length;return`<!DOCTYPE html>
304
304
  <html lang="en">
305
305
  <head>
306
306
  <meta charset="UTF-8">
@@ -341,7 +341,7 @@ footer strong{color:#e6edf3}
341
341
  <div class="eyebrow">project.faf · visual render</div>
342
342
  <header>
343
343
  <h1>${Q}</h1>
344
- <span class="badge">${J.glyph} ${k$(X)}</span>
344
+ <span class="badge">${J.glyph} ${v$(X)}</span>
345
345
  <span class="score">${Y}</span>
346
346
  </header>
347
347
  <div class="meter"><span></span></div>
@@ -349,103 +349,103 @@ ${W?'<p class="award statline"><span class="awd-pre">✅ All Required slots fill
349
349
 
350
350
  <section>
351
351
  <h2>The 6 W's</h2>
352
- ${s5(G)||'<p class="muted">No human_context yet.</p>'}
353
- ${V.length?s5(V):""}
352
+ ${a5(G)||'<p class="muted">No human_context yet.</p>'}
353
+ ${V.length?a5(V):""}
354
354
  </section>
355
355
 
356
356
  <section>
357
357
  <h2>Project</h2>
358
- ${s5(H)||'<p class="muted">—</p>'}
358
+ ${a5(q)||'<p class="muted">—</p>'}
359
359
  </section>
360
360
 
361
361
  <section>
362
362
  <h2>Stack</h2>
363
- ${K.length?s5(K):'<p class="muted">No active stack slots.</p>'}
363
+ ${K.length?a5(K):'<p class="muted">No active stack slots.</p>'}
364
364
  </section>
365
365
 
366
366
  <footer>
367
- Rendered on-demand from your current <strong>${k$(z)}</strong><br>
367
+ Rendered on-demand from your current <strong>${v$(z)}</strong><br>
368
368
  <strong>Humans like visuals. <span style="color:#00D4D4">We gave them one.</span></strong>
369
369
  </footer>
370
370
  </div>
371
371
  </body>
372
372
  </html>
373
- `}var wS='<meta name="description" content="Visual render of project.faf.';function xS($){return new TextDecoder().decode($).split(/\r?\n/).some((Z)=>Z.trim().startsWith(wS)&&Z.includes(" by faf"))}function o5($,Z,z,Q="project.faf",X={}){W2(CS($,"project.html"),fU(Z,z,Q),{root:$,format:"html",hasMark:xS,mark:"faf mark (the `Visual render of project.faf` description line)",force:X.force})}var $u=_S(fU,"faf-cli: generateProjectHtml is deprecated, use renderProjectHtml","FAF0001");import{join as kS}from"path";import{deprecate as bS}from"node:util";var uU="JSONRPC",U4="1.0",G4=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],mU="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";function cU($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function b$($,Z={}){let z=cU($);if(z.length>0)return z;let Q=Z.doorUrl?.trim();if(Q)return[{protocol:"a2a",location:Q,version:U4}];return[]}function yS($){let Z=new Set;for(let z of $.capabilities??[])if(z.cites_spec&&G4.includes(z.cites_spec))Z.add(z.cites_spec);return["text/plain",...Z]}function pU($,Z={}){let z=$.agent??{},Q=b$($,Z);if(Q.length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");let X=String(z.displayName??$.metadata?.persona??z.name??"").trim(),J=String(z.description??"").trim(),Y=String(z.version??"").trim();if(!X||!J||!Y)throw Error("A2A card needs agent.displayName|name, description, version in .fafa");let W=String(z.vendor??"").trim(),U=String(z.homepage??"").trim(),G=W&&U?{organization:W,url:U}:void 0,V=($.capabilities??[]).map((H)=>{let q=String(H.name??"").trim();if(!q)throw Error("A2A skill missing capabilities[].name");let K=Array.isArray(H.tags)?H.tags.map(String):[],L=H.cites_spec&&G4.includes(H.cites_spec)?[H.cites_spec,"text/plain"]:void 0;return{id:q,name:q,description:String(H.description??"").trim()||q,tags:K,...L?{inputModes:L}:{}}});return{name:X,description:J,supportedInterfaces:Q.map((H)=>({url:String(H.location),protocolBinding:uU,protocolVersion:String(H.version??U4)})),...G?{provider:G}:{},version:Y,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[...Z.extensions??[]]},defaultInputModes:yS($),defaultOutputModes:["text/plain","application/json"],skills:V}}var lU="application/vnd.faf+yaml",vS=mU,gS=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function iU($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&gS.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 hS($){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 V4($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:lU,iana:`https://www.iana.org/assignments/media-types/${lU}`,deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function a5($,Z={}){let z={$schema:vS,name:iU($),version:String($.project?.version??"0.1.0"),description:hS($)},Q=T9($)??$.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":V4($,Z)},z}var v$="io.modelcontextprotocol.registry/publisher-provided",dU=4096;function nU($,Z={}){let z={"one.faf/context":V4($,Z)},Q=new TextEncoder().encode(JSON.stringify(z)).length;if(Q>dU)throw Error(`publisher-provided _meta is ${Q}B — exceeds the registry ${dU}B cap`);return{[v$]:z}}function rU($){return iU($)}function T9($){let Z=$.project?.title;if(typeof Z==="string"){let z=Z.trim();if(z&&z.length<=100)return z}return}function sU($){try{return JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return}}var r6=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function H4($){let Z=sU($);return r6(Z)&&r6(Z._meta)&&r6(Z._meta["one.faf/context"])}function t5($){let Z=sU($),z=r6(Z)&&r6(Z._meta)?Z._meta[v$]:void 0;return r6(z)&&r6(z["one.faf/context"])}function oU($,Z,z={},Q={}){let X=a5(Z,z),J=kS($,"server-card");return W2(J,`${JSON.stringify(X,null,2)}
374
- `,{root:$,format:"json",hasMark:H4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:Q.force}),J}function e5($,Z){let z={name:Z.name,title:Z.title,version:Z.version,_meta:Z.meta};return r5($,z,{"":{name:["$schema"],title:["name"],version:["description","title","name"]}})}var Gu=bS(a5,"faf-cli: generateServerCard is deprecated, use buildServerCard","FAF0002");d();function q4($,Z,z,Q){let X=p5(fS($,Z),Z,Q?.[0],Q?.[1],{root:$});if(z(),console.log(` ${Z}`),X)console.log(M(` ${X}`))}function mS($){try{return $(),!0}catch(Z){if(!w$(Z))throw Z;return console.error(K6(Z,!0)),!1}}function s6($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
373
+ `}var fS='<meta name="description" content="Visual render of project.faf.';function uS($){return new TextDecoder().decode($).split(/\r?\n/).some((Z)=>Z.trim().startsWith(fS)&&Z.includes(" by faf"))}function t5($,Z,z,Q="project.faf",X={}){W2(wS($,"project.html"),pU(Z,z,Q),{root:$,format:"html",hasMark:uS,mark:"faf mark (the `Visual render of project.faf` description line)",force:X.force})}var Gu=xS(pU,"faf-cli: generateProjectHtml is deprecated, use renderProjectHtml","FAF0001");import{join as pS}from"path";import{deprecate as lS}from"node:util";var dU="JSONRPC",q4="1.0",H4=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],iU="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";function nU($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function g$($,Z={}){let z=nU($);if(z.length>0)return z;let Q=Z.doorUrl?.trim();if(Q)return[{protocol:"a2a",location:Q,version:q4}];return[]}function mS($){let Z=new Set;for(let z of $.capabilities??[])if(z.cites_spec&&H4.includes(z.cites_spec))Z.add(z.cites_spec);return["text/plain",...Z]}function rU($,Z={}){let z=$.agent??{},Q=g$($,Z);if(Q.length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");let X=String(z.displayName??$.metadata?.persona??z.name??"").trim(),J=String(z.description??"").trim(),Y=String(z.version??"").trim();if(!X||!J||!Y)throw Error("A2A card needs agent.displayName|name, description, version in .fafa");let W=String(z.vendor??"").trim(),U=String(z.homepage??"").trim(),G=W&&U?{organization:W,url:U}:void 0,V=($.capabilities??[]).map((q)=>{let H=String(q.name??"").trim();if(!H)throw Error("A2A skill missing capabilities[].name");let K=Array.isArray(q.tags)?q.tags.map(String):[],L=q.cites_spec&&H4.includes(q.cites_spec)?[q.cites_spec,"text/plain"]:void 0;return{id:H,name:H,description:String(q.description??"").trim()||H,tags:K,...L?{inputModes:L}:{}}});return{name:X,description:J,supportedInterfaces:Q.map((q)=>({url:String(q.location),protocolBinding:dU,protocolVersion:String(q.version??q4)})),...G?{provider:G}:{},version:Y,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[...Z.extensions??[]]},defaultInputModes:mS($),defaultOutputModes:["text/plain","application/json"],skills:V}}function M6($){return String($??"").trim()}function lU($){return Array.isArray($)?$.map(M6).filter(Boolean):[]}function K4($){let Z=M6($.agent?.id),z=/^urn:air:([^:]+):/.exec(Z);if(z)return z[1];let Q=M6($.metadata?.cards?.domain);if(Q)return Q;try{return new URL(M6($.agent?.homepage)).hostname.replace(/^www\./,"")}catch{throw Error("The .fafa names no domain (agent.id urn:air, metadata.cards.domain or agent.homepage).")}}function sU($){return cS($)}function cS($){let Z=M6($.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 oU($){let Z=$.agent??{},z=M6(Z.vendor)||M6(Z.displayName)||M6(Z.name);if(!z)return;let Q;try{Q=K4($)}catch{Q=void 0}return{displayName:z,...Q?{identifier:Q}:{}}}function aU($){let Z=$.metadata?.cards??{},z=lU(Z.keywords),Q=lU(Z.examples);return{...z.length?{tags:z}:{},...Q.length?{representativeQueries:Q}:{}}}var tU="application/vnd.faf+yaml",dS=iU,iS=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function $G($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&iS.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 nS($){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 B4($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:tU,iana:`https://www.iana.org/assignments/media-types/${tU}`,deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function e5($,Z={}){let z={$schema:dS,name:$G($),version:String($.project?.version??"0.1.0"),description:nS($)},Q=_9($)??$.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":B4($,Z)},z}var h$="io.modelcontextprotocol.registry/publisher-provided",eU=4096;function ZG($,Z={}){let z={"one.faf/context":B4($,Z)},Q=new TextEncoder().encode(JSON.stringify(z)).length;if(Q>eU)throw Error(`publisher-provided _meta is ${Q}B — exceeds the registry ${eU}B cap`);return{[h$]:z}}function zG($){return $G($)}function _9($){let Z=$.project?.title;if(typeof Z==="string"){let z=Z.trim();if(z&&z.length<=100)return z}return}function QG($){try{return JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return}}var s6=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function M4($){let Z=QG($);return s6(Z)&&s6(Z._meta)&&s6(Z._meta["one.faf/context"])}function $Z($){let Z=QG($),z=s6(Z)&&s6(Z._meta)?Z._meta[h$]:void 0;return s6(z)&&s6(z["one.faf/context"])}function XG($,Z,z={},Q={}){let X=e5(Z,z),J=pS($,"server-card");return W2(J,`${JSON.stringify(X,null,2)}
374
+ `,{root:$,format:"json",hasMark:M4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:Q.force}),J}function ZZ($,Z){let z={name:Z.name,title:Z.title,version:Z.version,_meta:Z.meta};return b$($,z,{"":{name:["$schema"],title:["name"],version:["description","title","name"]}})}var Ou=lS(e5,"faf-cli: generateServerCard is deprecated, use buildServerCard","FAF0002");d();function L4($,Z,z,Q){let X=i5(rS($,Z),Z,Q?.[0],Q?.[1],{root:$});if(z(),console.log(` ${Z}`),X)console.log(M(` ${X}`))}function oS($){try{return $(),!0}catch(Z){if(!x$(Z))throw Z;return console.error(K6(Z,!0)),!1}}function o6($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
375
375
 
376
- Run 'faf init' to create one.`),process.exit(2);let z=$.output?uS(process.cwd(),$.output):process.cwd();if($.output)w0(z);let Q=r(Z),X=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.llms&&!$.conductor&&!$.html&&!$.card,J=0,Y=(U)=>{if(!mS(U))J++};if(X||$.agents)Y(()=>q4(z,"AGENTS.md",()=>SU(z,O9(z,Q))));if(X||$.cursor)Y(()=>q4(z,".cursorrules",()=>EU(z,Q),["# faf:start","# faf:end"]));if(X||$.gemini)Y(()=>q4(z,"GEMINI.md",()=>jU(z,O9(z,Q))));if(X||$.copilot)Y(()=>q4(z,".github/copilot-instructions.md",()=>xU(z,Q)));if($.grok)Y(()=>{let U=kU(z,Q);console.log(` .grok/config.toml (${U})`)});if($.llms)Y(()=>q4(z,"llms.txt",()=>bU(z,Q)));if(X||$.html)Y(()=>{let U=n(Z,()=>L0(p(Z)));o5(z,Q,U,Z,{force:$.force}),console.log(" project.html")});let W=Q.app_type==="server-card"||Q.project?.type==="server-card";if($.card||X&&W)Y(()=>{let U=oU(z,Q,{},{force:$.force});console.log(` ${U.replace(`${z}/`,"")}`)});if(console.log(`${I("exported")} ${M(`from ${Z}`)}`),J>0)process.exit(1)}import{existsSync as aS,lstatSync as tS}from"fs";import{dirname as JG,resolve as R9}from"path";import{existsSync as aU}from"fs";import{basename as cS,dirname as K4,join as tU}from"path";import{deprecate as pS}from"node:util";var B4="https://faf.one/ext/context/v1",A9=["a2a","mcp","registry","catalog"];function eU($){return i0(J0(l(K4($),cS($))))}function $G($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let Q of Z){let X=tU($,Q);if(aU(X))return X}let z=K4($);if(z!==$)for(let Q of Z){let X=tU(z,Q);if(aU(X))return X}return null}function lS($,Z,z){let Q=V4(Z,z),X=$.agent??{},J={fafaSpecVersion:String($.version??U4),mediaTypes:[...G4],provenance:{faf:Q.faf,mediaType:Q.mediaType},generated:Q.generated};if(X.id)J.agentId=X.id;let Y=zG($,"fafa");if(Y)J.passport=Y;return J}function ZG($,Z,z={}){if(b$($,z).length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");return pU($,{doorUrl:z.doorUrl,extensions:[{uri:B4,description:"FAF passport and project DNA as typed parts",required:!1,params:lS($,Z,z)}]})}var gu=pS(ZG,"faf-cli: generateA2ACard is deprecated, use buildA2ACard","FAF0003");function dS($){let Z=$.agent?.homepage;if(!Z)return"local";try{return new URL(Z).hostname.replace(/^www\./,"")}catch{return"local"}}function iS($,Z){if(Z.a2aCardUrl)return Z.a2aCardUrl;let z=$.agent?.homepage;if(z)try{return new URL("/.well-known/agent-card.json",z).href}catch{}return"/.well-known/agent-card.json"}function nS($,Z,z={}){let Q=dS($),X=$.agent??{},J=String(X.name??"agent"),Y=z.now??Z.generated??new Date().toISOString(),W=[];if(b$($,z).length>0)W.push({identifier:`urn:air:${Q}:a2a:${J}`,displayName:String(X.displayName??X.name??"A2A Agent Card"),type:"application/a2a-agent-card+json",description:"A2A v1.0 Agent Card. Projected from .fafa.",url:iS($,z),updatedAt:Y});let U=zG($,"fafa");if(U)W.push({identifier:`urn:air:${Q}:agent:${J}`,displayName:String(X.displayName??X.name??".fafa"),type:"application/vnd.fafa+yaml",description:"FAF agent passport (.fafa).",url:U,updatedAt:Y});return W}function zG($,Z){let z=$.agent?.homepage;if(!z)return;try{return new URL(`/.well-known/${Z}`,z).href}catch{return}}var rS=["url","type","updatedAt"];function QG($,Z){if($===null)return{text:`${JSON.stringify({specVersion:"1.0",entries:Z},null,2)}
377
- `,changed:!0};return NU($,"entries",Z,{id:"identifier",update:rS})}function $Z($){let Z=$.opts??{},z=new Set($.targets?.length?$.targets:A9),X={block:V4($.faf,Z)};if(z.has("mcp"))X.mcp=a5($.faf,Z);if(z.has("registry")){let J=T9($.faf);X.registry={name:rU($.faf),...J?{title:J}:{},_meta:nU($.faf,Z)}}if(z.has("a2a")||z.has("catalog")){if(!$.fafa){if($.targets?.includes("a2a")||$.targets?.includes("catalog"))throw Error("A2A/catalog require a .fafa (agent.fafa). Will not invent an agent.")}}if(z.has("a2a")&&$.fafa)if(b$($.fafa,Z).length===0){if($.targets?.includes("a2a"))throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.")}else X.a2a=ZG($.fafa,$.faf,Z);if(z.has("catalog")&&$.fafa)X.catalog=nS($.fafa,$.faf,Z);return sS(X),X}function sS($){let Z=JSON.stringify($.block),z=[];if($.mcp){let Q=$.mcp._meta;z.push(JSON.stringify(Q["one.faf/context"]))}if($.registry){let Q=$.registry._meta["io.modelcontextprotocol.registry/publisher-provided"];z.push(JSON.stringify(Q["one.faf/context"]))}for(let Q of z)if(Q!==Z)throw Error("context block drifted across card targets — one projector, one block");if($.a2a){let Q=$.a2a.capabilities.extensions[0].params,X=$.block;if(Q.provenance?.faf!==X.faf||Q.provenance?.mediaType!==X.mediaType)throw Error("A2A extension provenance drifted from the context block — one context, every door")}}function C9($){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===B4)}function oS($){return H4($)||t5($)||C9($)}function _9($,Z,z,Q={}){return w0(z??K4($),K4($)),W2($,`${JSON.stringify(Z,null,2)}
378
- `,{root:z??K4($),format:"json",hasMark:Q.owns??oS,mark:Q.mark??"FAF context-block (a faf card mark)",force:Q.force}).result}function XG($){if(!$)return;let Z=$.split(",").map((Q)=>Q.trim().toLowerCase()).filter(Boolean),z=Z.filter((Q)=>!A9.includes(Q));if(z.length)throw Error(`unknown card target: ${z.join(", ")} (use ${A9.join(",")})`);return Z}d();function eS($){try{return tS($),!0}catch{return!1}}function $E($){try{let z=JSON.parse($.replace(/^\uFEFF/,""))?._meta?.[v$]?.["one.faf/context"]?.generated;return typeof z==="string"?z:void 0}catch{return}}function YG($={}){let Z=$.faf?R9($.faf):u();if(!Z||!aS(Z))console.error(`Error: project.faf not found
376
+ Run 'faf init' to create one.`),process.exit(2);let z=$.output?sS(process.cwd(),$.output):process.cwd();if($.output)S0(z);let Q=r(Z),X=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.llms&&!$.conductor&&!$.html&&!$.card,J=0,Y=(U)=>{if(!oS(U))J++};if(X||$.agents)Y(()=>L4(z,"AGENTS.md",()=>xU(z,T9(z,Q))));if(X||$.cursor)Y(()=>L4(z,".cursorrules",()=>yU(z,Q),["# faf:start","# faf:end"]));if(X||$.gemini)Y(()=>L4(z,"GEMINI.md",()=>kU(z,T9(z,Q))));if(X||$.copilot)Y(()=>L4(z,".github/copilot-instructions.md",()=>vU(z,Q)));if($.grok)Y(()=>{let U=hU(z,Q);console.log(` .grok/config.toml (${U})`)});if($.llms)Y(()=>L4(z,"llms.txt",()=>fU(z,Q)));if(X||$.html)Y(()=>{let U=n(Z,()=>L0(p(Z)));t5(z,Q,U,Z,{force:$.force}),console.log(" project.html")});let W=Q.app_type==="server-card"||Q.project?.type==="server-card";if($.card||X&&W)Y(()=>{let U=XG(z,Q,{},{force:$.force});console.log(` ${U.replace(`${z}/`,"")}`)});if(console.log(`${I("exported")} ${M(`from ${Z}`)}`),J>0)process.exit(1)}import{existsSync as WE,lstatSync as UE}from"fs";import{dirname as qG,resolve as E9}from"path";import{existsSync as JG}from"fs";import{basename as aS,dirname as N4,join as YG}from"path";import{deprecate as tS}from"node:util";var O4="https://faf.one/ext/context/v1",R9=["a2a","mcp","registry","catalog","ard"];function WG($){return i0(z0(l(N4($),aS($))))}function UG($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let Q of Z){let X=YG($,Q);if(JG(X))return X}let z=N4($);if(z!==$)for(let Q of Z){let X=YG(z,Q);if(JG(X))return X}return null}function eS($,Z,z){let Q=B4(Z,z),X=$.agent??{},J={fafaSpecVersion:String($.version??q4),mediaTypes:[...H4],provenance:{faf:Q.faf,mediaType:Q.mediaType},generated:Q.generated};if(X.id)J.agentId=X.id;let Y=$E($);if(Y)J.passport=Y;return J}function $E($){try{return`https://${K4($)}/.well-known/fafa`}catch{return}}function GG($,Z,z={}){if(g$($,z).length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");return rU($,{doorUrl:z.doorUrl,extensions:[{uri:O4,description:"FAF passport and project DNA as typed parts",required:!1,params:eS($,Z,z)}]})}var iu=tS(GG,"faf-cli: generateA2ACard is deprecated, use buildA2ACard","FAF0003");function ZE($,Z){return Z.a2aCardUrl??`https://${K4($)}/.well-known/agent-card.json`}function zE($,Z,z={}){let Q=K4($),X=sU($),J=$.agent??{},Y=z.now??Z.generated??new Date().toISOString(),W=[];if(g$($,z).length>0)W.push({identifier:`urn:air:${Q}:a2a:${X}`,displayName:String(J.displayName??J.name??"A2A Agent Card"),type:"application/a2a-agent-card+json",description:"A2A v1.0 Agent Card. Projected from .fafa.",url:ZE($,z),updatedAt:Y});return W.push({identifier:`urn:air:${Q}:agent:${X}`,displayName:String(J.displayName??J.name??".fafa"),type:"application/vnd.fafa+yaml",description:"FAF agent passport (.fafa).",url:`https://${Q}/.well-known/fafa`,updatedAt:Y}),W}var QE=["url","type","updatedAt"];function F9($,Z,z){if($===null){let J={specVersion:"1.0",...z?{host:z}:{},entries:Z};return{text:`${JSON.stringify(J,null,2)}
377
+ `,changed:!0}}let Q=TU($,"entries",Z,{id:"identifier",update:QE});if(!z||XE(Q.text))return Q;let X=b$(Q.text,{host:z},{"":{host:["specVersion"]}});return{text:X.text,changed:Q.changed||X.changed}}function XE($){try{let Z=JSON.parse($);return Object.prototype.hasOwnProperty.call(Z,"host")}catch{return!0}}function zZ($){let Z=$.opts??{},z=new Set($.targets?.length?$.targets:R9),X={block:B4($.faf,Z)};if(z.has("mcp"))X.mcp=e5($.faf,Z);if(z.has("registry")){let J=_9($.faf);X.registry={name:zG($.faf),...J?{title:J}:{},_meta:ZG($.faf,Z)}}if(z.has("a2a")||z.has("catalog")||z.has("ard")){if(!$.fafa){if($.targets?.some((J)=>J==="a2a"||J==="catalog"||J==="ard"))throw Error("A2A/catalog/ARD require a .fafa (agent.fafa). Will not invent an agent.")}}if(z.has("a2a")&&$.fafa)if(g$($.fafa,Z).length===0){if($.targets?.includes("a2a"))throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.")}else X.a2a=GG($.fafa,$.faf,Z);if((z.has("catalog")||z.has("ard"))&&$.fafa){let J=zE($.fafa,$.faf,Z);if(z.has("catalog"))X.catalog=J;if(z.has("ard")){let W=aU($.fafa);X.ard=J.map((U)=>({...U,...W}))}let Y=oU($.fafa);if(Y)X.catalogHost=Y}return JE(X),X}function JE($){let Z=JSON.stringify($.block),z=[];if($.mcp){let Q=$.mcp._meta;z.push(JSON.stringify(Q["one.faf/context"]))}if($.registry){let Q=$.registry._meta["io.modelcontextprotocol.registry/publisher-provided"];z.push(JSON.stringify(Q["one.faf/context"]))}for(let Q of z)if(Q!==Z)throw Error("context block drifted across card targets — one projector, one block");if($.a2a){let Q=$.a2a.capabilities.extensions[0].params,X=$.block;if(Q.provenance?.faf!==X.faf||Q.provenance?.mediaType!==X.mediaType)throw Error("A2A extension provenance drifted from the context block — one context, every door")}}function P9($){let Z;try{Z=JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return!1}let Q=(typeof Z==="object"&&Z!==null?Z.capabilities:void 0)?.extensions;return Array.isArray(Q)&&Q.some((X)=>typeof X==="object"&&X!==null&&X.uri===O4)}function YE($){return M4($)||$Z($)||P9($)}function S9($,Z,z,Q={}){return S0(z??N4($),N4($)),W2($,`${JSON.stringify(Z,null,2)}
378
+ `,{root:z??N4($),format:"json",hasMark:Q.owns??YE,mark:Q.mark??"FAF context-block (a faf card mark)",force:Q.force}).result}function VG($){if(!$)return;let Z=$.split(",").map((Q)=>Q.trim().toLowerCase()).filter(Boolean),z=Z.filter((Q)=>!R9.includes(Q));if(z.length)throw Error(`unknown card target: ${z.join(", ")} (use ${R9.join(",")})`);return Z}d();function GE($){try{return UE($),!0}catch{return!1}}function VE($){try{let z=JSON.parse($.replace(/^\uFEFF/,""))?._meta?.[h$]?.["one.faf/context"]?.generated;return typeof z==="string"?z:void 0}catch{return}}function HG($={}){let Z=$.faf?E9($.faf):u();if(!Z||!WE(Z))console.error(`Error: project.faf not found
379
379
 
380
- Run 'faf init' to create one.`),process.exit(2);let z=r(Z),Q=R9($.in??"./server.json"),X=$.in?JG(Q):process.cwd();if(!eS(Q))console.error(`Error: ${Q} not found.
380
+ Run 'faf init' to create one.`),process.exit(2);let z=r(Z),Q=E9($.in??"./server.json"),X=$.in?qG(Q):process.cwd();if(!GE(Q))console.error(`Error: ${Q} not found.
381
381
 
382
382
  'faf server-card' patches the identity into an existing registry server.json;
383
- it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=l(X,Q),Y=J0(J),W=$.generated??$E(Y)??new Date().toISOString(),U=$Z({faf:z,targets:["registry"],opts:{fafPointer:"./project.faf",now:W}}),G=U.registry.name,V=U.registry.title,H;try{H=e5(Y,{name:G,title:V,version:$.setVersion,meta:U.registry._meta})}catch(L){if(!(L instanceof g0))throw L;console.error(`faf: ${Q}: ${L.message} — faf cannot change only its identity keys, so it left the file unchanged.`),process.exit(1)}if($.check){process.stdout.write(H.text);return}let q=R9($.out??Q),K=V??"(none in project.faf — the file's own kept)";if(q===Q){if(H.changed)a(J,H.text,{root:X,expect:Y})}else X2(q),W2(q,H.text,{root:$.out?JG(q):process.cwd(),format:"json",hasMark:t5,mark:"faf identity (`_meta` publisher-provided `one.faf/context`)",force:$.force});console.error(`${I("✓")} ${q} — name=${G} title=${K} ${M(H.changed||q!==Q?"(identity emitted from faf-cli)":"(unchanged)")}`)}import{existsSync as WG,lstatSync as ZE}from"fs";import{dirname as zE,join as M4,resolve as F9}from"path";d();function P9($){try{return ZE($),!0}catch{return!1}}var p2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)?$:void 0,QE=[{target:"registry",file:["server.json"],stamp:($)=>p2(p2(p2($._meta)?.[v$])?.["one.faf/context"])?.generated},{target:"mcp",file:["server-card"],stamp:($)=>p2(p2($._meta)?.["one.faf/context"])?.generated},{target:"a2a",file:[".well-known","agent-card.json"],stamp:($)=>{let Z=p2($.capabilities)?.extensions,z=Array.isArray(Z)?Z.map(p2).find((Q)=>Q?.uri===B4):void 0;return p2(z?.params)?.generated}}];function XE($,Z){for(let{target:z,file:Q,stamp:X}of QE){let J=M4($,...Q);if(Z?.length&&!Z.includes(z)||!P9(J))continue;try{let Y=p2(JSON.parse(J0(l($,J)).replace(/^\uFEFF/,""))),W=Y?X(Y):void 0;if(typeof W==="string")return W}catch{}}return}function UG($={}){let Z=$.dir?F9($.dir):process.cwd(),z;try{z=XG($.target)}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}let Q=$.faf?F9($.faf):u(Z);if(!Q||!WG(Q))console.error(`Error: project.faf not found
383
+ it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=l(X,Q),Y=z0(J),W=$.generated??VE(Y)??new Date().toISOString(),U=zZ({faf:z,targets:["registry"],opts:{fafPointer:"./project.faf",now:W}}),G=U.registry.name,V=U.registry.title,q;try{q=ZZ(Y,{name:G,title:V,version:$.setVersion,meta:U.registry._meta})}catch(L){if(!(L instanceof g0))throw L;console.error(`faf: ${Q}: ${L.message} — faf cannot change only its identity keys, so it left the file unchanged.`),process.exit(1)}if($.check){process.stdout.write(q.text);return}let H=E9($.out??Q),K=V??"(none in project.faf — the file's own kept)";if(H===Q){if(q.changed)a(J,q.text,{root:X,expect:Y})}else X2(H),W2(H,q.text,{root:$.out?qG(H):process.cwd(),format:"json",hasMark:$Z,mark:"faf identity (`_meta` publisher-provided `one.faf/context`)",force:$.force});console.error(`${I("✓")} ${H} — name=${G} title=${K} ${M(q.changed||H!==Q?"(identity emitted from faf-cli)":"(unchanged)")}`)}import{existsSync as KG,lstatSync as qE}from"fs";import{dirname as BG,join as f$,resolve as j9}from"path";d();function QZ($){try{return qE($),!0}catch{return!1}}var p2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)?$:void 0,HE=[{target:"registry",file:["server.json"],stamp:($)=>p2(p2(p2($._meta)?.[h$])?.["one.faf/context"])?.generated},{target:"mcp",file:["server-card"],stamp:($)=>p2(p2($._meta)?.["one.faf/context"])?.generated},{target:"a2a",file:[".well-known","agent-card.json"],stamp:($)=>{let Z=p2($.capabilities)?.extensions,z=Array.isArray(Z)?Z.map(p2).find((Q)=>Q?.uri===O4):void 0;return p2(z?.params)?.generated}}];function KE($,Z){for(let{target:z,file:Q,stamp:X}of HE){let J=f$($,...Q);if(Z?.length&&!Z.includes(z)||!QZ(J))continue;try{let Y=p2(JSON.parse(z0(l($,J)).replace(/^\uFEFF/,""))),W=Y?X(Y):void 0;if(typeof W==="string")return W}catch{}}return}function MG($={}){let Z=$.dir?j9($.dir):process.cwd(),z;try{z=VG($.target)}catch(H){console.error(`Error: ${H.message}`),process.exit(2)}let Q=$.faf?j9($.faf):u(Z);if(!Q||!KG(Q))console.error(`Error: project.faf not found
384
384
 
385
- Run 'faf init' to create one.`),process.exit(2);let X=r(Q),J=$.fafa?F9($.fafa):$G(Z),Y=J&&WG(J)?eU(J):void 0,W;try{W=$Z({faf:X,fafa:Y,targets:z,opts:{a2aCardUrl:$.a2aUrl,doorUrl:$.doorUrl,fafPointer:$.fafPointer,now:XE(Z,z)??new Date().toISOString()}})}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}if($.check){process.stdout.write(`${JSON.stringify(W,null,2)}
386
- `);return}let U=[],G=$.force===!0,V=0,H=(q,K,L="its own keys")=>{try{U.push({out:q,changed:K()})}catch(B){if(B instanceof g0)console.error(`faf: ${q}: ${B.message} — faf cannot change only ${L}, so it left the file unchanged.`);else if(w$(B))console.error(K6(B,!0));else throw B;V++}};if(W.a2a){let q=M4(Z,".well-known","agent-card.json");H(q,()=>_9(q,W.a2a,Z,{owns:C9,mark:`FAF context extension (${B4})`,force:G})!=="unchanged")}if(W.mcp){let q=M4(Z,"server-card");H(q,()=>_9(q,W.mcp,Z,{owns:H4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:G})!=="unchanged")}if(W.catalog){let q=M4(Z,".well-known","ai-catalog.json"),K=W.catalog;H(q,()=>{w0(Z,zE(q));let L=l(Z,q),B=P9(q)?J0(L):null,N=QG(B,K);if(N.changed)a(L,N.text,{root:Z,expect:B});return N.changed},"its own rows")}if(W.registry){let q=M4(Z,"server.json");if(P9(q)){let K=W.registry;H(q,()=>{let L=l(Z,q),B=J0(L),N=e5(B,{name:K.name,title:K.title,meta:K._meta});if(N.changed)a(L,N.text,{root:Z,expect:B});return N.changed},"its identity keys")}else if(z?.includes("registry"))console.error(`Error: ${q} not found.
385
+ Run 'faf init' to create one.`),process.exit(2);let X=r(Q),J=$.fafa?j9($.fafa):UG(Z),Y=J&&KG(J)?WG(J):void 0,W;try{W=zZ({faf:X,fafa:Y,targets:z,opts:{a2aCardUrl:$.a2aUrl,doorUrl:$.doorUrl,fafPointer:$.fafPointer,now:KE(Z,z)??new Date().toISOString()}})}catch(H){console.error(`Error: ${H.message}`),process.exit(2)}if($.check){process.stdout.write(`${JSON.stringify(W,null,2)}
386
+ `);return}let U=[],G=$.force===!0,V=0,q=(H,K,L="its own keys")=>{try{U.push({out:H,changed:K()})}catch(B){if(B instanceof g0)console.error(`faf: ${H}: ${B.message} — faf cannot change only ${L}, so it left the file unchanged.`);else if(x$(B))console.error(K6(B,!0));else throw B;V++}};if(W.a2a){let H=f$(Z,".well-known","agent-card.json");q(H,()=>S9(H,W.a2a,Z,{owns:P9,mark:`FAF context extension (${O4})`,force:G})!=="unchanged")}if(W.mcp){let H=f$(Z,"server-card");q(H,()=>S9(H,W.mcp,Z,{owns:M4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:G})!=="unchanged")}if(W.catalog){let H=f$(Z,".well-known","ai-catalog.json"),K=W.catalog;q(H,()=>{S0(Z,BG(H));let L=l(Z,H),B=QZ(H)?z0(L):null,N=F9(B,K,W.catalogHost);if(N.changed)a(L,N.text,{root:Z,expect:B});return N.changed},"its own rows")}if(W.ard){let H=f$(Z,".well-known","ard.json"),K=W.ard;if(q(H,()=>{S0(Z,BG(H));let L=l(Z,H),B=QZ(H)?z0(L):null,N=F9(B,K,W.catalogHost);if(N.changed)a(L,N.text,{root:Z,expect:B});return N.changed},"its own rows"),!K.some((L)=>L.representativeQueries?.length))console.error(`${M("note")} ${H}: no representativeQueries — registries build their search index from these, so the entries are a valid catalog but will not be found. Add 2-5 to the .fafa as metadata.cards.examples.`)}if(W.registry){let H=f$(Z,"server.json");if(QZ(H)){let K=W.registry;q(H,()=>{let L=l(Z,H),B=z0(L),N=ZZ(B,{name:K.name,title:K.title,meta:K._meta});if(N.changed)a(L,N.text,{root:Z,expect:B});return N.changed},"its identity keys")}else if(z?.includes("registry"))console.error(`Error: ${H} not found.
387
387
 
388
- Registry target patches an existing server.json. Seed one first.`),process.exit(2)}if(U.length===0&&V===0){console.error(`${I("faf cards")} ${M("nothing to write — need .fafa for A2A/catalog; server.json for registry")}`);return}for(let{out:q,changed:K}of U)console.error(`${I("✓")} ${q}${K?"":` ${M("(unchanged)")}`}`);if(V>0)process.exit(1)}import{join as JE}from"path";import YE from"open";d();function WE($){if(process.env.CI)return!1;try{return YE($).catch(()=>{return}),!0}catch{return!1}}function GG($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
388
+ Registry target patches an existing server.json. Seed one first.`),process.exit(2)}if(U.length===0&&V===0){console.error(`${I("faf cards")} ${M("nothing to write — need .fafa for A2A/catalog; server.json for registry")}`);return}for(let{out:H,changed:K}of U)console.error(`${I("✓")} ${H}${K?"":` ${M("(unchanged)")}`}`);if(V>0)process.exit(1)}import{join as BE}from"path";import ME from"open";d();function LE($){if(process.env.CI)return!1;try{return ME($).catch(()=>{return}),!0}catch{return!1}}function LG($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
389
389
 
390
- Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=r(Z),X=n(Z,()=>L0(p(Z)));o5(z,Q,X,Z,{force:$.force});let J=JE(z,"project.html"),Y=WE(J);console.log(" project.html"),console.log(Y?`${I("opened")} ${M("in your browser")}`:`${I("rendered")} ${M(`file://${J}`)}`)}import{existsSync as UE}from"fs";import{join as S9,resolve as GE}from"path";import{execFileSync as KG}from"child_process";function VG($){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 HG($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function qG($,Z={}){let z=E$($);if(Z.repoUrl&&z.project&&!D2($)?.name&&z.project.name===$.split("/").pop())z.project.name=HG(Z.repoUrl);return z}d();function VE($){let Z;try{Z=KG("git",["-C",$,"ls-files","-s","-z"],{stdio:["ignore","pipe","pipe"]}).toString()}catch{return 0}let z=0;for(let Q of Z.split("\x00")){if(!Q.startsWith("120000 "))continue;let X=Q.indexOf("\t");if(X<0)continue;let J=S9($,Q.slice(X+1)),Y=j0(J);if(Y===null)continue;try{if(V5(J,{root:$,expect:Y}))z++}catch{}}return z}function HE($,Z,z){return["clone","-c","core.symlinks=false","--depth","1",...z?["--branch",z]:[],"--",$,Z]}function qE($,Z=process.cwd()){if($.stdout)return{outputPath:null};let z=$.output?GE(Z,$.output):S9(Z,"project.faf");if(UE(z)&&!$.force)throw Error(`${z} already exists — refusing to overwrite your context.
391
- `+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:z}}function BG($,Z={},z=process.cwd()){let Q;try{Q=VG($)}catch(W){console.error(`Error: ${W.message}
390
+ Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=r(Z),X=n(Z,()=>L0(p(Z)));t5(z,Q,X,Z,{force:$.force});let J=BE(z,"project.html"),Y=LE(J);console.log(" project.html"),console.log(Y?`${I("opened")} ${M("in your browser")}`:`${I("rendered")} ${M(`file://${J}`)}`)}import{existsSync as NE}from"fs";import{join as w9,resolve as OE}from"path";import{execFileSync as IG}from"child_process";function NG($){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 OG($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function DG($,Z={}){let z=j$($);if(Z.repoUrl&&z.project&&!D2($)?.name&&z.project.name===$.split("/").pop())z.project.name=OG(Z.repoUrl);return z}d();function DE($){let Z;try{Z=IG("git",["-C",$,"ls-files","-s","-z"],{stdio:["ignore","pipe","pipe"]}).toString()}catch{return 0}let z=0;for(let Q of Z.split("\x00")){if(!Q.startsWith("120000 "))continue;let X=Q.indexOf("\t");if(X<0)continue;let J=w9($,Q.slice(X+1)),Y=w0(J);if(Y===null)continue;try{if(K5(J,{root:$,expect:Y}))z++}catch{}}return z}function IE($,Z,z){return["clone","-c","core.symlinks=false","--depth","1",...z?["--branch",z]:[],"--",$,Z]}function TE($,Z=process.cwd()){if($.stdout)return{outputPath:null};let z=$.output?OE(Z,$.output):w9(Z,"project.faf");if(NE(z)&&!$.force)throw Error(`${z} already exists — refusing to overwrite your context.
391
+ `+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:z}}function TG($,Z={},z=process.cwd()){let Q;try{Q=NG($)}catch(W){console.error(`Error: ${W.message}
392
392
 
393
- Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let X;try{X=qE(Z,z)}catch(W){console.error(`Error: ${W.message}`),process.exit(1);return}X2(X.outputPath===null?void 0:Z.output);let J=H5("faf-git-"),Y=S9(J,"repo");try{console.error(M(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{KG("git",HE(Q,Y,Z.ref),{stdio:"pipe"})}catch(V){let q=(V?.stderr?.toString()??"").trim().split(`
393
+ Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let X;try{X=TE(Z,z)}catch(W){console.error(`Error: ${W.message}`),process.exit(1);return}X2(X.outputPath===null?void 0:Z.output);let J=B5("faf-git-"),Y=w9(J,"repo");try{console.error(M(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{IG("git",IE(Q,Y,Z.ref),{stdio:"pipe"})}catch(V){let H=(V?.stderr?.toString()??"").trim().split(`
394
394
  `).slice(-2).join(" ").trim()||"git clone failed",K=Z.ref?`
395
395
 
396
396
  (does the branch/tag '${Z.ref}' exist?)`:"";console.error(`Error: could not clone ${$}
397
397
 
398
- ${q}${K}`),process.exit(1)}VE(Y);let W=qG(Y,{repoUrl:Q});if(X.outputPath===null){process.stdout.write(T3(W));return}B0(X.outputPath,W,{replace:Z.force===!0}),console.log(`${I("created")} ${X.outputPath}`);let U=p(X.outputPath),G=n(X.outputPath,()=>x0(R0(U)));F0(G,X.outputPath)}finally{q5(J)}}import{execFileSync as S2}from"child_process";import{readFileSync as KE,existsSync as BE}from"fs";import{dirname as ME,resolve as LE}from"path";var g$=($)=>String($).trim(),NE="slotignored",MG=($)=>U0($)||typeof $==="string"&&$.trim().toLowerCase()===NE;function OE($,Z){let z=[],Q=0,X=0;for(let J of Q0){let Y=u1($,J),W=u1(Z,J),U=!MG(Y),G=!MG(W);if(U)Q++;if(G)X++;let V=J.label??J.path.split(".").pop()??J.path,H={path:J.path,label:V,category:String(J.category)};if(!U&&G)z.push({...H,kind:"added",to:g$(W)});else if(U&&!G)z.push({...H,kind:"removed",from:g$(Y)});else if(U&&G&&g$(Y)!==g$(W))z.push({...H,kind:"changed",from:g$(Y),to:g$(W)})}return{changes:z,filledBase:Q,filledTarget:X}}function LG($){if(!$.trim())return 0;try{return L0($).score??0}catch{return 0}}function NG($){if(!$.trim())return{};try{return z2($)??{}}catch{return{}}}function QZ($,Z){let{changes:z,filledBase:Q,filledTarget:X}=OE(NG($),NG(Z)),J=LG($),Y=LG(Z);return{changes:z,scoreBase:J,scoreTarget:Y,scoreDelta:Y-J,filledBase:Q,filledTarget:X}}var DE={added:"+",removed:"-",changed:"~"},OG=($)=>$>0?`+${$}`:`${$}`,ZZ=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function IG($,Z,z){let Q=[],X=N2(G6($.scoreBase)),J=N2(G6($.scoreTarget));if(Q.push(`project.faf ${Z} → ${z}`),Q.push(`Score: ${$.scoreBase}% ${X} → ${$.scoreTarget}% ${J} (${OG($.scoreDelta)})`),Q.push(""),$.changes.length===0)Q.push(" (no slot changes)");else{let Y="";for(let W of $.changes){if(W.category!==Y)Q.push(` ${W.category}`),Y=W.category;let U=DE[W.kind],G=W.label.padEnd(16);if(W.kind==="changed")Q.push(` ${U} ${G} ${ZZ(W.from)} → ${ZZ(W.to)}`);else if(W.kind==="added")Q.push(` ${U} ${G} ${ZZ(W.to)} (added)`);else Q.push(` ${U} ${G} ${ZZ(W.from)} (removed)`)}}return Q.push(""),Q.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${OG($.filledTarget-$.filledBase)})`),Q.join(`
399
- `)}function IE($,Z){try{return S2("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function L4($,Z){if(!IE($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function h$($,Z,z){try{return S2("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function TG($){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"&&BE(J)?KE(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=QZ(z($[1]),z($[4]));console.log(IG(X,Q($[1],$[2]),Q($[4],$[5])))}catch(z){console.log(`${Z} — faf diff unavailable (${z instanceof Error?z.message:"error"})`)}}var zZ="*.faf diff=faf";function E9($){let[Z,...z]=$.trim().split(/\s+/);try{return S2(Z,z,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function AG($){try{return S2("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 r0="faf-cli diff-driver";function CG($,Z,z){try{return S2("git",["config","--null",...Z],{cwd:$,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch(Q){if(Q.status===1)return"";let X=String(Q.stderr??"").trim().split(`
400
- `)[0]||"git config failed";throw Error(`git cannot read ${z} (${X})`,{cause:Q})}}function j9($,Z=!1){return CG($,[...Z?["--local"]:[],"--get-all","diff.faf.command"],"diff.faf.command").split("\x00").slice(0,-1)}function TE($){let z=CG($,["--get-regexp","^diff\\.faf\\."],"the diff.faf settings").split("\x00").slice(0,-1).map((Q)=>Q.split(`
401
- `)[0]);return[...new Set(z.filter((Q)=>Q!=="diff.faf.command"))]}var _G=($)=>$.map((Z)=>JSON.stringify(Z)).join(", ");function AE($){let Z=l($,".gitattributes"),z=B6(Z),Q=z??"";if(Q.split(`
402
- `).some((Y)=>Y.trim()===zZ)){console.log(`• .gitattributes already opts in (${zZ})`);return}let X=Q.includes(`\r
398
+ ${H}${K}`),process.exit(1)}DE(Y);let W=DG(Y,{repoUrl:Q});if(X.outputPath===null){process.stdout.write(_3(W));return}B0(X.outputPath,W,{replace:Z.force===!0}),console.log(`${I("created")} ${X.outputPath}`);let U=p(X.outputPath),G=n(X.outputPath,()=>x0(R0(U)));F0(G,X.outputPath)}finally{M5(J)}}import{execFileSync as S2}from"child_process";import{readFileSync as AE,existsSync as CE}from"fs";import{dirname as _E,resolve as RE}from"path";var u$=($)=>String($).trim(),FE="slotignored",AG=($)=>U0($)||typeof $==="string"&&$.trim().toLowerCase()===FE;function PE($,Z){let z=[],Q=0,X=0;for(let J of X0){let Y=p1($,J),W=p1(Z,J),U=!AG(Y),G=!AG(W);if(U)Q++;if(G)X++;let V=J.label??J.path.split(".").pop()??J.path,q={path:J.path,label:V,category:String(J.category)};if(!U&&G)z.push({...q,kind:"added",to:u$(W)});else if(U&&!G)z.push({...q,kind:"removed",from:u$(Y)});else if(U&&G&&u$(Y)!==u$(W))z.push({...q,kind:"changed",from:u$(Y),to:u$(W)})}return{changes:z,filledBase:Q,filledTarget:X}}function CG($){if(!$.trim())return 0;try{return L0($).score??0}catch{return 0}}function _G($){if(!$.trim())return{};try{return z2($)??{}}catch{return{}}}function YZ($,Z){let{changes:z,filledBase:Q,filledTarget:X}=PE(_G($),_G(Z)),J=CG($),Y=CG(Z);return{changes:z,scoreBase:J,scoreTarget:Y,scoreDelta:Y-J,filledBase:Q,filledTarget:X}}var SE={added:"+",removed:"-",changed:"~"},RG=($)=>$>0?`+${$}`:`${$}`,XZ=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function PG($,Z,z){let Q=[],X=N2(G6($.scoreBase)),J=N2(G6($.scoreTarget));if(Q.push(`project.faf ${Z} → ${z}`),Q.push(`Score: ${$.scoreBase}% ${X} → ${$.scoreTarget}% ${J} (${RG($.scoreDelta)})`),Q.push(""),$.changes.length===0)Q.push(" (no slot changes)");else{let Y="";for(let W of $.changes){if(W.category!==Y)Q.push(` ${W.category}`),Y=W.category;let U=SE[W.kind],G=W.label.padEnd(16);if(W.kind==="changed")Q.push(` ${U} ${G} ${XZ(W.from)} → ${XZ(W.to)}`);else if(W.kind==="added")Q.push(` ${U} ${G} ${XZ(W.to)} (added)`);else Q.push(` ${U} ${G} ${XZ(W.from)} (removed)`)}}return Q.push(""),Q.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${RG($.filledTarget-$.filledBase)})`),Q.join(`
399
+ `)}function EE($,Z){try{return S2("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function D4($,Z){if(!EE($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function m$($,Z,z){try{return S2("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function SG($){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"&&CE(J)?AE(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=YZ(z($[1]),z($[4]));console.log(PG(X,Q($[1],$[2]),Q($[4],$[5])))}catch(z){console.log(`${Z} — faf diff unavailable (${z instanceof Error?z.message:"error"})`)}}var JZ="*.faf diff=faf";function x9($){let[Z,...z]=$.trim().split(/\s+/);try{return S2(Z,z,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function EG($){try{return S2("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 r0="faf-cli diff-driver";function jG($,Z,z){try{return S2("git",["config","--null",...Z],{cwd:$,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch(Q){if(Q.status===1)return"";let X=String(Q.stderr??"").trim().split(`
400
+ `)[0]||"git config failed";throw Error(`git cannot read ${z} (${X})`,{cause:Q})}}function y9($,Z=!1){return jG($,[...Z?["--local"]:[],"--get-all","diff.faf.command"],"diff.faf.command").split("\x00").slice(0,-1)}function jE($){let z=jG($,["--get-regexp","^diff\\.faf\\."],"the diff.faf settings").split("\x00").slice(0,-1).map((Q)=>Q.split(`
401
+ `)[0]);return[...new Set(z.filter((Q)=>Q!=="diff.faf.command"))]}var wG=($)=>$.map((Z)=>JSON.stringify(Z)).join(", ");function wE($){let Z=l($,".gitattributes"),z=B6(Z),Q=z??"";if(Q.split(`
402
+ `).some((Y)=>Y.trim()===JZ)){console.log(`• .gitattributes already opts in (${JZ})`);return}let X=Q.includes(`\r
403
403
  `)?`\r
404
404
  `:`
405
405
  `,J=`${Q}${Q&&!Q.endsWith(`
406
- `)?X:""}${zZ}${X}`;a(Z,J,{root:$,expect:z}),console.log(`✅ .gitattributes ${zZ}`)}function CE($){let Z=AG($),z;try{z=j9($)}catch(J){return console.error(`faf: ${J.message} — faf left your git config unchanged.`),!1}let Q=z.length===1&&z[0]===r0;if(z.length>0&&!Q)return console.error(`faf: diff.faf.command is already set to ${_G(z)}, not faf's driver (${r0}) — faf left your git config and .gitattributes unchanged.`),!1;let X;try{X=TE($)}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(AE(Z),Q)console.log(`• git config already set (diff.faf.command = ${r0})`);else S2("git",["config","diff.faf.command",r0],{cwd:$}),console.log(`✅ git config diff.faf.command = ${r0}`);if(console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!E9(r0))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 _E='[diff "faf"]',RE=` command = ${r0}`,RG=($)=>/\r(?!\n)/.test($),FE=($)=>(/\\+$/.exec(J2($))?.[0].length??0)%2===1;function PE($){if(RG($))return null;let Z=i6($),z=Z.map((V,H)=>H>0&&FE(Z[H-1])),Q=Z.map((V,H)=>!z[H]&&J2(V).trimStart().startsWith("[")),X=[],J=-1;if(Z.forEach((V,H)=>{if(Q[H])J=J2(V)===_E?H:-1;else if(J>=0&&!z[H]&&J2(V)===RE)X.push({at:H,head:J})}),X.length!==1)return null;let{at:Y,head:W}=X[0],U=Y+1;while(U<Z.length&&!Q[U])U++;if(Z.slice(W+1,U).some((V,H)=>W+1+H!==Y&&J2(V).trim()!==""))return null;return Z.filter((V,H)=>H!==W&&H!==Y).join("")}function DG($,Z){try{return S2("git",["config","--file","-","--null","--list"],{cwd:$,input:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).split("\x00").slice(0,-1)}catch{return null}}function SE($,Z,z){let Q=DG($,Z),X=DG($,z);if(Q===null||X===null)return!1;let J=`diff.faf.command
407
- ${r0}`,Y=Q.indexOf(J);if(Y<0||Q.lastIndexOf(J)!==Y)return!1;let W=[...Q.slice(0,Y),...Q.slice(Y+1)];return W.length===X.length&&W.every((U,G)=>U===X[G])}function EE($){let Z=j9($,!0);if(Z.length!==1||Z[0]!==r0)return`diff.faf.command = ${r0} is set outside this repo's own config (your global or system git config) — faf left it unchanged.`;let z=LE($,S2("git",["rev-parse","--git-path","config"],{cwd:$,encoding:"utf-8"}).trim()),Q=ME(z);try{let X=l(Q,z,{allowGitConfig:!0}),J=J0(X);if(RG(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=PE(J);if(Y===null||!SE($,J,Y))return`diff.faf.command in ${X} is not in the section faf writes (a [diff "faf"] line and a tab-indented "command = ${r0}" line, with nothing else in the section or on either line) — faf left your git config unchanged.`;return a(X,Y,{root:Q,allowGitConfig:!0,expect:J}),null}catch(X){if(X instanceof b||X instanceof k2)return X.message;throw X}}function jE($){AG($);let Z;try{Z=j9($)}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]!==r0)return console.error(`faf: diff.faf.command is ${_G(Z)}, not faf's driver (${r0}) — faf left your git config unchanged.`),!1;let z;try{z=EE($)}catch(Q){z=`${Q.message.split(`
408
- `)[0]} — faf left your git config unchanged.`}if(z!==null)return console.error(`faf: ${z}`),!1;return console.log("✅ removed diff.faf.command (the .gitattributes line is left for you to keep or delete)."),!0}function FG($,Z={},z=process.cwd()){if(Z.installDriver){if(!CE(z))process.exit(1);return}if(Z.uninstallDriver){if(!jE(z))process.exit(1);return}let Q=u(z);if(!Q)console.error(`Error: project.faf not found
406
+ `)?X:""}${JZ}${X}`;a(Z,J,{root:$,expect:z}),console.log(`✅ .gitattributes ${JZ}`)}function xE($){let Z=EG($),z;try{z=y9($)}catch(J){return console.error(`faf: ${J.message} — faf left your git config unchanged.`),!1}let Q=z.length===1&&z[0]===r0;if(z.length>0&&!Q)return console.error(`faf: diff.faf.command is already set to ${wG(z)}, not faf's driver (${r0}) — faf left your git config and .gitattributes unchanged.`),!1;let X;try{X=jE($)}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(wE(Z),Q)console.log(`• git config already set (diff.faf.command = ${r0})`);else S2("git",["config","diff.faf.command",r0],{cwd:$}),console.log(`✅ git config diff.faf.command = ${r0}`);if(console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!x9(r0))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 yE='[diff "faf"]',kE=` command = ${r0}`,xG=($)=>/\r(?!\n)/.test($),bE=($)=>(/\\+$/.exec(J2($))?.[0].length??0)%2===1;function vE($){if(xG($))return null;let Z=n6($),z=Z.map((V,q)=>q>0&&bE(Z[q-1])),Q=Z.map((V,q)=>!z[q]&&J2(V).trimStart().startsWith("[")),X=[],J=-1;if(Z.forEach((V,q)=>{if(Q[q])J=J2(V)===yE?q:-1;else if(J>=0&&!z[q]&&J2(V)===kE)X.push({at:q,head:J})}),X.length!==1)return null;let{at:Y,head:W}=X[0],U=Y+1;while(U<Z.length&&!Q[U])U++;if(Z.slice(W+1,U).some((V,q)=>W+1+q!==Y&&J2(V).trim()!==""))return null;return Z.filter((V,q)=>q!==W&&q!==Y).join("")}function FG($,Z){try{return S2("git",["config","--file","-","--null","--list"],{cwd:$,input:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).split("\x00").slice(0,-1)}catch{return null}}function gE($,Z,z){let Q=FG($,Z),X=FG($,z);if(Q===null||X===null)return!1;let J=`diff.faf.command
407
+ ${r0}`,Y=Q.indexOf(J);if(Y<0||Q.lastIndexOf(J)!==Y)return!1;let W=[...Q.slice(0,Y),...Q.slice(Y+1)];return W.length===X.length&&W.every((U,G)=>U===X[G])}function hE($){let Z=y9($,!0);if(Z.length!==1||Z[0]!==r0)return`diff.faf.command = ${r0} is set outside this repo's own config (your global or system git config) — faf left it unchanged.`;let z=RE($,S2("git",["rev-parse","--git-path","config"],{cwd:$,encoding:"utf-8"}).trim()),Q=_E(z);try{let X=l(Q,z,{allowGitConfig:!0}),J=z0(X);if(xG(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=vE(J);if(Y===null||!gE($,J,Y))return`diff.faf.command in ${X} is not in the section faf writes (a [diff "faf"] line and a tab-indented "command = ${r0}" line, with nothing else in the section or on either line) — faf left your git config unchanged.`;return a(X,Y,{root:Q,allowGitConfig:!0,expect:J}),null}catch(X){if(X instanceof b||X instanceof k2)return X.message;throw X}}function fE($){EG($);let Z;try{Z=y9($)}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]!==r0)return console.error(`faf: diff.faf.command is ${wG(Z)}, not faf's driver (${r0}) — faf left your git config unchanged.`),!1;let z;try{z=hE($)}catch(Q){z=`${Q.message.split(`
408
+ `)[0]} — faf left your git config unchanged.`}if(z!==null)return console.error(`faf: ${z}`),!1;return console.log("✅ removed diff.faf.command (the .gitattributes line is left for you to keep or delete)."),!0}function yG($,Z={},z=process.cwd()){if(Z.installDriver){if(!xE(z))process.exit(1);return}if(Z.uninstallDriver){if(!fE(z))process.exit(1);return}let Q=u(z);if(!Q)console.error(`Error: project.faf not found
409
409
 
410
- Run 'faf init' to create one.`),process.exit(2);let X;try{X=S2("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=_$(Q,z),Y,W,U,G;if(!$)Y="HEAD",W="(working tree)",U=h$("HEAD",J,z),G=p(Q);else if($.includes("...")){let[H,q]=$.split("...");L4(H,z),L4(q,z);let K;try{K=S2("git",["merge-base",H,q],{cwd:z,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${H}' and '${q}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=K.slice(0,7),W=q,U=h$(K,J,z),G=h$(q,J,z)}else if($.includes("..")){let[H,q]=$.split("..");L4(H,z),L4(q,z),Y=H,W=q,U=h$(H,J,z),G=h$(q,J,z)}else L4($,z),Y=$,W="(working tree)",U=h$($,J,z),G=p(Q);let V=QZ(U,G);if(Z.json)console.log(JSON.stringify({base:Y,target:W,...V},null,2));else console.log(IG(V,Y,W))}import{execFileSync as w9}from"child_process";function wE($){if(!$.trim())return 0;try{return L0($).score??0}catch{return 0}}var xE=($)=>$>0?`+${$}`:`${$}`;function yE($){let Z=$.map((z)=>({...z,score:wE(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 kE($,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?" ·":xE(Q.delta).padStart(4);z.push(` ${X} ${J} ${Q.date} ${Q.hex} ${N2(G6(Q.score))} ${Q.subject}`)}return z.join(`
411
- `)}function bE($,Z,z){try{return w9("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function PG($={},Z=process.cwd()){let z=u(Z);if(!z)console.error(`Error: project.faf not found
410
+ Run 'faf init' to create one.`),process.exit(2);let X;try{X=S2("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=R$(Q,z),Y,W,U,G;if(!$)Y="HEAD",W="(working tree)",U=m$("HEAD",J,z),G=p(Q);else if($.includes("...")){let[q,H]=$.split("...");D4(q,z),D4(H,z);let K;try{K=S2("git",["merge-base",q,H],{cwd:z,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${q}' and '${H}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=K.slice(0,7),W=H,U=m$(K,J,z),G=m$(H,J,z)}else if($.includes("..")){let[q,H]=$.split("..");D4(q,z),D4(H,z),Y=q,W=H,U=m$(q,J,z),G=m$(H,J,z)}else D4($,z),Y=$,W="(working tree)",U=m$($,J,z),G=p(Q);let V=YZ(U,G);if(Z.json)console.log(JSON.stringify({base:Y,target:W,...V},null,2));else console.log(PG(V,Y,W))}import{execFileSync as k9}from"child_process";function uE($){if(!$.trim())return 0;try{return L0($).score??0}catch{return 0}}var mE=($)=>$>0?`+${$}`:`${$}`;function cE($){let Z=$.map((z)=>({...z,score:uE(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 pE($,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?" ·":mE(Q.delta).padStart(4);z.push(` ${X} ${J} ${Q.date} ${Q.hex} ${N2(G6(Q.score))} ${Q.subject}`)}return z.join(`
411
+ `)}function lE($,Z,z){try{return k9("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function kG($={},Z=process.cwd()){let z=u(Z);if(!z)console.error(`Error: project.faf not found
412
412
 
413
- Run 'faf init' to create one.`),process.exit(2);let Q;try{Q=w9("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=_$(z,Z),J=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=w9("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",X],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let W=Y.split(`
414
- `).filter(Boolean).map((K)=>{let[L,B,N]=K.split("\x1F");return{hex:L,date:B,subject:N??""}}),U=J>0?Math.min(W.length,J+1):W.length,G=W.slice(0,U).map((K)=>({...K,raw:bE(K.hex,X,Z)})),V=yE(G),H=J>0?V.slice(0,J):V;if($.reverse)H=[...H].reverse();let q=W.length;if($.json)console.log(JSON.stringify({file:X,total:q,count:H.length,entries:H},null,2));else{let K=kE(H,X.split("/").pop()??"project.faf");if(J>0&&q>H.length)K+=`
413
+ Run 'faf init' to create one.`),process.exit(2);let Q;try{Q=k9("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=R$(z,Z),J=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=k9("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",X],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let W=Y.split(`
414
+ `).filter(Boolean).map((K)=>{let[L,B,N]=K.split("\x1F");return{hex:L,date:B,subject:N??""}}),U=J>0?Math.min(W.length,J+1):W.length,G=W.slice(0,U).map((K)=>({...K,raw:lE(K.hex,X,Z)})),V=cE(G),q=J>0?V.slice(0,J):V;if($.reverse)q=[...q].reverse();let H=W.length;if($.json)console.log(JSON.stringify({file:X,total:H,count:q.length,entries:q},null,2));else{let K=pE(q,X.split("/").pop()??"project.faf");if(J>0&&H>q.length)K+=`
415
415
 
416
- … showing ${H.length} of ${q} commits — \`faf log --all\` for the full timeline.`;console.log(K)}}import{execFileSync as N4}from"child_process";import{existsSync as y9,readFileSync as vE,realpathSync as SG,statSync as wG}from"fs";import{resolve as xG,dirname as k9,relative as gE,isAbsolute as hE,sep as fE}from"path";var b9="# >>> faf >>>",yG="# <<< faf <<<",x9=`#!/bin/sh
417
- `,EG="faf-cli hooks-run",uE=($)=>$>0?`+${$}`:`${$}`;function kG($){return N4("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function jG($,Z){try{return N4("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function bG($,Z){try{return N4("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function v9($){let Z=N4("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return xG($,Z)}function mE($,Z){let z=N4("git",["rev-parse","--git-common-dir"],{cwd:$,encoding:"utf-8"}).trim(),Q=SG.native(xG($,z)),X=SG.native(Z),J=gE(Q,X);return{out:J===".."||J.startsWith(`..${fE}`)||hE(J),real:X}}function vG($){let Z=[],z=[],Q=0;for(let X of $.split(/(?<=\n)/)){let J=X.replace(/\n$/,"").replace(/\r$/,"");if(J===b9)Z.push(Q);if(J===yG)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 cE($,Z){if(!Z)return 493;let z=wG($).mode&511;return z|(z&292)>>2}function gG($){try{let Z=l(k9($),$,{allowGitHooks:!0});return{real:Z,text:B6(Z)}}catch(Z){if(Z instanceof b)return`${Z.message} faf left the hook as it is.`;throw Z}}function hG($,Z,z,Q){try{return a($,Z,{root:k9($),allowGitHooks:!0,expect:z,mode:Q}),null}catch(X){if(X instanceof b||X instanceof k2)return X.message;throw X}}var fG="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 uG($={},Z=process.cwd()){try{let z;try{z=kG(Z)}catch{return}let Q=u(Z);if(!Q)return;let X=_$(Q,Z),J=jG(`:${X}`,Z);if(J===null)return;let Y=jG(`HEAD:${X}`,Z)??"",W=QZ(Y,J),U=`${W.scoreBase}% → ${W.scoreTarget}% (${uE(W.scoreDelta)})`;if(W.scoreDelta<0){if(console.error(`⚠ faf: context regressed ${U} — ${W.changes.length} slot change(s)`),$.strict)console.error(" commit blocked (--strict). Fix with `faf score` / `faf sync`, or `git commit --no-verify` to override."),process.exit(1)}else console.log(`✓ faf: context ${U}`)}catch(z){console.error(`faf hooks: skipped (${z instanceof Error?z.message:"error"})`)}}function pE($,Z){let z=$.trim().split(/\s+/)[0],Q=Z?`${$} --strict || exit 1`:`${$} || true`;return[b9,`if command -v ${z} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${Q}`,"fi",yG,""].join(`
418
- `)}function lE($,Z={}){let z;try{z=kG($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let Q=bG("core.hooksPath",$);if(Q){let L=Z.runnerCmd??EG;return console.error(`Error: core.hooksPath is set (${Q}) — a hook manager (husky/lefthook/pre-commit) owns hooks here.`),console.error(" faf won't touch a managed hooks directory. Add this to your pre-commit yourself:"),console.error(` ${L}${Z.strict?" --strict":""}`),!1}let X=v9($),J=Z.runnerCmd??EG;if(!E9(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=pE(J,!!Z.strict),W=k9(X);if(!y9(W))return console.error(`Error: ${W} does not exist — faf does not create folders inside .git. Create it (mkdir -p) and re-run.`),!1;let U=gG(X);if(typeof U==="string")return console.error(`Error: ${U}`),!1;let{real:G,text:V}=U,H=V===null?null:vG(V);if(H==="broken")return console.error(`Error: ${X} ${fG}`),!1;let q;if(V===null)q=`${x9}${Y}`;else if(H)q=V.slice(0,H.start)+Y+V.slice(H.end);else{let L=mE($,W);if(L.out)return console.error(`Error: ${X} is in a hooks folder outside this repo (${L.real}) and faf did not write it — faf left it as it is. Add \`${J}${Z.strict?" --strict":""}\` to it yourself.`),!1;if(V.trim()==="")q=`${x9}${Y}${V}`;else q=V.endsWith(`
416
+ … showing ${q.length} of ${H} commits — \`faf log --all\` for the full timeline.`;console.log(K)}}import{execFileSync as I4}from"child_process";import{existsSync as v9,readFileSync as dE,realpathSync as bG,statSync as hG}from"fs";import{resolve as fG,dirname as g9,relative as iE,isAbsolute as nE,sep as rE}from"path";var h9="# >>> faf >>>",uG="# <<< faf <<<",b9=`#!/bin/sh
417
+ `,vG="faf-cli hooks-run",sE=($)=>$>0?`+${$}`:`${$}`;function mG($){return I4("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function gG($,Z){try{return I4("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function cG($,Z){try{return I4("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function f9($){let Z=I4("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return fG($,Z)}function oE($,Z){let z=I4("git",["rev-parse","--git-common-dir"],{cwd:$,encoding:"utf-8"}).trim(),Q=bG.native(fG($,z)),X=bG.native(Z),J=iE(Q,X);return{out:J===".."||J.startsWith(`..${rE}`)||nE(J),real:X}}function pG($){let Z=[],z=[],Q=0;for(let X of $.split(/(?<=\n)/)){let J=X.replace(/\n$/,"").replace(/\r$/,"");if(J===h9)Z.push(Q);if(J===uG)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 aE($,Z){if(!Z)return 493;let z=hG($).mode&511;return z|(z&292)>>2}function lG($){try{let Z=l(g9($),$,{allowGitHooks:!0});return{real:Z,text:B6(Z)}}catch(Z){if(Z instanceof b)return`${Z.message} faf left the hook as it is.`;throw Z}}function dG($,Z,z,Q){try{return a($,Z,{root:g9($),allowGitHooks:!0,expect:z,mode:Q}),null}catch(X){if(X instanceof b||X instanceof k2)return X.message;throw X}}var iG="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 nG($={},Z=process.cwd()){try{let z;try{z=mG(Z)}catch{return}let Q=u(Z);if(!Q)return;let X=R$(Q,Z),J=gG(`:${X}`,Z);if(J===null)return;let Y=gG(`HEAD:${X}`,Z)??"",W=YZ(Y,J),U=`${W.scoreBase}% → ${W.scoreTarget}% (${sE(W.scoreDelta)})`;if(W.scoreDelta<0){if(console.error(`⚠ faf: context regressed ${U} — ${W.changes.length} slot change(s)`),$.strict)console.error(" commit blocked (--strict). Fix with `faf score` / `faf sync`, or `git commit --no-verify` to override."),process.exit(1)}else console.log(`✓ faf: context ${U}`)}catch(z){console.error(`faf hooks: skipped (${z instanceof Error?z.message:"error"})`)}}function tE($,Z){let z=$.trim().split(/\s+/)[0],Q=Z?`${$} --strict || exit 1`:`${$} || true`;return[h9,`if command -v ${z} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${Q}`,"fi",uG,""].join(`
418
+ `)}function eE($,Z={}){let z;try{z=mG($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let Q=cG("core.hooksPath",$);if(Q){let L=Z.runnerCmd??vG;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=f9($),J=Z.runnerCmd??vG;if(!x9(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=tE(J,!!Z.strict),W=g9(X);if(!v9(W))return console.error(`Error: ${W} does not exist — faf does not create folders inside .git. Create it (mkdir -p) and re-run.`),!1;let U=lG(X);if(typeof U==="string")return console.error(`Error: ${U}`),!1;let{real:G,text:V}=U,q=V===null?null:pG(V);if(q==="broken")return console.error(`Error: ${X} ${iG}`),!1;let H;if(V===null)H=`${b9}${Y}`;else if(q)H=V.slice(0,q.start)+Y+V.slice(q.end);else{let L=oE($,W);if(L.out)return console.error(`Error: ${X} is in a hooks folder outside this repo (${L.real}) and faf did not write it — faf left it as it is. Add \`${J}${Z.strict?" --strict":""}\` to it yourself.`),!1;if(V.trim()==="")H=`${b9}${Y}${V}`;else H=V.endsWith(`
419
419
  `)?`${V}
420
420
  ${Y}`:`${V}
421
421
 
422
- ${Y}`}let K=hG(X,q,V,cE(G,V!==null));if(K)return console.error(`Error: ${K}`),!1;return console.log(`✅ pre-commit context guard installed — ${Z.strict?"STRICT (blocks on score regression)":"warn (informs only)"}`),console.log(" Skips when no .faf is staged · respects `git commit --no-verify` · fails open."),!0}function dE($,Z){if($===x9&&Z.trim()==="")return"";return $.endsWith(`
422
+ ${Y}`}let K=dG(X,H,V,aE(G,V!==null));if(K)return console.error(`Error: ${K}`),!1;return console.log(`✅ pre-commit context guard installed — ${Z.strict?"STRICT (blocks on score regression)":"warn (informs only)"}`),console.log(" Skips when no .faf is staged · respects `git commit --no-verify` · fails open."),!0}function $j($,Z){if($===b9&&Z.trim()==="")return"";return $.endsWith(`
423
423
 
424
- `)&&$.slice(0,-1).trim()!==""?$.slice(0,-1):$}function iE($){let Z;try{Z=v9($)}catch{return console.error("Error: not a git repository."),!1}if(!y9(Z))return console.log("• no pre-commit hook to clean."),!0;let z=gG(Z);if(typeof z==="string")return console.error(`Error: ${z}`),!1;let{real:Q,text:X}=z,J=X===null?null:vG(X);if(J==="broken")return console.error(`Error: ${Z} ${fG}`),!1;if(X===null||J===null)return console.log("• faf block not found in pre-commit — nothing to remove."),!0;let Y=X.slice(J.end),W=hG(Z,dE(X.slice(0,J.start),Y)+Y,X,wG(Q).mode&511);if(W)return console.error(`Error: ${W}`),!1;return console.log("✅ faf pre-commit block removed (other hook content preserved)."),!0}function nE($){let Z;try{Z=v9($)}catch{console.error("Error: not a git repository.");return}let z=bG("core.hooksPath",$),Q=y9(Z)?vE(Z,"utf-8"):"",X=Q.includes(b9),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 mG($={}){let Z=process.cwd();if($.install){if(!lE(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!iE(Z))process.exit(2);return}nE(Z)}d();function cG($={}){if($.version||Object.keys($).length===0)sE()}function sE(){let $=g9();console.log(`${I(C("faf"))} v${$.version}`),console.log(M(`kernel ${cY()} IANA application/vnd.faf+yaml`))}var O4=[{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"}];d();function pG(){console.log(`${I("formats")} ${M("— supported file types")}
425
- `);let $=new Map;for(let Z of O4){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(` ${O4.length} formats across ${$.size} categories`))}d();function lG(){let $=0;try{$=XY("faf-git-")}catch{}if($>0)console.log(`${I("cleared")} ${$} cached director${$===1?"y":"ies"}`);else console.log(M("nothing to clear"))}function dG($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
424
+ `)&&$.slice(0,-1).trim()!==""?$.slice(0,-1):$}function Zj($){let Z;try{Z=f9($)}catch{return console.error("Error: not a git repository."),!1}if(!v9(Z))return console.log("• no pre-commit hook to clean."),!0;let z=lG(Z);if(typeof z==="string")return console.error(`Error: ${z}`),!1;let{real:Q,text:X}=z,J=X===null?null:pG(X);if(J==="broken")return console.error(`Error: ${Z} ${iG}`),!1;if(X===null||J===null)return console.log("• faf block not found in pre-commit — nothing to remove."),!0;let Y=X.slice(J.end),W=dG(Z,$j(X.slice(0,J.start),Y)+Y,X,hG(Q).mode&511);if(W)return console.error(`Error: ${W}`),!1;return console.log("✅ faf pre-commit block removed (other hook content preserved)."),!0}function zj($){let Z;try{Z=f9($)}catch{console.error("Error: not a git repository.");return}let z=cG("core.hooksPath",$),Q=v9(Z)?dE(Z,"utf-8"):"",X=Q.includes(h9),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 rG($={}){let Z=process.cwd();if($.install){if(!eE(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!Zj(Z))process.exit(2);return}zj(Z)}d();function sG($={}){if($.version||Object.keys($).length===0)Xj()}function Xj(){let $=u9();console.log(`${I(C("faf"))} v${$.version}`),console.log(M(`kernel ${iY()} IANA application/vnd.faf+yaml`))}var T4=[{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"}];d();function oG(){console.log(`${I("formats")} ${M("— supported file types")}
425
+ `);let $=new Map;for(let Z of T4){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(` ${T4.length} formats across ${$.size} categories`))}d();function aG(){let $=0;try{$=WY("faf-git-")}catch{}if($>0)console.log(`${I("cleared")} ${$} cached director${$===1?"y":"ies"}`);else console.log(M("nothing to clear"))}function tG($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
426
426
 
427
- Run 'faf init' to create one.`),process.exit(2);if($.json){let z=r(Z);console.log(JSON.stringify(z,null,2))}else{let z=p(Z);console.log(z)}}d();function iG(){let $=u();if(!$)console.error(`Error: project.faf not found
427
+ Run 'faf init' to create one.`),process.exit(2);if($.json){let z=r(Z);console.log(JSON.stringify(z,null,2))}else{let z=p(Z);console.log(z)}}d();function eG(){let $=u();if(!$)console.error(`Error: project.faf not found
428
428
 
429
- Run 'faf init' to create one.`),process.exit(2);let Z=r($),z=[];for(let Q of Q0){let[X,J]=Q.path.split("."),W=Z[X]?.[J];if(U0(W)||W==="slotignored")continue;z.push(`${Q.path}: ${W}`)}if(z.length===0){console.log(M("no populated slots"));return}console.log(z.join(`
430
- `))}import{existsSync as oE,statSync as nG}from"fs";import{dirname as aE,join as tE}from"path";var eE=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"],$j=1000;function rG($,Z=aE($)){let z=nG($).mtimeMs,Q=eE.map((X)=>{let J=tE(Z,X);if(!oE(J))return{file:X,exists:!1,mtime_ms:null,status:"missing",delta_ms:null};let Y=nG(J).mtimeMs,W=Y-z,U;if(Math.abs(W)<$j)U="in-sync";else if(W>0)U="newer";else U="older";return{file:X,exists:!0,mtime_ms:Y,status:U,delta_ms:W}});return{source:$,source_mtime_ms:z,targets:Q,drifted:Q.filter((X)=>X.status==="newer"||X.status==="older").length,in_sync:Q.filter((X)=>X.status==="in-sync").length,missing:Q.filter((X)=>X.status==="missing").length}}d();function oG($={}){let Z=u();if(!Z){if($.json)console.log(JSON.stringify({error:"project.faf not found",hint:"run 'faf init' to create one"},null,2));else console.error(`Error: project.faf not found
429
+ Run 'faf init' to create one.`),process.exit(2);let Z=r($),z=[];for(let Q of X0){let[X,J]=Q.path.split("."),W=Z[X]?.[J];if(U0(W)||W==="slotignored")continue;z.push(`${Q.path}: ${W}`)}if(z.length===0){console.log(M("no populated slots"));return}console.log(z.join(`
430
+ `))}import{existsSync as Jj,statSync as $V}from"fs";import{dirname as Yj,join as Wj}from"path";var Uj=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"],Gj=1000;function ZV($,Z=Yj($)){let z=$V($).mtimeMs,Q=Uj.map((X)=>{let J=Wj(Z,X);if(!Jj(J))return{file:X,exists:!1,mtime_ms:null,status:"missing",delta_ms:null};let Y=$V(J).mtimeMs,W=Y-z,U;if(Math.abs(W)<Gj)U="in-sync";else if(W>0)U="newer";else U="older";return{file:X,exists:!0,mtime_ms:Y,status:U,delta_ms:W}});return{source:$,source_mtime_ms:z,targets:Q,drifted:Q.filter((X)=>X.status==="newer"||X.status==="older").length,in_sync:Q.filter((X)=>X.status==="in-sync").length,missing:Q.filter((X)=>X.status==="missing").length}}d();function QV($={}){let Z=u();if(!Z){if($.json)console.log(JSON.stringify({error:"project.faf not found",hint:"run 'faf init' to create one"},null,2));else console.error(`Error: project.faf not found
431
431
 
432
- Run 'faf init' to create one.`);process.exit(2)}let z=rG(Z,process.cwd());if($.json){let Q=r(Z),X={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",...z};console.log(JSON.stringify(X,null,2));return}Zj(z)}function Zj($){console.log(`${I("drift")} ${M("— context file sync status")}
433
- `),console.log(` ${C(".faf")} ${M(sG($.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(sG(Z.mtime_ms));if(Z.status==="in-sync")console.log(` ${I("●")} ${Z.file} ${M("in sync")}`);else if(Z.status==="newer")console.log(` ${C("!")} ${Z.file} ${C("newer")} ${z}`);else console.log(` ${M("○")} ${Z.file} ${M("older")} ${z}`)}if($.drifted>0)console.log(M(`
434
- run ${C("'faf sync'")} to resolve drift`))}function sG($){let Z=Date.now()-$,z=Math.floor(Z/1000);if(z<60)return`${z}s ago`;let Q=Math.floor(z/60);if(Q<60)return`${Q}m ago`;let X=Math.floor(Q/60);if(X<24)return`${X}h ago`;return`${Math.floor(X/24)}d ago`}function h9($,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 D4($,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 I4($,Z){return`cannot set ${$}: ${Z.at} is ${k6(Z.value)}, not a mapping. `+`faf will not replace it — make ${Z.at} a mapping in project.faf by hand, then run again.`}function XZ($,Z,z){let Q=D4($,Z);if(Q)throw Error(I4(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}d();function aG($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
432
+ Run 'faf init' to create one.`);process.exit(2)}let z=ZV(Z,process.cwd());if($.json){let Q=r(Z),X={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",...z};console.log(JSON.stringify(X,null,2));return}Vj(z)}function Vj($){console.log(`${I("drift")} ${M("— context file sync status")}
433
+ `),console.log(` ${C(".faf")} ${M(zV($.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(zV(Z.mtime_ms));if(Z.status==="in-sync")console.log(` ${I("●")} ${Z.file} ${M("in sync")}`);else if(Z.status==="newer")console.log(` ${C("!")} ${Z.file} ${C("newer")} ${z}`);else console.log(` ${M("○")} ${Z.file} ${M("older")} ${z}`)}if($.drifted>0)console.log(M(`
434
+ run ${C("'faf sync'")} to resolve drift`))}function zV($){let Z=Date.now()-$,z=Math.floor(Z/1000);if(z<60)return`${z}s ago`;let Q=Math.floor(z/60);if(Q<60)return`${Q}m ago`;let X=Math.floor(Q/60);if(X<24)return`${X}h ago`;return`${Math.floor(X/24)}d ago`}function m9($,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 A4($,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 C4($,Z){return`cannot set ${$}: ${Z.at} is ${b6(Z.value)}, not a mapping. `+`faf will not replace it — make ${Z.at} a mapping in project.faf by hand, then run again.`}function WZ($,Z,z){let Q=A4($,Z);if(Q)throw Error(C4(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}d();function XV($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
435
435
 
436
436
  Example: faf edit project.name "My Project"`),process.exit(1);let z=u();if(!z)console.error(`Error: project.faf not found
437
437
 
438
- Run 'faf init' to create one.`),process.exit(2);let Q=r(z);if($.split(".").length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let J=D4(Q,$);if(J)console.error(`Error: ${I4($,J)}`),process.exit(1);XZ(Q,$,Z);let Y=[];if(B0(z,Q,{onAliasKept:(W)=>Y.push(m0(W))}),Y.length>0){for(let W of Y)console.error(`Error: ${W}. Change the value its anchor holds, or replace the alias by hand.`);process.exit(1)}console.log(`${I("updated")} ${$} ${M("→")} ${Z}`)}import{existsSync as zj,lstatSync as Qj}from"fs";import{join as u9}from"path";d();function Xj($){try{return Qj($),!0}catch{return!1}}function f9($,Z,z){if(!Xj(u9($,Z)))return null;try{return J0(l($,Z,{read:!0}))}catch(Q){if(!(Q instanceof b))throw Q;return console.error(K6(Q,!1)),z.push(Z),null}}function tG(){let $=process.cwd(),Z=[],z=[],Q={faf_version:V6,project:{}},X=f9($,"CLAUDE.md",z);if(X!==null){let G=l5(X);if(G.project?.name)Q.project.name=G.project.name;if(G.project?.goal)Q.project.goal=G.project.goal;if(G.project?.main_language)Q.project.main_language=G.project.main_language;Z.push("CLAUDE.md")}let J=f9($,"AGENTS.md",z);if(J!==null){if(!Q.project.name){let G=J.match(/^#\s+(.+)/m);if(G)Q.project.name=G[1].trim()}Z.push("AGENTS.md")}let Y=f9($,"GEMINI.md",z);if(Y!==null){if(!Q.project.name){let G=Y.match(/^#\s+(.+)/m);if(G)Q.project.name=G[1].trim()}Z.push("GEMINI.md")}let W=u9($,".cursorrules");if(zj(W))Z.push(".cursorrules");if(Z.length===0){if(z.length>0)console.error(`Nothing to recover from: ${z.join(", ")} ${z.length===1?"was":"were"} refused (above), and no other context file is there. Nothing was written.`),process.exit(1);console.error("No context files found (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules)."),process.exit(2)}let U=u($);if(U){let G=r(U);if(!G.project)G.project={};if(Q.project.name&&!G.project.name)G.project.name=Q.project.name;if(Q.project.goal&&!G.project.goal)G.project.goal=Q.project.goal;if(Q.project.main_language&&!G.project.main_language)G.project.main_language=Q.project.main_language;B0(U,G,{onAliasKept:(V)=>console.log(M(` ${m0(V)}`))}),console.log(`${I("◆")} recover merged into ${U}`)}else{let G=u9($,"project.faf");B0(G,Q),console.log(`${I("◆")} recover created ${G}`)}console.log(M(` sources: ${Z.join(", ")}`))}d();var T4=V6;function eG($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
438
+ Run 'faf init' to create one.`),process.exit(2);let Q=r(z);if($.split(".").length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let J=A4(Q,$);if(J)console.error(`Error: ${C4($,J)}`),process.exit(1);WZ(Q,$,Z);let Y=[];if(B0(z,Q,{onAliasKept:(W)=>Y.push(m0(W))}),Y.length>0){for(let W of Y)console.error(`Error: ${W}. Change the value its anchor holds, or replace the alias by hand.`);process.exit(1)}console.log(`${I("updated")} ${$} ${M("→")} ${Z}`)}import{existsSync as qj,lstatSync as Hj}from"fs";import{join as p9}from"path";d();function Kj($){try{return Hj($),!0}catch{return!1}}function c9($,Z,z){if(!Kj(p9($,Z)))return null;try{return z0(l($,Z,{read:!0}))}catch(Q){if(!(Q instanceof b))throw Q;return console.error(K6(Q,!1)),z.push(Z),null}}function JV(){let $=process.cwd(),Z=[],z=[],Q={faf_version:V6,project:{}},X=c9($,"CLAUDE.md",z);if(X!==null){let G=n5(X);if(G.project?.name)Q.project.name=G.project.name;if(G.project?.goal)Q.project.goal=G.project.goal;if(G.project?.main_language)Q.project.main_language=G.project.main_language;Z.push("CLAUDE.md")}let J=c9($,"AGENTS.md",z);if(J!==null){if(!Q.project.name){let G=J.match(/^#\s+(.+)/m);if(G)Q.project.name=G[1].trim()}Z.push("AGENTS.md")}let Y=c9($,"GEMINI.md",z);if(Y!==null){if(!Q.project.name){let G=Y.match(/^#\s+(.+)/m);if(G)Q.project.name=G[1].trim()}Z.push("GEMINI.md")}let W=p9($,".cursorrules");if(qj(W))Z.push(".cursorrules");if(Z.length===0){if(z.length>0)console.error(`Nothing to recover from: ${z.join(", ")} ${z.length===1?"was":"were"} refused (above), and no other context file is there. Nothing was written.`),process.exit(1);console.error("No context files found (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules)."),process.exit(2)}let U=u($);if(U){let G=r(U);if(!G.project)G.project={};if(Q.project.name&&!G.project.name)G.project.name=Q.project.name;if(Q.project.goal&&!G.project.goal)G.project.goal=Q.project.goal;if(Q.project.main_language&&!G.project.main_language)G.project.main_language=Q.project.main_language;B0(U,G,{onAliasKept:(V)=>console.log(M(` ${m0(V)}`))}),console.log(`${I("◆")} recover merged into ${U}`)}else{let G=p9($,"project.faf");B0(G,Q),console.log(`${I("◆")} recover created ${G}`)}console.log(M(` sources: ${Z.join(", ")}`))}d();var _4=V6;function YV($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
439
439
 
440
- Run 'faf init' to create one.`),process.exit(2);let z=r(Z),Q=z.faf_version??"unknown";if(Q===T4){console.log(`${I("◆")} migrate already at v${T4}`);return}if(z.faf_version=T4,!z.project)z.project={};if(!z.stack)z.stack={};if(!z.human_context)z.human_context={};if(!z.monorepo)z.monorepo={};if($.dryRun){console.log(`${I("◆")} migrate ${M("(dry run)")} v${Q} → v${T4}`),console.log(M(` would update ${Z}`));return}B0(Z,z,{onAliasKept:(X)=>console.log(M(` ${m0(X)}`))}),console.log(`${I("◆")} migrate v${Q} → v${T4}`),console.log(M(` updated ${Z}`))}d();function $V($){if($==="features")Yj();else if($==="activate")Wj();else Jj()}function Jj(){let $=Y4();if(console.log(`${I("pro")} ${M("— FAF Pro status")}
441
- `),console.log(` Status: ${$?_0(C("PRO")):C("Free")}`),console.log(""),!$)console.log(M(" Upgrade: faf pro activate"))}function Yj(){console.log(`${I("pro")} ${M("— Pro features")}
442
- `);let $=[["tri-sync",".faf → CLAUDE.md + Claude Code's MEMORY.md (faf's block only)"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,z]of $)console.log(` ${I("◆")} ${C(Z)} ${M("—")} ${z}`);console.log("")}function Wj(){console.log(`${I("pro")} ${M("— activate")}
443
- `),console.log(" Set FAF_PRO=1 in your environment to enable Pro features."),console.log(""),console.log(M(" export FAF_PRO=1")),console.log(""),console.log(M(" Visit: https://faf.one/pro")),import("open").then(({default:$})=>$("https://faf.one/pro")).catch(()=>{})}import{gzipSync as Uj}from"zlib";d();function ZV($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
440
+ Run 'faf init' to create one.`),process.exit(2);let z=r(Z),Q=z.faf_version??"unknown";if(Q===_4){console.log(`${I("◆")} migrate already at v${_4}`);return}if(z.faf_version=_4,!z.project)z.project={};if(!z.stack)z.stack={};if(!z.human_context)z.human_context={};if(!z.monorepo)z.monorepo={};if($.dryRun){console.log(`${I("◆")} migrate ${M("(dry run)")} v${Q} → v${_4}`),console.log(M(` would update ${Z}`));return}B0(Z,z,{onAliasKept:(X)=>console.log(M(` ${m0(X)}`))}),console.log(`${I("◆")} migrate v${Q} → v${_4}`),console.log(M(` updated ${Z}`))}d();function WV($){if($==="features")Mj();else if($==="activate")Lj();else Bj()}function Bj(){let $=G4();if(console.log(`${I("pro")} ${M("— FAF Pro status")}
441
+ `),console.log(` Status: ${$?_0(C("PRO")):C("Free")}`),console.log(""),!$)console.log(M(" Upgrade: faf pro activate"))}function Mj(){console.log(`${I("pro")} ${M("— Pro features")}
442
+ `);let $=[["tri-sync",".faf → CLAUDE.md + Claude Code's MEMORY.md (faf's block only)"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,z]of $)console.log(` ${I("◆")} ${C(Z)} ${M("—")} ${z}`);console.log("")}function Lj(){console.log(`${I("pro")} ${M("— activate")}
443
+ `),console.log(" Set FAF_PRO=1 in your environment to enable Pro features."),console.log(""),console.log(M(" export FAF_PRO=1")),console.log(""),console.log(M(" Visit: https://faf.one/pro")),import("open").then(({default:$})=>$("https://faf.one/pro")).catch(()=>{})}import{gzipSync as Nj}from"zlib";d();function UV($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
444
444
 
445
- Run 'faf init' to create one.`),process.exit(2);let z=p(Z),X=Uj(Buffer.from(z)).toString("base64url");if($.raw){console.log(X);return}let J=`https://faf.one/share?d=${X}`;if(console.log(`${I("◆")} share ${M(Z)}
445
+ Run 'faf init' to create one.`),process.exit(2);let z=p(Z),X=Nj(Buffer.from(z)).toString("base64url");if($.raw){console.log(X);return}let J=`https://faf.one/share?d=${X}`;if(console.log(`${I("◆")} share ${M(Z)}
446
446
  `),console.log(` ${J}`),$.copy)try{let{execSync:Y}=d0("child_process"),W=process.platform;if(W==="darwin")Y("pbcopy",{input:J});else if(W==="linux")Y("xclip -selection clipboard",{input:J});console.log(M(`
447
447
  copied to clipboard`))}catch{console.log(M(`
448
- copy failed — install xclip or pbcopy`))}}import{join as Gj}from"path";d();function zV(){let $=H5("faf-demo-");console.log(`${I("demo")} ${M("— FAF in action")}
448
+ copy failed — install xclip or pbcopy`))}}import{join as Oj}from"path";d();function GV(){let $=B5("faf-demo-");console.log(`${I("demo")} ${M("— FAF in action")}
449
449
  `);let Z=`faf_version: 2.5.0
450
450
  project:
451
451
  name: acme-app
@@ -471,18 +471,18 @@ human_context:
471
471
  where: Cloud (Vercel + AWS)
472
472
  when: "2026"
473
473
  how: Agile sprints with CI/CD
474
- `,z=Gj($,"project.faf");a(z,Z,{root:$,expect:null}),console.log(` ${C("1.")} Created sample project.faf`),console.log(M(` ${z}
475
- `)),console.log(` ${C("2.")} Scoring...`);let Q=n(z,()=>x0(R0(p(z))));console.log(""),F0(Q,"project.faf",!0),q5($),console.log(`
476
- ${M(' Demo complete. Run "faf init" in your project to get started.')}`)}d();function QV($,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=Q0.filter((Y)=>Y.path.toLowerCase().includes(z)||Y.description.toLowerCase().includes(z)||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${I("slots")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
477
- `);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=O4.filter((Y)=>Y.name.toLowerCase().includes(z)||Y.extensions.some((W)=>W.toLowerCase().includes(z))||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${I("formats")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
478
- `);for(let Y of J)console.log(` ${C(Y.name)} ${M(Y.extensions.join(", "))} ${M(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(X===0)console.log(M(` No results for "${$}"`))}import{existsSync as Vj}from"fs";import{dirname as Hj,join as XV,resolve as qj}from"path";d();function Kj($){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 Bj="Wolfe-Jam/faf-taf-git@v2.2.0";function JV($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;if($==="setup"){Oj(Z);return}Dj(Z)}function Mj($){if(A($,"bun.lockb")||A($,"bun.lock"))return"bun";if(A($,"pnpm-lock.yaml"))return"pnpm";if(A($,"yarn.lock"))return"yarn";return"npm"}var Lj={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: pnpm/action-setup@v4
474
+ `,z=Oj($,"project.faf");a(z,Z,{root:$,expect:null}),console.log(` ${C("1.")} Created sample project.faf`),console.log(M(` ${z}
475
+ `)),console.log(` ${C("2.")} Scoring...`);let Q=n(z,()=>x0(R0(p(z))));console.log(""),F0(Q,"project.faf",!0),M5($),console.log(`
476
+ ${M(' Demo complete. Run "faf init" in your project to get started.')}`)}d();function VV($,Z={}){if(!$)console.error("Usage: faf search <keyword>"),process.exit(2);let z=$.toLowerCase(),Q=!Z.slots&&!Z.formats,X=0;if(Q||Z.slots){let J=X0.filter((Y)=>Y.path.toLowerCase().includes(z)||Y.description.toLowerCase().includes(z)||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${I("slots")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
477
+ `);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=T4.filter((Y)=>Y.name.toLowerCase().includes(z)||Y.extensions.some((W)=>W.toLowerCase().includes(z))||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${I("formats")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
478
+ `);for(let Y of J)console.log(` ${C(Y.name)} ${M(Y.extensions.join(", "))} ${M(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(X===0)console.log(M(` No results for "${$}"`))}import{existsSync as Dj}from"fs";import{dirname as Ij,join as qV,resolve as Tj}from"path";d();function Aj($){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 Cj="Wolfe-Jam/faf-taf-git@v2.2.0";function HV($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;if($==="setup"){Pj(Z);return}Sj(Z)}function _j($){if(A($,"bun.lockb")||A($,"bun.lock"))return"bun";if(A($,"pnpm-lock.yaml"))return"pnpm";if(A($,"yarn.lock"))return"yarn";return"npm"}var Rj={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: pnpm/action-setup@v4
479
479
  - uses: actions/setup-node@v4
480
480
  with:
481
481
  node-version: 20`,install:"pnpm install --frozen-lockfile",test:"pnpm test"},yarn:{setup:` - uses: actions/setup-node@v4
482
482
  with:
483
483
  node-version: 20`,install:"yarn install --frozen-lockfile",test:"yarn test"},npm:{setup:` - uses: actions/setup-node@v4
484
484
  with:
485
- node-version: 20`,install:"npm ci",test:"npm test"}};function Nj($){let Z=`name: TAF Receipts
485
+ node-version: 20`,install:"npm ci",test:"npm test"}};function Fj($){let Z=`name: TAF Receipts
486
486
  `+`# Prints a Test Receipt (.taf) on every push — proof over time, cannot be gamed.
487
487
  `+`# Written by \`faf taf setup\`. Docs: https://github.com/Wolfe-Jam/faf-taf-git
488
488
  on:
@@ -494,7 +494,7 @@ jobs:
494
494
  runs-on: ubuntu-latest
495
495
  steps:
496
496
  - uses: actions/checkout@v4
497
- `,z;if(A($,"package.json")){let X=Lj[Mj($)];z=`${X.setup}
497
+ `,z;if(A($,"package.json")){let X=Rj[_j($)];z=`${X.setup}
498
498
  - run: ${X.install}
499
499
  - name: Run tests
500
500
  run: ${X.test} 2>&1 | tee test-output.txt
@@ -505,71 +505,71 @@ jobs:
505
505
  echo "TODO: your test command" 2>&1 | tee test-output.txt
506
506
  `;let Q=` - name: Print TAF receipt
507
507
  if: github.event_name == 'push'
508
- uses: ${Bj}
508
+ uses: ${Cj}
509
509
  with:
510
510
  test-output-file: test-output.txt
511
511
  auto-commit: 'true'
512
512
  commit-message: 'chore(taf): update .taf receipt [skip ci]'
513
513
  target-branch: taf-receipts
514
- `;return Z+z+Q}function Oj($){let Z=process.cwd(),z=Nj(Z),Q=XV(Z,".github","workflows","taf.yml");if($.write){if(Vj(Q)){console.error(`${C("×")} .github/workflows/taf.yml already exists — not overwriting.`),console.error(M(" Add the faf-taf-git step to your existing workflow, or remove taf.yml and re-run."));return}w0(Z,XV(".github","workflows")),a(Q,z,{root:Z,expect:null}),console.log(`${I("◆")} taf wrote .github/workflows/taf.yml`),console.log(M(" commit + push → your first Test Receipt prints to the taf-receipts branch."));return}console.log(`${I("TAF setup")} ${M("— Test Receipt Printer: proof over time, cannot be gamed")}
515
- `),console.log(M("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(z),console.log(M("Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run."))}function Dj($){console.error(M("note: `faf taf` (score snapshot) is deprecated — use `faf score --json`. (`faf taf setup` wires the Receipt Printer.)"));let Z=u();if(!Z)console.error(`Error: project.faf not found
514
+ `;return Z+z+Q}function Pj($){let Z=process.cwd(),z=Fj(Z),Q=qV(Z,".github","workflows","taf.yml");if($.write){if(Dj(Q)){console.error(`${C("×")} .github/workflows/taf.yml already exists — not overwriting.`),console.error(M(" Add the faf-taf-git step to your existing workflow, or remove taf.yml and re-run."));return}S0(Z,qV(".github","workflows")),a(Q,z,{root:Z,expect:null}),console.log(`${I("◆")} taf wrote .github/workflows/taf.yml`),console.log(M(" commit + push → your first Test Receipt prints to the taf-receipts branch."));return}console.log(`${I("TAF setup")} ${M("— Test Receipt Printer: proof over time, cannot be gamed")}
515
+ `),console.log(M("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(z),console.log(M("Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run."))}function Sj($){console.error(M("note: `faf taf` (score snapshot) is deprecated — use `faf score --json`. (`faf taf setup` wires the Receipt Printer.)"));let Z=u();if(!Z)console.error(`Error: project.faf not found
516
516
 
517
- Run 'faf init' to create one.`),process.exit(2);let z=r(Z),Q=p(Z),X=n(Z,()=>L0(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)X2($.output),W2($.output,Y,{root:Hj(qj($.output)),format:"json",hasMark:Kj,mark:"TAF snapshot (`taf_version`)",force:$.force}),console.log(`${I("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as Ij}from"readline";import{join as YV}from"path";d();var JZ=".faf-session.json";function m9($){if($===null)return null;let Z=new TextDecoder().decode($);try{let z=JSON.parse(Z);if((typeof z==="object"&&z!==null&&!Array.isArray(z)?Object.keys(z).sort().join(","):"")!=="fafPath,slotIndex"||typeof z.slotIndex!=="number"||typeof z.fafPath!=="string")return null;return JSON.stringify({slotIndex:z.slotIndex,fafPath:z.fafPath})===Z?{slotIndex:z.slotIndex,fafPath:z.fafPath}:null}catch{return null}}function WV($){try{return j0(l($,JZ))}catch(Z){if(!(Z instanceof b))throw Z;return console.error(M(` ${JZ}: ${Z.message}`)),null}}function Tj($,Z){try{return F2(YV($,JZ),JSON.stringify(Z),{root:$,owns:(z)=>m9(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 Aj($){let Z=WV($);if(m9(Z)===null||Z===null)return;try{V5(YV($,JZ),{root:$,expect:Z})}catch(z){if(!(z instanceof b))throw z}}function Cj($,Z){let z=new Map;for(let X of Z){let J=D4($,X);if(J&&!z.has(J.at))z.set(J.at,I4(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 _j($,Z){let z=T$(Z)?` ${M(`now '${String(Z).trim()}' — Enter keeps it`)}`:"";return` ${C(`#${$.index}`)} ${m5($.path)} ${M(`(${$.path})`)}${z}: `}async function UV($={}){j$(process.cwd(),"faf go");let Z=u();if(!Z)console.error(`Error: project.faf not found
517
+ Run 'faf init' to create one.`),process.exit(2);let z=r(Z),Q=p(Z),X=n(Z,()=>L0(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)X2($.output),W2($.output,Y,{root:Ij(Tj($.output)),format:"json",hasMark:Aj,mark:"TAF snapshot (`taf_version`)",force:$.force}),console.log(`${I("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as Ej}from"readline";import{join as KV}from"path";d();var UZ=".faf-session.json";function l9($){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 BV($){try{return w0(l($,UZ))}catch(Z){if(!(Z instanceof b))throw Z;return console.error(M(` ${UZ}: ${Z.message}`)),null}}function jj($,Z){try{return F2(KV($,UZ),JSON.stringify(Z),{root:$,owns:(z)=>l9(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 wj($){let Z=BV($);if(l9(Z)===null||Z===null)return;try{K5(KV($,UZ),{root:$,expect:Z})}catch(z){if(!(z instanceof b))throw z}}function xj($,Z){let z=new Map;for(let X of Z){let J=A4($,X);if(J&&!z.has(J.at))z.set(J.at,C4(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 yj($,Z){let z=A$(Z)?` ${M(`now '${String(Z).trim()}' — Enter keeps it`)}`:"";return` ${C(`#${$.index}`)} ${l5($.path)} ${M(`(${$.path})`)}${z}: `}async function MV($={}){w$(process.cwd(),"faf go");let Z=u();if(!Z)console.error(`Error: project.faf not found
518
518
 
519
- Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=0;if($.resume){let L=m9(WV(z));if(L)Q=L.slotIndex,console.log(M(` resuming from slot #${Q+1}`))}let X=r(Z),J=n(Z,()=>x0(R0(p(Z)))),Y=Q0.filter((L)=>{let B=h9(X,L.path);return U0(B)&&B!==m1});if(Cj(X,Y.map((L)=>L.path)),Y.length===0){console.log(`${I("◆")} go all slots populated — ✪ Trophy`),F0(J,Z);return}console.log(`${I("go")} ${M("— guided interview to ✪ Trophy")}`);let W=Y.length===1?"slot":"slots";console.log(M(` ${Y.length} ${W} from Trophy. Enter a value, "skip" to skip, or "quit" to stop.
520
- `));let U=Ij({input:process.stdin,output:process.stdout}),G=(L)=>new Promise((B)=>U.question(L,B)),V=0,H=!1,q=Y.slice(Q);for(let L=0;L<q.length;L++){let B=q[L],N=await G(_j(B,h9(X,B.path)));if(N.toLowerCase()==="quit"){if(H=!0,Tj(z,{slotIndex:Q+L,fafPath:Z}))console.log(M(`
521
- session saved. Resume with: faf go --resume`));break}if(N.toLowerCase()==="skip"||N.trim()==="")continue;XZ(X,B.path,N.trim()),V++}if(U.close(),V>0)B0(Z,X,{onAliasKept:(L)=>console.log(M(` ${m0(L)}`))}),console.log(`
522
- ${I("◆")} go filled ${V} slot${V===1?"":"s"}`);let K=n(Z,()=>x0(R0(p(Z))));if(F0(K,Z),!H)Aj(z)}d();var Tw="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 UH($){if($==="analyze")await Cw();else if($==="enhance")console.error(Tw),process.exit(1);else console.log(`${I("ai")} ${M("— ask Claude for suggestions about project.faf")}
523
- `),console.log(` ${C("faf ai analyze")} ${M("— get improvement suggestions")}`),console.log(""),console.log(M(" Requires ANTHROPIC_API_KEY environment variable."))}async function Aw(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
519
+ Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=0;if($.resume){let L=l9(BV(z));if(L)Q=L.slotIndex,console.log(M(` resuming from slot #${Q+1}`))}let X=r(Z),J=n(Z,()=>x0(R0(p(Z)))),Y=X0.filter((L)=>{let B=m9(X,L.path);return U0(B)&&B!==l1});if(xj(X,Y.map((L)=>L.path)),Y.length===0){console.log(`${I("◆")} go all slots populated — ✪ Trophy`),F0(J,Z);return}console.log(`${I("go")} ${M("— guided interview to ✪ Trophy")}`);let W=Y.length===1?"slot":"slots";console.log(M(` ${Y.length} ${W} from Trophy. Enter a value, "skip" to skip, or "quit" to stop.
520
+ `));let U=Ej({input:process.stdin,output:process.stdout}),G=(L)=>new Promise((B)=>U.question(L,B)),V=0,q=!1,H=Y.slice(Q);for(let L=0;L<H.length;L++){let B=H[L],N=await G(yj(B,m9(X,B.path)));if(N.toLowerCase()==="quit"){if(q=!0,jj(z,{slotIndex:Q+L,fafPath:Z}))console.log(M(`
521
+ session saved. Resume with: faf go --resume`));break}if(N.toLowerCase()==="skip"||N.trim()==="")continue;WZ(X,B.path,N.trim()),V++}if(U.close(),V>0)B0(Z,X,{onAliasKept:(L)=>console.log(M(` ${m0(L)}`))}),console.log(`
522
+ ${I("◆")} go filled ${V} slot${V===1?"":"s"}`);let K=n(Z,()=>x0(R0(p(Z))));if(F0(K,Z),!q)wj(z)}d();var jw="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 Mq($){if($==="analyze")await xw();else if($==="enhance")console.error(jw),process.exit(1);else console.log(`${I("ai")} ${M("— ask Claude for suggestions about project.faf")}
523
+ `),console.log(` ${C("faf ai analyze")} ${M("— get improvement suggestions")}`),console.log(""),console.log(M(" Requires ANTHROPIC_API_KEY environment variable."))}async function ww(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
524
524
 
525
- export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (WH(),YH));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
525
+ export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (Bq(),Kq));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
526
526
 
527
- npm install @anthropic-ai/sdk`),process.exit(2)}}async function Cw(){let $=u();if(!$)console.error(`Error: project.faf not found
527
+ npm install @anthropic-ai/sdk`),process.exit(2)}}async function xw(){let $=u();if(!$)console.error(`Error: project.faf not found
528
528
 
529
- Run 'faf init' to create one.`),process.exit(2);let Z=p($);console.log(`${I("ai")} analyze ${M("getting suggestions...")}`);let Q=await(await Aw()).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.
529
+ Run 'faf init' to create one.`),process.exit(2);let Z=p($);console.log(`${I("ai")} analyze ${M("getting suggestions...")}`);let Q=await(await ww()).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.
530
530
 
531
531
  ${Z}
532
532
 
533
- Be concise. One line per suggestion.`}]});console.log(""),console.log(Q.content[0].text)}import{existsSync as zQ,readFileSync as QQ,readdirSync as _w}from"fs";import{join as GH}from"path";d();function VH($,Z){if($==="import")Rw(Z);else if($==="export")Fw();else console.log(`${I("conductor")} ${M("— conductor integration")}
534
- `),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 Rw($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!zQ($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:V6,project:{}};if(zQ($)&&$.endsWith(".json")){let X=JSON.parse(QQ($,"utf-8"));if(X.name)Z.project.name=X.name;if(X.description)Z.project.goal=X.description;if(X.language)Z.project.main_language=X.language}else if(zQ($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let X=i0(QQ($,"utf-8"));if(X.name)Z.project.name=X.name;if(X.description)Z.project.goal=X.description;if(X.language)Z.project.main_language=X.language}else try{let X=_w($);for(let J of X){let Y=GH($,J);if(J.endsWith(".json"))try{let W=JSON.parse(QQ(Y,"utf-8"));if(W.name&&!Z.project.name)Z.project.name=W.name;if(W.description&&!Z.project.goal)Z.project.goal=W.description}catch{}}}catch{console.error(`Error: could not read directory: ${$}`),process.exit(2)}let z=process.cwd(),Q=u(z);if(Q){let X=r(Q);if(!X.project)X.project={};if(Z.project.name&&!X.project.name)X.project.name=Z.project.name;if(Z.project.goal&&!X.project.goal)X.project.goal=Z.project.goal;if(Z.project.main_language&&!X.project.main_language)X.project.main_language=Z.project.main_language;B0(Q,X,{onAliasKept:(J)=>console.log(M(` ${m0(J)}`))}),console.log(`${I("◆")} conductor import merged into ${Q}`)}else{let X=GH(z,"project.faf");B0(X,Z),console.log(`${I("◆")} conductor import created ${X}`)}}function Fw(){let $=u();if(!$)console.error(`Error: project.faf not found
533
+ Be concise. One line per suggestion.`}]});console.log(""),console.log(Q.content[0].text)}import{existsSync as JQ,readFileSync as YQ,readdirSync as yw}from"fs";import{join as Lq}from"path";d();function Nq($,Z){if($==="import")kw(Z);else if($==="export")bw();else console.log(`${I("conductor")} ${M("— conductor integration")}
534
+ `),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 kw($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!JQ($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:V6,project:{}};if(JQ($)&&$.endsWith(".json")){let X=JSON.parse(YQ($,"utf-8"));if(X.name)Z.project.name=X.name;if(X.description)Z.project.goal=X.description;if(X.language)Z.project.main_language=X.language}else if(JQ($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let X=i0(YQ($,"utf-8"));if(X.name)Z.project.name=X.name;if(X.description)Z.project.goal=X.description;if(X.language)Z.project.main_language=X.language}else try{let X=yw($);for(let J of X){let Y=Lq($,J);if(J.endsWith(".json"))try{let W=JSON.parse(YQ(Y,"utf-8"));if(W.name&&!Z.project.name)Z.project.name=W.name;if(W.description&&!Z.project.goal)Z.project.goal=W.description}catch{}}}catch{console.error(`Error: could not read directory: ${$}`),process.exit(2)}let z=process.cwd(),Q=u(z);if(Q){let X=r(Q);if(!X.project)X.project={};if(Z.project.name&&!X.project.name)X.project.name=Z.project.name;if(Z.project.goal&&!X.project.goal)X.project.goal=Z.project.goal;if(Z.project.main_language&&!X.project.main_language)X.project.main_language=Z.project.main_language;B0(Q,X,{onAliasKept:(J)=>console.log(M(` ${m0(J)}`))}),console.log(`${I("◆")} conductor import merged into ${Q}`)}else{let X=Lq(z,"project.faf");B0(X,Z),console.log(`${I("◆")} conductor import created ${X}`)}}function bw(){let $=u();if(!$)console.error(`Error: project.faf not found
535
535
 
536
- Run 'faf init' to create one.`),process.exit(2);let Z=r($),z={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(z,null,2))}d();import{readdirSync as Pw,readFileSync as Sw,existsSync as Ew}from"fs";import{join as jw}from"path";var ww=["BRAKE","ENGINE","AERO","TYRE","PIT"],xw=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function yw($){let Z=$.match(xw);if(!Z)return null;return Z[1].toUpperCase()}function kw($){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 bw($,Z){let z=[];switch(Z){case"typescript":{let Q=/\b(describe|test|it)\s*\(\s*(['"`])((?:\\.|(?!\2).)*)\2/g,X=[],J;while((J=Q.exec($))!==null)X.push({idx:J.index,type:J[1]==="describe"?"describe":"test",name:J[3]});let Y=[],W=0,U=null,G=0;for(let V=0;V<$.length;V++){while(G<X.length&&X[G].idx===V){let q=X[G];if(q.type==="describe")U=q.name;else{let K=Y.map((B)=>B.name),L=K.length>0?`${K.join(" > ")} > ${q.name}`:q.name;z.push(L)}G++}let H=$[V];if(H==="{"){if(W++,U!==null)Y.push({name:U,openDepth:W}),U=null}else if(H==="}"){W--;while(Y.length>0&&W<Y[Y.length-1].openDepth)Y.pop()}}break}case"rust":{let Q=/#\[test\]\s*(?:\r?\n)\s*(?:pub\s+)?fn\s+([a-zA-Z_][a-zA-Z_0-9]*)/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"python":{let Q=/^\s*def\s+(test_[a-zA-Z_0-9]+)\s*\(/gm,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"zig":{let Q=/\btest\s+"((?:\\.|[^"\\])+)"/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"go":{let Q=/\bfunc\s+(Test[A-Z][a-zA-Z_0-9]*)\s*\(/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}}return z}var vw=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function HH($,Z=[]){let z;try{z=Pw($,{withFileTypes:!0})}catch{return Z}for(let Q of z){if(vw.has(Q.name))continue;if(Q.name.startsWith(".")&&Q.name!==".")continue;let X=jw($,Q.name);if(Q.isDirectory())HH(X,Z);else if(Q.isFile())Z.push(X)}return Z}function gw($){let Z=[];if(!Ew($))return Z;let z=HH($);for(let Q of z){let X=Q.split("/").pop()??"",J=kw(X);if(!J.ok||!J.lang)continue;let Y;try{Y=Sw(Q,"utf-8")}catch{continue}if(J.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(J.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let W=bw(Y,J.lang),U=Q.replace(`${$}/`,"");for(let G of W)Z.push({file:U,language:J.lang,testName:G,tier:yw(G)})}return Z}function hw($){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 fw($){if(console.log(`${I(C("faf wjttc"))} ${M("— vendor-neutral test audit")}`),console.log(""),console.log(` Files scanned: ${C(String($.filesScanned))}`),console.log(` Tests found: ${C(String($.totalTests))}`),console.log(""),$.totalTests===0){console.log(M(" no tests found"));return}console.log(M(" Tiers:"));for(let Z of ww){let z=$.byTier[Z],Q=(z/$.totalTests*100).toFixed(0),X=Z==="BRAKE"?_0("●"):Z==="ENGINE"?I("●"):Z==="AERO"?M("●"):Z==="TYRE"?I("◐"):M("○");console.log(` ${X} ${Z.padEnd(7)} ${C(String(z).padStart(4))} ${M(`(${Q}%)`)}`)}if($.untiered>0){let Z=($.untiered/$.totalTests*100).toFixed(0);console.log(` ${M("○")} ${"untiered".padEnd(7)} ${C(String($.untiered).padStart(4))} ${M(`(${Z}%)`)}`)}if($.untiered>0&&$.untieredExamples.length>0){console.log(""),console.log(M(` Untiered examples (first ${$.untieredExamples.length}):`));for(let Z of $.untieredExamples)console.log(` ${M("·")} ${Z}`)}if(Object.keys($.byLanguage).length>1){console.log(""),console.log(M(" Languages:"));for(let[Z,z]of Object.entries($.byLanguage))console.log(` ${M("·")} ${Z.padEnd(12)} ${C(String(z))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(_0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function qH($={}){let Z=$.path??"tests",z=gw(Z),Q=hw(z);if($.json)console.log(JSON.stringify(Q,null,2));else fw(Q);if($.strict&&Q.untiered>0)process.exit(1)}import{createHash as MH}from"crypto";import{readFileSync as uw,existsSync as mw}from"fs";import{join as cw,dirname as pw}from"path";d();var KH="faf-bench/1",lw={"project.name":"What is the project's name?","project.goal":"What is the project's goal — what is it for?","project.main_language":"What is the primary programming language?","human_context.who":"Who is this project for?","human_context.what":"What are they building?","human_context.why":"Why does this project exist?","human_context.where":"Where does it run or get distributed?","human_context.when":"When — what is the project's timeline or stage?","human_context.how":"How is it built or used?"};function dw($,Z){return lw[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var iw=[["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;iw.forEach(($,Z)=>$.forEach((z)=>V8.set(z,Z)));var nw=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function XQ($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function BH($){return XQ($).split(" ").filter((Z)=>Z&&!nw.has(Z))}function rw($,Z){let z=XQ($),Q=XQ(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=BH($);if(J.length===0)return!1;let Y=new Set(BH(Z));return J.every((W)=>{if(Y.has(W))return!0;let U=V8.get(W);return U!==void 0&&[...Y].some((G)=>V8.get(G)===U)})}function sw($){let Z=L0($),z=i0($),Q=[],X={},J=0;for(let U of Q0){if(Z.slots[U.path]!=="populated")continue;let G=u1(z,U);if(typeof G!=="string")continue;let V=G.trim();if(!V||U3.has(V.toLowerCase()))continue;J+=1,Q.push({n:J,path:U.path,question:dw(U.path,U.description)}),X[J]=V}let Y=JSON.stringify({v:KH,q:Q.map((U)=>[U.path,U.question])}),W=MH("sha256").update(Y).digest("hex").slice(0,12);return{version:KH,qsetHash:W,questions:Q,answers:X}}function ow($,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()!==""&&rw($.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 LH=".faf-bench.json";function NH($){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)}
537
- `===Z}catch{return!1}}function aw($){let Z=j0(l($,LH));if(Z===null||!NH(Z))return{state:null,bytes:Z};return{state:JSON.parse(Z.toString("utf-8")),bytes:Z}}function tw($,Z,z){F2(cw($,LH),`${JSON.stringify(Z,null,2)}
538
- `,{root:$,owns:NH,mark:"faf bench state (2-space JSON with version, qsetHash and protocol)",expect:z})}function JQ($,Z){let z=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:z,hash:MH("sha256").update(z).digest("hex")}}var kZ=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function ew($,Z){let{cold:z,faf:Q}=$;console.log(`
536
+ Run 'faf init' to create one.`),process.exit(2);let Z=r($),z={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(z,null,2))}d();import{readdirSync as vw,readFileSync as gw,existsSync as hw}from"fs";import{join as fw}from"path";var uw=["BRAKE","ENGINE","AERO","TYRE","PIT"],mw=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function cw($){let Z=$.match(mw);if(!Z)return null;return Z[1].toUpperCase()}function pw($){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 lw($,Z){let z=[];switch(Z){case"typescript":{let Q=/\b(describe|test|it)\s*\(\s*(['"`])((?:\\.|(?!\2).)*)\2/g,X=[],J;while((J=Q.exec($))!==null)X.push({idx:J.index,type:J[1]==="describe"?"describe":"test",name:J[3]});let Y=[],W=0,U=null,G=0;for(let V=0;V<$.length;V++){while(G<X.length&&X[G].idx===V){let H=X[G];if(H.type==="describe")U=H.name;else{let K=Y.map((B)=>B.name),L=K.length>0?`${K.join(" > ")} > ${H.name}`:H.name;z.push(L)}G++}let q=$[V];if(q==="{"){if(W++,U!==null)Y.push({name:U,openDepth:W}),U=null}else if(q==="}"){W--;while(Y.length>0&&W<Y[Y.length-1].openDepth)Y.pop()}}break}case"rust":{let Q=/#\[test\]\s*(?:\r?\n)\s*(?:pub\s+)?fn\s+([a-zA-Z_][a-zA-Z_0-9]*)/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"python":{let Q=/^\s*def\s+(test_[a-zA-Z_0-9]+)\s*\(/gm,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"zig":{let Q=/\btest\s+"((?:\\.|[^"\\])+)"/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"go":{let Q=/\bfunc\s+(Test[A-Z][a-zA-Z_0-9]*)\s*\(/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}}return z}var dw=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function Oq($,Z=[]){let z;try{z=vw($,{withFileTypes:!0})}catch{return Z}for(let Q of z){if(dw.has(Q.name))continue;if(Q.name.startsWith(".")&&Q.name!==".")continue;let X=fw($,Q.name);if(Q.isDirectory())Oq(X,Z);else if(Q.isFile())Z.push(X)}return Z}function iw($){let Z=[];if(!hw($))return Z;let z=Oq($);for(let Q of z){let X=Q.split("/").pop()??"",J=pw(X);if(!J.ok||!J.lang)continue;let Y;try{Y=gw(Q,"utf-8")}catch{continue}if(J.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(J.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let W=lw(Y,J.lang),U=Q.replace(`${$}/`,"");for(let G of W)Z.push({file:U,language:J.lang,testName:G,tier:cw(G)})}return Z}function nw($){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 rw($){if(console.log(`${I(C("faf wjttc"))} ${M("— vendor-neutral test audit")}`),console.log(""),console.log(` Files scanned: ${C(String($.filesScanned))}`),console.log(` Tests found: ${C(String($.totalTests))}`),console.log(""),$.totalTests===0){console.log(M(" no tests found"));return}console.log(M(" Tiers:"));for(let Z of uw){let z=$.byTier[Z],Q=(z/$.totalTests*100).toFixed(0),X=Z==="BRAKE"?_0("●"):Z==="ENGINE"?I("●"):Z==="AERO"?M("●"):Z==="TYRE"?I("◐"):M("○");console.log(` ${X} ${Z.padEnd(7)} ${C(String(z).padStart(4))} ${M(`(${Q}%)`)}`)}if($.untiered>0){let Z=($.untiered/$.totalTests*100).toFixed(0);console.log(` ${M("○")} ${"untiered".padEnd(7)} ${C(String($.untiered).padStart(4))} ${M(`(${Z}%)`)}`)}if($.untiered>0&&$.untieredExamples.length>0){console.log(""),console.log(M(` Untiered examples (first ${$.untieredExamples.length}):`));for(let Z of $.untieredExamples)console.log(` ${M("·")} ${Z}`)}if(Object.keys($.byLanguage).length>1){console.log(""),console.log(M(" Languages:"));for(let[Z,z]of Object.entries($.byLanguage))console.log(` ${M("·")} ${Z.padEnd(12)} ${C(String(z))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(_0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function Dq($={}){let Z=$.path??"tests",z=iw(Z),Q=nw(z);if($.json)console.log(JSON.stringify(Q,null,2));else rw(Q);if($.strict&&Q.untiered>0)process.exit(1)}import{createHash as Aq}from"crypto";import{readFileSync as sw,existsSync as ow}from"fs";import{join as aw,dirname as tw}from"path";d();var Iq="faf-bench/1",ew={"project.name":"What is the project's name?","project.goal":"What is the project's goal — what is it for?","project.main_language":"What is the primary programming language?","human_context.who":"Who is this project for?","human_context.what":"What are they building?","human_context.why":"Why does this project exist?","human_context.where":"Where does it run or get distributed?","human_context.when":"When — what is the project's timeline or stage?","human_context.how":"How is it built or used?"};function $x($,Z){return ew[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var Zx=[["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"]],K8=new Map;Zx.forEach(($,Z)=>$.forEach((z)=>K8.set(z,Z)));var zx=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function WQ($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function Tq($){return WQ($).split(" ").filter((Z)=>Z&&!zx.has(Z))}function Qx($,Z){let z=WQ($),Q=WQ(Z);if(!z||!Q)return!1;if(z===Q)return!0;let X=K8.get(z);if(X!==void 0&&K8.get(Q)===X)return!0;let J=Tq($);if(J.length===0)return!1;let Y=new Set(Tq(Z));return J.every((W)=>{if(Y.has(W))return!0;let U=K8.get(W);return U!==void 0&&[...Y].some((G)=>K8.get(G)===U)})}function Xx($){let Z=L0($),z=i0($),Q=[],X={},J=0;for(let U of X0){if(Z.slots[U.path]!=="populated")continue;let G=p1(z,U);if(typeof G!=="string")continue;let V=G.trim();if(!V||q3.has(V.toLowerCase()))continue;J+=1,Q.push({n:J,path:U.path,question:$x(U.path,U.description)}),X[J]=V}let Y=JSON.stringify({v:Iq,q:Q.map((U)=>[U.path,U.question])}),W=Aq("sha256").update(Y).digest("hex").slice(0,12);return{version:Iq,qsetHash:W,questions:Q,answers:X}}function Jx($,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()!==""&&Qx($.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 Cq=".faf-bench.json";function _q($){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)}
537
+ `===Z}catch{return!1}}function Yx($){let Z=w0(l($,Cq));if(Z===null||!_q(Z))return{state:null,bytes:Z};return{state:JSON.parse(Z.toString("utf-8")),bytes:Z}}function Wx($,Z,z){F2(aw($,Cq),`${JSON.stringify(Z,null,2)}
538
+ `,{root:$,owns:_q,mark:"faf bench state (2-space JSON with version, qsetHash and protocol)",expect:z})}function UQ($,Z){let z=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:z,hash:Aq("sha256").update(z).digest("hex")}}var gZ=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function Ux($,Z){let{cold:z,faf:Q}=$;console.log(`
539
539
  ${C(`faf bench — ${Z}`)}
540
- `),console.log(` ${M("without context")} ${I("with .faf")}`),console.log(`answers ${z.score}/${z.total} ${C(`${Q.score}/${Q.total}`)}`),console.log(`tokens ${kZ(z.tokens)} ${kZ(Q.tokens)}`);let X=z.total-z.score;if(X>0)console.log(`
541
- ${M(`The ${X} missing answer${X===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(M("Structured context closes the gap."));let J=JQ($,Z);console.log(`
542
- ${_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 $x($,Z){let z=$.cold,Q=z.total-z.score;if(console.log(`
540
+ `),console.log(` ${M("without context")} ${I("with .faf")}`),console.log(`answers ${z.score}/${z.total} ${C(`${Q.score}/${Q.total}`)}`),console.log(`tokens ${gZ(z.tokens)} ${gZ(Q.tokens)}`);let X=z.total-z.score;if(X>0)console.log(`
541
+ ${M(`The ${X} missing answer${X===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(M("Structured context closes the gap."));let J=UQ($,Z);console.log(`
542
+ ${_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 Gx($,Z){let z=$.cold,Q=z.total-z.score;if(console.log(`
543
543
  ${C(`faf bench — ${Z}`)} ${_0("Trouble ahead, expensive trouble.")}
544
- `),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 ${kZ(z.tokens)} ${M("— re-derivation burn, paid again EVERY session")}`);if(Q>0)console.log(`
544
+ `),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 ${gZ(z.tokens)} ${M("— re-derivation burn, paid again EVERY session")}`);if(Q>0)console.log(`
545
545
  ${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(`
546
- ${I("→ faf init && faf bench")} ${M("(close the gap, get the receipt)")}`)}var Zx="https://mcpaas.live/bench/submit";async function zx($,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 OH($,Z,z={}){let Q=z.file??u();if(!Q)console.error(`Error: project.faf not found
546
+ ${I("→ faf init && faf bench")} ${M("(close the gap, get the receipt)")}`)}var Vx="https://mcpaas.live/bench/submit";async function qx($,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 Rq($,Z,z={}){let Q=z.file??u();if(!Q)console.error(`Error: project.faf not found
547
547
 
548
- Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let X=p(Q);z2(X,Q);let J=n(Q,()=>sw(X)),Y=pw(Q),W=i0(X)?.project?.name??Y.split("/").pop();if(J.questions.length===0)console.error("Error: no populated slots to derive questions from.\n\n Run `faf go` to fill the .faf first."),process.exit(2);if($==="questions"){if(z.json){console.log(JSON.stringify({version:J.version,qsetHash:J.qsetHash,questions:J.questions.map(({n:U,question:G})=>({n:U,question:G}))},null,2));return}console.log(`
548
+ Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let X=p(Q);z2(X,Q);let J=n(Q,()=>Xx(X)),Y=tw(Q),W=i0(X)?.project?.name??Y.split("/").pop();if(J.questions.length===0)console.error("Error: no populated slots to derive questions from.\n\n Run `faf go` to fill the .faf first."),process.exit(2);if($==="questions"){if(z.json){console.log(JSON.stringify({version:J.version,qsetHash:J.qsetHash,questions:J.questions.map(({n:U,question:G})=>({n:U,question:G}))},null,2));return}console.log(`
549
549
  ${C(`faf bench — ${J.questions.length} questions`)} ${M(`qset ${J.qsetHash}`)}
550
550
  `);for(let U of J.questions)console.log(` ${String(U.n).padStart(2)}. ${U.question}`);console.log(`
551
- ${M('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!mw(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(uw(Z,"utf-8")),G=U.answers??U,V=ow(J,G),H={score:V.correct,total:V.total,...z.tokens?{tokens:parseInt(z.tokens,10)}:{},...z.model?{model:z.model}:{}},{state:q,bytes:K}=aw(Y),L=q&&q.qsetHash===J.qsetHash?q:{version:J.version,qsetHash:J.qsetHash,protocol:"in-session"};if(z.cold)L.cold=H;else if(z.faf)L.faf=H;else console.error("Error: specify the run mode — --cold (no context) or --faf (after reading project.faf)."),process.exit(2);if(tw(Y,L,K),z.json){let B=JQ(L,W);console.log(JSON.stringify({...L,receipt:B.hash,perQuestion:V.perQuestion},null,2));return}if(L.cold&&L.faf)ew(L,W);if(z.submit&&L.cold&&L.faf){let{cold:B,faf:N}=L,T=JQ(L,W);zx({date:new Date().toISOString().slice(0,10),model:N.model??B.model??z.model??"unreported",repo:W,qset:L.qsetHash,cold:`${B.score}/${B.total}`,faf:`${N.score}/${N.total}`,sha256:T.hash.slice(0,16)},z.endpoint??Zx)}else if(L.cold)$x(L,W);else console.log(`
552
- ${C(`faf bench — ${W}`)} ${I("with .faf")}: ${C(`${H.score}/${H.total}`)} ${M(`tokens ${kZ(H.tokens)}`)}`),console.log(M("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
551
+ ${M('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!ow(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(sw(Z,"utf-8")),G=U.answers??U,V=Jx(J,G),q={score:V.correct,total:V.total,...z.tokens?{tokens:parseInt(z.tokens,10)}:{},...z.model?{model:z.model}:{}},{state:H,bytes:K}=Yx(Y),L=H&&H.qsetHash===J.qsetHash?H:{version:J.version,qsetHash:J.qsetHash,protocol:"in-session"};if(z.cold)L.cold=q;else if(z.faf)L.faf=q;else console.error("Error: specify the run mode — --cold (no context) or --faf (after reading project.faf)."),process.exit(2);if(Wx(Y,L,K),z.json){let B=UQ(L,W);console.log(JSON.stringify({...L,receipt:B.hash,perQuestion:V.perQuestion},null,2));return}if(L.cold&&L.faf)Ux(L,W);if(z.submit&&L.cold&&L.faf){let{cold:B,faf:N}=L,T=UQ(L,W);qx({date:new Date().toISOString().slice(0,10),model:N.model??B.model??z.model??"unreported",repo:W,qset:L.qsetHash,cold:`${B.score}/${B.total}`,faf:`${N.score}/${N.total}`,sha256:T.hash.slice(0,16)},z.endpoint??Vx)}else if(L.cold)Gx(L,W);else console.log(`
552
+ ${C(`faf bench — ${W}`)} ${I("with .faf")}: ${C(`${q.score}/${q.total}`)} ${M(`tokens ${gZ(q.tokens)}`)}`),console.log(M("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
553
553
  ${C("faf bench — agent-native protocol")} ${M(`qset ${J.qsetHash} · ${J.questions.length} questions`)}
554
554
  `),console.log(`${C("COLD phase")} ${M("(fresh AI session, repo access)")}`),console.log(' 1. Instruct: "Answer these questions from the repository.'),console.log(' Do NOT read project.faf, CLAUDE.md, AGENTS.md, or any *.faf file."'),console.log(` 2. ${I("faf bench questions")} — hand them over; answers terse, saved as cold.json`),console.log(` 3. ${I("faf bench grade cold.json --cold --tokens <used> --model <name>")}
555
555
  `),console.log(`${C("FAF phase")} ${M("(same questions, context first)")}`),console.log(' 4. Instruct: "Read project.faf, then answer the same questions." → faf.json'),console.log(` 5. ${I("faf bench grade faf.json --faf --tokens <used> --model <name>")}
556
- `),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 Qx}from"fs";import{dirname as Xx,resolve as Jx}from"path";d();function Yx($){try{return Qx($),!0}catch{return!1}}function Wx($,Z,z,Q){let X=n(Q,()=>A5(Z));try{return F2($,X,{root:z,owns:Y9,mark:W9}),{bytes:X.length,left:null}}catch(J){if(J instanceof b)return{bytes:null,left:J.message};throw J}}function Ux({result:$,known:Z,drifted:z,delta:Q,prevScore:X,fafbBytes:J,fafbLeft:Y}){if(console.log(`${I("refresh")} ${M("— re-grounding on the live .faf")}
557
- `),!Z)console.log(` score unknown ${M("— about-repo with no about.source_score; the DNA journey is left as it is")}`);else if(z){let W=Q>0?"↑":"↓";console.log(` drift: ${M(`${X}%`)} ${W} ${C(`${$.score}%`)} ${M(`(${Q>0?"+":""}${Q})`)}`)}else if(X!==null&&X!==void 0)console.log(` no drift ${M(`— steady at ${$.score}%`)}`);else console.log(` baseline set ${M(`— ${$.score}%`)}`);if(J!==null)console.log(` .fafb re-compiled ${M(`(${J} bytes — fast tier current)`)}`);if(Y!==null)console.log(` .fafb left as it is ${M(`— ${Y}`)}`);if(Z)console.log(` re-grounded: ${N2($.tier)} ${C(`${$.score}%`)}`)}function DH($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
556
+ `),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 Hx}from"fs";import{dirname as Kx,resolve as Bx}from"path";d();function Mx($){try{return Hx($),!0}catch{return!1}}function Lx($,Z,z,Q){let X=n(Q,()=>R5(Z));try{return F2($,X,{root:z,owns:G9,mark:V9}),{bytes:X.length,left:null}}catch(J){if(J instanceof b)return{bytes:null,left:J.message};throw J}}function Nx({result:$,known:Z,drifted:z,delta:Q,prevScore:X,fafbBytes:J,fafbLeft:Y}){if(console.log(`${I("refresh")} ${M("— re-grounding on the live .faf")}
557
+ `),!Z)console.log(` score unknown ${M("— about-repo with no about.source_score; the DNA journey is left as it is")}`);else if(z){let W=Q>0?"↑":"↓";console.log(` drift: ${M(`${X}%`)} ${W} ${C(`${$.score}%`)} ${M(`(${Q>0?"+":""}${Q})`)}`)}else if(X!==null&&X!==void 0)console.log(` no drift ${M(`— steady at ${$.score}%`)}`);else console.log(` baseline set ${M(`— ${$.score}%`)}`);if(J!==null)console.log(` .fafb re-compiled ${M(`(${J} bytes — fast tier current)`)}`);if(Y!==null)console.log(` .fafb left as it is ${M(`— ${Y}`)}`);if(Z)console.log(` re-grounded: ${N2($.tier)} ${C(`${$.score}%`)}`)}function Fq($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
558
558
 
559
- Run 'faf init' to create one.`),process.exit(2);let z=p(Z);z2(z,Z);let Q=n(Z,()=>L0(z)),X=new g2(process.cwd()),J=X.load()?X.getBirthDNADisplay():null,Y=J?J.current:null,W=!Q.unknown,U=W&&Y!==null&&Y!==void 0?Q.score-Y:0,G=W&&Y!==null&&Y!==void 0&&U!==0,V=U9(Z),H=null,q=null;if(Yx(V))({bytes:H,left:q}=Wx(V,z,Xx(Jx(Z)),Z));if($.json)console.log(JSON.stringify({reGrounded:W,score:Q.score,...W?{}:{unknown:!0},tier:Q.tier,baseline:Y,delta:U,drifted:G,fafb:H!==null&&H!==void 0?{reCompiled:!0,bytes:H}:{reCompiled:!1,...q!==null?{left:q}:{}},journey:X.getJourney()||null},null,2));else Ux({result:Q,known:W,drifted:G,delta:U,prevScore:Y,fafbBytes:H,fafbLeft:q});if(!W)return;if(X.exists())X.recordGrowth(Q.score,["refresh — re-grounded"]),h5(X);else X.birth(Q.score)}d();import{existsSync as yH,lstatSync as Rx}from"fs";import{resolve as q8}from"path";var IH=["ephemeral","standard","high","critical"],X$=Object.fromEntries(IH.map(($,Z)=>[$,Z])),YQ=new Set(["user","feedback","project","reference"]),WQ=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),UQ=new Set(["facts","sessions","preferences","custom"]),GQ={low:"ephemeral",medium:"standard"};import{existsSync as Gx}from"fs";import{dirname as FH,resolve as PH}from"path";function V1(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function H0($){return $===null||$===void 0}function Vx($){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 G1=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function Hx($){let Z=PH($),z=l(FH(Z),Z,{read:!0});return{real:z,text:J0(z)}}function TH($,Z,z,Q){let X=PH($),J=l(FH(X),X),Y=z!==void 0&&z.real===J;if(Y&&z.text===Z)return J;let W;try{W=j0(J)}catch{W=void 0}if(W&&W.equals(Buffer.from(Z,"utf-8")))return J;if(!Y&&!Q&&W)throw new b("changed",X,`${X} already exists — not written; pass { replace: true } (faf memory convert --force) to replace it`,{onWrite:!0});let U=Y?z.text:Q?W:null;return a($,Z,U===void 0?{}:{expect:U})}function H8($){if(H0($))return"standard";if(GQ[$])return GQ[$];if($ in X$)return $;return"standard"}var qx=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function VQ($){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(!qx.has(Q))z[Q]=X;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:H8(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 U1($){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 AH($){let Z=$;return G1($)&&typeof Z.text==="string"&&Array.isArray(Z.tags)&&Array.isArray(Z.links)&&G1(Z.extra)&&typeof Z.priority==="string"?Z:VQ($)}function Kx($){if(typeof $==="string"||G1($)&&"text"in $)return VQ($);return null}var CH=["profile","namepoint","created","last_etched","retention"];class h0{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??V1(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.map(AH):[],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||K0(this._index,this.derivedIndex()),this._indexAtRecord=this._index.slice()}get facts(){return this._facts}get index(){return this._index}get sessions(){return this._sessions}get preferences(){return this._preferences}get custom(){return this._custom}get extra(){return this._extra}get memoryExtra(){return this._memoryExtra}static load($){if(!Gx($))throw Error(`soul file not found: ${$}`);let{real:Z,text:z}=Hx($);return h0.fromText(z,$,Z)}static fromText($,Z,z){let Q=K3($,Z).toJS();if(!G1(Q))throw Error(`soul is not a YAML mapping: ${Z} is ${Vx(Q)}`);let X=new SH,J=X.pick("memory",Q.memory,$0)??{},Y=new h0(String(Q.namepoint??Z.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(Q.profile??"voice"),retention:String(Q.retention??"forever"),created:Q.created??null,...X.modelled(Q,J)});return(X.pick("memory.facts",J.facts,Array.isArray)??[]).forEach((W,U)=>{let G=Kx(W);if(G)Y.adopt(G,U)}),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 h0.load($)}toDoc(){let $={facts:this._facts.map(U1),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[z,Q]of Object.entries(this._memoryExtra))if(!UQ.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(!WQ.has(z))Z[z]=structuredClone(Q);return Z}toYaml(){return N$(this.toDoc(),{lineWidth:100})}derivedIndex($=80){return this._facts.map((Z)=>`${Z.id??"?"} — ${String(Z.text).slice(0,$)}`)}indexIsDerived($=80){return!this._origin?.residual.has("index")&&K0(this._index,this.derivedIndex($))}rebuildIndex($=80){return this._index=this.derivedIndex($),this._indexDerived=!0,this._indexAtRecord=this._index.slice(),this._index}save($,Z={}){let z=Z.reindex??(this._indexDerived&&K0(this._index,this._indexAtRecord));if(z)this.rebuildIndex();let Q=Z.replace===!0,X=this._origin;if(!X){let U=this.toYaml(),G=TH($,U,void 0,Q);return this.settle($,U,new Map(this._facts.map((V,H)=>[V,H])),G),$}let J=new Map,{text:Y}=M5(X.text,(U)=>{J=this.applyTo(U,X,z)},$),W=TH($,Y,X.real===void 0?void 0:{real:X.real,text:X.text},Q);return this.settle($,Y,J,W),$}toFile($,Z={}){return this.save($,Z)}settle($,Z,z,Q){this._factAt=new WeakMap;for(let[X,J]of z)this._factAt.set(X,J);this._origin={path:$,real:Q,text:Z,base:this.state(),residual:this._origin?.residual??new Map},this.recordIndex()}state(){let $=new Map;for(let Z of this._facts){let z=this._factAt.get(Z);if(z!==void 0)$.set(z,structuredClone(U1(Z)))}return{top:Object.fromEntries(CH.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 CH)if(Q.top[Y]!==X.top[Y])$.set(Y,X.top[Y]);if(!K0(Q.index,X.index)){if(Z.residual.has("index")&&!z)h0.refuse(Z,"index","replace it");N5($,["index"],Z.residual.has("index")?void 0:Q.index,X.index,J)}for(let Y of RH(Q.extra,X.extra))N5($,[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],...RH(z.memoryExtra,Q.memoryExtra).map((J)=>[J,z.memoryExtra[J],Q.memoryExtra[J]])];for(let[J,Y,W]of X){if(K0(Y,W))continue;if(Z.residual.has("memory"))h0.refuse(Z,"memory",`change memory.${J}`);if(Z.residual.has(`memory.${J}`))h0.refuse(Z,`memory.${J}`,"replace it");N5($,["memory",J],Y,W,Z.path)}}sortFacts($){let Z=[],z=[];for(let Q of this._facts){let X=this._factAt.get(Q);if(X===void 0){z.push(Q);continue}if(z.length>0||Z.length>0&&X<=Z[Z.length-1][1])throw Error(`${$.path}: the facts were reordered — faf keeps the order soul.fafm has. Nothing written.`);Z.push([Q,X])}return{kept:Z,added:z}}applyFacts($,Z){let{kept:z,added:Q}=this.sortFacts(Z),X=new Set(z.map(([,G])=>G)),J=[...Z.base.facts.keys()].filter((G)=>!X.has(G)).sort((G,V)=>V-G),Y=z.filter(([G,V])=>!K0(Z.base.facts.get(V),U1(G))),W=new Map(z);if(Q.length===0&&J.length===0&&Y.length===0)return W;for(let G of["memory","memory.facts"])if(Z.residual.has(G))h0.refuse(Z,G,"add facts to it");let U=PY($,["memory","facts"],Z.path);for(let[G,V]of Y)U.items[V]=Mx($,U.items[V],Z.base.facts.get(V),U1(G));for(let G of J)U.items.splice(G,1);for(let[G,V]of z)W.set(G,V-J.filter((H)=>H<V).length);for(let G of Q)W.set(G,U.items.length),U.items.push($.createNode(U1(G)));return W}add($){let Z=AH($);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(Bx(z,$,Z));return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:H8(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:V1(),source:Z.source??null,extra:{}})}recall($,Z={}){let z=G1($)?{...$,...Z}:Z,Q=G1($)?$.query:$,X=X$[H8(z.minPriority??"ephemeral")]??0,J=typeof Q==="string"?Q.toLowerCase():"",Y=new Set(z.tags??[]),W=[];this._facts.forEach((G,V)=>{if(J&&!String(G.text??"").toLowerCase().includes(J))return;if(Y.size>0&&![...Y].some((H)=>(G.tags??[]).includes(H)))return;if(!H0(z.type)&&G.type!==z.type)return;if((X$[G.priority]??1)<X)return;W.push([V,G])}),W.sort((G,V)=>{let H=X$[G[1].priority]??1,q=X$[V[1].priority]??1;if(q!==H)return q-H;let K=G[1].timestamp??"",L=V[1].timestamp??"";if(L!==K)return L<K?-1:L>K?1:0;return V[0]-G[0]});let U=W.map(([,G])=>G);if(!H0(z.limit))return U.slice(0,z.limit);return U}getFact($){let Z=this._byId.get($);return Z===void 0?null:this._facts[Z]}deleteFact($){let Z=this._byId.get($);if(Z===void 0)return!1;return this._facts.splice(Z,1),this._byId.clear(),this._facts.forEach((z,Q)=>{if(!H0(z.id))this._byId.set(z.id,Q)}),!0}}function Bx($,Z,z){let Q=(X,J)=>H0(X)?J:X;return{...$,text:Z,type:Q(z.type,$.type),priority:H0(z.priority)?$.priority:H8(z.priority),tags:Q(z.tags,$.tags).slice(),links:Q(z.links,$.links).slice(),source:Q(z.source,$.source),timestamp:V1(),extra:{...$.extra}}}class SH{residual=new Map;pick($,Z,z){if(H0(Z))return;if(z(Z))return Z;this.residual.set($,k6(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:_H($,WQ),memoryExtra:_H(Z,UQ)}}}function _H($,Z){let z={};for(let[Q,X]of Object.entries($))if(!Z.has(Q))z[Q]=structuredClone(X);return z}function RH($,Z){return[...new Set([...Object.keys($),...Object.keys(Z)])]}function Mx($,Z,z,Q){if(!q0(Z))return i1($,Z,z,Q);let X=(J)=>typeof J==="string"?{text:J}:J;return i1($,Z,X(z),X(Q))}import{readdirSync as Lx,readFileSync as Nx,statSync as EH,existsSync as Ox}from"fs";import{join as Dx,basename as jH,resolve as Ix}from"path";var wH=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),Tx=/\[\[([^\]]+)\]\]/g;function Ax($){let Z=EH($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function Cx($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let z=i0(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 _x($,Z,z){if(!z.name)return null;let Q=z.metadata&&typeof z.metadata==="object"?z.metadata:{},X=Q.type;if(typeof X!=="string"||!YQ.has(X))return null;let J=String(z.name).trim(),W=(z.description!==void 0&&z.description!==null&&String(z.description).trim()?String(z.description).trim():"")||J,U={};if(Q.originSessionId)U.provenance=[`session:${Q.originSessionId}`];let G=[...new Set([...Z.matchAll(Tx)].map((V)=>V[1]))].sort();return{text:W,id:J,type:X,priority:"standard",tags:[],links:G,timestamp:Ax($),source:`claude-code memory: ${jH($)}`,extra:U}}function HQ($,Z={}){let z=Ix($);if(!Ox(z))throw Error(`Claude memory directory not found: ${z}`);if(!EH(z).isDirectory())throw Error(`Claude memory path is not a directory: ${z}`);let Q=Z.skip??wH,X=Z.namepoint??`@claude-code:${jH(z)}`,J=[],Y=Lx(z).filter((H)=>H.endsWith(".md")).sort();for(let H of Y){if(Q.has(H))continue;let q=Dx(z,H),K;try{K=Nx(q,"utf-8")}catch{continue}let{fm:L,body:B}=Cx(K);if(!L)continue;let N=_x(q,B,L);if(N)J.push(N)}let W=J.map((H)=>H.timestamp).filter(Boolean),U=W.length?W.reduce((H,q)=>H<q?H:q):V1(),G=W.length?W.reduce((H,q)=>H>q?H:q):U,V=new h0(X,{profile:"knowledge",facts:J,created:U});return V.last_etched=G,V.rebuildIndex(),V}function Fx($){try{return Rx($),!0}catch{return!1}}function qQ(){return q8(process.cwd(),"soul.fafm")}function KQ($){let Z=q8($??qQ());if(!yH(Z))console.error(`Error: soul file not found: ${Z}
559
+ Run 'faf init' to create one.`),process.exit(2);let z=p(Z);z2(z,Z);let Q=n(Z,()=>L0(z)),X=new g2(process.cwd()),J=X.load()?X.getBirthDNADisplay():null,Y=J?J.current:null,W=!Q.unknown,U=W&&Y!==null&&Y!==void 0?Q.score-Y:0,G=W&&Y!==null&&Y!==void 0&&U!==0,V=q9(Z),q=null,H=null;if(Mx(V))({bytes:q,left:H}=Lx(V,z,Kx(Bx(Z)),Z));if($.json)console.log(JSON.stringify({reGrounded:W,score:Q.score,...W?{}:{unknown:!0},tier:Q.tier,baseline:Y,delta:U,drifted:G,fafb:q!==null&&q!==void 0?{reCompiled:!0,bytes:q}:{reCompiled:!1,...H!==null?{left:H}:{}},journey:X.getJourney()||null},null,2));else Nx({result:Q,known:W,drifted:G,delta:U,prevScore:Y,fafbBytes:q,fafbLeft:H});if(!W)return;if(X.exists())X.recordGrowth(Q.score,["refresh — re-grounded"]),m5(X);else X.birth(Q.score)}d();import{existsSync as uq,lstatSync as kx}from"fs";import{resolve as M8}from"path";var Pq=["ephemeral","standard","high","critical"],J$=Object.fromEntries(Pq.map(($,Z)=>[$,Z])),GQ=new Set(["user","feedback","project","reference"]),VQ=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),qQ=new Set(["facts","sessions","preferences","custom"]),HQ={low:"ephemeral",medium:"standard"};import{existsSync as Ox}from"fs";import{dirname as yq,resolve as kq}from"path";function K1(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function q0($){return $===null||$===void 0}function Dx($){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 H1=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function Ix($){let Z=kq($),z=l(yq(Z),Z,{read:!0});return{real:z,text:z0(z)}}function Sq($,Z,z,Q){let X=kq($),J=l(yq(X),X),Y=z!==void 0&&z.real===J;if(Y&&z.text===Z)return J;let W;try{W=w0(J)}catch{W=void 0}if(W&&W.equals(Buffer.from(Z,"utf-8")))return J;if(!Y&&!Q&&W)throw new b("changed",X,`${X} already exists — not written; pass { replace: true } (faf memory convert --force) to replace it`,{onWrite:!0});let U=Y?z.text:Q?W:null;return a($,Z,U===void 0?{}:{expect:U})}function B8($){if(q0($))return"standard";if(HQ[$])return HQ[$];if($ in J$)return $;return"standard"}var Tx=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function KQ($){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(!Tx.has(Q))z[Q]=X;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:B8(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 q1($){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 Eq($){let Z=$;return H1($)&&typeof Z.text==="string"&&Array.isArray(Z.tags)&&Array.isArray(Z.links)&&H1(Z.extra)&&typeof Z.priority==="string"?Z:KQ($)}function Ax($){if(typeof $==="string"||H1($)&&"text"in $)return KQ($);return null}var jq=["profile","namepoint","created","last_etched","retention"];class h0{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??K1(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.map(Eq):[],this._byId=new Map,this._facts.forEach((z,Q)=>{if(!q0(z.id))this._byId.set(z.id,Q)}),this._index=Z.index?Z.index.slice():[],this._sessions=Z.sessions?structuredClone(Z.sessions):[],this._preferences=Z.preferences?{...Z.preferences}:{},this._custom=Z.custom?{...Z.custom}:{},this._extra=Z.extra?{...Z.extra}:{},this._memoryExtra=Z.memoryExtra?{...Z.memoryExtra}:{},this._indexDerived=Z.index===void 0||K0(this._index,this.derivedIndex()),this._indexAtRecord=this._index.slice()}get facts(){return this._facts}get index(){return this._index}get sessions(){return this._sessions}get preferences(){return this._preferences}get custom(){return this._custom}get extra(){return this._extra}get memoryExtra(){return this._memoryExtra}static load($){if(!Ox($))throw Error(`soul file not found: ${$}`);let{real:Z,text:z}=Ix($);return h0.fromText(z,$,Z)}static fromText($,Z,z){let Q=L3($,Z).toJS();if(!H1(Q))throw Error(`soul is not a YAML mapping: ${Z} is ${Dx(Q)}`);let X=new bq,J=X.pick("memory",Q.memory,$0)??{},Y=new h0(String(Q.namepoint??Z.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(Q.profile??"voice"),retention:String(Q.retention??"forever"),created:Q.created??null,...X.modelled(Q,J)});return(X.pick("memory.facts",J.facts,Array.isArray)??[]).forEach((W,U)=>{let G=Ax(W);if(G)Y.adopt(G,U)}),Y.last_etched=String(Q.last_etched??Y.created),Y._version=q0(Q.version)?void 0:String(Q.version),Y._origin={path:Z,real:z,text:$,base:Y.state(),residual:X.residual},Y.recordIndex(),Y}recordIndex(){this._indexDerived=this.indexIsDerived(),this._indexAtRecord=this._index.slice()}adopt($,Z){if(this._facts.push($),!q0($.id))this._byId.set($.id,this._facts.length-1);this._factAt.set($,Z)}static fromFile($){return h0.load($)}toDoc(){let $={facts:this._facts.map(q1),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[z,Q]of Object.entries(this._memoryExtra))if(!qQ.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(!VQ.has(z))Z[z]=structuredClone(Q);return Z}toYaml(){return O$(this.toDoc(),{lineWidth:100})}derivedIndex($=80){return this._facts.map((Z)=>`${Z.id??"?"} — ${String(Z.text).slice(0,$)}`)}indexIsDerived($=80){return!this._origin?.residual.has("index")&&K0(this._index,this.derivedIndex($))}rebuildIndex($=80){return this._index=this.derivedIndex($),this._indexDerived=!0,this._indexAtRecord=this._index.slice(),this._index}save($,Z={}){let z=Z.reindex??(this._indexDerived&&K0(this._index,this._indexAtRecord));if(z)this.rebuildIndex();let Q=Z.replace===!0,X=this._origin;if(!X){let U=this.toYaml(),G=Sq($,U,void 0,Q);return this.settle($,U,new Map(this._facts.map((V,q)=>[V,q])),G),$}let J=new Map,{text:Y}=O5(X.text,(U)=>{J=this.applyTo(U,X,z)},$),W=Sq($,Y,X.real===void 0?void 0:{real:X.real,text:X.text},Q);return this.settle($,Y,J,W),$}toFile($,Z={}){return this.save($,Z)}settle($,Z,z,Q){this._factAt=new WeakMap;for(let[X,J]of z)this._factAt.set(X,J);this._origin={path:$,real:Q,text:Z,base:this.state(),residual:this._origin?.residual??new Map},this.recordIndex()}state(){let $=new Map;for(let Z of this._facts){let z=this._factAt.get(Z);if(z!==void 0)$.set(z,structuredClone(q1(Z)))}return{top:Object.fromEntries(jq.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 jq)if(Q.top[Y]!==X.top[Y])$.set(Y,X.top[Y]);if(!K0(Q.index,X.index)){if(Z.residual.has("index")&&!z)h0.refuse(Z,"index","replace it");I5($,["index"],Z.residual.has("index")?void 0:Q.index,X.index,J)}for(let Y of xq(Q.extra,X.extra))I5($,[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],...xq(z.memoryExtra,Q.memoryExtra).map((J)=>[J,z.memoryExtra[J],Q.memoryExtra[J]])];for(let[J,Y,W]of X){if(K0(Y,W))continue;if(Z.residual.has("memory"))h0.refuse(Z,"memory",`change memory.${J}`);if(Z.residual.has(`memory.${J}`))h0.refuse(Z,`memory.${J}`,"replace it");I5($,["memory",J],Y,W,Z.path)}}sortFacts($){let Z=[],z=[];for(let Q of this._facts){let X=this._factAt.get(Q);if(X===void 0){z.push(Q);continue}if(z.length>0||Z.length>0&&X<=Z[Z.length-1][1])throw Error(`${$.path}: the facts were reordered — faf keeps the order soul.fafm has. Nothing written.`);Z.push([Q,X])}return{kept:Z,added:z}}applyFacts($,Z){let{kept:z,added:Q}=this.sortFacts(Z),X=new Set(z.map(([,G])=>G)),J=[...Z.base.facts.keys()].filter((G)=>!X.has(G)).sort((G,V)=>V-G),Y=z.filter(([G,V])=>!K0(Z.base.facts.get(V),q1(G))),W=new Map(z);if(Q.length===0&&J.length===0&&Y.length===0)return W;for(let G of["memory","memory.facts"])if(Z.residual.has(G))h0.refuse(Z,G,"add facts to it");let U=wY($,["memory","facts"],Z.path);for(let[G,V]of Y)U.items[V]=_x($,U.items[V],Z.base.facts.get(V),q1(G));for(let G of J)U.items.splice(G,1);for(let[G,V]of z)W.set(G,V-J.filter((q)=>q<V).length);for(let G of Q)W.set(G,U.items.length),U.items.push($.createNode(q1(G)));return W}add($){let Z=Eq($);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(Cx(z,$,Z));return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:B8(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:K1(),source:Z.source??null,extra:{}})}recall($,Z={}){let z=H1($)?{...$,...Z}:Z,Q=H1($)?$.query:$,X=J$[B8(z.minPriority??"ephemeral")]??0,J=typeof Q==="string"?Q.toLowerCase():"",Y=new Set(z.tags??[]),W=[];this._facts.forEach((G,V)=>{if(J&&!String(G.text??"").toLowerCase().includes(J))return;if(Y.size>0&&![...Y].some((q)=>(G.tags??[]).includes(q)))return;if(!q0(z.type)&&G.type!==z.type)return;if((J$[G.priority]??1)<X)return;W.push([V,G])}),W.sort((G,V)=>{let q=J$[G[1].priority]??1,H=J$[V[1].priority]??1;if(H!==q)return H-q;let K=G[1].timestamp??"",L=V[1].timestamp??"";if(L!==K)return L<K?-1:L>K?1:0;return V[0]-G[0]});let U=W.map(([,G])=>G);if(!q0(z.limit))return U.slice(0,z.limit);return U}getFact($){let Z=this._byId.get($);return Z===void 0?null:this._facts[Z]}deleteFact($){let Z=this._byId.get($);if(Z===void 0)return!1;return this._facts.splice(Z,1),this._byId.clear(),this._facts.forEach((z,Q)=>{if(!q0(z.id))this._byId.set(z.id,Q)}),!0}}function Cx($,Z,z){let Q=(X,J)=>q0(X)?J:X;return{...$,text:Z,type:Q(z.type,$.type),priority:q0(z.priority)?$.priority:B8(z.priority),tags:Q(z.tags,$.tags).slice(),links:Q(z.links,$.links).slice(),source:Q(z.source,$.source),timestamp:K1(),extra:{...$.extra}}}class bq{residual=new Map;pick($,Z,z){if(q0(Z))return;if(z(Z))return Z;this.residual.set($,b6(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:wq($,VQ),memoryExtra:wq(Z,qQ)}}}function wq($,Z){let z={};for(let[Q,X]of Object.entries($))if(!Z.has(Q))z[Q]=structuredClone(X);return z}function xq($,Z){return[...new Set([...Object.keys($),...Object.keys(Z)])]}function _x($,Z,z,Q){if(!H0(Z))return s1($,Z,z,Q);let X=(J)=>typeof J==="string"?{text:J}:J;return s1($,Z,X(z),X(Q))}import{readdirSync as Rx,readFileSync as Fx,statSync as vq,existsSync as Px}from"fs";import{join as Sx,basename as gq,resolve as Ex}from"path";var hq=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),jx=/\[\[([^\]]+)\]\]/g;function wx($){let Z=vq($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function xx($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let z=i0(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 yx($,Z,z){if(!z.name)return null;let Q=z.metadata&&typeof z.metadata==="object"?z.metadata:{},X=Q.type;if(typeof X!=="string"||!GQ.has(X))return null;let J=String(z.name).trim(),W=(z.description!==void 0&&z.description!==null&&String(z.description).trim()?String(z.description).trim():"")||J,U={};if(Q.originSessionId)U.provenance=[`session:${Q.originSessionId}`];let G=[...new Set([...Z.matchAll(jx)].map((V)=>V[1]))].sort();return{text:W,id:J,type:X,priority:"standard",tags:[],links:G,timestamp:wx($),source:`claude-code memory: ${gq($)}`,extra:U}}function BQ($,Z={}){let z=Ex($);if(!Px(z))throw Error(`Claude memory directory not found: ${z}`);if(!vq(z).isDirectory())throw Error(`Claude memory path is not a directory: ${z}`);let Q=Z.skip??hq,X=Z.namepoint??`@claude-code:${gq(z)}`,J=[],Y=Rx(z).filter((q)=>q.endsWith(".md")).sort();for(let q of Y){if(Q.has(q))continue;let H=Sx(z,q),K;try{K=Fx(H,"utf-8")}catch{continue}let{fm:L,body:B}=xx(K);if(!L)continue;let N=yx(H,B,L);if(N)J.push(N)}let W=J.map((q)=>q.timestamp).filter(Boolean),U=W.length?W.reduce((q,H)=>q<H?q:H):K1(),G=W.length?W.reduce((q,H)=>q>H?q:H):U,V=new h0(X,{profile:"knowledge",facts:J,created:U});return V.last_etched=G,V.rebuildIndex(),V}function bx($){try{return kx($),!0}catch{return!1}}function MQ(){return M8(process.cwd(),"soul.fafm")}function LQ($){let Z=M8($??MQ());if(!uq(Z))console.error(`Error: soul file not found: ${Z}
560
560
 
561
- Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return h0.load(Z)}function Px($,Z){if(!$)console.error(`Error: directory required
561
+ Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return h0.load(Z)}function vx($,Z){if(!$)console.error(`Error: directory required
562
562
 
563
- faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let z=q8($),Q=q8(Z.output??qQ());if(Fx(Q)&&!Z.force)console.error(`${Z.output??"soul.fafm"} already exists. Use ${C("--force")} to overwrite.`),process.exit(1);try{let X=HQ(z,{namepoint:Z.namepoint});X.toFile(Q,{replace:Z.force===!0}),console.log(`${I("memory convert")} ${M("—")} ${X.facts.length} facts → ${Q}`),console.log(M(` namepoint ${X.namepoint} profile ${X.profile} index ${X.index.length}`))}catch(X){console.error(`Error: ${X instanceof Error?X.message:X}`),process.exit(1)}}function Sx($){let Z=KQ($.file);if($.json){console.log(JSON.stringify(Z.facts.map((z)=>({id:z.id,text:z.text,type:z.type,priority:z.priority,tags:z.tags})),null,2));return}console.log(`${I("memory ls")} ${M(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
564
- `);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 Ex($,Z){let z=KQ(Z.file),Q=Z.tag?Z.tag.split(",").map((Y)=>Y.trim()):void 0,X=Z.limit!==void 0&&Z.limit!==null?parseInt(Z.limit,10):void 0,J=z.recall($??null,{tags:Q,type:Z.type,minPriority:Z.priority,limit:Number.isFinite(X)?X:null});if(Z.json){console.log(JSON.stringify(J.map((Y)=>({id:Y.id,text:Y.text,priority:Y.priority})),null,2));return}console.log(`${I("memory recall")} ${M(`— ${J.length} hit(s)`)}${$?M(` for "${$}"`):""}
565
- `);for(let Y of J)console.log(` ${Y.id?C(Y.id):M("?")} ${Y.text}`)}function jx($,Z){if(!$)console.error(`Error: text required
563
+ faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let z=M8($),Q=M8(Z.output??MQ());if(bx(Q)&&!Z.force)console.error(`${Z.output??"soul.fafm"} already exists. Use ${C("--force")} to overwrite.`),process.exit(1);try{let X=BQ(z,{namepoint:Z.namepoint});X.toFile(Q,{replace:Z.force===!0}),console.log(`${I("memory convert")} ${M("—")} ${X.facts.length} facts → ${Q}`),console.log(M(` namepoint ${X.namepoint} profile ${X.profile} index ${X.index.length}`))}catch(X){console.error(`Error: ${X instanceof Error?X.message:X}`),process.exit(1)}}function gx($){let Z=LQ($.file);if($.json){console.log(JSON.stringify(Z.facts.map((z)=>({id:z.id,text:z.text,type:z.type,priority:z.priority,tags:z.tags})),null,2));return}console.log(`${I("memory ls")} ${M(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
564
+ `);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 hx($,Z){let z=LQ(Z.file),Q=Z.tag?Z.tag.split(",").map((Y)=>Y.trim()):void 0,X=Z.limit!==void 0&&Z.limit!==null?parseInt(Z.limit,10):void 0,J=z.recall($??null,{tags:Q,type:Z.type,minPriority:Z.priority,limit:Number.isFinite(X)?X:null});if(Z.json){console.log(JSON.stringify(J.map((Y)=>({id:Y.id,text:Y.text,priority:Y.priority})),null,2));return}console.log(`${I("memory recall")} ${M(`— ${J.length} hit(s)`)}${$?M(` for "${$}"`):""}
565
+ `);for(let Y of J)console.log(` ${Y.id?C(Y.id):M("?")} ${Y.text}`)}function fx($,Z){if(!$)console.error(`Error: text required
566
566
 
567
- faf memory etch "a durable fact" [--id slug]`),process.exit(2);let z=q8(Z.file??qQ()),Q=yH(z)?h0.load(z):new h0(Z.namepoint??"@local",{profile:"knowledge"}),X=Q.indexIsDerived(),J=Q.etch($,{id:Z.id,type:Z.type,priority:Z.priority});Q.toFile(z,{reindex:X}),console.log(`${I("memory etch")} ${M("—")} ${J.id??"(no-id)"} → ${z}`)}function wx($){let Z=KQ($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${I("memory show")} ${M(`— ${Z.namepoint}`)}
567
+ faf memory etch "a durable fact" [--id slug]`),process.exit(2);let z=M8(Z.file??MQ()),Q=uq(z)?h0.load(z):new h0(Z.namepoint??"@local",{profile:"knowledge"}),X=Q.indexIsDerived(),J=Q.etch($,{id:Z.id,type:Z.type,priority:Z.priority});Q.toFile(z,{reindex:X}),console.log(`${I("memory etch")} ${M("—")} ${J.id??"(no-id)"} → ${z}`)}function ux($){let Z=LQ($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${I("memory show")} ${M(`— ${Z.namepoint}`)}
568
568
  `),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(`
569
- ${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 kH($,Z,z={}){if(Z&&typeof Z==="object")z=Z,Z=void 0;switch($){case"convert":Px(Z,z);break;case"ls":case"list":Sx(z);break;case"recall":Ex(Z,z);break;case"etch":jx(Z,z);break;case"show":wx(z);break;case void 0:case"help":xH();break;default:console.error(`Unknown memory subcommand: ${$}`),xH(),process.exit(2)}}function xH(){console.log(`${I("faf memory")} ${M("— .fafm soul ops (knowledge profile)")}
569
+ ${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 mq($,Z,z={}){if(Z&&typeof Z==="object")z=Z,Z=void 0;switch($){case"convert":vx(Z,z);break;case"ls":case"list":gx(z);break;case"recall":hx(Z,z);break;case"etch":fx(Z,z);break;case"show":ux(z);break;case void 0:case"help":fq();break;default:console.error(`Unknown memory subcommand: ${$}`),fq(),process.exit(2)}}function fq(){console.log(`${I("faf memory")} ${M("— .fafm soul ops (knowledge profile)")}
570
570
  `),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
571
- `),console.log(M(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json · --force")),console.log(M(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}var{version:bH}=g9(),g=new kQ;g.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(bH,"-v, --version");g.command("init").description("Create .faf from your project").option("--yolo","Quick init with sensible defaults").option("--quick","Alias for --yolo").option("--force","Overwrite existing project.faf").option("--output <path>","Output path").action(($)=>s3($));g.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>vW());g.command("auto").description("Fill every tech slot from the repo, then score").action(()=>f5());g.command("loop").description("Drive to 100% — source what we can, then ask only the human").option("-r, --rounds <n>","max auto rounds before stopping","5").action(($)=>hW($));g.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>UV($));g.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>_5($,Z));g.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key)").option("--json","Output as JSON").option("--cold","Grade as the without-context run").option("--faf","Grade as the with-context run").option("--tokens <n>","Tokens used in the run (reported by the agent)").option("--model <name>","Model that answered (reported)").option("--file <path>","Path to project.faf (default: discovered)").option("--submit","Submit the full-pair receipt to the public bench ledger").option("--endpoint <url>","Override the submit endpoint").action(($,Z,z)=>OH($,Z,z));g.command("show").description("Render project.faf → project.html and open it").option("--force","Replace a project.html faf cannot prove it rendered (edited since, or not faf's)").action(($)=>GG($));g.command("sync").description(".faf → CLAUDE.md (--direction pull: Trophy-gated backfill into .faf)").option("--watch","Watch for changes").option("--direction <dir>","auto|push write CLAUDE.md from .faf; pull backfills .faf at ✪ Trophy","auto").action(($)=>J9($));g.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").option("--force","Replace an output file that is not a .fafb faf compiled").action(($,Z)=>BU($,Z));g.command("decompile <file>").description("Decompile .fafb to JSON").option("--output <path>","Output path").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a faf decompile)").action(($,Z)=>RU($,Z));g.command("git <url>").description("Instant scored context from any GitHub repo (any branch/tag with --ref)").option("--ref <ref>","Clone at a specific branch or tag (versioned context)").option("--output <path>","Write to a custom path (default: ./project.faf)").option("--force","Overwrite an existing project.faf").option("--stdout","Print the .faf to stdout instead of writing a file").action(($,Z)=>BG($,Z));g.command("diff [range]").description("Semantic context diff between two .faf versions (slot deltas + score). git ranges: <ref>, A..B, A...B").option("--json","Emit the delta as structured JSON").option("--install-driver","Wire faf diff into native git — `git diff` renders .faf score+slot deltas").option("--uninstall-driver","Remove the native-git diff driver").action(($,Z)=>FG($,Z));g.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>TG($??[]));g.command("log").description("Score timeline across git history — the .faf score at every commit that touched it").option("-n, --limit <n>","Max commits to show (default 20)").option("--all","Show every commit, no cap").option("--reverse","Oldest-first instead of newest-first").option("--json","Emit the timeline as structured JSON").action(($)=>PG($));g.command("hooks").description("Pre-commit context guard — scores staged .faf vs HEAD, warns (or --strict blocks) on regression").option("--install","Install the pre-commit hook").option("--uninstall","Remove the faf hook block (preserves other hooks)").option("--strict","With --install: block the commit on a score regression (default: warn only)").action(($)=>mG($));g.command("hooks-run",{hidden:!0}).description("Internal: the pre-commit context guard the git hook invokes").option("--strict","Exit non-zero on a score regression").action(($)=>uG($));g.command("export").description("Export context files from .faf").option("--agents","Author AGENTS.md").option("--cursor","Author .cursorrules").option("--gemini","Author GEMINI.md").option("--copilot","Author .github/copilot-instructions.md (GitHub Copilot)").option("--grok","Wire grok-faf-mcp into .grok/config.toml").option("--llms","Author llms.txt (llmstxt.org view of authored 6Ws — opt-in)").option("--conductor","Author conductor config").option("--html","Author project.html (visual render of project.faf)").option("--card","Author MCP Server Card (./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(($)=>s6($));g.command("server-card").description("Emit the registry server.json identity (name + title + _meta) from project.faf — the cross-language server-card emitter; patches an existing file").option("--in <path>","Existing server.json to patch (default: ./server.json)").option("--out <path>","Output path (default: same as --in)").option("--faf <path>","project.faf path (default: auto-discover)").option("--set-version <version>","Set the version field (default: preserve existing). NOTE: not --version, which is the global CLI-version flag").option("--generated <iso>","Override the _meta generated stamp (default: preserve existing)").option("--check","Print to stdout, do not write (diff/verify — the idempotency-test hook)").option("--force","With --out: replace a file faf cannot prove it wrote (edited since, or no faf identity)").action(($)=>YG($));g.command("cards").description("Project .faf + .fafa onto A2A / MCP / registry / catalog cards — one context block, every door").option("--target <list>","Comma list: a2a,mcp,registry,catalog (default: whatever inputs allow)").option("--faf <path>","project.faf path (default: auto-discover)").option("--fafa <path>","agent.fafa path (default: auto-discover)").option("--dir <path>","Working directory (default: cwd)").option("--a2a-url <url>","Public URL of the A2A card (catalog row)").option("--door-url <url>","A2A door when .fafa has no a2a endpoint").option("--faf-pointer <url>","Absolute .faf pointer for served cards (default: ./project.faf)").option("--check","Print projected cards to stdout, do not write").option("--force","Replace a card file faf cannot prove it wrote (edited since, or not faf's)").action(($)=>UG($));g.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--fix","Auto-fix issues").option("--doctor","Full diagnostic").option("--trust","Verify trust chain").option("--verbose","Show slot breakdown").action(($,Z)=>N9($,Z));g.command("info").description("Show version and system info").option("--version","Show version").option("--faq","Show FAQ").option("--index","Show command index").option("--stacks","Show supported stacks").action(($)=>cG($));g.command("formats").description("Show supported formats").action(()=>pG());g.command("clear").description("Clear cached data").action(()=>lG());g.command("convert").description("Convert .faf to other formats").option("--json","Output as JSON").action(($)=>dG($));g.command("context").description("Author context output").action(()=>iG());g.command("refresh").description("Re-ground on the live .faf — re-score, measure drift vs the DNA baseline, keep .fafb current").option("--json","Output as JSON").action(($)=>DH($));g.command("drift").description("Check context drift").option("--json","Emit the drift report as structured JSON").action(($)=>oG($));g.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>aG($,Z));g.command("recover").description("Recover .faf from context files").action(()=>tG());g.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>eG($));g.command("pro [subcommand]").description("Pro features & licensing").action(($)=>$V($));g.command("share").description("Share .faf via URL").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>ZV($));g.command("demo").description("Demo walkthrough").action(()=>zV());g.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>QV($,Z));g.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` wires the CI receipt printer; bare snapshot deprecated → faf score --json").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a TAF snapshot)").action(($,Z)=>JV($,Z));g.command("ai [subcommand]").description("Ask Claude for suggestions about project.faf (analyze)").action(($)=>UH($));g.command("conductor [subcommand] [path]").description("Conductor integration").action(($,Z)=>VH($,Z));g.command("wjttc").description("Audit test suite for WJTTC tier coverage (vendor-neutral)").option("--path <path>","Test directory (default: tests)").option("--strict","Exit non-zero if any tests are untiered").option("--json","Output as JSON for CI consumption").action(($)=>qH($));g.command("memory [subcommand] [arg]").description(".fafm soul ops — convert Claude memory, etch, recall, ls, show").option("-f, --file <path>","Soul file (default: ./soul.fafm)").option("-o, --output <path>","Output path (convert)").option("--namepoint <handle>","Namepoint for new/converted soul").option("--id <id>","Fact id (etch)").option("--type <type>","Fact type filter / etch type").option("--tag <tags>","Comma-separated tags (recall)").option("--priority <level>","Min priority floor (recall) or etch priority").option("--limit <n>","Max recall hits").option("--json","JSON output").option("--force","Overwrite an existing soul.fafm (convert)").action(($,Z,z)=>kH($,Z,z));g.command("bi-sync",{hidden:!0}).action(()=>J9());g.command("status",{hidden:!0}).action(()=>_5(void 0,{status:!0}));g.command("agents",{hidden:!0}).action(()=>s6({agents:!0}));g.command("cursor",{hidden:!0}).action(()=>s6({cursor:!0}));g.command("gemini",{hidden:!0}).action(()=>s6({gemini:!0}));g.command("grok",{hidden:!0}).action(()=>s6({grok:!0}));g.command("llms",{hidden:!0}).action(()=>s6({llms:!0}));g.command("validate",{hidden:!0}).action(($)=>N9($));g.command("yolo",{hidden:!0}).action(()=>s3({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:z}=await Promise.resolve().then(() => (d(),fY)),Q=process.cwd().replace(process.env.HOME??"","~"),X="\x1B[38;2;150;150;150m",J="\x1B[48;2;150;150;150m",Y="\x1B[38;2;29;29;29m",W="\x1B[48;2;29;29;29m",U="\x1B[0m";console.log(""),console.log(`\x1B[48;2;29;29;29m ${"\x1B[38;2;150;150;150m"}▄${"\x1B[48;2;150;150;150m"}███████${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▄${"\x1B[0m"}`),console.log(`\x1B[48;2;29;29;29m \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}█${"\x1B[38;2;29;29;29m"}█${"\x1B[38;2;150;150;150m"}███████${"\x1B[0m"} ${z($("faf"))} ${Z(`v${bH}`)}`);let G="\x1B[38;2;39;174;96m";console.log(`\x1B[48;2;29;29;29m${"\x1B[38;2;150;150;150m"}▀${"\x1B[48;2;150;150;150m"}${"\x1B[38;2;29;29;29m"}▀${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[0m ${Z("Nelly Never Forgets")}`),console.log(`${G}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`),console.log(`${Z(` ${Q}`)}`),console.log("");try{await _5(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${z("faf --help")} ${Z("for commands")}`)})();else g.addHelpText("after",["","Git-native (The GIT Version):"," faf diff [range] semantic context diff + score delta (A..B, A...B)"," faf diff --install-driver make native `git diff` render .faf deltas"," faf log score timeline across history (Proof-Over-Time)"," faf hooks --install pre-commit guard against context regression"," faf git <url> [--ref] instant scored context from any repo, any branch/tag","",' "FAF is to Context what Git is to Versions."',""].join(`
572
- `)),g.parseAsync(process.argv).catch(($)=>{if(!w$($))throw $;console.error(K6($,xx())),process.exit(1)});function xx(){let $=process.argv[2];return g.commands.find((z)=>z.name()===$||z.aliases().includes($))?.options.some((z)=>z.long==="--force")??!1}
571
+ `),console.log(M(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json · --force")),console.log(M(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}var{version:cq}=u9(),g=new gQ;g.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(cq,"-v, --version");g.command("init").description("Create .faf from your project").option("--yolo","Quick init with sensible defaults").option("--quick","Alias for --yolo").option("--force","Overwrite existing project.faf").option("--output <path>","Output path").action(($)=>t3($));g.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>uW());g.command("auto").description("Fill every tech slot from the repo, then score").action(()=>c5());g.command("loop").description("Drive to 100% — source what we can, then ask only the human").option("-r, --rounds <n>","max auto rounds before stopping","5").action(($)=>cW($));g.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>MV($));g.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>P5($,Z));g.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key)").option("--json","Output as JSON").option("--cold","Grade as the without-context run").option("--faf","Grade as the with-context run").option("--tokens <n>","Tokens used in the run (reported by the agent)").option("--model <name>","Model that answered (reported)").option("--file <path>","Path to project.faf (default: discovered)").option("--submit","Submit the full-pair receipt to the public bench ledger").option("--endpoint <url>","Override the submit endpoint").action(($,Z,z)=>Rq($,Z,z));g.command("show").description("Render project.faf → project.html and open it").option("--force","Replace a project.html faf cannot prove it rendered (edited since, or not faf's)").action(($)=>LG($));g.command("sync").description(".faf → CLAUDE.md (--direction pull: Trophy-gated backfill into .faf)").option("--watch","Watch for changes").option("--direction <dir>","auto|push write CLAUDE.md from .faf; pull backfills .faf at ✪ Trophy","auto").action(($)=>U9($));g.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").option("--force","Replace an output file that is not a .fafb faf compiled").action(($,Z)=>OU($,Z));g.command("decompile <file>").description("Decompile .fafb to JSON").option("--output <path>","Output path").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a faf decompile)").action(($,Z)=>EU($,Z));g.command("git <url>").description("Instant scored context from any GitHub repo (any branch/tag with --ref)").option("--ref <ref>","Clone at a specific branch or tag (versioned context)").option("--output <path>","Write to a custom path (default: ./project.faf)").option("--force","Overwrite an existing project.faf").option("--stdout","Print the .faf to stdout instead of writing a file").action(($,Z)=>TG($,Z));g.command("diff [range]").description("Semantic context diff between two .faf versions (slot deltas + score). git ranges: <ref>, A..B, A...B").option("--json","Emit the delta as structured JSON").option("--install-driver","Wire faf diff into native git — `git diff` renders .faf score+slot deltas").option("--uninstall-driver","Remove the native-git diff driver").action(($,Z)=>yG($,Z));g.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>SG($??[]));g.command("log").description("Score timeline across git history — the .faf score at every commit that touched it").option("-n, --limit <n>","Max commits to show (default 20)").option("--all","Show every commit, no cap").option("--reverse","Oldest-first instead of newest-first").option("--json","Emit the timeline as structured JSON").action(($)=>kG($));g.command("hooks").description("Pre-commit context guard — scores staged .faf vs HEAD, warns (or --strict blocks) on regression").option("--install","Install the pre-commit hook").option("--uninstall","Remove the faf hook block (preserves other hooks)").option("--strict","With --install: block the commit on a score regression (default: warn only)").action(($)=>rG($));g.command("hooks-run",{hidden:!0}).description("Internal: the pre-commit context guard the git hook invokes").option("--strict","Exit non-zero on a score regression").action(($)=>nG($));g.command("export").description("Export context files from .faf").option("--agents","Author AGENTS.md").option("--cursor","Author .cursorrules").option("--gemini","Author GEMINI.md").option("--copilot","Author .github/copilot-instructions.md (GitHub Copilot)").option("--grok","Wire grok-faf-mcp into .grok/config.toml").option("--llms","Author llms.txt (llmstxt.org view of authored 6Ws — opt-in)").option("--conductor","Author conductor config").option("--html","Author project.html (visual render of project.faf)").option("--card","Author MCP Server Card (./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(($)=>o6($));g.command("server-card").description("Emit the registry server.json identity (name + title + _meta) from project.faf — the cross-language server-card emitter; patches an existing file").option("--in <path>","Existing server.json to patch (default: ./server.json)").option("--out <path>","Output path (default: same as --in)").option("--faf <path>","project.faf path (default: auto-discover)").option("--set-version <version>","Set the version field (default: preserve existing). NOTE: not --version, which is the global CLI-version flag").option("--generated <iso>","Override the _meta generated stamp (default: preserve existing)").option("--check","Print to stdout, do not write (diff/verify — the idempotency-test hook)").option("--force","With --out: replace a file faf cannot prove it wrote (edited since, or no faf identity)").action(($)=>HG($));g.command("cards").description("Project .faf + .fafa onto A2A / MCP / registry / catalog cards — one context block, every door").option("--target <list>","Comma list: a2a,mcp,registry,catalog,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(($)=>MG($));g.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--fix","Auto-fix issues").option("--doctor","Full diagnostic").option("--trust","Verify trust chain").option("--verbose","Show slot breakdown").action(($,Z)=>I9($,Z));g.command("info").description("Show version and system info").option("--version","Show version").option("--faq","Show FAQ").option("--index","Show command index").option("--stacks","Show supported stacks").action(($)=>sG($));g.command("formats").description("Show supported formats").action(()=>oG());g.command("clear").description("Clear cached data").action(()=>aG());g.command("convert").description("Convert .faf to other formats").option("--json","Output as JSON").action(($)=>tG($));g.command("context").description("Author context output").action(()=>eG());g.command("refresh").description("Re-ground on the live .faf — re-score, measure drift vs the DNA baseline, keep .fafb current").option("--json","Output as JSON").action(($)=>Fq($));g.command("drift").description("Check context drift").option("--json","Emit the drift report as structured JSON").action(($)=>QV($));g.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>XV($,Z));g.command("recover").description("Recover .faf from context files").action(()=>JV());g.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>YV($));g.command("pro [subcommand]").description("Pro features & licensing").action(($)=>WV($));g.command("share").description("Share .faf via URL").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>UV($));g.command("demo").description("Demo walkthrough").action(()=>GV());g.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>VV($,Z));g.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` wires the CI receipt printer; bare snapshot deprecated → faf score --json").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a TAF snapshot)").action(($,Z)=>HV($,Z));g.command("ai [subcommand]").description("Ask Claude for suggestions about project.faf (analyze)").action(($)=>Mq($));g.command("conductor [subcommand] [path]").description("Conductor integration").action(($,Z)=>Nq($,Z));g.command("wjttc").description("Audit test suite for WJTTC tier coverage (vendor-neutral)").option("--path <path>","Test directory (default: tests)").option("--strict","Exit non-zero if any tests are untiered").option("--json","Output as JSON for CI consumption").action(($)=>Dq($));g.command("memory [subcommand] [arg]").description(".fafm soul ops — convert Claude memory, etch, recall, ls, show").option("-f, --file <path>","Soul file (default: ./soul.fafm)").option("-o, --output <path>","Output path (convert)").option("--namepoint <handle>","Namepoint for new/converted soul").option("--id <id>","Fact id (etch)").option("--type <type>","Fact type filter / etch type").option("--tag <tags>","Comma-separated tags (recall)").option("--priority <level>","Min priority floor (recall) or etch priority").option("--limit <n>","Max recall hits").option("--json","JSON output").option("--force","Overwrite an existing soul.fafm (convert)").action(($,Z,z)=>mq($,Z,z));g.command("bi-sync",{hidden:!0}).action(()=>U9());g.command("status",{hidden:!0}).action(()=>P5(void 0,{status:!0}));g.command("agents",{hidden:!0}).action(()=>o6({agents:!0}));g.command("cursor",{hidden:!0}).action(()=>o6({cursor:!0}));g.command("gemini",{hidden:!0}).action(()=>o6({gemini:!0}));g.command("grok",{hidden:!0}).action(()=>o6({grok:!0}));g.command("llms",{hidden:!0}).action(()=>o6({llms:!0}));g.command("validate",{hidden:!0}).action(($)=>I9($));g.command("yolo",{hidden:!0}).action(()=>t3({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:z}=await Promise.resolve().then(() => (d(),pY)),Q=process.cwd().replace(process.env.HOME??"","~"),X="\x1B[38;2;150;150;150m",J="\x1B[48;2;150;150;150m",Y="\x1B[38;2;29;29;29m",W="\x1B[48;2;29;29;29m",U="\x1B[0m";console.log(""),console.log(`\x1B[48;2;29;29;29m ${"\x1B[38;2;150;150;150m"}▄${"\x1B[48;2;150;150;150m"}███████${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▄${"\x1B[0m"}`),console.log(`\x1B[48;2;29;29;29m \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}█${"\x1B[38;2;29;29;29m"}█${"\x1B[38;2;150;150;150m"}███████${"\x1B[0m"} ${z($("faf"))} ${Z(`v${cq}`)}`);let G="\x1B[38;2;39;174;96m";console.log(`\x1B[48;2;29;29;29m${"\x1B[38;2;150;150;150m"}▀${"\x1B[48;2;150;150;150m"}${"\x1B[38;2;29;29;29m"}▀${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[0m ${Z("Nelly Never Forgets")}`),console.log(`${G}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`),console.log(`${Z(` ${Q}`)}`),console.log("");try{await P5(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${z("faf --help")} ${Z("for commands")}`)})();else g.addHelpText("after",["","Git-native (The GIT Version):"," faf diff [range] semantic context diff + score delta (A..B, A...B)"," faf diff --install-driver make native `git diff` render .faf deltas"," faf log score timeline across history (Proof-Over-Time)"," faf hooks --install pre-commit guard against context regression"," faf git <url> [--ref] instant scored context from any repo, any branch/tag","",' "FAF is to Context what Git is to Versions."',""].join(`
572
+ `)),g.parseAsync(process.argv).catch(($)=>{if(!x$($))throw $;console.error(K6($,mx())),process.exit(1)});function mx(){let $=process.argv[2];return g.commands.find((z)=>z.name()===$||z.aliases().includes($))?.options.some((z)=>z.long==="--force")??!1}
573
573
 
574
- //# debugId=35F37ADBF0E6CE5F64756E2164756E21
574
+ //# debugId=3782CDA668590EB264756E2164756E21
575
575
  //# sourceMappingURL=cli.js.map