faf-cli 6.7.1 → 6.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -8
- package/dist/cli.js +264 -223
- package/dist/cli.js.map +27 -15
- package/dist/core/interview.d.ts +64 -0
- package/dist/core/slots.d.ts +4 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +110 -110
- package/dist/index.js.map +6 -5
- package/package.json +5 -4
package/dist/cli.js
CHANGED
|
@@ -1,176 +1,176 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as
|
|
3
|
-
`)}displayWidth($){return
|
|
4
|
-
`+" ".repeat(Z+
|
|
5
|
-
${Q}`)}boxWrap($,Z){if(Z<this.minWidthToWrap)return $;let
|
|
6
|
-
`)}}function
|
|
2
|
+
import{createRequire as az}from"node:module";var uz=Object.create;var{getPrototypeOf:mz,defineProperty:A6,getOwnPropertyNames:cz}=Object;var dz=Object.prototype.hasOwnProperty;function pz($){return this[$]}var lz,iz,nz=($,Z,X)=>{var z=$!=null&&typeof $==="object";if(z){var J=Z?lz??=new WeakMap:iz??=new WeakMap,Q=J.get($);if(Q)return Q}X=$!=null?uz(mz($)):{};let Y=Z||!$||!$.__esModule?A6(X,"default",{value:$,enumerable:!0}):X;for(let G of cz($))if(!dz.call(Y,G))A6(Y,G,{get:pz.bind($,G),enumerable:!0});if(z)J.set($,Y);return Y};var A=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var sz=($)=>$;function rz($,Z){this[$]=sz.bind(null,Z)}var RZ=($,Z)=>{for(var X in Z)A6($,X,{get:Z[X],enumerable:!0,configurable:!0,set:rz.bind(Z,X)})};var S=($,Z)=>()=>($&&(Z=$($=0)),Z);var T0=az(import.meta.url);var F1=A((oz)=>{class R6 extends Error{constructor($,Z,X){super(X);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=Z,this.exitCode=$,this.nestedError=void 0}}class FZ extends R6{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}oz.CommanderError=R6;oz.InvalidArgumentError=FZ});var l4=A((XJ)=>{var{InvalidArgumentError:$J}=F1();class wZ{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,X)=>{if(!this.argChoices.includes(Z))throw new $J(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,X);return Z},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function ZJ($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}XJ.Argument=wZ;XJ.humanReadableArgName=ZJ});var F6=A((YJ)=>{var{humanReadableArgName:QJ}=l4();class PZ{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((z)=>!z._hidden),X=$._getHelpCommand();if(X&&!X._hidden)Z.push(X);if(this.sortSubcommands)Z.sort((z,J)=>{return z.name().localeCompare(J.name())});return Z}compareOptions($,Z){let X=(z)=>{return z.short?z.short.replace(/^-/,""):z.long.replace(/^--/,"")};return X($).localeCompare(X(Z))}visibleOptions($){let Z=$.options.filter((z)=>!z.hidden),X=$._getHelpOption();if(X&&!X.hidden){let z=X.short&&$._findOption(X.short),J=X.long&&$._findOption(X.long);if(!z&&!J)Z.push(X);else if(X.long&&!J)Z.push($.createOption(X.long,X.description));else if(X.short&&!z)Z.push($.createOption(X.short,X.description))}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let Z=[];for(let X=$.parent;X;X=X.parent){let z=X.options.filter((J)=>!J.hidden);Z.push(...z)}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((X)=>QJ(X)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(Z?" "+Z:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,Z){return Z.visibleCommands($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleSubcommandTerm(Z.subcommandTerm(z))))},0)}longestOptionTermLength($,Z){return Z.visibleOptions($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(z))))},0)}longestGlobalOptionTermLength($,Z){return Z.visibleGlobalOptions($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(z))))},0)}longestArgumentTermLength($,Z){return Z.visibleArguments($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleArgumentTerm(Z.argumentTerm(z))))},0)}commandUsage($){let Z=$._name;if($._aliases[0])Z=Z+"|"+$._aliases[0];let X="";for(let z=$.parent;z;z=z.parent)X=z.name()+" "+X;return X+Z+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((X)=>JSON.stringify(X)).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 X=`(${Z.join(", ")})`;if($.description)return`${$.description} ${X}`;return X}return $.description}argumentDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((X)=>JSON.stringify(X)).join(", ")}`);if($.defaultValue!==void 0)Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(Z.length>0){let X=`(${Z.join(", ")})`;if($.description)return`${$.description} ${X}`;return X}return $.description}formatItemList($,Z,X){if(Z.length===0)return[];return[X.styleTitle($),...Z,""]}groupItems($,Z,X){let z=new Map;return $.forEach((J)=>{let Q=X(J);if(!z.has(Q))z.set(Q,[])}),Z.forEach((J)=>{let Q=X(J);if(!z.has(Q))z.set(Q,[]);z.get(Q).push(J)}),z}formatHelp($,Z){let X=Z.padWidth($,Z),z=Z.helpWidth??80;function J(q,V){return Z.formatItem(q,X,V,Z)}let Q=[`${Z.styleTitle("Usage:")} ${Z.styleUsage(Z.commandUsage($))}`,""],Y=Z.commandDescription($);if(Y.length>0)Q=Q.concat([Z.boxWrap(Z.styleCommandDescription(Y),z),""]);let G=Z.visibleArguments($).map((q)=>{return J(Z.styleArgumentTerm(Z.argumentTerm(q)),Z.styleArgumentDescription(Z.argumentDescription(q)))});if(Q=Q.concat(this.formatItemList("Arguments:",G,Z)),this.groupItems($.options,Z.visibleOptions($),(q)=>q.helpGroupHeading??"Options:").forEach((q,V)=>{let K=q.map((N)=>{return J(Z.styleOptionTerm(Z.optionTerm(N)),Z.styleOptionDescription(Z.optionDescription(N)))});Q=Q.concat(this.formatItemList(V,K,Z))}),Z.showGlobalOptions){let q=Z.visibleGlobalOptions($).map((V)=>{return J(Z.styleOptionTerm(Z.optionTerm(V)),Z.styleOptionDescription(Z.optionDescription(V)))});Q=Q.concat(this.formatItemList("Global Options:",q,Z))}return this.groupItems($.commands,Z.visibleCommands($),(q)=>q.helpGroup()||"Commands:").forEach((q,V)=>{let K=q.map((N)=>{return J(Z.styleSubcommandTerm(Z.subcommandTerm(N)),Z.styleSubcommandDescription(Z.subcommandDescription(N)))});Q=Q.concat(this.formatItemList(V,K,Z))}),Q.join(`
|
|
3
|
+
`)}displayWidth($){return _Z($).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,X,z){let Q=" ".repeat(2);if(!X)return Q+$;let Y=$.padEnd(Z+$.length-z.displayWidth($)),G=2,W=(this.helpWidth??80)-Z-G-2,q;if(W<this.minWidthToWrap||z.preformatted(X))q=X;else q=z.boxWrap(X,W).replace(/\n/g,`
|
|
4
|
+
`+" ".repeat(Z+G));return Q+Y+" ".repeat(G)+q.replace(/\n/g,`
|
|
5
|
+
${Q}`)}boxWrap($,Z){if(Z<this.minWidthToWrap)return $;let X=$.split(/\r\n|\n/),z=/[\s]*[^\s]+/g,J=[];return X.forEach((Q)=>{let Y=Q.match(z);if(Y===null){J.push("");return}let G=[Y.shift()],U=this.displayWidth(G[0]);Y.forEach((W)=>{let q=this.displayWidth(W);if(U+q<=Z){G.push(W),U+=q;return}J.push(G.join(""));let V=W.trimStart();G=[V],U=this.displayWidth(V)}),J.push(G.join(""))}),J.join(`
|
|
6
|
+
`)}}function _Z($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}YJ.Help=PZ;YJ.stripColor=_Z});var w6=A((VJ)=>{var{InvalidArgumentError:WJ}=F1();class EZ{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let X=qJ($);if(this.short=X.shortFlag,this.long=X.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,X)=>{if(!this.argChoices.includes(Z))throw new WJ(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,X);return Z},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return CZ(this.name().replace(/^no-/,""));return CZ(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class jZ{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,X)=>{if(this.positiveOptions.has(X))this.dualOptions.add(X)})}valueFromOption($,Z){let X=Z.attributeName();if(!this.dualOptions.has(X))return!0;let z=this.negativeOptions.get(X).presetArg,J=z!==void 0?z:!1;return Z.negate===(J===$)}}function CZ($){return $.split("-").reduce((Z,X)=>{return Z+X[0].toUpperCase()+X.slice(1)})}function qJ($){let Z,X,z=/^-[^-]$/,J=/^--[^-]/,Q=$.split(/[ |,]+/).concat("guard");if(z.test(Q[0]))Z=Q.shift();if(J.test(Q[0]))X=Q.shift();if(!Z&&z.test(Q[0]))Z=Q.shift();if(!Z&&J.test(Q[0]))Z=X,X=Q.shift();if(Q[0].startsWith("-")){let Y=Q[0],G=`option creation failed due to '${Y}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${G}
|
|
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
|
-
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(
|
|
10
|
-
- too many short flags`);if(J.test(Y))throw Error(`${
|
|
11
|
-
- too many long flags`);throw Error(`${
|
|
12
|
-
- unrecognised flag format`)}if(Z===void 0&&
|
|
13
|
-
(Did you mean one of ${
|
|
14
|
-
(Did you mean ${
|
|
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
|
|
16
|
-
Expecting one of '${
|
|
17
|
-
- already used by option '${Z.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let Z=(
|
|
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,
|
|
19
|
-
- if '${
|
|
9
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(z.test(Y))throw Error(`${G}
|
|
10
|
+
- too many short flags`);if(J.test(Y))throw Error(`${G}
|
|
11
|
+
- too many long flags`);throw Error(`${G}
|
|
12
|
+
- unrecognised flag format`)}if(Z===void 0&&X===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:Z,longFlag:X}}VJ.Option=EZ;VJ.DualOptions=jZ});var SZ=A((NJ)=>{function BJ($,Z){if(Math.abs($.length-Z.length)>3)return Math.max($.length,Z.length);let X=[];for(let z=0;z<=$.length;z++)X[z]=[z];for(let z=0;z<=Z.length;z++)X[0][z]=z;for(let z=1;z<=Z.length;z++)for(let J=1;J<=$.length;J++){let Q=1;if($[J-1]===Z[z-1])Q=0;else Q=1;if(X[J][z]=Math.min(X[J-1][z]+1,X[J][z-1]+1,X[J-1][z-1]+Q),J>1&&z>1&&$[J-1]===Z[z-2]&&$[J-2]===Z[z-1])X[J][z]=Math.min(X[J][z],X[J-2][z-2]+1)}return X[$.length][Z.length]}function LJ($,Z){if(!Z||Z.length===0)return"";Z=Array.from(new Set(Z));let X=$.startsWith("--");if(X)$=$.slice(2),Z=Z.map((Y)=>Y.slice(2));let z=[],J=3,Q=0.4;if(Z.forEach((Y)=>{if(Y.length<=1)return;let G=BJ($,Y),U=Math.max($.length,Y.length);if((U-G)/U>Q){if(G<J)J=G,z=[Y];else if(G===J)z.push(Y)}}),z.sort((Y,G)=>Y.localeCompare(G)),X)z=z.map((Y)=>`--${Y}`);if(z.length>1)return`
|
|
13
|
+
(Did you mean one of ${z.join(", ")}?)`;if(z.length===1)return`
|
|
14
|
+
(Did you mean ${z[0]}?)`;return""}NJ.suggestSimilar=LJ});var yZ=A((FJ)=>{var TJ=T0("node:events").EventEmitter,P6=T0("node:child_process"),f0=T0("node:path"),i4=T0("node:fs"),p=T0("node:process"),{Argument:OJ,humanReadableArgName:DJ}=l4(),{CommanderError:_6}=F1(),{Help:IJ,stripColor:AJ}=F6(),{Option:bZ,DualOptions:RJ}=w6(),{suggestSimilar:xZ}=SZ();class E6 extends TJ{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)=>p.stdout.write(Z),writeErr:(Z)=>p.stderr.write(Z),outputError:(Z,X)=>X(Z),getOutHelpWidth:()=>p.stdout.isTTY?p.stdout.columns:void 0,getErrHelpWidth:()=>p.stderr.isTTY?p.stderr.columns:void 0,getOutHasColors:()=>C6()??(p.stdout.isTTY&&p.stdout.hasColors?.()),getErrHasColors:()=>C6()??(p.stderr.isTTY&&p.stderr.hasColors?.()),stripColor:(Z)=>AJ(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,X){let z=Z,J=X;if(typeof z==="object"&&z!==null)J=z,z=null;J=J||{};let[,Q,Y]=$.match(/([^ ]+) *(.*)/),G=this.createCommand(Q);if(z)G.description(z),G._executableHandler=!0;if(J.isDefault)this._defaultCommandName=G._name;if(G._hidden=!!(J.noHelp||J.hidden),G._executableFile=J.executableFile||null,Y)G.arguments(Y);if(this._registerCommand(G),G.parent=this,G.copyInheritedSettings(this),z)return this;return G}createCommand($){return new E6($)}createHelp(){return Object.assign(new IJ,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 OJ($,Z)}argument($,Z,X,z){let J=this.createArgument($,Z);if(typeof X==="function")J.default(z).argParser(X);else J.default(X);return this.addArgument(J),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 X=$??"help [command]",[,z,J]=X.match(/([^ ]+) *(.*)/),Q=Z??"display help for command",Y=this.createCommand(z);if(Y.helpOption(!1),J)Y.arguments(J);if(Q)Y.description(Q);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 X=["preSubcommand","preAction","postAction"];if(!X.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
|
|
16
|
+
Expecting one of '${X.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,X){if(this._exitCallback)this._exitCallback(new _6($,Z,X));p.exit($)}action($){let Z=(X)=>{let z=this.registeredArguments.length,J=X.slice(0,z);if(this._storeOptionsAsProperties)J[z]=this;else J[z]=this.opts();return J.push(this),$.apply(this,J)};return this._actionHandler=Z,this}createOption($,Z){return new bZ($,Z)}_callParseArg($,Z,X,z){try{return $.parseArg(Z,X)}catch(J){if(J.code==="commander.invalidArgument"){let Q=`${z} ${J.message}`;this.error(Q,{exitCode:J.exitCode,code:J.code})}throw J}}_registerOption($){let Z=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(Z){let X=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${X}'
|
|
17
|
+
- already used by option '${Z.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let Z=(z)=>{return[z.name()].concat(z.aliases())},X=Z($).find((z)=>this._findCommand(z));if(X){let z=Z(this._findCommand(X)).join("|"),J=Z($).join("|");throw Error(`cannot add command '${J}' as already have command '${z}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let Z=$.name(),X=$.attributeName();if($.negate){let J=$.long.replace(/^--no-/,"--");if(!this._findOption(J))this.setOptionValueWithSource(X,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(X,$.defaultValue,"default");let z=(J,Q,Y)=>{if(J==null&&$.presetArg!==void 0)J=$.presetArg;let G=this.getOptionValue(X);if(J!==null&&$.parseArg)J=this._callParseArg($,J,G,Q);else if(J!==null&&$.variadic)J=$._collectValue(J,G);if(J==null)if($.negate)J=!1;else if($.isBoolean()||$.optional)J=!0;else J="";this.setOptionValueWithSource(X,J,Y)};if(this.on("option:"+Z,(J)=>{let Q=`error: option '${$.flags}' argument '${J}' is invalid.`;z(J,Q,"cli")}),$.envVar)this.on("optionEnv:"+Z,(J)=>{let Q=`error: option '${$.flags}' value '${J}' from env '${$.envVar}' is invalid.`;z(J,Q,"env")});return this}_optionEx($,Z,X,z,J){if(typeof Z==="object"&&Z instanceof bZ)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let Q=this.createOption(Z,X);if(Q.makeOptionMandatory(!!$.mandatory),typeof z==="function")Q.default(J).argParser(z);else if(z instanceof RegExp){let Y=z;z=(G,U)=>{let W=Y.exec(G);return W?W[0]:U},Q.default(J).argParser(z)}else Q.default(z);return this.addOption(Q)}option($,Z,X,z){return this._optionEx({},$,Z,X,z)}requiredOption($,Z,X,z){return this._optionEx({mandatory:!0},$,Z,X,z)}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,X){if(this._storeOptionsAsProperties)this[$]=Z;else this._optionValues[$]=Z;return this._optionValueSources[$]=X,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let Z;return this._getCommandAndAncestors().forEach((X)=>{if(X.getOptionValueSource($)!==void 0)Z=X.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(p.versions?.electron)Z.from="electron";let z=p.execArgv??[];if(z.includes("-e")||z.includes("--eval")||z.includes("-p")||z.includes("--print"))Z.from="eval"}if($===void 0)$=p.argv;this.rawArgs=$.slice();let X;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],X=$.slice(2);break;case"electron":if(p.defaultApp)this._scriptPath=$[1],X=$.slice(2);else X=$.slice(1);break;case"user":X=$.slice(0);break;case"eval":X=$.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",X}parse($,Z){this._prepareForParse();let X=this._prepareUserArgs($,Z);return this._parseCommand([],X),this}async parseAsync($,Z){this._prepareForParse();let X=this._prepareUserArgs($,Z);return await this._parseCommand([],X),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,X){if(i4.existsSync($))return;let z=Z?`searched for local subcommand relative to directory '${Z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",J=`'${$}' does not exist
|
|
19
|
+
- if '${X}' 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
|
-
- ${
|
|
21
|
+
- ${z}`;throw Error(J)}_executeSubCommand($,Z){Z=Z.slice();let X=!1,z=[".js",".ts",".tsx",".mjs",".cjs"];function J(W,q){let V=f0.resolve(W,q);if(i4.existsSync(V))return V;if(z.includes(f0.extname(q)))return;let K=z.find((N)=>i4.existsSync(`${V}${N}`));if(K)return`${V}${K}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Q=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let W;try{W=i4.realpathSync(this._scriptPath)}catch{W=this._scriptPath}Y=f0.resolve(f0.dirname(W),Y)}if(Y){let W=J(Y,Q);if(!W&&!$._executableFile&&this._scriptPath){let q=f0.basename(this._scriptPath,f0.extname(this._scriptPath));if(q!==this._name)W=J(Y,`${q}-${$._name}`)}Q=W||Q}X=z.includes(f0.extname(Q));let G;if(p.platform!=="win32")if(X)Z.unshift(Q),Z=kZ(p.execArgv).concat(Z),G=P6.spawn(p.argv[0],Z,{stdio:"inherit"});else G=P6.spawn(Q,Z,{stdio:"inherit"});else this._checkForMissingExecutable(Q,Y,$._name),Z.unshift(Q),Z=kZ(p.execArgv).concat(Z),G=P6.spawn(p.execPath,Z,{stdio:"inherit"});if(!G.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((q)=>{p.on(q,()=>{if(G.killed===!1&&G.exitCode===null)G.kill(q)})});let U=this._exitCallback;G.on("close",(W)=>{if(W=W??1,!U)p.exit(W);else U(new _6(W,"commander.executeSubCommandAsync","(close)"))}),G.on("error",(W)=>{if(W.code==="ENOENT")this._checkForMissingExecutable(Q,Y,$._name);else if(W.code==="EACCES")throw Error(`'${Q}' not executable`);if(!U)p.exit(1);else{let q=new _6(1,"commander.executeSubCommandAsync","(error)");q.nestedError=W,U(q)}}),this.runningCommand=G}_dispatchSubcommand($,Z,X){let z=this._findCommand($);if(!z)this.help({error:!0});z._prepareForParse();let J;return J=this._chainOrCallSubCommandHook(J,z,"preSubcommand"),J=this._chainOrCall(J,()=>{if(z._executableHandler)this._executeSubCommand(z,Z.concat(X));else return z._parseCommand(Z,X)}),J}_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 $=(X,z,J)=>{let Q=z;if(z!==null&&X.parseArg){let Y=`error: command-argument value '${z}' is invalid for argument '${X.name()}'.`;Q=this._callParseArg(X,z,J,Y)}return Q};this._checkNumberOfArguments();let Z=[];this.registeredArguments.forEach((X,z)=>{let J=X.defaultValue;if(X.variadic){if(z<this.args.length){if(J=this.args.slice(z),X.parseArg)J=J.reduce((Q,Y)=>{return $(X,Y,Q)},X.defaultValue)}else if(J===void 0)J=[]}else if(z<this.args.length){if(J=this.args[z],X.parseArg)J=$(X,J,X.defaultValue)}Z[z]=J}),this.processedArgs=Z}_chainOrCall($,Z){if($?.then&&typeof $.then==="function")return $.then(()=>Z());return Z()}_chainOrCallHooks($,Z){let X=$,z=[];if(this._getCommandAndAncestors().reverse().filter((J)=>J._lifeCycleHooks[Z]!==void 0).forEach((J)=>{J._lifeCycleHooks[Z].forEach((Q)=>{z.push({hookedCommand:J,callback:Q})})}),Z==="postAction")z.reverse();return z.forEach((J)=>{X=this._chainOrCall(X,()=>{return J.callback(J.hookedCommand,this)})}),X}_chainOrCallSubCommandHook($,Z,X){let z=$;if(this._lifeCycleHooks[X]!==void 0)this._lifeCycleHooks[X].forEach((J)=>{z=this._chainOrCall(z,()=>{return J(this,Z)})});return z}_parseCommand($,Z){let X=this.parseOptions(Z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(X.operands),Z=X.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(X.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let z=()=>{if(X.unknown.length>0)this.unknownOption(X.unknown[0])},J=`command:${this.name()}`;if(this._actionHandler){z(),this._processArguments();let Q;if(Q=this._chainOrCallHooks(Q,"preAction"),Q=this._chainOrCall(Q,()=>this._actionHandler(this.processedArgs)),this.parent)Q=this._chainOrCall(Q,()=>{this.parent.emit(J,$,Z)});return Q=this._chainOrCallHooks(Q,"postAction"),Q}if(this.parent?.listenerCount(J))z(),this._processArguments(),this.parent.emit(J,$,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 z(),this._processArguments()}else if(this.commands.length)z(),this.help({error:!0});else z(),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((X)=>{let z=X.attributeName();if(this.getOptionValue(z)===void 0)return!1;return this.getOptionValueSource(z)!=="default"});$.filter((X)=>X.conflictsWith.length>0).forEach((X)=>{let z=$.find((J)=>X.conflictsWith.includes(J.attributeName()));if(z)this._conflictingOption(X,z)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let Z=[],X=[],z=Z;function J(W){return W.length>1&&W[0]==="-"}let Q=(W)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(W))return!1;return!this._getCommandAndAncestors().some((q)=>q.options.map((V)=>V.short).some((V)=>/^-\d$/.test(V)))},Y=null,G=null,U=0;while(U<$.length||G){let W=G??$[U++];if(G=null,W==="--"){if(z===X)z.push(W);z.push(...$.slice(U));break}if(Y&&(!J(W)||Q(W))){this.emit(`option:${Y.name()}`,W);continue}if(Y=null,J(W)){let q=this._findOption(W);if(q){if(q.required){let V=$[U++];if(V===void 0)this.optionMissingArgument(q);this.emit(`option:${q.name()}`,V)}else if(q.optional){let V=null;if(U<$.length&&(!J($[U])||Q($[U])))V=$[U++];this.emit(`option:${q.name()}`,V)}else this.emit(`option:${q.name()}`);Y=q.variadic?q:null;continue}}if(W.length>2&&W[0]==="-"&&W[1]!=="-"){let q=this._findOption(`-${W[1]}`);if(q){if(q.required||q.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${q.name()}`,W.slice(2));else this.emit(`option:${q.name()}`),G=`-${W.slice(2)}`;continue}}if(/^--[^=]+=/.test(W)){let q=W.indexOf("="),V=this._findOption(W.slice(0,q));if(V&&(V.required||V.optional)){this.emit(`option:${V.name()}`,W.slice(q+1));continue}}if(z===Z&&J(W)&&!(this.commands.length===0&&Q(W)))z=X;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&X.length===0){if(this._findCommand(W)){Z.push(W),X.push(...$.slice(U));break}else if(this._getHelpCommand()&&W===this._getHelpCommand().name()){Z.push(W,...$.slice(U));break}else if(this._defaultCommandName){X.push(W,...$.slice(U));break}}if(this._passThroughOptions){z.push(W,...$.slice(U));break}z.push(W)}return{operands:Z,unknown:X}}opts(){if(this._storeOptionsAsProperties){let $={},Z=this.options.length;for(let X=0;X<Z;X++){let z=this.options[X].attributeName();$[z]=z===this._versionOptionName?this._version:this[z]}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
|
|
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
|
|
26
|
-
Expecting one of '${
|
|
27
|
-
`)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((
|
|
28
|
-
`)}}
|
|
29
|
-
`)?
|
|
24
|
+
`),this.outputHelp({error:!0});let X=Z||{},z=X.exitCode||1,J=X.code||"commander.error";this._exit(z,J,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in p.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,p.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new RJ(this.options),Z=(X)=>{return this.getOptionValue(X)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(X))};this.options.filter((X)=>X.implied!==void 0&&Z(X.attributeName())&&$.valueFromOption(this.getOptionValue(X.attributeName()),X)).forEach((X)=>{Object.keys(X.implied).filter((z)=>!Z(z)).forEach((z)=>{this.setOptionValueWithSource(z,X.implied[z],"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 X=(Q)=>{let Y=Q.attributeName(),G=this.getOptionValue(Y),U=this.options.find((q)=>q.negate&&Y===q.attributeName()),W=this.options.find((q)=>!q.negate&&Y===q.attributeName());if(U&&(U.presetArg===void 0&&G===!1||U.presetArg!==void 0&&G===U.presetArg))return U;return W||Q},z=(Q)=>{let Y=X(Q),G=Y.attributeName();if(this.getOptionValueSource(G)==="env")return`environment variable '${Y.envVar}'`;return`option '${Y.flags}'`},J=`error: ${z($)} cannot be used with ${z(Z)}`;this.error(J,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let Z="";if($.startsWith("--")&&this._showSuggestionAfterError){let z=[],J=this;do{let Q=J.createHelp().visibleOptions(J).filter((Y)=>Y.long).map((Y)=>Y.long);z=z.concat(Q),J=J.parent}while(J&&!J._enablePositionalOptions);Z=xZ($,z)}let X=`error: unknown option '${$}'${Z}`;this.error(X,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let Z=this.registeredArguments.length,X=Z===1?"":"s",J=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Z} argument${X} but got ${$.length}.`;this.error(J,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],Z="";if(this._showSuggestionAfterError){let z=[];this.createHelp().visibleCommands(this).forEach((J)=>{if(z.push(J.name()),J.alias())z.push(J.alias())}),Z=xZ($,z)}let X=`error: unknown command '${$}'${Z}`;this.error(X,{code:"commander.unknownCommand"})}version($,Z,X){if($===void 0)return this._version;this._version=$,Z=Z||"-V, --version",X=X||"output the version number";let z=this.createOption(Z,X);return this._versionOptionName=z.attributeName(),this._registerOption(z),this.on("option:"+z.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 X=this.parent?._findCommand($);if(X){let z=[X.name()].concat(X.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${z}'`)}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((X)=>{return DJ(X)});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=f0.basename($,f0.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let Z=this.createHelp(),X=this._getOutputContext($);Z.prepareContext({error:X.error,helpWidth:X.helpWidth,outputHasColors:X.hasColors});let z=Z.formatHelp(this,Z);if(X.hasColors)return z;return this._outputConfiguration.stripColor(z)}_getOutputContext($){$=$||{};let Z=!!$.error,X,z,J;if(Z)X=(Y)=>this._outputConfiguration.writeErr(Y),z=this._outputConfiguration.getErrHasColors(),J=this._outputConfiguration.getErrHelpWidth();else X=(Y)=>this._outputConfiguration.writeOut(Y),z=this._outputConfiguration.getOutHasColors(),J=this._outputConfiguration.getOutHelpWidth();return{error:Z,write:(Y)=>{if(!z)Y=this._outputConfiguration.stripColor(Y);return X(Y)},hasColors:z,helpWidth:J}}outputHelp($){let Z;if(typeof $==="function")Z=$,$=void 0;let X=this._getOutputContext($),z={error:X.error,write:X.write,command:this};this._getCommandAndAncestors().reverse().forEach((Q)=>Q.emit("beforeAllHelp",z)),this.emit("beforeHelp",z);let J=this.helpInformation({error:X.error});if(Z){if(J=Z(J),typeof J!=="string"&&!Buffer.isBuffer(J))throw Error("outputHelp callback must return a string or a Buffer")}if(X.write(J),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",z),this._getCommandAndAncestors().forEach((Q)=>Q.emit("afterAllHelp",z))}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(p.exitCode??0);if(Z===0&&$&&typeof $!=="function"&&$.error)Z=1;this._exit(Z,"commander.help","(outputHelp)")}addHelpText($,Z){let X=["beforeAll","before","after","afterAll"];if(!X.includes($))throw Error(`Unexpected value for position to addHelpText.
|
|
26
|
+
Expecting one of '${X.join("', '")}'`);let z=`${$}Help`;return this.on(z,(J)=>{let Q;if(typeof Z==="function")Q=Z({error:J.error,command:J.command});else Q=Z;if(Q)J.write(`${Q}
|
|
27
|
+
`)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((z)=>Z.is(z)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function kZ($){return $.map((Z)=>{if(!Z.startsWith("--inspect"))return Z;let X,z="127.0.0.1",J="9229",Q;if((Q=Z.match(/^(--inspect(-brk)?)$/))!==null)X=Q[1];else if((Q=Z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(X=Q[1],/^\d+$/.test(Q[3]))J=Q[3];else z=Q[3];else if((Q=Z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)X=Q[1],z=Q[3],J=Q[4];if(X&&J!=="0")return`${X}=${z}:${parseInt(J)+1}`;return Z})}function C6(){if(p.env.NO_COLOR||p.env.FORCE_COLOR==="0"||p.env.FORCE_COLOR==="false")return!1;if(p.env.FORCE_COLOR||p.env.CLICOLOR_FORCE!==void 0)return!0;return}FJ.Command=E6;FJ.useColor=C6});var vZ=A((EJ)=>{var{Argument:fZ}=l4(),{Command:j6}=yZ(),{CommanderError:_J,InvalidArgumentError:gZ}=F1(),{Help:CJ}=F6(),{Option:hZ}=w6();EJ.program=new j6;EJ.createCommand=($)=>new j6($);EJ.createOption=($,Z)=>new hZ($,Z);EJ.createArgument=($,Z)=>new fZ($,Z);EJ.Command=j6;EJ.Option=hZ;EJ.Argument=fZ;EJ.Help=CJ;EJ.CommanderError=_J;EJ.InvalidArgumentError=gZ;EJ.InvalidOptionArgumentError=gZ});var c=A((sJ)=>{var S6=Symbol.for("yaml.alias"),cZ=Symbol.for("yaml.document"),n4=Symbol.for("yaml.map"),dZ=Symbol.for("yaml.pair"),b6=Symbol.for("yaml.scalar"),s4=Symbol.for("yaml.seq"),g0=Symbol.for("yaml.node.type"),mJ=($)=>!!$&&typeof $==="object"&&$[g0]===S6,cJ=($)=>!!$&&typeof $==="object"&&$[g0]===cZ,dJ=($)=>!!$&&typeof $==="object"&&$[g0]===n4,pJ=($)=>!!$&&typeof $==="object"&&$[g0]===dZ,pZ=($)=>!!$&&typeof $==="object"&&$[g0]===b6,lJ=($)=>!!$&&typeof $==="object"&&$[g0]===s4;function lZ($){if($&&typeof $==="object")switch($[g0]){case n4:case s4:return!0}return!1}function iJ($){if($&&typeof $==="object")switch($[g0]){case S6:case n4:case b6:case s4:return!0}return!1}var nJ=($)=>(pZ($)||lZ($))&&!!$.anchor;sJ.ALIAS=S6;sJ.DOC=cZ;sJ.MAP=n4;sJ.NODE_TYPE=g0;sJ.PAIR=dZ;sJ.SCALAR=b6;sJ.SEQ=s4;sJ.hasAnchor=nJ;sJ.isAlias=mJ;sJ.isCollection=lZ;sJ.isDocument=cJ;sJ.isMap=dJ;sJ.isNode=iJ;sJ.isPair=pJ;sJ.isScalar=pZ;sJ.isSeq=lJ});var w1=A((VQ)=>{var Q0=c(),L0=Symbol("break visit"),iZ=Symbol("skip children"),k0=Symbol("remove node");function r4($,Z){let X=nZ(Z);if(Q0.isDocument($)){if(k$(null,$.contents,X,Object.freeze([$]))===k0)$.contents=null}else k$(null,$,X,Object.freeze([]))}r4.BREAK=L0;r4.SKIP=iZ;r4.REMOVE=k0;function k$($,Z,X,z){let J=sZ($,Z,X,z);if(Q0.isNode(J)||Q0.isPair(J))return rZ($,z,J),k$($,J,X,z);if(typeof J!=="symbol"){if(Q0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let Q=0;Q<Z.items.length;++Q){let Y=k$(Q,Z.items[Q],X,z);if(typeof Y==="number")Q=Y-1;else if(Y===L0)return L0;else if(Y===k0)Z.items.splice(Q,1),Q-=1}}else if(Q0.isPair(Z)){z=Object.freeze(z.concat(Z));let Q=k$("key",Z.key,X,z);if(Q===L0)return L0;else if(Q===k0)Z.key=null;let Y=k$("value",Z.value,X,z);if(Y===L0)return L0;else if(Y===k0)Z.value=null}}return J}async function a4($,Z){let X=nZ(Z);if(Q0.isDocument($)){if(await y$(null,$.contents,X,Object.freeze([$]))===k0)$.contents=null}else await y$(null,$,X,Object.freeze([]))}a4.BREAK=L0;a4.SKIP=iZ;a4.REMOVE=k0;async function y$($,Z,X,z){let J=await sZ($,Z,X,z);if(Q0.isNode(J)||Q0.isPair(J))return rZ($,z,J),y$($,J,X,z);if(typeof J!=="symbol"){if(Q0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let Q=0;Q<Z.items.length;++Q){let Y=await y$(Q,Z.items[Q],X,z);if(typeof Y==="number")Q=Y-1;else if(Y===L0)return L0;else if(Y===k0)Z.items.splice(Q,1),Q-=1}}else if(Q0.isPair(Z)){z=Object.freeze(z.concat(Z));let Q=await y$("key",Z.key,X,z);if(Q===L0)return L0;else if(Q===k0)Z.key=null;let Y=await y$("value",Z.value,X,z);if(Y===L0)return L0;else if(Y===k0)Z.value=null}}return J}function nZ($){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 sZ($,Z,X,z){if(typeof X==="function")return X($,Z,z);if(Q0.isMap(Z))return X.Map?.($,Z,z);if(Q0.isSeq(Z))return X.Seq?.($,Z,z);if(Q0.isPair(Z))return X.Pair?.($,Z,z);if(Q0.isScalar(Z))return X.Scalar?.($,Z,z);if(Q0.isAlias(Z))return X.Alias?.($,Z,z);return}function rZ($,Z,X){let z=Z[Z.length-1];if(Q0.isCollection(z))z.items[$]=X;else if(Q0.isPair(z))if($==="key")z.key=X;else z.value=X;else if(Q0.isDocument(z))z.contents=X;else{let J=Q0.isAlias(z)?"alias":"scalar";throw Error(`Cannot replace node with ${J} parent`)}}VQ.visit=r4;VQ.visitAsync=a4});var x6=A((MQ)=>{var aZ=c(),BQ=w1(),LQ={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},NQ=($)=>$.replace(/[!,[\]{}]/g,(Z)=>LQ[Z]);class R0{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},R0.defaultYaml,$),this.tags=Object.assign({},R0.defaultTags,Z)}clone(){let $=new R0(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new R0(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:R0.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},R0.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:R0.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},R0.defaultTags),this.atNextDocument=!1;let X=$.trim().split(/[ \t]+/),z=X.shift();switch(z){case"%TAG":{if(X.length!==2){if(Z(0,"%TAG directive should contain exactly two parts"),X.length<2)return!1}let[J,Q]=X;return this.tags[J]=Q,!0}case"%YAML":{if(this.yaml.explicit=!0,X.length!==1)return Z(0,"%YAML directive should contain exactly one part"),!1;let[J]=X;if(J==="1.1"||J==="1.2")return this.yaml.version=J,!0;else{let Q=/^\d+\.\d+$/.test(J);return Z(6,`Unsupported YAML version ${J}`,Q),!1}}default:return Z(0,`Unknown directive ${z}`,!0),!1}}tagName($,Z){if($==="!")return"!";if($[0]!=="!")return Z(`Not a valid tag: ${$}`),null;if($[1]==="<"){let Q=$.slice(2,-1);if(Q==="!"||Q==="!!")return Z(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")Z("Verbatim tags must end with a >");return Q}let[,X,z]=$.match(/^(.*!)([^!]*)$/s);if(!z)Z(`The ${$} tag has no suffix`);let J=this.tags[X];if(J)try{return J+decodeURIComponent(z)}catch(Q){return Z(String(Q)),null}if(X==="!")return $;return Z(`Could not resolve tag: ${$}`),null}tagString($){for(let[Z,X]of Object.entries(this.tags))if($.startsWith(X))return Z+NQ($.substring(X.length));return $[0]==="!"?$:`!<${$}>`}toString($){let Z=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],X=Object.entries(this.tags),z;if($&&X.length>0&&aZ.isNode($.contents)){let J={};BQ.visit($.contents,(Q,Y)=>{if(aZ.isNode(Y)&&Y.tag)J[Y.tag]=!0}),z=Object.keys(J)}else z=[];for(let[J,Q]of X){if(J==="!!"&&Q==="tag:yaml.org,2002:")continue;if(!$||z.some((Y)=>Y.startsWith(Q)))Z.push(`%TAG ${J} ${Q}`)}return Z.join(`
|
|
28
|
+
`)}}R0.defaultYaml={explicit:!1,version:"1.2"};R0.defaultTags={"!!":"tag:yaml.org,2002:"};MQ.Directives=R0});var o4=A((AQ)=>{var oZ=c(),OQ=w1();function DQ($){if(/[\x00-\x19\s,[\]{}]/.test($)){let X=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(X)}return!0}function tZ($){let Z=new Set;return OQ.visit($,{Value(X,z){if(z.anchor)Z.add(z.anchor)}}),Z}function eZ($,Z){for(let X=1;;++X){let z=`${$}${X}`;if(!Z.has(z))return z}}function IQ($,Z){let X=[],z=new Map,J=null;return{onAnchor:(Q)=>{X.push(Q),J??(J=tZ($));let Y=eZ(Z,J);return J.add(Y),Y},setAnchors:()=>{for(let Q of X){let Y=z.get(Q);if(typeof Y==="object"&&Y.anchor&&(oZ.isScalar(Y.node)||oZ.isCollection(Y.node)))Y.node.anchor=Y.anchor;else{let G=Error("Failed to resolve repeated object (this should not happen)");throw G.source=Q,G}}},sourceObjects:z}}AQ.anchorIsValid=DQ;AQ.anchorNames=tZ;AQ.createNodeAnchors=IQ;AQ.findNewAnchor=eZ});var k6=A((_Q)=>{function P1($,Z,X,z){if(z&&typeof z==="object")if(Array.isArray(z))for(let J=0,Q=z.length;J<Q;++J){let Y=z[J],G=P1($,z,String(J),Y);if(G===void 0)delete z[J];else if(G!==Y)z[J]=G}else if(z instanceof Map)for(let J of Array.from(z.keys())){let Q=z.get(J),Y=P1($,z,J,Q);if(Y===void 0)z.delete(J);else if(Y!==Q)z.set(J,Y)}else if(z instanceof Set)for(let J of Array.from(z)){let Q=P1($,z,J,J);if(Q===void 0)z.delete(J);else if(Q!==J)z.delete(J),z.add(Q)}else for(let[J,Q]of Object.entries(z)){let Y=P1($,z,J,Q);if(Y===void 0)delete z[J];else if(Y!==Q)z[J]=Y}return $.call(Z,X,z)}_Q.applyReviver=P1});var s0=A((jQ)=>{var EQ=c();function $5($,Z,X){if(Array.isArray($))return $.map((z,J)=>$5(z,String(J),X));if($&&typeof $.toJSON==="function"){if(!X||!EQ.hasAnchor($))return $.toJSON(Z,X);let z={aliasCount:0,count:1,res:void 0};X.anchors.set($,z),X.onCreate=(Q)=>{z.res=Q,delete X.onCreate};let J=$.toJSON(Z,X);if(X.onCreate)X.onCreate(J);return J}if(typeof $==="bigint"&&!X?.keep)return Number($);return $}jQ.toJS=$5});var t4=A((kQ)=>{var bQ=k6(),Z5=c(),xQ=s0();class X5{constructor($){Object.defineProperty(this,Z5.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:X,onAnchor:z,reviver:J}={}){if(!Z5.isDocument($))throw TypeError("A document argument is required");let Q={anchors:new Map,doc:$,keep:!0,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof X==="number"?X:100},Y=xQ.toJS(this,"",Q);if(typeof z==="function")for(let{count:G,res:U}of Q.anchors.values())z(U,G);return typeof J==="function"?bQ.applyReviver(J,{"":Y},"",Y):Y}}kQ.NodeBase=X5});var _1=A((uQ)=>{var fQ=o4(),gQ=w1(),f$=c(),hQ=t4(),vQ=s0();class z5 extends hQ.NodeBase{constructor($){super(f$.ALIAS);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,Z){let X;if(Z?.aliasResolveCache)X=Z.aliasResolveCache;else if(X=[],gQ.visit($,{Node:(J,Q)=>{if(f$.isAlias(Q)||f$.hasAnchor(Q))X.push(Q)}}),Z)Z.aliasResolveCache=X;let z=void 0;for(let J of X){if(J===this)break;if(J.anchor===this.source)z=J}return z}toJSON($,Z){if(!Z)return{source:this.source};let{anchors:X,doc:z,maxAliasCount:J}=Z,Q=this.resolve(z,Z);if(!Q){let G=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(G)}let Y=X.get(Q);if(!Y)vQ.toJS(Q,null,Z),Y=X.get(Q);if(Y?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(J>=0){if(Y.count+=1,Y.aliasCount===0)Y.aliasCount=e4(z,Q,X);if(Y.count*Y.aliasCount>J)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return Y.res}toString($,Z,X){let z=`*${this.source}`;if($){if(fQ.anchorIsValid(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let J=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(J)}if($.implicitKey)return`${z} `}return z}}function e4($,Z,X){if(f$.isAlias(Z)){let z=Z.resolve($),J=X&&z&&X.get(z);return J?J.count*J.aliasCount:0}else if(f$.isCollection(Z)){let z=0;for(let J of Z.items){let Q=e4($,J,X);if(Q>z)z=Q}return z}else if(f$.isPair(Z)){let z=e4($,Z.key,X),J=e4($,Z.value,X);return Math.max(z,J)}return 1}uQ.Alias=z5});var Z0=A((iQ)=>{var cQ=c(),dQ=t4(),pQ=s0(),lQ=($)=>!$||typeof $!=="function"&&typeof $!=="object";class L$ extends dQ.NodeBase{constructor($){super(cQ.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:pQ.toJS(this.value,$,Z)}toString(){return String(this.value)}}L$.BLOCK_FOLDED="BLOCK_FOLDED";L$.BLOCK_LITERAL="BLOCK_LITERAL";L$.PLAIN="PLAIN";L$.QUOTE_DOUBLE="QUOTE_DOUBLE";L$.QUOTE_SINGLE="QUOTE_SINGLE";iQ.Scalar=L$;iQ.isScalarValue=lQ});var C1=A((eQ)=>{var rQ=_1(),N$=c(),J5=Z0(),aQ="tag:yaml.org,2002:";function oQ($,Z,X){if(Z){let z=X.filter((Q)=>Q.tag===Z),J=z.find((Q)=>!Q.format)??z[0];if(!J)throw Error(`Tag ${Z} not found`);return J}return X.find((z)=>z.identify?.($)&&!z.format)}function tQ($,Z,X){if(N$.isDocument($))$=$.contents;if(N$.isNode($))return $;if(N$.isPair($)){let V=X.schema[N$.MAP].createNode?.(X.schema,null,X);return V.items.push($),V}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:z,onAnchor:J,onTagObj:Q,schema:Y,sourceObjects:G}=X,U=void 0;if(z&&$&&typeof $==="object")if(U=G.get($),U)return U.anchor??(U.anchor=J($)),new rQ.Alias(U.anchor);else U={anchor:null,node:null},G.set($,U);if(Z?.startsWith("!!"))Z=aQ+Z.slice(2);let W=oQ($,Z,Y.tags);if(!W){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let V=new J5.Scalar($);if(U)U.node=V;return V}W=$ instanceof Map?Y[N$.MAP]:(Symbol.iterator in Object($))?Y[N$.SEQ]:Y[N$.MAP]}if(Q)Q(W),delete X.onTagObj;let q=W?.createNode?W.createNode(X.schema,$,X):typeof W?.nodeClass?.from==="function"?W.nodeClass.from(X.schema,$,X):new J5.Scalar($);if(Z)q.tag=Z;else if(!W.default)q.tag=W.tag;if(U)U.node=q;return q}eQ.createNode=tQ});var $2=A((zY)=>{var ZY=C1(),y0=c(),XY=t4();function y6($,Z,X){let z=X;for(let J=Z.length-1;J>=0;--J){let Q=Z[J];if(typeof Q==="number"&&Number.isInteger(Q)&&Q>=0){let Y=[];Y[Q]=z,z=Y}else z=new Map([[Q,z]])}return ZY.createNode(z,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var Q5=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class Y5 extends XY.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((X)=>y0.isNode(X)||y0.isPair(X)?X.clone($):X),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(Q5($))this.add(Z);else{let[X,...z]=$,J=this.get(X,!0);if(y0.isCollection(J))J.addIn(z,Z);else if(J===void 0&&this.schema)this.set(X,y6(this.schema,z,Z));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${z}`)}}deleteIn($){let[Z,...X]=$;if(X.length===0)return this.delete(Z);let z=this.get(Z,!0);if(y0.isCollection(z))return z.deleteIn(X);else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${X}`)}getIn($,Z){let[X,...z]=$,J=this.get(X,!0);if(z.length===0)return!Z&&y0.isScalar(J)?J.value:J;else return y0.isCollection(J)?J.getIn(z,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!y0.isPair(Z))return!1;let X=Z.value;return X==null||$&&y0.isScalar(X)&&X.value==null&&!X.commentBefore&&!X.comment&&!X.tag})}hasIn($){let[Z,...X]=$;if(X.length===0)return this.has(Z);let z=this.get(Z,!0);return y0.isCollection(z)?z.hasIn(X):!1}setIn($,Z){let[X,...z]=$;if(z.length===0)this.set(X,Z);else{let J=this.get(X,!0);if(y0.isCollection(J))J.setIn(z,Z);else if(J===void 0&&this.schema)this.set(X,y6(this.schema,z,Z));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${z}`)}}}zY.Collection=Y5;zY.collectionFromPath=y6;zY.isEmptyPath=Q5});var E1=A((WY)=>{var GY=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function f6($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var UY=($,Z,X)=>$.endsWith(`
|
|
29
|
+
`)?f6(X,Z):X.includes(`
|
|
30
30
|
`)?`
|
|
31
|
-
`+
|
|
32
|
-
`){if(
|
|
33
|
-
`&&
|
|
34
|
-
`&&x!=="\t")K=B}if(B>=V)if(K)
|
|
35
|
-
${Z}${$.slice(0,
|
|
36
|
-
${Z}${$.slice(x+1,
|
|
37
|
-
`);
|
|
38
|
-
`){if(Q-Y>
|
|
39
|
-
|
|
40
|
-
`;while(
|
|
41
|
-
`,
|
|
42
|
-
`)||/[ \t]\n|\n[ \t]/.test($))return
|
|
43
|
-
${
|
|
31
|
+
`+f6(X,Z):($.endsWith(" ")?"":" ")+X;WY.indentComment=f6;WY.lineComment=UY;WY.stringifyComment=GY});var U5=A((BY)=>{function HY($,Z,X="flow",{indentAtStart:z,lineWidth:J=80,minContentWidth:Q=20,onFold:Y,onOverflow:G}={}){if(!J||J<0)return $;if(J<Q)Q=0;let U=Math.max(1+Q,1+J-Z.length);if($.length<=U)return $;let W=[],q={},V=J-Z.length;if(typeof z==="number")if(z>J-Math.max(2,Q))W.push(0);else V=J-z;let K=void 0,N=void 0,O=!1,B=-1,T=-1,F=-1;if(X==="block"){if(B=G5($,B,Z.length),B!==-1)V=B+U}for(let b;b=$[B+=1];){if(X==="quoted"&&b==="\\"){switch(T=B,$[B+1]){case"x":B+=3;break;case"u":B+=5;break;case"U":B+=9;break;default:B+=1}F=B}if(b===`
|
|
32
|
+
`){if(X==="block")B=G5($,B,Z.length);V=B+Z.length+U,K=void 0}else{if(b===" "&&N&&N!==" "&&N!==`
|
|
33
|
+
`&&N!=="\t"){let x=$[B+1];if(x&&x!==" "&&x!==`
|
|
34
|
+
`&&x!=="\t")K=B}if(B>=V)if(K)W.push(K),V=K+U,K=void 0;else if(X==="quoted"){while(N===" "||N==="\t")N=b,b=$[B+=1],O=!0;let x=B>F+1?B-2:T-1;if(q[x])return $;W.push(x),q[x]=!0,V=x+U,K=void 0}else O=!0}N=b}if(O&&G)G();if(W.length===0)return $;if(Y)Y();let j=$.slice(0,W[0]);for(let b=0;b<W.length;++b){let x=W[b],k=W[b+1]||$.length;if(x===0)j=`
|
|
35
|
+
${Z}${$.slice(0,k)}`;else{if(X==="quoted"&&q[x])j+=`${$[x]}\\`;j+=`
|
|
36
|
+
${Z}${$.slice(x+1,k)}`}}return j}function G5($,Z,X){let z=Z,J=Z+1,Q=$[J];while(Q===" "||Q==="\t")if(Z<J+X)Q=$[++Z];else{do Q=$[++Z];while(Q&&Q!==`
|
|
37
|
+
`);z=Z,J=Z+1,Q=$[J]}return z}BY.FOLD_BLOCK="block";BY.FOLD_FLOW="flow";BY.FOLD_QUOTED="quoted";BY.foldFlowLines=HY});var S1=A((AY)=>{var C0=Z0(),r0=U5(),X2=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),z2=($)=>/^(%|---|\.\.\.)/m.test($);function OY($,Z,X){if(!Z||Z<0)return!1;let z=Z-X,J=$.length;if(J<=z)return!1;for(let Q=0,Y=0;Q<J;++Q)if($[Q]===`
|
|
38
|
+
`){if(Q-Y>z)return!0;if(Y=Q+1,J-Y<=z)return!1}return!0}function j1($,Z){let X=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return X;let{implicitKey:z}=Z,J=Z.options.doubleQuotedMinMultiLineLength,Q=Z.indent||(z2($)?" ":""),Y="",G=0;for(let U=0,W=X[U];W;W=X[++U]){if(W===" "&&X[U+1]==="\\"&&X[U+2]==="n")Y+=X.slice(G,U)+"\\ ",U+=1,G=U,W="\\";if(W==="\\")switch(X[U+1]){case"u":{Y+=X.slice(G,U);let q=X.substr(U+2,4);switch(q){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(q.substr(0,2)==="00")Y+="\\x"+q.substr(2);else Y+=X.substr(U,6)}U+=5,G=U+1}break;case"n":if(z||X[U+2]==='"'||X.length<J)U+=1;else{Y+=X.slice(G,U)+`
|
|
39
|
+
|
|
40
|
+
`;while(X[U+2]==="\\"&&X[U+3]==="n"&&X[U+4]!=='"')Y+=`
|
|
41
|
+
`,U+=2;if(Y+=Q,X[U+2]===" ")Y+="\\";U+=1,G=U+1}break;default:U+=1}}return Y=G?Y+X.slice(G):X,z?Y:r0.foldFlowLines(Y,Q,r0.FOLD_QUOTED,X2(Z,!1))}function g6($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
|
|
42
|
+
`)||/[ \t]\n|\n[ \t]/.test($))return j1($,Z);let X=Z.indent||(z2($)?" ":""),z="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
43
|
+
${X}`)+"'";return Z.implicitKey?z:r0.foldFlowLines(z,X,r0.FOLD_FLOW,X2(Z,!1))}function g$($,Z){let{singleQuote:X}=Z.options,z;if(X===!1)z=j1;else{let J=$.includes('"'),Q=$.includes("'");if(J&&!Q)z=g6;else if(Q&&!J)z=j1;else z=X?g6:j1}return z($,Z)}var h6;try{h6=new RegExp(`(^|(?<!
|
|
44
44
|
))
|
|
45
45
|
+(?!
|
|
46
|
-
|$)`,"g")}catch{
|
|
46
|
+
|$)`,"g")}catch{h6=/\n+(?!\n|$)/g}function Z2({comment:$,type:Z,value:X},z,J,Q){let{blockQuote:Y,commentString:G,lineWidth:U}=z.options;if(!Y||/\n[\t ]+$/.test(X))return g$(X,z);let W=z.indent||(z.forceBlockIndent||z2(X)?" ":""),q=Y==="literal"?!0:Y==="folded"||Z===C0.Scalar.BLOCK_FOLDED?!1:Z===C0.Scalar.BLOCK_LITERAL?!0:!OY(X,U,W.length);if(!X)return q?`|
|
|
47
47
|
`:`>
|
|
48
|
-
`;let V,K;for(K=
|
|
49
|
-
`&&
|
|
50
|
-
`);if(O===-1)V="-";else if(
|
|
51
|
-
`)
|
|
52
|
-
`)F=
|
|
53
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${
|
|
54
|
-
${
|
|
55
|
-
${
|
|
56
|
-
`)||
|
|
57
|
-
`)?
|
|
58
|
-
`))return
|
|
59
|
-
${
|
|
60
|
-
${Z.indent}${
|
|
61
|
-
${
|
|
62
|
-
`:"",
|
|
63
|
-
${
|
|
64
|
-
`&&b)
|
|
65
|
-
|
|
66
|
-
`}else
|
|
67
|
-
${
|
|
68
|
-
`),
|
|
69
|
-
${
|
|
70
|
-
`)
|
|
71
|
-
${
|
|
72
|
-
`}}if($){if(
|
|
73
|
-
|
|
74
|
-
`)))
|
|
48
|
+
`;let V,K;for(K=X.length;K>0;--K){let k=X[K-1];if(k!==`
|
|
49
|
+
`&&k!=="\t"&&k!==" ")break}let N=X.substring(K),O=N.indexOf(`
|
|
50
|
+
`);if(O===-1)V="-";else if(X===N||O!==N.length-1){if(V="+",Q)Q()}else V="";if(N){if(X=X.slice(0,-N.length),N[N.length-1]===`
|
|
51
|
+
`)N=N.slice(0,-1);N=N.replace(h6,`$&${W}`)}let B=!1,T,F=-1;for(T=0;T<X.length;++T){let k=X[T];if(k===" ")B=!0;else if(k===`
|
|
52
|
+
`)F=T;else break}let j=X.substring(0,F<T?F+1:T);if(j)X=X.substring(j.length),j=j.replace(/\n+/g,`$&${W}`);let x=(B?W?"2":"1":"")+V;if($){if(x+=" "+G($.replace(/ ?[\r\n]+/g," ")),J)J()}if(!q){let k=X.replace(/\n+/g,`
|
|
53
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${W}`),y=!1,g=X2(z,!0);if(Y!=="folded"&&Z!==C0.Scalar.BLOCK_FOLDED)g.onOverflow=()=>{y=!0};let E=r0.foldFlowLines(`${j}${k}${N}`,W,r0.FOLD_BLOCK,g);if(!y)return`>${x}
|
|
54
|
+
${W}${E}`}return X=X.replace(/\n+/g,`$&${W}`),`|${x}
|
|
55
|
+
${W}${j}${X}${N}`}function DY($,Z,X,z){let{type:J,value:Q}=$,{actualString:Y,implicitKey:G,indent:U,indentStep:W,inFlow:q}=Z;if(G&&Q.includes(`
|
|
56
|
+
`)||q&&/[[\]{},]/.test(Q))return g$(Q,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(Q))return G||q||!Q.includes(`
|
|
57
|
+
`)?g$(Q,Z):Z2($,Z,X,z);if(!G&&!q&&J!==C0.Scalar.PLAIN&&Q.includes(`
|
|
58
|
+
`))return Z2($,Z,X,z);if(z2(Q)){if(U==="")return Z.forceBlockIndent=!0,Z2($,Z,X,z);else if(G&&U===W)return g$(Q,Z)}let V=Q.replace(/\n+/g,`$&
|
|
59
|
+
${U}`);if(Y){let K=(B)=>B.default&&B.tag!=="tag:yaml.org,2002:str"&&B.test?.test(V),{compat:N,tags:O}=Z.doc.schema;if(O.some(K)||N?.some(K))return g$(Q,Z)}return G?V:r0.foldFlowLines(V,U,r0.FOLD_FLOW,X2(Z,!1))}function IY($,Z,X,z){let{implicitKey:J,inFlow:Q}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:G}=$;if(G!==C0.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))G=C0.Scalar.QUOTE_DOUBLE}let U=(q)=>{switch(q){case C0.Scalar.BLOCK_FOLDED:case C0.Scalar.BLOCK_LITERAL:return J||Q?g$(Y.value,Z):Z2(Y,Z,X,z);case C0.Scalar.QUOTE_DOUBLE:return j1(Y.value,Z);case C0.Scalar.QUOTE_SINGLE:return g6(Y.value,Z);case C0.Scalar.PLAIN:return DY(Y,Z,X,z);default:return null}},W=U(G);if(W===null){let{defaultKeyType:q,defaultStringType:V}=Z.options,K=J&&q||V;if(W=U(K),W===null)throw Error(`Unsupported default string type ${K}`)}return W}AY.stringifyString=IY});var b1=A((SY)=>{var FY=o4(),a0=c(),wY=E1(),PY=S1();function _Y($,Z){let X=Object.assign({blockQuote:!0,commentString:wY.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,trueStr:"true",verifyAliasOrder:!0},$.schema.toStringOptions,Z),z;switch(X.collectionStyle){case"block":z=!1;break;case"flow":z=!0;break;default:z=null}return{anchors:new Set,doc:$,flowCollectionPadding:X.flowCollectionPadding?" ":"",indent:"",indentStep:typeof X.indent==="number"?" ".repeat(X.indent):" ",inFlow:z,options:X}}function CY($,Z){if(Z.tag){let J=$.filter((Q)=>Q.tag===Z.tag);if(J.length>0)return J.find((Q)=>Q.format===Z.format)??J[0]}let X=void 0,z;if(a0.isScalar(Z)){z=Z.value;let J=$.filter((Q)=>Q.identify?.(z));if(J.length>1){let Q=J.filter((Y)=>Y.test);if(Q.length>0)J=Q}X=J.find((Q)=>Q.format===Z.format)??J.find((Q)=>!Q.format)}else z=Z,X=$.find((J)=>J.nodeClass&&z instanceof J.nodeClass);if(!X){let J=z?.constructor?.name??(z===null?"null":typeof z);throw Error(`Tag not resolved for ${J} value`)}return X}function EY($,Z,{anchors:X,doc:z}){if(!z.directives)return"";let J=[],Q=(a0.isScalar($)||a0.isCollection($))&&$.anchor;if(Q&&FY.anchorIsValid(Q))X.add(Q),J.push(`&${Q}`);let Y=$.tag??(Z.default?null:Z.tag);if(Y)J.push(z.directives.tagString(Y));return J.join(" ")}function jY($,Z,X,z){if(a0.isPair($))return $.toString(Z,X,z);if(a0.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 J=void 0,Q=a0.isNode($)?$:Z.doc.createNode($,{onTagObj:(U)=>J=U});J??(J=CY(Z.doc.schema.tags,Q));let Y=EY(Q,J,Z);if(Y.length>0)Z.indentAtStart=(Z.indentAtStart??0)+Y.length+1;let G=typeof J.stringify==="function"?J.stringify(Q,Z,X,z):a0.isScalar(Q)?PY.stringifyString(Q,Z,X,z):Q.toString(Z,X,z);if(!Y)return G;return a0.isScalar(Q)||G[0]==="{"||G[0]==="["?`${Y} ${G}`:`${Y}
|
|
60
|
+
${Z.indent}${G}`}SY.createStringifyContext=_Y;SY.stringify=jY});var V5=A((yY)=>{var h0=c(),W5=Z0(),q5=b1(),x1=E1();function kY({key:$,value:Z},X,z,J){let{allNullValues:Q,doc:Y,indent:G,indentStep:U,options:{commentString:W,indentSeq:q,simpleKeys:V}}=X,K=h0.isNode($)&&$.comment||null;if(V){if(K)throw Error("With simple keys, key nodes cannot have comments");if(h0.isCollection($)||!h0.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let N=!V&&(!$||K&&Z==null&&!X.inFlow||h0.isCollection($)||(h0.isScalar($)?$.type===W5.Scalar.BLOCK_FOLDED||$.type===W5.Scalar.BLOCK_LITERAL:typeof $==="object"));X=Object.assign({},X,{allNullValues:!1,implicitKey:!N&&(V||!Q),indent:G+U});let O=!1,B=!1,T=q5.stringify($,X,()=>O=!0,()=>B=!0);if(!N&&!X.inFlow&&T.length>1024){if(V)throw Error("With simple keys, single line scalar must not span more than 1024 characters");N=!0}if(X.inFlow){if(Q||Z==null){if(O&&z)z();return T===""?"?":N?`? ${T}`:T}}else if(Q&&!V||Z==null&&N){if(T=`? ${T}`,K&&!O)T+=x1.lineComment(T,X.indent,W(K));else if(B&&J)J();return T}if(O)K=null;if(N){if(K)T+=x1.lineComment(T,X.indent,W(K));T=`? ${T}
|
|
61
|
+
${G}:`}else if(T=`${T}:`,K)T+=x1.lineComment(T,X.indent,W(K));let F,j,b;if(h0.isNode(Z))F=!!Z.spaceBefore,j=Z.commentBefore,b=Z.comment;else if(F=!1,j=null,b=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(X.implicitKey=!1,!N&&!K&&h0.isScalar(Z))X.indentAtStart=T.length+1;if(B=!1,!q&&U.length>=2&&!X.inFlow&&!N&&h0.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)X.indent=X.indent.substring(2);let x=!1,k=q5.stringify(Z,X,()=>x=!0,()=>B=!0),y=" ";if(K||F||j){if(y=F?`
|
|
62
|
+
`:"",j){let g=W(j);y+=`
|
|
63
|
+
${x1.indentComment(g,X.indent)}`}if(k===""&&!X.inFlow){if(y===`
|
|
64
|
+
`&&b)y=`
|
|
65
|
+
|
|
66
|
+
`}else y+=`
|
|
67
|
+
${X.indent}`}else if(!N&&h0.isCollection(Z)){let g=k[0],E=k.indexOf(`
|
|
68
|
+
`),m=E!==-1,b0=X.inFlow??Z.flow??Z.items.length===0;if(m||!b0){let x0=!1;if(m&&(g==="&"||g==="!")){let e=k.indexOf(" ");if(g==="&"&&e!==-1&&e<E&&k[e+1]==="!")e=k.indexOf(" ",e+1);if(e===-1||E<e)x0=!0}if(!x0)y=`
|
|
69
|
+
${X.indent}`}}else if(k===""||k[0]===`
|
|
70
|
+
`)y="";if(T+=y+k,X.inFlow){if(x&&z)z()}else if(b&&!x)T+=x1.lineComment(T,X.indent,W(b));else if(B&&J)J();return T}yY.stringifyPair=kY});var v6=A((vY)=>{var K5=T0("process");function gY($,...Z){if($==="debug")console.log(...Z)}function hY($,Z){if($==="debug"||$==="warn")if(typeof K5.emitWarning==="function")K5.emitWarning(Z);else console.warn(Z)}vY.debug=gY;vY.warn=hY});var Y2=A((dY)=>{var k1=c(),H5=Z0(),J2="<<",Q2={identify:($)=>$===J2||typeof $==="symbol"&&$.description===J2,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new H5.Scalar(Symbol(J2)),{addToJSMap:B5}),stringify:()=>J2},cY=($,Z)=>(Q2.identify(Z)||k1.isScalar(Z)&&(!Z.type||Z.type===H5.Scalar.PLAIN)&&Q2.identify(Z.value))&&$?.doc.schema.tags.some((X)=>X.tag===Q2.tag&&X.default);function B5($,Z,X){if(X=$&&k1.isAlias(X)?X.resolve($.doc):X,k1.isSeq(X))for(let z of X.items)u6($,Z,z);else if(Array.isArray(X))for(let z of X)u6($,Z,z);else u6($,Z,X)}function u6($,Z,X){let z=$&&k1.isAlias(X)?X.resolve($.doc):X;if(!k1.isMap(z))throw Error("Merge sources must be maps or map aliases");let J=z.toJSON(null,$,Map);for(let[Q,Y]of J)if(Z instanceof Map){if(!Z.has(Q))Z.set(Q,Y)}else if(Z instanceof Set)Z.add(Q);else if(!Object.prototype.hasOwnProperty.call(Z,Q))Object.defineProperty(Z,Q,{value:Y,writable:!0,enumerable:!0,configurable:!0});return Z}dY.addMergeToJSMap=B5;dY.isMergeKey=cY;dY.merge=Q2});var c6=A((oY)=>{var nY=v6(),L5=Y2(),sY=b1(),N5=c(),m6=s0();function rY($,Z,{key:X,value:z}){if(N5.isNode(X)&&X.addToJSMap)X.addToJSMap($,Z,z);else if(L5.isMergeKey($,X))L5.addMergeToJSMap($,Z,z);else{let J=m6.toJS(X,"",$);if(Z instanceof Map)Z.set(J,m6.toJS(z,J,$));else if(Z instanceof Set)Z.add(J);else{let Q=aY(X,J,$),Y=m6.toJS(z,Q,$);if(Q in Z)Object.defineProperty(Z,Q,{value:Y,writable:!0,enumerable:!0,configurable:!0});else Z[Q]=Y}}return Z}function aY($,Z,X){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(N5.isNode($)&&X?.doc){let z=sY.createStringifyContext(X.doc,{});z.anchors=new Set;for(let Q of X.anchors.keys())z.anchors.add(Q.anchor);z.inFlow=!0,z.inStringifyKey=!0;let J=$.toString(z);if(!X.mapKeyWarned){let Q=JSON.stringify(J);if(Q.length>40)Q=Q.substring(0,36)+'..."';nY.warn(X.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${Q}. Set mapAsMap: true to use object keys.`),X.mapKeyWarned=!0}return J}return JSON.stringify(Z)}oY.addPairToJSMap=rY});var o0=A((XG)=>{var M5=C1(),eY=V5(),$G=c6(),G2=c();function ZG($,Z,X){let z=M5.createNode($,void 0,X),J=M5.createNode(Z,void 0,X);return new U2(z,J)}class U2{constructor($,Z=null){Object.defineProperty(this,G2.NODE_TYPE,{value:G2.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:X}=this;if(G2.isNode(Z))Z=Z.clone($);if(G2.isNode(X))X=X.clone($);return new U2(Z,X)}toJSON($,Z){let X=Z?.mapAsMap?new Map:{};return $G.addPairToJSMap(Z,X,this)}toString($,Z,X){return $?.doc?eY.stringifyPair(this,$,Z,X):JSON.stringify(this)}}XG.Pair=U2;XG.createPair=ZG});var d6=A((UG)=>{var M$=c(),T5=b1(),W2=E1();function QG($,Z,X){return(Z.inFlow??$.flow?GG:YG)($,Z,X)}function YG({comment:$,items:Z},X,{blockItemPrefix:z,flowChars:J,itemIndent:Q,onChompKeep:Y,onComment:G}){let{indent:U,options:{commentString:W}}=X,q=Object.assign({},X,{indent:Q,type:null}),V=!1,K=[];for(let O=0;O<Z.length;++O){let B=Z[O],T=null;if(M$.isNode(B)){if(!V&&B.spaceBefore)K.push("");if(q2(X,K,B.commentBefore,V),B.comment)T=B.comment}else if(M$.isPair(B)){let j=M$.isNode(B.key)?B.key:null;if(j){if(!V&&j.spaceBefore)K.push("");q2(X,K,j.commentBefore,V)}}V=!1;let F=T5.stringify(B,q,()=>T=null,()=>V=!0);if(T)F+=W2.lineComment(F,Q,W(T));if(V&&T)V=!1;K.push(z+F)}let N;if(K.length===0)N=J.start+J.end;else{N=K[0];for(let O=1;O<K.length;++O){let B=K[O];N+=B?`
|
|
71
|
+
${U}${B}`:`
|
|
72
|
+
`}}if($){if(N+=`
|
|
73
|
+
`+W2.indentComment(W($),U),G)G()}else if(V&&Y)Y();return N}function GG({items:$},Z,{flowChars:X,itemIndent:z}){let{indent:J,indentStep:Q,flowCollectionPadding:Y,options:{commentString:G}}=Z;z+=Q;let U=Object.assign({},Z,{indent:z,inFlow:!0,type:null}),W=!1,q=0,V=[];for(let O=0;O<$.length;++O){let B=$[O],T=null;if(M$.isNode(B)){if(B.spaceBefore)V.push("");if(q2(Z,V,B.commentBefore,!1),B.comment)T=B.comment}else if(M$.isPair(B)){let j=M$.isNode(B.key)?B.key:null;if(j){if(j.spaceBefore)V.push("");if(q2(Z,V,j.commentBefore,!1),j.comment)W=!0}let b=M$.isNode(B.value)?B.value:null;if(b){if(b.comment)T=b.comment;if(b.commentBefore)W=!0}else if(B.value==null&&j?.comment)T=j.comment}if(T)W=!0;let F=T5.stringify(B,U,()=>T=null);if(O<$.length-1)F+=",";if(T)F+=W2.lineComment(F,z,G(T));if(!W&&(V.length>q||F.includes(`
|
|
74
|
+
`)))W=!0;V.push(F),q=V.length}let{start:K,end:N}=X;if(V.length===0)return K+N;else{if(!W){let O=V.reduce((B,T)=>B+T.length+2,2);W=Z.options.lineWidth>0&&O>Z.options.lineWidth}if(W){let O=K;for(let B of V)O+=B?`
|
|
75
75
|
${Q}${J}${B}`:`
|
|
76
76
|
`;return`${O}
|
|
77
|
-
${J}${
|
|
78
|
-
`:" ")}return
|
|
79
|
-
${J.key.commentBefore}`:
|
|
80
|
-
${Q.comment}`:X.comment}X=J}$.items[z]=W2.isPair(X)?X:new v6.Pair(X)}else Z("Expected a sequence for this tag");return $}function L5($,Z,z){let{replacer:X}=z,J=new hq.YAMLSeq($);J.tag="tag:yaml.org,2002:pairs";let Q=0;if(Z&&Symbol.iterator in Object(Z))for(let Y of Z){if(typeof X==="function")Y=X.call(Z,String(Q++),Y);let q,W;if(Array.isArray(Y))if(Y.length===2)q=Y[0],W=Y[1];else throw TypeError(`Expected [key, value] tuple: ${Y}`);else if(Y&&Y instanceof Object){let G=Object.keys(Y);if(G.length===1)q=G[0],W=Y[q];else throw TypeError(`Expected tuple with one key, not ${G.length} keys`)}else q=Y;J.items.push(v6.createPair(q,W,z))}return J}var vq={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:B5,createNode:L5};uq.createPairs=L5;uq.pairs=vq;uq.resolvePairs=B5});var m6=A((iq)=>{var N5=m(),u6=l0(),C1=a0(),pq=o0(),T5=G2();class B$ extends pq.YAMLSeq{constructor(){super();this.add=C1.YAMLMap.prototype.add.bind(this),this.delete=C1.YAMLMap.prototype.delete.bind(this),this.get=C1.YAMLMap.prototype.get.bind(this),this.has=C1.YAMLMap.prototype.has.bind(this),this.set=C1.YAMLMap.prototype.set.bind(this),this.tag=B$.tag}toJSON($,Z){if(!Z)return super.toJSON($);let z=new Map;if(Z?.onCreate)Z.onCreate(z);for(let X of this.items){let J,Q;if(N5.isPair(X))J=u6.toJS(X.key,"",Z),Q=u6.toJS(X.value,J,Z);else J=u6.toJS(X,"",Z);if(z.has(J))throw Error("Ordered maps must not include duplicate keys");z.set(J,Q)}return z}static from($,Z,z){let X=T5.createPairs($,Z,z),J=new this;return J.items=X.items,J}}B$.tag="tag:yaml.org,2002:omap";var lq={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:B$,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let z=T5.resolvePairs($,Z),X=[];for(let{key:J}of z.items)if(N5.isScalar(J))if(X.includes(J.value))Z(`Ordered maps must not include duplicate keys: ${J.value}`);else X.push(J.value);return Object.assign(new B$,z)},createNode:($,Z,z)=>B$.from($,Z,z)};iq.YAMLOMap=B$;iq.omap=lq});var I5=A((rq)=>{var M5=$0();function O5({value:$,source:Z},z){if(Z&&($?D5:A5).test.test(Z))return Z;return $?z.options.trueStr:z.options.falseStr}var D5={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new M5.Scalar(!0),stringify:O5},A5={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new M5.Scalar(!1),stringify:O5};rq.falseTag=A5;rq.trueTag=D5});var w5=A((zW)=>{var tq=$0(),d6=k$(),eq={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:d6.stringifyNumber},$W={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():d6.stringifyNumber($)}},ZW={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new tq.Scalar(parseFloat($.replace(/_/g,""))),z=$.indexOf(".");if(z!==-1){let X=$.substring(z+1).replace(/_/g,"");if(X[X.length-1]==="0")Z.minFractionDigits=X.length}return Z},stringify:d6.stringifyNumber};zW.float=ZW;zW.floatExp=$W;zW.floatNaN=eq});var R5=A((UW)=>{var F5=k$(),j1=($)=>typeof $==="bigint"||Number.isInteger($);function U2($,Z,z,{intAsBigInt:X}){let J=$[0];if(J==="-"||J==="+")Z+=1;if($=$.substring(Z).replace(/_/g,""),X){switch(z){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let Y=BigInt($);return J==="-"?BigInt(-1)*Y:Y}let Q=parseInt($,z);return J==="-"?-1*Q:Q}function c6($,Z,z){let{value:X}=$;if(j1(X)){let J=X.toString(Z);return X<0?"-"+z+J.substr(1):z+J}return F5.stringifyNumber($)}var YW={identify:j1,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,z)=>U2($,2,2,z),stringify:($)=>c6($,2,"0b")},qW={identify:j1,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,z)=>U2($,1,8,z),stringify:($)=>c6($,8,"0")},WW={identify:j1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,z)=>U2($,0,10,z),stringify:F5.stringifyNumber},GW={identify:j1,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,z)=>U2($,2,16,z),stringify:($)=>c6($,16,"0x")};UW.int=WW;UW.intBin=YW;UW.intHex=GW;UW.intOct=qW});var p6=A((NW)=>{var H2=m(),V2=s0(),K2=a0();class L$ extends K2.YAMLMap{constructor($){super($);this.tag=L$.tag}add($){let Z;if(H2.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new V2.Pair($.key,null);else Z=new V2.Pair($,null);if(!K2.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let z=K2.findPair(this.items,$);return!Z&&H2.isPair(z)?H2.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=K2.findPair(this.items,$);if(z&&!Z)this.items.splice(this.items.indexOf(z),1);else if(!z&&Z)this.items.push(new V2.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:X}=z,J=new this($);if(Z&&Symbol.iterator in Object(Z))for(let Q of Z){if(typeof X==="function")Q=X.call(Z,Q,Q);J.items.push(V2.createPair(Q,null,z))}return J}}L$.tag="tag:yaml.org,2002:set";var LW={collection:"map",identify:($)=>$ instanceof Set,nodeClass:L$,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,z)=>L$.from($,Z,z),resolve($,Z){if(H2.isMap($))if($.hasAllNullValues(!0))return Object.assign(new L$,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};NW.YAMLSet=L$;NW.set=LW});var i6=A((IW)=>{var OW=k$();function l6($,Z){let z=$[0],X=z==="-"||z==="+"?$.substring(1):$,J=(Y)=>Z?BigInt(Y):Number(Y),Q=X.replace(/_/g,"").split(":").reduce((Y,q)=>Y*J(60)+J(q),J(0));return z==="-"?J(-1)*Q:Q}function P5($){let{value:Z}=$,z=(Y)=>Y;if(typeof Z==="bigint")z=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return OW.stringifyNumber($);let X="";if(Z<0)X="-",Z*=z(-1);let J=z(60),Q=[Z%J];if(Z<60)Q.unshift(0);else if(Z=(Z-Q[0])/J,Q.unshift(Z%J),Z>=60)Z=(Z-Q[0])/J,Q.unshift(Z);return X+Q.map((Y)=>String(Y).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var DW={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})=>l6($,z),stringify:P5},AW={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:($)=>l6($,!1),stringify:P5},_5={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(_5.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,z,X,J,Q,Y,q]=Z.map(Number),W=Z[7]?Number((Z[7]+"00").substr(1,3)):0,G=Date.UTC(z,X-1,J,Q||0,Y||0,q||0,W),U=Z[8];if(U&&U!=="Z"){let V=l6(U,!1);if(Math.abs(V)<30)V*=60;G-=60000*V}return new Date(G)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};IW.floatTime=AW;IW.intTime=DW;IW.timestamp=_5});var C5=A((fW)=>{var PW=x$(),_W=Q2(),EW=y$(),CW=_1(),jW=h6(),E5=I5(),n6=w5(),B2=R5(),SW=o4(),bW=m6(),xW=G2(),yW=p6(),s6=i6(),kW=[PW.map,EW.seq,CW.string,_W.nullTag,E5.trueTag,E5.falseTag,B2.intBin,B2.intOct,B2.int,B2.intHex,n6.floatNaN,n6.floatExp,n6.float,jW.binary,SW.merge,bW.omap,xW.pairs,yW.set,s6.intTime,s6.floatTime,s6.timestamp];fW.schema=kW});var v5=A((lW)=>{var x5=x$(),hW=Q2(),y5=y$(),vW=_1(),uW=j6(),r6=b6(),a6=y6(),mW=V5(),dW=H5(),k5=h6(),S1=o4(),f5=m6(),g5=G2(),j5=C5(),h5=p6(),L2=i6(),S5=new Map([["core",mW.schema],["failsafe",[x5.map,y5.seq,vW.string]],["json",dW.schema],["yaml11",j5.schema],["yaml-1.1",j5.schema]]),b5={binary:k5.binary,bool:uW.boolTag,float:r6.float,floatExp:r6.floatExp,floatNaN:r6.floatNaN,floatTime:L2.floatTime,int:a6.int,intHex:a6.intHex,intOct:a6.intOct,intTime:L2.intTime,map:x5.map,merge:S1.merge,null:hW.nullTag,omap:f5.omap,pairs:g5.pairs,seq:y5.seq,set:h5.set,timestamp:L2.timestamp},cW={"tag:yaml.org,2002:binary":k5.binary,"tag:yaml.org,2002:merge":S1.merge,"tag:yaml.org,2002:omap":f5.omap,"tag:yaml.org,2002:pairs":g5.pairs,"tag:yaml.org,2002:set":h5.set,"tag:yaml.org,2002:timestamp":L2.timestamp};function pW($,Z,z){let X=S5.get(Z);if(X&&!$)return z&&!X.includes(S1.merge)?X.concat(S1.merge):X.slice();let J=X;if(!J)if(Array.isArray($))J=[];else{let Q=Array.from(S5.keys()).filter((Y)=>Y!=="yaml11").map((Y)=>JSON.stringify(Y)).join(", ");throw Error(`Unknown schema "${Z}"; use one of ${Q} or define customTags array`)}if(Array.isArray($))for(let Q of $)J=J.concat(Q);else if(typeof $==="function")J=$(J.slice());if(z)J=J.concat(S1.merge);return J.reduce((Q,Y)=>{let q=typeof Y==="string"?b5[Y]:Y;if(!q){let W=JSON.stringify(Y),G=Object.keys(b5).map((U)=>JSON.stringify(U)).join(", ");throw Error(`Unknown custom tag ${W}; use one of ${G}`)}if(!Q.includes(q))Q.push(q);return Q},[])}lW.coreKnownTags=cW;lW.getTags=pW});var e6=A((tW)=>{var o6=m(),sW=x$(),rW=y$(),aW=_1(),N2=v5(),oW=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class t6{constructor({compat:$,customTags:Z,merge:z,resolveKnownTags:X,schema:J,sortMapEntries:Q,toStringDefaults:Y}){this.compat=Array.isArray($)?N2.getTags($,"compat"):$?N2.getTags(null,$):null,this.name=typeof J==="string"&&J||"core",this.knownTags=X?N2.coreKnownTags:{},this.tags=N2.getTags(Z,this.name,z),this.toStringOptions=Y??null,Object.defineProperty(this,o6.MAP,{value:sW.map}),Object.defineProperty(this,o6.SCALAR,{value:aW.string}),Object.defineProperty(this,o6.SEQ,{value:rW.seq}),this.sortMapEntries=typeof Q==="function"?Q:Q===!0?oW:null}clone(){let $=Object.create(t6.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}tW.Schema=t6});var u5=A((zG)=>{var $G=m(),$8=w1(),b1=D1();function ZG($,Z){let z=[],X=Z.directives===!0;if(Z.directives!==!1&&$.directives){let W=$.directives.toString($);if(W)z.push(W),X=!0;else if($.directives.docStart)X=!0}if(X)z.push("---");let J=$8.createStringifyContext($,Z),{commentString:Q}=J.options;if($.commentBefore){if(z.length!==1)z.unshift("");let W=Q($.commentBefore);z.unshift(b1.indentComment(W,""))}let Y=!1,q=null;if($.contents){if($G.isNode($.contents)){if($.contents.spaceBefore&&X)z.push("");if($.contents.commentBefore){let U=Q($.contents.commentBefore);z.push(b1.indentComment(U,""))}J.forceBlockIndent=!!$.comment,q=$.contents.comment}let W=q?void 0:()=>Y=!0,G=$8.stringify($.contents,J,()=>q=null,W);if(q)G+=b1.lineComment(G,"",Q(q));if((G[0]==="|"||G[0]===">")&&z[z.length-1]==="---")z[z.length-1]=`--- ${G}`;else z.push(G)}else z.push($8.stringify($.contents,J));if($.directives?.docEnd)if($.comment){let W=Q($.comment);if(W.includes(`
|
|
81
|
-
`))
|
|
77
|
+
${J}${N}`}else return`${K}${Y}${V.join(" ")}${Y}${N}`}}function q2({indent:$,options:{commentString:Z}},X,z,J){if(z&&J)z=z.replace(/^\n+/,"");if(z){let Q=W2.indentComment(Z(z),$);X.push(Q.trimStart())}}UG.stringifyCollection=QG});var e0=A((BG)=>{var qG=d6(),VG=c6(),KG=$2(),t0=c(),V2=o0(),HG=Z0();function y1($,Z){let X=t0.isScalar(Z)?Z.value:Z;for(let z of $)if(t0.isPair(z)){if(z.key===Z||z.key===X)return z;if(t0.isScalar(z.key)&&z.key.value===X)return z}return}class O5 extends KG.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(t0.MAP,$);this.items=[]}static from($,Z,X){let{keepUndefined:z,replacer:J}=X,Q=new this($),Y=(G,U)=>{if(typeof J==="function")U=J.call(Z,G,U);else if(Array.isArray(J)&&!J.includes(G))return;if(U!==void 0||z)Q.items.push(V2.createPair(G,U,X))};if(Z instanceof Map)for(let[G,U]of Z)Y(G,U);else if(Z&&typeof Z==="object")for(let G of Object.keys(Z))Y(G,Z[G]);if(typeof $.sortMapEntries==="function")Q.items.sort($.sortMapEntries);return Q}add($,Z){let X;if(t0.isPair($))X=$;else if(!$||typeof $!=="object"||!("key"in $))X=new V2.Pair($,$?.value);else X=new V2.Pair($.key,$.value);let z=y1(this.items,X.key),J=this.schema?.sortMapEntries;if(z){if(!Z)throw Error(`Key ${X.key} already set`);if(t0.isScalar(z.value)&&HG.isScalarValue(X.value))z.value.value=X.value;else z.value=X.value}else if(J){let Q=this.items.findIndex((Y)=>J(X,Y)<0);if(Q===-1)this.items.push(X);else this.items.splice(Q,0,X)}else this.items.push(X)}delete($){let Z=y1(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let z=y1(this.items,$)?.value;return(!Z&&t0.isScalar(z)?z.value:z)??void 0}has($){return!!y1(this.items,$)}set($,Z){this.add(new V2.Pair($,Z),!0)}toJSON($,Z,X){let z=X?new X:Z?.mapAsMap?new Map:{};if(Z?.onCreate)Z.onCreate(z);for(let J of this.items)VG.addPairToJSMap(Z,z,J);return z}toString($,Z,X){if(!$)return JSON.stringify(this);for(let z of this.items)if(!t0.isPair(z))throw Error(`Map items must all be pairs; found ${JSON.stringify(z)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return qG.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:X,onComment:Z})}}BG.YAMLMap=O5;BG.findPair=y1});var h$=A((OG)=>{var MG=c(),D5=e0(),TG={collection:"map",default:!0,nodeClass:D5.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!MG.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,X)=>D5.YAMLMap.from($,Z,X)};OG.map=TG});var $$=A((PG)=>{var IG=C1(),AG=d6(),RG=$2(),H2=c(),FG=Z0(),wG=s0();class I5 extends RG.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(H2.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=K2($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let X=K2($);if(typeof X!=="number")return;let z=this.items[X];return!Z&&H2.isScalar(z)?z.value:z}has($){let Z=K2($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let X=K2($);if(typeof X!=="number")throw Error(`Expected a valid index, not ${$}.`);let z=this.items[X];if(H2.isScalar(z)&&FG.isScalarValue(Z))z.value=Z;else this.items[X]=Z}toJSON($,Z){let X=[];if(Z?.onCreate)Z.onCreate(X);let z=0;for(let J of this.items)X.push(wG.toJS(J,String(z++),Z));return X}toString($,Z,X){if(!$)return JSON.stringify(this);return AG.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:X,onComment:Z})}static from($,Z,X){let{replacer:z}=X,J=new this($);if(Z&&Symbol.iterator in Object(Z)){let Q=0;for(let Y of Z){if(typeof z==="function"){let G=Z instanceof Set?Y:String(Q++);Y=z.call(Z,G,Y)}J.items.push(IG.createNode(Y,void 0,X))}}return J}}function K2($){let Z=H2.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}PG.YAMLSeq=I5});var v$=A((jG)=>{var CG=c(),A5=$$(),EG={collection:"seq",default:!0,nodeClass:A5.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!CG.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,X)=>A5.YAMLSeq.from($,Z,X)};jG.seq=EG});var f1=A((kG)=>{var bG=S1(),xG={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,X,z){return Z=Object.assign({actualString:!0},Z),bG.stringifyString($,Z,X,z)}};kG.string=xG});var B2=A((fG)=>{var R5=Z0(),F5={identify:($)=>$==null,createNode:()=>new R5.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new R5.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&F5.test.test($)?$:Z.options.nullStr};fG.nullTag=F5});var p6=A((vG)=>{var hG=Z0(),w5={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new hG.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},X){if($&&w5.test.test($)){let z=$[0]==="t"||$[0]==="T";if(Z===z)return $}return Z?X.options.trueStr:X.options.falseStr}};vG.boolTag=w5});var u$=A((cG)=>{function mG({format:$,minFractionDigits:Z,tag:X,value:z}){if(typeof z==="bigint")return String(z);let J=typeof z==="number"?z:Number(z);if(!isFinite(J))return isNaN(J)?".nan":J<0?"-.inf":".inf";let Q=Object.is(z,-0)?"-0":JSON.stringify(z);if(!$&&Z&&(!X||X==="tag:yaml.org,2002:float")&&/^\d/.test(Q)){let Y=Q.indexOf(".");if(Y<0)Y=Q.length,Q+=".";let G=Z-(Q.length-Y-1);while(G-- >0)Q+="0"}return Q}cG.stringifyNumber=mG});var i6=A((sG)=>{var pG=Z0(),l6=u$(),lG={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:l6.stringifyNumber},iG={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():l6.stringifyNumber($)}},nG={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new pG.Scalar(parseFloat($)),X=$.indexOf(".");if(X!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-X-1;return Z},stringify:l6.stringifyNumber};sG.float=nG;sG.floatExp=iG;sG.floatNaN=lG});var s6=A((ZU)=>{var P5=u$(),L2=($)=>typeof $==="bigint"||Number.isInteger($),n6=($,Z,X,{intAsBigInt:z})=>z?BigInt($):parseInt($.substring(Z),X);function _5($,Z,X){let{value:z}=$;if(L2(z)&&z>=0)return X+z.toString(Z);return P5.stringifyNumber($)}var tG={identify:($)=>L2($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,X)=>n6($,2,8,X),stringify:($)=>_5($,8,"0o")},eG={identify:L2,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,X)=>n6($,0,10,X),stringify:P5.stringifyNumber},$U={identify:($)=>L2($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,X)=>n6($,2,16,X),stringify:($)=>_5($,16,"0x")};ZU.int=eG;ZU.intHex=$U;ZU.intOct=tG});var C5=A((VU)=>{var QU=h$(),YU=B2(),GU=v$(),UU=f1(),WU=p6(),r6=i6(),a6=s6(),qU=[QU.map,GU.seq,UU.string,YU.nullTag,WU.boolTag,a6.intOct,a6.int,a6.intHex,r6.floatNaN,r6.floatExp,r6.float];VU.schema=qU});var j5=A((OU)=>{var HU=Z0(),BU=h$(),LU=v$();function E5($){return typeof $==="bigint"||Number.isInteger($)}var N2=({value:$})=>JSON.stringify($),NU=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:N2},{identify:($)=>$==null,createNode:()=>new HU.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:N2},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:N2},{identify:E5,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:X})=>X?BigInt($):parseInt($,10),stringify:({value:$})=>E5($)?$.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:N2}],MU={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},TU=[BU.map,LU.seq].concat(NU,MU);OU.schema=TU});var t6=A((RU)=>{var g1=T0("buffer"),o6=Z0(),IU=S1(),AU={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof g1.Buffer==="function")return g1.Buffer.from($,"base64");else if(typeof atob==="function"){let X=atob($.replace(/[\n\r]/g,"")),z=new Uint8Array(X.length);for(let J=0;J<X.length;++J)z[J]=X.charCodeAt(J);return z}else return Z("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:Z,value:X},z,J,Q){if(!X)return"";let Y=X,G;if(typeof g1.Buffer==="function")G=Y instanceof g1.Buffer?Y.toString("base64"):g1.Buffer.from(Y.buffer).toString("base64");else if(typeof btoa==="function"){let U="";for(let W=0;W<Y.length;++W)U+=String.fromCharCode(Y[W]);G=btoa(U)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(Z??(Z=o6.Scalar.BLOCK_LITERAL),Z!==o6.Scalar.QUOTE_DOUBLE){let U=Math.max(z.options.lineWidth-z.indent.length,z.options.minContentWidth),W=Math.ceil(G.length/U),q=Array(W);for(let V=0,K=0;V<W;++V,K+=U)q[V]=G.substr(K,U);G=q.join(Z===o6.Scalar.BLOCK_LITERAL?`
|
|
78
|
+
`:" ")}return IU.stringifyString({comment:$,type:Z,value:G},z,J,Q)}};RU.binary=AU});var T2=A((CU)=>{var M2=c(),e6=o0(),wU=Z0(),PU=$$();function S5($,Z){if(M2.isSeq($))for(let X=0;X<$.items.length;++X){let z=$.items[X];if(M2.isPair(z))continue;else if(M2.isMap(z)){if(z.items.length>1)Z("Each pair must have its own sequence indicator");let J=z.items[0]||new e6.Pair(new wU.Scalar(null));if(z.commentBefore)J.key.commentBefore=J.key.commentBefore?`${z.commentBefore}
|
|
79
|
+
${J.key.commentBefore}`:z.commentBefore;if(z.comment){let Q=J.value??J.key;Q.comment=Q.comment?`${z.comment}
|
|
80
|
+
${Q.comment}`:z.comment}z=J}$.items[X]=M2.isPair(z)?z:new e6.Pair(z)}else Z("Expected a sequence for this tag");return $}function b5($,Z,X){let{replacer:z}=X,J=new PU.YAMLSeq($);J.tag="tag:yaml.org,2002:pairs";let Q=0;if(Z&&Symbol.iterator in Object(Z))for(let Y of Z){if(typeof z==="function")Y=z.call(Z,String(Q++),Y);let G,U;if(Array.isArray(Y))if(Y.length===2)G=Y[0],U=Y[1];else throw TypeError(`Expected [key, value] tuple: ${Y}`);else if(Y&&Y instanceof Object){let W=Object.keys(Y);if(W.length===1)G=W[0],U=Y[G];else throw TypeError(`Expected tuple with one key, not ${W.length} keys`)}else G=Y;J.items.push(e6.createPair(G,U,X))}return J}var _U={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:S5,createNode:b5};CU.createPairs=b5;CU.pairs=_U;CU.resolvePairs=S5});var Z8=A((kU)=>{var x5=c(),$8=s0(),h1=e0(),bU=$$(),k5=T2();class T$ extends bU.YAMLSeq{constructor(){super();this.add=h1.YAMLMap.prototype.add.bind(this),this.delete=h1.YAMLMap.prototype.delete.bind(this),this.get=h1.YAMLMap.prototype.get.bind(this),this.has=h1.YAMLMap.prototype.has.bind(this),this.set=h1.YAMLMap.prototype.set.bind(this),this.tag=T$.tag}toJSON($,Z){if(!Z)return super.toJSON($);let X=new Map;if(Z?.onCreate)Z.onCreate(X);for(let z of this.items){let J,Q;if(x5.isPair(z))J=$8.toJS(z.key,"",Z),Q=$8.toJS(z.value,J,Z);else J=$8.toJS(z,"",Z);if(X.has(J))throw Error("Ordered maps must not include duplicate keys");X.set(J,Q)}return X}static from($,Z,X){let z=k5.createPairs($,Z,X),J=new this;return J.items=z.items,J}}T$.tag="tag:yaml.org,2002:omap";var xU={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:T$,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let X=k5.resolvePairs($,Z),z=[];for(let{key:J}of X.items)if(x5.isScalar(J))if(z.includes(J.value))Z(`Ordered maps must not include duplicate keys: ${J.value}`);else z.push(J.value);return Object.assign(new T$,X)},createNode:($,Z,X)=>T$.from($,Z,X)};kU.YAMLOMap=T$;kU.omap=xU});var v5=A((gU)=>{var y5=Z0();function f5({value:$,source:Z},X){if(Z&&($?g5:h5).test.test(Z))return Z;return $?X.options.trueStr:X.options.falseStr}var g5={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new y5.Scalar(!0),stringify:f5},h5={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new y5.Scalar(!1),stringify:f5};gU.falseTag=h5;gU.trueTag=g5});var u5=A((pU)=>{var uU=Z0(),X8=u$(),mU={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:X8.stringifyNumber},cU={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():X8.stringifyNumber($)}},dU={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new uU.Scalar(parseFloat($.replace(/_/g,""))),X=$.indexOf(".");if(X!==-1){let z=$.substring(X+1).replace(/_/g,"");if(z[z.length-1]==="0")Z.minFractionDigits=z.length}return Z},stringify:X8.stringifyNumber};pU.float=dU;pU.floatExp=cU;pU.floatNaN=mU});var c5=A((tU)=>{var m5=u$(),v1=($)=>typeof $==="bigint"||Number.isInteger($);function O2($,Z,X,{intAsBigInt:z}){let J=$[0];if(J==="-"||J==="+")Z+=1;if($=$.substring(Z).replace(/_/g,""),z){switch(X){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let Y=BigInt($);return J==="-"?BigInt(-1)*Y:Y}let Q=parseInt($,X);return J==="-"?-1*Q:Q}function z8($,Z,X){let{value:z}=$;if(v1(z)){let J=z.toString(Z);return z<0?"-"+X+J.substr(1):X+J}return m5.stringifyNumber($)}var sU={identify:v1,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,X)=>O2($,2,2,X),stringify:($)=>z8($,2,"0b")},rU={identify:v1,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,X)=>O2($,1,8,X),stringify:($)=>z8($,8,"0")},aU={identify:v1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,X)=>O2($,0,10,X),stringify:m5.stringifyNumber},oU={identify:v1,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,X)=>O2($,2,16,X),stringify:($)=>z8($,16,"0x")};tU.int=aU;tU.intBin=sU;tU.intHex=oU;tU.intOct=rU});var J8=A((JW)=>{var A2=c(),D2=o0(),I2=e0();class O$ extends I2.YAMLMap{constructor($){super($);this.tag=O$.tag}add($){let Z;if(A2.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new D2.Pair($.key,null);else Z=new D2.Pair($,null);if(!I2.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let X=I2.findPair(this.items,$);return!Z&&A2.isPair(X)?A2.isScalar(X.key)?X.key.value:X.key:X}set($,Z){if(typeof Z!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof Z}`);let X=I2.findPair(this.items,$);if(X&&!Z)this.items.splice(this.items.indexOf(X),1);else if(!X&&Z)this.items.push(new D2.Pair($))}toJSON($,Z){return super.toJSON($,Z,Set)}toString($,Z,X){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),Z,X);else throw Error("Set items must all have null values")}static from($,Z,X){let{replacer:z}=X,J=new this($);if(Z&&Symbol.iterator in Object(Z))for(let Q of Z){if(typeof z==="function")Q=z.call(Z,Q,Q);J.items.push(D2.createPair(Q,null,X))}return J}}O$.tag="tag:yaml.org,2002:set";var zW={collection:"map",identify:($)=>$ instanceof Set,nodeClass:O$,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,X)=>O$.from($,Z,X),resolve($,Z){if(A2.isMap($))if($.hasAllNullValues(!0))return Object.assign(new O$,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};JW.YAMLSet=O$;JW.set=zW});var Y8=A((qW)=>{var GW=u$();function Q8($,Z){let X=$[0],z=X==="-"||X==="+"?$.substring(1):$,J=(Y)=>Z?BigInt(Y):Number(Y),Q=z.replace(/_/g,"").split(":").reduce((Y,G)=>Y*J(60)+J(G),J(0));return X==="-"?J(-1)*Q:Q}function d5($){let{value:Z}=$,X=(Y)=>Y;if(typeof Z==="bigint")X=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return GW.stringifyNumber($);let z="";if(Z<0)z="-",Z*=X(-1);let J=X(60),Q=[Z%J];if(Z<60)Q.unshift(0);else if(Z=(Z-Q[0])/J,Q.unshift(Z%J),Z>=60)Z=(Z-Q[0])/J,Q.unshift(Z);return z+Q.map((Y)=>String(Y).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var UW={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:X})=>Q8($,X),stringify:d5},WW={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:($)=>Q8($,!1),stringify:d5},p5={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(p5.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,X,z,J,Q,Y,G]=Z.map(Number),U=Z[7]?Number((Z[7]+"00").substr(1,3)):0,W=Date.UTC(X,z-1,J,Q||0,Y||0,G||0,U),q=Z[8];if(q&&q!=="Z"){let V=Q8(q,!1);if(Math.abs(V)<30)V*=60;W-=60000*V}return new Date(W)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};qW.floatTime=WW;qW.intTime=UW;qW.timestamp=p5});var i5=A((FW)=>{var BW=h$(),LW=B2(),NW=v$(),MW=f1(),TW=t6(),l5=v5(),G8=u5(),R2=c5(),OW=Y2(),DW=Z8(),IW=T2(),AW=J8(),U8=Y8(),RW=[BW.map,NW.seq,MW.string,LW.nullTag,l5.trueTag,l5.falseTag,R2.intBin,R2.intOct,R2.int,R2.intHex,G8.floatNaN,G8.floatExp,G8.float,TW.binary,OW.merge,DW.omap,IW.pairs,AW.set,U8.intTime,U8.floatTime,U8.timestamp];FW.schema=RW});var X9=A((xW)=>{var a5=h$(),PW=B2(),o5=v$(),_W=f1(),CW=p6(),W8=i6(),q8=s6(),EW=C5(),jW=j5(),t5=t6(),u1=Y2(),e5=Z8(),$9=T2(),n5=i5(),Z9=J8(),F2=Y8(),s5=new Map([["core",EW.schema],["failsafe",[a5.map,o5.seq,_W.string]],["json",jW.schema],["yaml11",n5.schema],["yaml-1.1",n5.schema]]),r5={binary:t5.binary,bool:CW.boolTag,float:W8.float,floatExp:W8.floatExp,floatNaN:W8.floatNaN,floatTime:F2.floatTime,int:q8.int,intHex:q8.intHex,intOct:q8.intOct,intTime:F2.intTime,map:a5.map,merge:u1.merge,null:PW.nullTag,omap:e5.omap,pairs:$9.pairs,seq:o5.seq,set:Z9.set,timestamp:F2.timestamp},SW={"tag:yaml.org,2002:binary":t5.binary,"tag:yaml.org,2002:merge":u1.merge,"tag:yaml.org,2002:omap":e5.omap,"tag:yaml.org,2002:pairs":$9.pairs,"tag:yaml.org,2002:set":Z9.set,"tag:yaml.org,2002:timestamp":F2.timestamp};function bW($,Z,X){let z=s5.get(Z);if(z&&!$)return X&&!z.includes(u1.merge)?z.concat(u1.merge):z.slice();let J=z;if(!J)if(Array.isArray($))J=[];else{let Q=Array.from(s5.keys()).filter((Y)=>Y!=="yaml11").map((Y)=>JSON.stringify(Y)).join(", ");throw Error(`Unknown schema "${Z}"; use one of ${Q} or define customTags array`)}if(Array.isArray($))for(let Q of $)J=J.concat(Q);else if(typeof $==="function")J=$(J.slice());if(X)J=J.concat(u1.merge);return J.reduce((Q,Y)=>{let G=typeof Y==="string"?r5[Y]:Y;if(!G){let U=JSON.stringify(Y),W=Object.keys(r5).map((q)=>JSON.stringify(q)).join(", ");throw Error(`Unknown custom tag ${U}; use one of ${W}`)}if(!Q.includes(G))Q.push(G);return Q},[])}xW.coreKnownTags=SW;xW.getTags=bW});var H8=A((uW)=>{var V8=c(),fW=h$(),gW=v$(),hW=f1(),w2=X9(),vW=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class K8{constructor({compat:$,customTags:Z,merge:X,resolveKnownTags:z,schema:J,sortMapEntries:Q,toStringDefaults:Y}){this.compat=Array.isArray($)?w2.getTags($,"compat"):$?w2.getTags(null,$):null,this.name=typeof J==="string"&&J||"core",this.knownTags=z?w2.coreKnownTags:{},this.tags=w2.getTags(Z,this.name,X),this.toStringOptions=Y??null,Object.defineProperty(this,V8.MAP,{value:fW.map}),Object.defineProperty(this,V8.SCALAR,{value:hW.string}),Object.defineProperty(this,V8.SEQ,{value:gW.seq}),this.sortMapEntries=typeof Q==="function"?Q:Q===!0?vW:null}clone(){let $=Object.create(K8.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}uW.Schema=K8});var z9=A((pW)=>{var cW=c(),B8=b1(),m1=E1();function dW($,Z){let X=[],z=Z.directives===!0;if(Z.directives!==!1&&$.directives){let U=$.directives.toString($);if(U)X.push(U),z=!0;else if($.directives.docStart)z=!0}if(z)X.push("---");let J=B8.createStringifyContext($,Z),{commentString:Q}=J.options;if($.commentBefore){if(X.length!==1)X.unshift("");let U=Q($.commentBefore);X.unshift(m1.indentComment(U,""))}let Y=!1,G=null;if($.contents){if(cW.isNode($.contents)){if($.contents.spaceBefore&&z)X.push("");if($.contents.commentBefore){let q=Q($.contents.commentBefore);X.push(m1.indentComment(q,""))}J.forceBlockIndent=!!$.comment,G=$.contents.comment}let U=G?void 0:()=>Y=!0,W=B8.stringify($.contents,J,()=>G=null,U);if(G)W+=m1.lineComment(W,"",Q(G));if((W[0]==="|"||W[0]===">")&&X[X.length-1]==="---")X[X.length-1]=`--- ${W}`;else X.push(W)}else X.push(B8.stringify($.contents,J));if($.directives?.docEnd)if($.comment){let U=Q($.comment);if(U.includes(`
|
|
81
|
+
`))X.push("..."),X.push(m1.indentComment(U,""));else X.push(`... ${U}`)}else X.push("...");else{let U=$.comment;if(U&&Y)U=U.replace(/^\n+/,"");if(U){if((!Y||G)&&X[X.length-1]!=="")X.push("");X.push(m1.indentComment(Q(U),""))}}return X.join(`
|
|
82
82
|
`)+`
|
|
83
|
-
`}
|
|
84
|
-
`;Y=
|
|
83
|
+
`}pW.stringifyDocument=dW});var c1=A((eW)=>{var iW=_1(),m$=$2(),F0=c(),nW=o0(),sW=s0(),rW=H8(),aW=z9(),L8=o4(),oW=k6(),tW=C1(),N8=x6();class M8{constructor($,Z,X){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,F0.NODE_TYPE,{value:F0.DOC});let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(X===void 0&&Z)X=Z,Z=void 0;let J=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},X);this.options=J;let{version:Q}=J;if(X?._directives){if(this.directives=X._directives.atDocument(),this.directives.yaml.explicit)Q=this.directives.yaml.version}else this.directives=new N8.Directives({version:Q});this.setSchema(Q,X),this.contents=$===void 0?null:this.createNode($,z,X)}clone(){let $=Object.create(M8.prototype,{[F0.NODE_TYPE]:{value:F0.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=F0.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(c$(this.contents))this.contents.add($)}addIn($,Z){if(c$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let X=L8.anchorNames(this);$.anchor=!Z||X.has(Z)?L8.findNewAnchor(Z||"a",X):Z}return new iW.Alias($.anchor)}createNode($,Z,X){let z=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),z=Z;else if(Array.isArray(Z)){let B=(F)=>typeof F==="number"||F instanceof String||F instanceof Number,T=Z.filter(B).map(String);if(T.length>0)Z=Z.concat(T);z=Z}else if(X===void 0&&Z)X=Z,Z=void 0;let{aliasDuplicateObjects:J,anchorPrefix:Q,flow:Y,keepUndefined:G,onTagObj:U,tag:W}=X??{},{onAnchor:q,setAnchors:V,sourceObjects:K}=L8.createNodeAnchors(this,Q||"a"),N={aliasDuplicateObjects:J??!0,keepUndefined:G??!1,onAnchor:q,onTagObj:U,replacer:z,schema:this.schema,sourceObjects:K},O=tW.createNode($,W,N);if(Y&&F0.isCollection(O))O.flow=!0;return V(),O}createPair($,Z,X={}){let z=this.createNode($,null,X),J=this.createNode(Z,null,X);return new nW.Pair(z,J)}delete($){return c$(this.contents)?this.contents.delete($):!1}deleteIn($){if(m$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return c$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return F0.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(m$.isEmptyPath($))return!Z&&F0.isScalar(this.contents)?this.contents.value:this.contents;return F0.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return F0.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(m$.isEmptyPath($))return this.contents!==void 0;return F0.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=m$.collectionFromPath(this.schema,[$],Z);else if(c$(this.contents))this.contents.set($,Z)}setIn($,Z){if(m$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=m$.collectionFromPath(this.schema,Array.from($),Z);else if(c$(this.contents))this.contents.setIn($,Z)}setSchema($,Z={}){if(typeof $==="number")$=String($);let X;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new N8.Directives({version:"1.1"});X={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new N8.Directives({version:$});X={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;X=null;break;default:{let z=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${z}`)}}if(Z.schema instanceof Object)this.schema=Z.schema;else if(X)this.schema=new rW.Schema(Object.assign(X,Z));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:Z,mapAsMap:X,maxAliasCount:z,onAnchor:J,reviver:Q}={}){let Y={anchors:new Map,doc:this,keep:!$,mapAsMap:X===!0,mapKeyWarned:!1,maxAliasCount:typeof z==="number"?z:100},G=sW.toJS(this.contents,Z??"",Y);if(typeof J==="function")for(let{count:U,res:W}of Y.anchors.values())J(W,U);return typeof Q==="function"?oW.applyReviver(Q,{"":G},"",G):G}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 aW.stringifyDocument(this,$)}}function c$($){if(F0.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}eW.Document=M8});var d1=A((Xq)=>{class P2 extends Error{constructor($,Z,X,z){super();this.name=$,this.code=X,this.message=z,this.pos=Z}}class J9 extends P2{constructor($,Z,X){super("YAMLParseError",$,Z,X)}}class Q9 extends P2{constructor($,Z,X){super("YAMLWarning",$,Z,X)}}var Zq=($,Z)=>(X)=>{if(X.pos[0]===-1)return;X.linePos=X.pos.map((G)=>Z.linePos(G));let{line:z,col:J}=X.linePos[0];X.message+=` at line ${z}, column ${J}`;let Q=J-1,Y=$.substring(Z.lineStarts[z-1],Z.lineStarts[z]).replace(/[\n\r]+$/,"");if(Q>=60&&Y.length>80){let G=Math.min(Q-39,Y.length-79);Y="…"+Y.substring(G),Q-=G-1}if(Y.length>80)Y=Y.substring(0,79)+"…";if(z>1&&/^ *$/.test(Y.substring(0,Q))){let G=$.substring(Z.lineStarts[z-2],Z.lineStarts[z-1]);if(G.length>80)G=G.substring(0,79)+`…
|
|
84
|
+
`;Y=G+Y}if(/[^ ]/.test(Y)){let G=1,U=X.linePos[1];if(U?.line===z&&U.col>J)G=Math.max(1,Math.min(U.col-J,80-Q));let W=" ".repeat(Q)+"^".repeat(G);X.message+=`:
|
|
85
85
|
|
|
86
86
|
${Y}
|
|
87
|
-
${
|
|
88
|
-
`}};
|
|
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
|
|
90
|
-
`+B.comment;else
|
|
91
|
-
`+b.comment;else
|
|
92
|
-
`+
|
|
93
|
-
`+
|
|
94
|
-
`+
|
|
95
|
-
`+
|
|
96
|
-
`.repeat(Math.max(1,Y.length-1)):"",
|
|
97
|
-
`;for(let B=
|
|
98
|
-
`;else if(
|
|
99
|
-
`;else if(!
|
|
87
|
+
${W}
|
|
88
|
+
`}};Xq.YAMLError=P2;Xq.YAMLParseError=J9;Xq.YAMLWarning=Q9;Xq.prettifyError=Zq});var p1=A((Uq)=>{function Gq($,{flow:Z,indicator:X,next:z,offset:J,onError:Q,parentIndent:Y,startOnNewline:G}){let U=!1,W=G,q=G,V="",K="",N=!1,O=!1,B=null,T=null,F=null,j=null,b=null,x=null,k=null;for(let E of $){if(O){if(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma")Q(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");O=!1}if(B){if(W&&E.type!=="comment"&&E.type!=="newline")Q(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");B=null}switch(E.type){case"space":if(!Z&&(X!=="doc-start"||z?.type!=="flow-collection")&&E.source.includes("\t"))B=E;q=!0;break;case"comment":{if(!q)Q(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let m=E.source.substring(1)||" ";if(!V)V=m;else V+=K+m;K="",W=!1;break}case"newline":if(W){if(V)V+=E.source;else if(!x||X!=="seq-item-ind")U=!0}else K+=E.source;if(W=!0,N=!0,T||F)j=E;q=!0;break;case"anchor":if(T)Q(E,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(E.source.endsWith(":"))Q(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);T=E,k??(k=E.offset),W=!1,q=!1,O=!0;break;case"tag":{if(F)Q(E,"MULTIPLE_TAGS","A node can have at most one tag");F=E,k??(k=E.offset),W=!1,q=!1,O=!0;break}case X:if(T||F)Q(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`);if(x)Q(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${Z??"collection"}`);x=E,W=X==="seq-item-ind"||X==="explicit-key-ind",q=!1;break;case"comma":if(Z){if(b)Q(E,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);b=E,W=!1,q=!1;break}default:Q(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),W=!1,q=!1}}let y=$[$.length-1],g=y?y.offset+y.source.length:J;if(O&&z&&z.type!=="space"&&z.type!=="newline"&&z.type!=="comma"&&(z.type!=="scalar"||z.source!==""))Q(z.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(B&&(W&&B.indent<=Y||z?.type==="block-map"||z?.type==="block-seq"))Q(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:b,found:x,spaceBefore:U,comment:V,hasNewline:N,anchor:T,tag:F,newlineAfterProp:j,end:g,start:k??g}}Uq.resolveProps=Gq});var _2=A((qq)=>{function T8($){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 X of Z.start)if(X.type==="newline")return!0;if(Z.sep){for(let X of Z.sep)if(X.type==="newline")return!0}if(T8(Z.key)||T8(Z.value))return!0}return!1;default:return!0}}qq.containsNewline=T8});var O8=A((Bq)=>{var Kq=_2();function Hq($,Z,X){if(Z?.type==="flow-collection"){let z=Z.end[0];if(z.indent===$&&(z.source==="]"||z.source==="}")&&Kq.containsNewline(Z))X(z,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Bq.flowIndentCheck=Hq});var D8=A((Mq)=>{var Y9=c();function Nq($,Z,X){let{uniqueKeys:z}=$.options;if(z===!1)return!1;let J=typeof z==="function"?z:(Q,Y)=>Q===Y||Y9.isScalar(Q)&&Y9.isScalar(Y)&&Q.value===Y.value;return Z.some((Q)=>J(Q.key,X))}Mq.mapIncludes=Nq});var V9=A((Rq)=>{var G9=o0(),Oq=e0(),U9=p1(),Dq=_2(),W9=O8(),Iq=D8(),q9="All mapping items must start at the same column";function Aq({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let G=new(Q?.nodeClass??Oq.YAMLMap)(X.schema);if(X.atRoot)X.atRoot=!1;let U=z.offset,W=null;for(let q of z.items){let{start:V,key:K,sep:N,value:O}=q,B=U9.resolveProps(V,{indicator:"explicit-key-ind",next:K??N?.[0],offset:U,onError:J,parentIndent:z.indent,startOnNewline:!0}),T=!B.found;if(T){if(K){if(K.type==="block-seq")J(U,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in K&&K.indent!==z.indent)J(U,"BAD_INDENT",q9)}if(!B.anchor&&!B.tag&&!N){if(W=B.end,B.comment)if(G.comment)G.comment+=`
|
|
90
|
+
`+B.comment;else G.comment=B.comment;continue}if(B.newlineAfterProp||Dq.containsNewline(K))J(K??V[V.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(B.found?.indent!==z.indent)J(U,"BAD_INDENT",q9);X.atKey=!0;let F=B.end,j=K?$(X,K,B,J):Z(X,F,V,null,B,J);if(X.schema.compat)W9.flowIndentCheck(z.indent,K,J);if(X.atKey=!1,Iq.mapIncludes(X,G.items,j))J(F,"DUPLICATE_KEY","Map keys must be unique");let b=U9.resolveProps(N??[],{indicator:"map-value-ind",next:O,offset:j.range[2],onError:J,parentIndent:z.indent,startOnNewline:!K||K.type==="block-scalar"});if(U=b.end,b.found){if(T){if(O?.type==="block-map"&&!b.hasNewline)J(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(X.options.strict&&B.start<b.found.offset-1024)J(j.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let x=O?$(X,O,b,J):Z(X,U,N,null,b,J);if(X.schema.compat)W9.flowIndentCheck(z.indent,O,J);U=x.range[2];let k=new G9.Pair(j,x);if(X.options.keepSourceTokens)k.srcToken=q;G.items.push(k)}else{if(T)J(j.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(b.comment)if(j.comment)j.comment+=`
|
|
91
|
+
`+b.comment;else j.comment=b.comment;let x=new G9.Pair(j);if(X.options.keepSourceTokens)x.srcToken=q;G.items.push(x)}}if(W&&W<U)J(W,"IMPOSSIBLE","Map comment with trailing content");return G.range=[z.offset,U,W??U],G}Rq.resolveBlockMap=Aq});var K9=A((Eq)=>{var wq=$$(),Pq=p1(),_q=O8();function Cq({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let G=new(Q?.nodeClass??wq.YAMLSeq)(X.schema);if(X.atRoot)X.atRoot=!1;if(X.atKey)X.atKey=!1;let U=z.offset,W=null;for(let{start:q,value:V}of z.items){let K=Pq.resolveProps(q,{indicator:"seq-item-ind",next:V,offset:U,onError:J,parentIndent:z.indent,startOnNewline:!0});if(!K.found)if(K.anchor||K.tag||V)if(V?.type==="block-seq")J(K.end,"BAD_INDENT","All sequence items must start at the same column");else J(U,"MISSING_CHAR","Sequence item without - indicator");else{if(W=K.end,K.comment)G.comment=K.comment;continue}let N=V?$(X,V,K,J):Z(X,K.end,q,null,K,J);if(X.schema.compat)_q.flowIndentCheck(z.indent,V,J);U=N.range[2],G.items.push(N)}return G.range=[z.offset,U,W??U],G}Eq.resolveBlockSeq=Cq});var d$=A((bq)=>{function Sq($,Z,X,z){let J="";if($){let Q=!1,Y="";for(let G of $){let{source:U,type:W}=G;switch(W){case"space":Q=!0;break;case"comment":{if(X&&!Q)z(G,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let q=U.substring(1)||" ";if(!J)J=q;else J+=Y+q;Y="";break}case"newline":if(J)Y+=U;Q=!0;break;default:z(G,"UNEXPECTED_TOKEN",`Unexpected ${W} at node end`)}Z+=U.length}}return{comment:J,offset:Z}}bq.resolveEnd=Sq});var L9=A((mq)=>{var kq=c(),yq=o0(),H9=e0(),fq=$$(),gq=d$(),B9=p1(),hq=_2(),vq=D8(),I8="Block collections are not allowed within flow collections",A8=($)=>$&&($.type==="block-map"||$.type==="block-seq");function uq({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let Y=z.start.source==="{",G=Y?"flow map":"flow sequence",W=new(Q?.nodeClass??(Y?H9.YAMLMap:fq.YAMLSeq))(X.schema);W.flow=!0;let q=X.atRoot;if(q)X.atRoot=!1;if(X.atKey)X.atKey=!1;let V=z.offset+z.start.source.length;for(let T=0;T<z.items.length;++T){let F=z.items[T],{start:j,key:b,sep:x,value:k}=F,y=B9.resolveProps(j,{flow:G,indicator:"explicit-key-ind",next:b??x?.[0],offset:V,onError:J,parentIndent:z.indent,startOnNewline:!1});if(!y.found){if(!y.anchor&&!y.tag&&!x&&!k){if(T===0&&y.comma)J(y.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${G}`);else if(T<z.items.length-1)J(y.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${G}`);if(y.comment)if(W.comment)W.comment+=`
|
|
92
|
+
`+y.comment;else W.comment=y.comment;V=y.end;continue}if(!Y&&X.options.strict&&hq.containsNewline(b))J(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(T===0){if(y.comma)J(y.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${G}`)}else{if(!y.comma)J(y.start,"MISSING_CHAR",`Missing , between ${G} items`);if(y.comment){let g="";$:for(let E of j)switch(E.type){case"comma":case"space":break;case"comment":g=E.source.substring(1);break $;default:break $}if(g){let E=W.items[W.items.length-1];if(kq.isPair(E))E=E.value??E.key;if(E.comment)E.comment+=`
|
|
93
|
+
`+g;else E.comment=g;y.comment=y.comment.substring(g.length+1)}}}if(!Y&&!x&&!y.found){let g=k?$(X,k,y,J):Z(X,y.end,x,null,y,J);if(W.items.push(g),V=g.range[2],A8(k))J(g.range,"BLOCK_IN_FLOW",I8)}else{X.atKey=!0;let g=y.end,E=b?$(X,b,y,J):Z(X,g,j,null,y,J);if(A8(b))J(E.range,"BLOCK_IN_FLOW",I8);X.atKey=!1;let m=B9.resolveProps(x??[],{flow:G,indicator:"map-value-ind",next:k,offset:E.range[2],onError:J,parentIndent:z.indent,startOnNewline:!1});if(m.found){if(!Y&&!y.found&&X.options.strict){if(x)for(let e of x){if(e===m.found)break;if(e.type==="newline"){J(e,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(y.start<m.found.offset-1024)J(m.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(k)if("source"in k&&k.source?.[0]===":")J(k,"MISSING_CHAR",`Missing space after : in ${G}`);else J(m.start,"MISSING_CHAR",`Missing , or : between ${G} items`);let b0=k?$(X,k,m,J):m.found?Z(X,m.end,x,null,m,J):null;if(b0){if(A8(k))J(b0.range,"BLOCK_IN_FLOW",I8)}else if(m.comment)if(E.comment)E.comment+=`
|
|
94
|
+
`+m.comment;else E.comment=m.comment;let x0=new yq.Pair(E,b0);if(X.options.keepSourceTokens)x0.srcToken=F;if(Y){let e=W;if(vq.mapIncludes(X,e.items,E))J(g,"DUPLICATE_KEY","Map keys must be unique");e.items.push(x0)}else{let e=new H9.YAMLMap(X.schema);e.flow=!0,e.items.push(x0);let R1=(b0??E).range;e.range=[E.range[0],R1[1],R1[2]],W.items.push(e)}V=b0?b0.range[2]:m.end}}let K=Y?"}":"]",[N,...O]=z.end,B=V;if(N?.source===K)B=N.offset+N.source.length;else{let T=G[0].toUpperCase()+G.substring(1),F=q?`${T} must end with a ${K}`:`${T} in block collection must be sufficiently indented and end with a ${K}`;if(J(V,q?"MISSING_CHAR":"BAD_INDENT",F),N&&N.source.length!==1)O.unshift(N)}if(O.length>0){let T=gq.resolveEnd(O,B,X.options.strict,J);if(T.comment)if(W.comment)W.comment+=`
|
|
95
|
+
`+T.comment;else W.comment=T.comment;W.range=[z.offset,B,T.offset]}else W.range=[z.offset,B,B];return W}mq.resolveFlowCollection=uq});var N9=A((oq)=>{var dq=c(),pq=Z0(),lq=e0(),iq=$$(),nq=V9(),sq=K9(),rq=L9();function R8($,Z,X,z,J,Q){let Y=X.type==="block-map"?nq.resolveBlockMap($,Z,X,z,Q):X.type==="block-seq"?sq.resolveBlockSeq($,Z,X,z,Q):rq.resolveFlowCollection($,Z,X,z,Q),G=Y.constructor;if(J==="!"||J===G.tagName)return Y.tag=G.tagName,Y;if(J)Y.tag=J;return Y}function aq($,Z,X,z,J){let Q=z.tag,Y=!Q?null:Z.directives.tagName(Q.source,(K)=>J(Q,"TAG_RESOLVE_FAILED",K));if(X.type==="block-seq"){let{anchor:K,newlineAfterProp:N}=z,O=K&&Q?K.offset>Q.offset?K:Q:K??Q;if(O&&(!N||N.offset<O.offset))J(O,"MISSING_CHAR","Missing newline after block sequence props")}let G=X.type==="block-map"?"map":X.type==="block-seq"?"seq":X.start.source==="{"?"map":"seq";if(!Q||!Y||Y==="!"||Y===lq.YAMLMap.tagName&&G==="map"||Y===iq.YAMLSeq.tagName&&G==="seq")return R8($,Z,X,J,Y);let U=Z.schema.tags.find((K)=>K.tag===Y&&K.collection===G);if(!U){let K=Z.schema.knownTags[Y];if(K?.collection===G)Z.schema.tags.push(Object.assign({},K,{default:!1})),U=K;else{if(K)J(Q,"BAD_COLLECTION_TYPE",`${K.tag} used for ${G} collection, but expects ${K.collection??"scalar"}`,!0);else J(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return R8($,Z,X,J,Y)}}let W=R8($,Z,X,J,Y,U),q=U.resolve?.(W,(K)=>J(Q,"TAG_RESOLVE_FAILED",K),Z.options)??W,V=dq.isNode(q)?q:new pq.Scalar(q);if(V.range=W.range,V.tag=Y,U?.format)V.format=U.format;return V}oq.composeCollection=aq});var w8=A((XV)=>{var F8=Z0();function eq($,Z,X){let z=Z.offset,J=$V(Z,$.options.strict,X);if(!J)return{value:"",type:null,comment:"",range:[z,z,z]};let Q=J.mode===">"?F8.Scalar.BLOCK_FOLDED:F8.Scalar.BLOCK_LITERAL,Y=Z.source?ZV(Z.source):[],G=Y.length;for(let B=Y.length-1;B>=0;--B){let T=Y[B][1];if(T===""||T==="\r")G=B;else break}if(G===0){let B=J.chomp==="+"&&Y.length>0?`
|
|
96
|
+
`.repeat(Math.max(1,Y.length-1)):"",T=z+J.length;if(Z.source)T+=Z.source.length;return{value:B,type:Q,comment:J.comment,range:[z,T,T]}}let U=Z.indent+J.indent,W=Z.offset+J.length,q=0;for(let B=0;B<G;++B){let[T,F]=Y[B];if(F===""||F==="\r"){if(J.indent===0&&T.length>U)U=T.length}else{if(T.length<U)X(W+T.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(J.indent===0)U=T.length;if(q=B,U===0&&!$.atRoot)X(W,"BAD_INDENT","Block scalar values in collections must be indented");break}W+=T.length+F.length+1}for(let B=Y.length-1;B>=G;--B)if(Y[B][0].length>U)G=B+1;let V="",K="",N=!1;for(let B=0;B<q;++B)V+=Y[B][0].slice(U)+`
|
|
97
|
+
`;for(let B=q;B<G;++B){let[T,F]=Y[B];W+=T.length+F.length+1;let j=F[F.length-1]==="\r";if(j)F=F.slice(0,-1);if(F&&T.length<U){let x=`Block scalar lines must not be less indented than their ${J.indent?"explicit indentation indicator":"first line"}`;X(W-F.length-(j?2:1),"BAD_INDENT",x),T=""}if(Q===F8.Scalar.BLOCK_LITERAL)V+=K+T.slice(U)+F,K=`
|
|
98
|
+
`;else if(T.length>U||F[0]==="\t"){if(K===" ")K=`
|
|
99
|
+
`;else if(!N&&K===`
|
|
100
100
|
`)K=`
|
|
101
101
|
|
|
102
|
-
`;V+=K+
|
|
103
|
-
`,
|
|
102
|
+
`;V+=K+T.slice(U)+F,K=`
|
|
103
|
+
`,N=!0}else if(F==="")if(K===`
|
|
104
104
|
`)V+=`
|
|
105
105
|
`;else K=`
|
|
106
|
-
`;else V+=K+F,K=" ",
|
|
107
|
-
`+Y[B][0].slice(
|
|
106
|
+
`;else V+=K+F,K=" ",N=!1}switch(J.chomp){case"-":break;case"+":for(let B=G;B<Y.length;++B)V+=`
|
|
107
|
+
`+Y[B][0].slice(U);if(V[V.length-1]!==`
|
|
108
108
|
`)V+=`
|
|
109
109
|
`;break;default:V+=`
|
|
110
|
-
`}let O=
|
|
111
|
-
`,"sy"),
|
|
112
|
-
`,"sy")}catch{Z=/(.*?)[ \t]*\r?\n/sy,
|
|
110
|
+
`}let O=z+J.length+Z.source.length;return{value:V,type:Q,comment:J.comment,range:[z,O,O]}}function $V({offset:$,props:Z},X,z){if(Z[0].type!=="block-scalar-header")return z(Z[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:J}=Z[0],Q=J[0],Y=0,G="",U=-1;for(let K=1;K<J.length;++K){let N=J[K];if(!G&&(N==="-"||N==="+"))G=N;else{let O=Number(N);if(!Y&&O)Y=O;else if(U===-1)U=$+K}}if(U!==-1)z(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${J}`);let W=!1,q="",V=J.length;for(let K=1;K<Z.length;++K){let N=Z[K];switch(N.type){case"space":W=!0;case"newline":V+=N.source.length;break;case"comment":if(X&&!W)z(N,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");V+=N.source.length,q=N.source.substring(1);break;case"error":z(N,"UNEXPECTED_TOKEN",N.message),V+=N.source.length;break;default:{let O=`Unexpected token in block scalar header: ${N.type}`;z(N,"UNEXPECTED_TOKEN",O);let B=N.source;if(B&&typeof B==="string")V+=B.length}}}return{mode:Q,indent:Y,chomp:G,comment:q,length:V}}function ZV($){let Z=$.split(/\n( *)/),X=Z[0],z=X.match(/^( *)/),Q=[z?.[1]?[z[1],X.slice(z[1].length)]:["",X]];for(let Y=1;Y<Z.length;Y+=2)Q.push([Z[Y],Z[Y+1]]);return Q}XV.resolveBlockScalar=eq});var _8=A((KV)=>{var P8=Z0(),JV=d$();function QV($,Z,X){let{offset:z,type:J,source:Q,end:Y}=$,G,U,W=(K,N,O)=>X(z+K,N,O);switch(J){case"scalar":G=P8.Scalar.PLAIN,U=YV(Q,W);break;case"single-quoted-scalar":G=P8.Scalar.QUOTE_SINGLE,U=GV(Q,W);break;case"double-quoted-scalar":G=P8.Scalar.QUOTE_DOUBLE,U=UV(Q,W);break;default:return X($,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${J}`),{value:"",type:null,comment:"",range:[z,z+Q.length,z+Q.length]}}let q=z+Q.length,V=JV.resolveEnd(Y,q,Z,X);return{value:U,type:G,comment:V.comment,range:[z,q,V.offset]}}function YV($,Z){let X="";switch($[0]){case"\t":X="a tab character";break;case",":X="flow indicator character ,";break;case"%":X="directive indicator character %";break;case"|":case">":{X=`block scalar indicator ${$[0]}`;break}case"@":case"`":{X=`reserved character ${$[0]}`;break}}if(X)Z(0,"BAD_SCALAR_START",`Plain value cannot start with ${X}`);return M9($)}function GV($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return M9($.slice(1,-1)).replace(/''/g,"'")}function M9($){let Z,X;try{Z=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
111
|
+
`,"sy"),X=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
112
|
+
`,"sy")}catch{Z=/(.*?)[ \t]*\r?\n/sy,X=/[ \t]*(.*?)[ \t]*\r?\n/sy}let z=Z.exec($);if(!z)return $;let J=z[1],Q=" ",Y=Z.lastIndex;X.lastIndex=Y;while(z=X.exec($)){if(z[1]==="")if(Q===`
|
|
113
113
|
`)J+=Q;else Q=`
|
|
114
|
-
`;else J+=Q+
|
|
114
|
+
`;else J+=Q+z[1],Q=" ";Y=X.lastIndex}let G=/[ \t]*(.*)/sy;return G.lastIndex=Y,z=G.exec($),J+Q+(z?.[1]??"")}function UV($,Z){let X="";for(let z=1;z<$.length-1;++z){let J=$[z];if(J==="\r"&&$[z+1]===`
|
|
115
115
|
`)continue;if(J===`
|
|
116
|
-
`){let{fold:Q,offset:Y}=
|
|
117
|
-
`){Q=$[
|
|
118
|
-
`){Q=$[++
|
|
119
|
-
`&&!(Y==="\r"&&$[
|
|
120
|
-
`))z
|
|
121
|
-
`||
|
|
122
|
-
`)break;if(
|
|
123
|
-
`)
|
|
124
|
-
`;Z+=1,
|
|
125
|
-
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function
|
|
116
|
+
`){let{fold:Q,offset:Y}=WV($,z);X+=Q,z=Y}else if(J==="\\"){let Q=$[++z],Y=qV[Q];if(Y)X+=Y;else if(Q===`
|
|
117
|
+
`){Q=$[z+1];while(Q===" "||Q==="\t")Q=$[++z+1]}else if(Q==="\r"&&$[z+1]===`
|
|
118
|
+
`){Q=$[++z+1];while(Q===" "||Q==="\t")Q=$[++z+1]}else if(Q==="x"||Q==="u"||Q==="U"){let G={x:2,u:4,U:8}[Q];X+=VV($,z+1,G,Z),z+=G}else{let G=$.substr(z-1,2);Z(z-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${G}`),X+=G}}else if(J===" "||J==="\t"){let Q=z,Y=$[z+1];while(Y===" "||Y==="\t")Y=$[++z+1];if(Y!==`
|
|
119
|
+
`&&!(Y==="\r"&&$[z+2]===`
|
|
120
|
+
`))X+=z>Q?$.slice(Q,z+1):J}else X+=J}if($[$.length-1]!=='"'||$.length===1)Z($.length,"MISSING_CHAR",'Missing closing "quote');return X}function WV($,Z){let X="",z=$[Z+1];while(z===" "||z==="\t"||z===`
|
|
121
|
+
`||z==="\r"){if(z==="\r"&&$[Z+2]!==`
|
|
122
|
+
`)break;if(z===`
|
|
123
|
+
`)X+=`
|
|
124
|
+
`;Z+=1,z=$[Z+1]}if(!X)X=" ";return{fold:X,offset:Z}}var qV={"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 VV($,Z,X,z){let J=$.substr(Z,X),Y=J.length===X&&/^[0-9a-fA-F]+$/.test(J)?parseInt(J,16):NaN;if(isNaN(Y)){let G=$.substr(Z-2,X+2);return z(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${G}`),G}return String.fromCodePoint(Y)}KV.resolveFlowScalar=QV});var O9=A((OV)=>{var D$=c(),T9=Z0(),BV=w8(),LV=_8();function NV($,Z,X,z){let{value:J,type:Q,comment:Y,range:G}=Z.type==="block-scalar"?BV.resolveBlockScalar($,Z,z):LV.resolveFlowScalar(Z,$.options.strict,z),U=X?$.directives.tagName(X.source,(V)=>z(X,"TAG_RESOLVE_FAILED",V)):null,W;if($.options.stringKeys&&$.atKey)W=$.schema[D$.SCALAR];else if(U)W=MV($.schema,J,U,X,z);else if(Z.type==="scalar")W=TV($,J,Z,z);else W=$.schema[D$.SCALAR];let q;try{let V=W.resolve(J,(K)=>z(X??Z,"TAG_RESOLVE_FAILED",K),$.options);q=D$.isScalar(V)?V:new T9.Scalar(V)}catch(V){let K=V instanceof Error?V.message:String(V);z(X??Z,"TAG_RESOLVE_FAILED",K),q=new T9.Scalar(J)}if(q.range=G,q.source=J,Q)q.type=Q;if(U)q.tag=U;if(W.format)q.format=W.format;if(Y)q.comment=Y;return q}function MV($,Z,X,z,J){if(X==="!")return $[D$.SCALAR];let Q=[];for(let G of $.tags)if(!G.collection&&G.tag===X)if(G.default&&G.test)Q.push(G);else return G;for(let G of Q)if(G.test?.test(Z))return G;let Y=$.knownTags[X];if(Y&&!Y.collection)return $.tags.push(Object.assign({},Y,{default:!1,test:void 0})),Y;return J(z,"TAG_RESOLVE_FAILED",`Unresolved tag: ${X}`,X!=="tag:yaml.org,2002:str"),$[D$.SCALAR]}function TV({atKey:$,directives:Z,schema:X},z,J,Q){let Y=X.tags.find((G)=>(G.default===!0||$&&G.default==="key")&&G.test?.test(z))||X[D$.SCALAR];if(X.compat){let G=X.compat.find((U)=>U.default&&U.test?.test(z))??X[D$.SCALAR];if(Y.tag!==G.tag){let U=Z.tagString(Y.tag),W=Z.tagString(G.tag),q=`Value may be parsed as either ${U} or ${W}`;Q(J,"TAG_RESOLVE_FAILED",q,!0)}}return Y}OV.composeScalar=NV});var D9=A((AV)=>{function IV($,Z,X){if(Z){X??(X=Z.length);for(let z=X-1;z>=0;--z){let J=Z[z];switch(J.type){case"space":case"comment":case"newline":$-=J.source.length;continue}J=Z[++z];while(J?.type==="space")$+=J.source.length,J=Z[++z];break}}return $}AV.emptyScalarPosition=IV});var R9=A((SV)=>{var FV=_1(),wV=c(),PV=N9(),I9=O9(),_V=d$(),CV=D9(),EV={composeNode:A9,composeEmptyNode:C8};function A9($,Z,X,z){let J=$.atKey,{spaceBefore:Q,comment:Y,anchor:G,tag:U}=X,W,q=!0;switch(Z.type){case"alias":if(W=jV($,Z,z),G||U)z(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(W=I9.composeScalar($,Z,U,z),G)W.anchor=G.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":if(W=PV.composeCollection(EV,$,Z,X,z),G)W.anchor=G.source.substring(1);break;default:{let V=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;z(Z,"UNEXPECTED_TOKEN",V),W=C8($,Z.offset,void 0,null,X,z),q=!1}}if(G&&W.anchor==="")z(G,"BAD_ALIAS","Anchor cannot be an empty string");if(J&&$.options.stringKeys&&(!wV.isScalar(W)||typeof W.value!=="string"||W.tag&&W.tag!=="tag:yaml.org,2002:str"))z(U??Z,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(Q)W.spaceBefore=!0;if(Y)if(Z.type==="scalar"&&Z.source==="")W.comment=Y;else W.commentBefore=Y;if($.options.keepSourceTokens&&q)W.srcToken=Z;return W}function C8($,Z,X,z,{spaceBefore:J,comment:Q,anchor:Y,tag:G,end:U},W){let q={type:"scalar",offset:CV.emptyScalarPosition(Z,X,z),indent:-1,source:""},V=I9.composeScalar($,q,G,W);if(Y){if(V.anchor=Y.source.substring(1),V.anchor==="")W(Y,"BAD_ALIAS","Anchor cannot be an empty string")}if(J)V.spaceBefore=!0;if(Q)V.comment=Q,V.range[2]=U;return V}function jV({options:$},{offset:Z,source:X,end:z},J){let Q=new FV.Alias(X.substring(1));if(Q.source==="")J(Z,"BAD_ALIAS","Alias cannot be an empty string");if(Q.source.endsWith(":"))J(Z+X.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let Y=Z+X.length,G=_V.resolveEnd(z,Y,$.strict,J);if(Q.range=[Z,Y,G.offset],G.comment)Q.comment=G.comment;return Q}SV.composeEmptyNode=C8;SV.composeNode=A9});var w9=A((hV)=>{var kV=c1(),F9=R9(),yV=d$(),fV=p1();function gV($,Z,{offset:X,start:z,value:J,end:Q},Y){let G=Object.assign({_directives:Z},$),U=new kV.Document(void 0,G),W={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},q=fV.resolveProps(z,{indicator:"doc-start",next:J??Q?.[0],offset:X,onError:Y,parentIndent:0,startOnNewline:!0});if(q.found){if(U.directives.docStart=!0,J&&(J.type==="block-map"||J.type==="block-seq")&&!q.hasNewline)Y(q.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}U.contents=J?F9.composeNode(W,J,q,Y):F9.composeEmptyNode(W,q.end,z,null,q,Y);let V=U.contents.range[2],K=yV.resolveEnd(Q,V,!1,Y);if(K.comment)U.comment=K.comment;return U.range=[X,V,K.offset],U}hV.composeDoc=gV});var E8=A((lV)=>{var uV=T0("process"),mV=x6(),cV=c1(),l1=d1(),P9=c(),dV=w9(),pV=d$();function i1($){if(typeof $==="number")return[$,$+1];if(Array.isArray($))return $.length===2?$:[$[0],$[1]];let{offset:Z,source:X}=$;return[Z,Z+(typeof X==="string"?X.length:1)]}function _9($){let Z="",X=!1,z=!1;for(let J=0;J<$.length;++J){let Q=$[J];switch(Q[0]){case"#":Z+=(Z===""?"":z?`
|
|
126
126
|
|
|
127
127
|
`:`
|
|
128
|
-
`)+(Q.substring(1)||" "),
|
|
129
|
-
${
|
|
130
|
-
${Y}`:
|
|
131
|
-
${Q}`:
|
|
132
|
-
${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.push(new
|
|
133
|
-
`}];switch(
|
|
134
|
-
`),
|
|
135
|
-
`,K=[{type:"block-scalar-header",offset:Q,indent:
|
|
136
|
-
`});return{type:"block-scalar",offset:Q,indent:
|
|
137
|
-
`),
|
|
138
|
-
`;if($.type==="block-scalar"){let Q=$.props[0];if(Q.type!=="block-scalar-header")throw Error("Invalid block scalar header");Q.source=
|
|
139
|
-
`});for(let
|
|
140
|
-
`};delete $.items,Object.assign($,{type:
|
|
128
|
+
`)+(Q.substring(1)||" "),X=!0,z=!1;break;case"%":if($[J+1]?.[0]!=="#")J+=1;X=!1;break;default:if(!X)z=!0;X=!1}}return{comment:Z,afterEmptyLine:z}}class C9{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,X,z,J)=>{let Q=i1(Z);if(J)this.warnings.push(new l1.YAMLWarning(Q,X,z));else this.errors.push(new l1.YAMLParseError(Q,X,z))},this.directives=new mV.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:X,afterEmptyLine:z}=_9(this.prelude);if(X){let J=$.contents;if(Z)$.comment=$.comment?`${$.comment}
|
|
129
|
+
${X}`:X;else if(z||$.directives.docStart||!J)$.commentBefore=X;else if(P9.isCollection(J)&&!J.flow&&J.items.length>0){let Q=J.items[0];if(P9.isPair(Q))Q=Q.key;let Y=Q.commentBefore;Q.commentBefore=Y?`${X}
|
|
130
|
+
${Y}`:X}else{let Q=J.commentBefore;J.commentBefore=Q?`${X}
|
|
131
|
+
${Q}`:X}}if(Z)Array.prototype.push.apply($.errors,this.errors),Array.prototype.push.apply($.warnings,this.warnings);else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:_9(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose($,Z=!1,X=-1){for(let z of $)yield*this.next(z);yield*this.end(Z,X)}*next($){if(uV.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,X,z)=>{let J=i1($);J[0]+=Z,this.onError(J,"BAD_DIRECTIVE",X,z)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=dV.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,X=new l1.YAMLParseError(i1($),"UNEXPECTED_TOKEN",Z);if(this.atDirectives||!this.doc)this.errors.push(X);else this.doc.errors.push(X);break}case"doc-end":{if(!this.doc){this.errors.push(new l1.YAMLParseError(i1($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=pV.resolveEnd($.end,$.offset+$.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),Z.comment){let X=this.doc.comment;this.doc.comment=X?`${X}
|
|
132
|
+
${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.push(new l1.YAMLParseError(i1($),"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 X=Object.assign({_directives:this.directives},this.options),z=new cV.Document(void 0,X);if(this.atDirectives)this.onError(Z,"MISSING_CHAR","Missing directives-end indicator line");z.range=[0,Z,Z],this.decorate(z,!1),yield z}}}lV.Composer=C9});var S9=A(($K)=>{var nV=w8(),sV=_8(),rV=d1(),E9=S1();function aV($,Z=!0,X){if($){let z=(J,Q,Y)=>{let G=typeof J==="number"?J:Array.isArray(J)?J[0]:J.offset;if(X)X(G,Q,Y);else throw new rV.YAMLParseError([G,G+1],Q,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return sV.resolveFlowScalar($,Z,z);case"block-scalar":return nV.resolveBlockScalar({options:{strict:Z}},$,z)}}return null}function oV($,Z){let{implicitKey:X=!1,indent:z,inFlow:J=!1,offset:Q=-1,type:Y="PLAIN"}=Z,G=E9.stringifyString({type:Y,value:$},{implicitKey:X,indent:z>0?" ".repeat(z):"",inFlow:J,options:{blockQuote:!0,lineWidth:-1}}),U=Z.end??[{type:"newline",offset:-1,indent:z,source:`
|
|
133
|
+
`}];switch(G[0]){case"|":case">":{let W=G.indexOf(`
|
|
134
|
+
`),q=G.substring(0,W),V=G.substring(W+1)+`
|
|
135
|
+
`,K=[{type:"block-scalar-header",offset:Q,indent:z,source:q}];if(!j9(K,U))K.push({type:"newline",offset:-1,indent:z,source:`
|
|
136
|
+
`});return{type:"block-scalar",offset:Q,indent:z,props:K,source:V}}case'"':return{type:"double-quoted-scalar",offset:Q,indent:z,source:G,end:U};case"'":return{type:"single-quoted-scalar",offset:Q,indent:z,source:G,end:U};default:return{type:"scalar",offset:Q,indent:z,source:G,end:U}}}function tV($,Z,X={}){let{afterKey:z=!1,implicitKey:J=!1,inFlow:Q=!1,type:Y}=X,G="indent"in $?$.indent:null;if(z&&typeof G==="number")G+=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 W=$.props[0];if(W.type!=="block-scalar-header")throw Error("Invalid block scalar header");Y=W.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:Y="PLAIN"}let U=E9.stringifyString({type:Y,value:Z},{implicitKey:J||G===null,indent:G!==null&&G>0?" ".repeat(G):"",inFlow:Q,options:{blockQuote:!0,lineWidth:-1}});switch(U[0]){case"|":case">":eV($,U);break;case'"':j8($,U,"double-quoted-scalar");break;case"'":j8($,U,"single-quoted-scalar");break;default:j8($,U,"scalar")}}function eV($,Z){let X=Z.indexOf(`
|
|
137
|
+
`),z=Z.substring(0,X),J=Z.substring(X+1)+`
|
|
138
|
+
`;if($.type==="block-scalar"){let Q=$.props[0];if(Q.type!=="block-scalar-header")throw Error("Invalid block scalar header");Q.source=z,$.source=J}else{let{offset:Q}=$,Y="indent"in $?$.indent:-1,G=[{type:"block-scalar-header",offset:Q,indent:Y,source:z}];if(!j9(G,"end"in $?$.end:void 0))G.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:G,source:J})}}function j9($,Z){if(Z)for(let X of Z)switch(X.type){case"space":case"comment":$.push(X);break;case"newline":return $.push(X),!0}return!1}function j8($,Z,X){switch($.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":$.type=X,$.source=Z;break;case"block-scalar":{let z=$.props.slice(1),J=Z.length;if($.props[0].type==="block-scalar-header")J-=$.props[0].source.length;for(let Q of z)Q.offset+=J;delete $.props,Object.assign($,{type:X,source:Z,end:z});break}case"block-map":case"block-seq":{let J={type:"newline",offset:$.offset+Z.length,indent:$.indent,source:`
|
|
140
|
+
`};delete $.items,Object.assign($,{type:X,source:Z,end:[J]});break}default:{let z="indent"in $?$.indent:-1,J="end"in $&&Array.isArray($.end)?$.end.filter((Q)=>Q.type==="space"||Q.type==="comment"||Q.type==="newline"):[];for(let Q of Object.keys($))if(Q!=="type"&&Q!=="offset")delete $[Q];Object.assign($,{type:X,indent:z,source:Z,end:J})}}}$K.createScalarToken=oV;$K.resolveAsScalar=aV;$K.setScalarValue=tV});var b9=A((QK)=>{var JK=($)=>("type"in $)?E2($):C2($);function E2($){switch($.type){case"block-scalar":{let Z="";for(let X of $.props)Z+=E2(X);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let X of $.items)Z+=C2(X);return Z}case"flow-collection":{let Z=$.start.source;for(let X of $.items)Z+=C2(X);for(let X of $.end)Z+=X.source;return Z}case"document":{let Z=C2($);if($.end)for(let X of $.end)Z+=X.source;return Z}default:{let Z=$.source;if("end"in $&&$.end)for(let X of $.end)Z+=X.source;return Z}}}function C2({start:$,key:Z,sep:X,value:z}){let J="";for(let Q of $)J+=Q.source;if(Z)J+=E2(Z);if(X)for(let Q of X)J+=Q.source;if(z)J+=E2(z);return J}QK.stringify=JK});var y9=A((UK)=>{var S8=Symbol("break visit"),GK=Symbol("skip children"),x9=Symbol("remove item");function I$($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};k9(Object.freeze([]),$,Z)}I$.BREAK=S8;I$.SKIP=GK;I$.REMOVE=x9;I$.itemAtPath=($,Z)=>{let X=$;for(let[z,J]of Z){let Q=X?.[z];if(Q&&"items"in Q)X=Q.items[J];else return}return X};I$.parentCollection=($,Z)=>{let X=I$.itemAtPath($,Z.slice(0,-1)),z=Z[Z.length-1][0],J=X?.[z];if(J&&"items"in J)return J;throw Error("Parent collection not found")};function k9($,Z,X){let z=X(Z,$);if(typeof z==="symbol")return z;for(let J of["key","value"]){let Q=Z[J];if(Q&&"items"in Q){for(let Y=0;Y<Q.items.length;++Y){let G=k9(Object.freeze($.concat([[J,Y]])),Q.items[Y],X);if(typeof G==="number")Y=G-1;else if(G===S8)return S8;else if(G===x9)Q.items.splice(Y,1),Y-=1}if(typeof z==="function"&&J==="key")z=z(Z,$)}}return typeof z==="function"?z(Z,$):z}UK.visit=I$});var j2=A((NK)=>{var b8=S9(),qK=b9(),VK=y9(),x8="\uFEFF",k8="\x02",y8="\x18",f8="\x1F",KK=($)=>!!$&&("items"in $),HK=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function BK($){switch($){case x8:return"<BOM>";case k8:return"<DOC>";case y8:return"<FLOW_END>";case f8:return"<SCALAR>";default:return JSON.stringify($)}}function LK($){switch($){case x8:return"byte-order-mark";case k8:return"doc-mode";case y8:return"flow-error-end";case f8: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}
|
|
143
|
-
`:case"\r":case"\t":return!0;default:return!1}}var
|
|
144
|
-
\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}NK.createScalarToken=b8.createScalarToken;NK.resolveAsScalar=b8.resolveAsScalar;NK.setScalarValue=b8.setScalarValue;NK.stringify=qK.stringify;NK.visit=VK.visit;NK.BOM=x8;NK.DOCUMENT=k8;NK.FLOW_END=y8;NK.SCALAR=f8;NK.isCollection=KK;NK.isScalar=HK;NK.prettyToken=BK;NK.tokenType=LK});var h8=A((bK)=>{var n1=j2();function E0($){switch($){case void 0:case" ":case`
|
|
143
|
+
`:case"\r":case"\t":return!0;default:return!1}}var f9=new Set("0123456789ABCDEFabcdef"),jK=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),S2=new Set(",[]{}"),SK=new Set(` ,[]{}
|
|
144
|
+
\r `),g8=($)=>!$||SK.has($);class g9{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 X=this.next??"stream";while(X&&(Z||this.hasChars(1)))X=yield*this.parseNext(X)}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
|
-
`;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let Z=this.buffer[$];if(this.indentNext>0){let
|
|
147
|
-
`||!
|
|
148
|
-
`||
|
|
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]===
|
|
150
|
-
`,this.pos);if(
|
|
151
|
-
`,J)}if(
|
|
146
|
+
`;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let Z=this.buffer[$];if(this.indentNext>0){let X=0;while(Z===" ")Z=this.buffer[++X+$];if(Z==="\r"){let z=this.buffer[X+$+1];if(z===`
|
|
147
|
+
`||!z&&!this.atEnd)return $+X+1}return Z===`
|
|
148
|
+
`||X>=this.indentNext||!Z&&!this.atEnd?$+X:-1}if(Z==="-"||Z==="."){let X=this.buffer.substr($,3);if((X==="---"||X==="...")&&E0(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]===n1.BOM)yield*this.pushCount(1),$=$.substring(1);if($[0]==="%"){let Z=$.length,X=$.indexOf("#");while(X!==-1){let J=$[X-1];if(J===" "||J==="\t"){Z=X-1;break}else X=$.indexOf("#",X+1)}while(!0){let J=$[Z-1];if(J===" "||J==="\t")Z-=1;else break}let z=(yield*this.pushCount(Z))+(yield*this.pushSpaces(!0));return yield*this.pushCount($.length-z),this.pushNewline(),"stream"}if(this.atLineEnd()){let Z=yield*this.pushSpaces(!0);return yield*this.pushCount($.length-Z),yield*this.pushNewline(),"stream"}return yield n1.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==="...")&&E0(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&&!E0(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(($==="-"||$==="?"||$===":")&&E0(Z)){let X=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=X,yield*this.parseBlockStart()}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(g8),"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,X=-1;do{if($=yield*this.pushNewline(),$>0)Z=yield*this.pushSpaces(!1),this.indentValue=X=Z;else Z=0;Z+=yield*this.pushSpaces(!0)}while($+Z>0);let z=this.getLine();if(z===null)return this.setNext("flow");if(X!==-1&&X<this.indentNext&&z[0]!=="#"||X===0&&(z.startsWith("---")||z.startsWith("..."))&&E0(z[3])){if(!(X===this.indentNext-1&&this.flowLevel===1&&(z[0]==="]"||z[0]==="}")))return this.flowLevel=0,yield n1.FLOW_END,yield*this.parseLineStart()}let J=0;while(z[J]===",")J+=yield*this.pushCount(1),J+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(J+=yield*this.pushIndicators(),z[J]){case void 0:return"flow";case"#":return yield*this.pushCount(z.length-J),"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(g8),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let Q=this.charAt(1);if(this.flowKey||E0(Q)||Q===",")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 J=0;while(this.buffer[Z-1-J]==="\\")J+=1;if(J%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let X=this.buffer.substring(0,Z),z=X.indexOf(`
|
|
150
|
+
`,this.pos);if(z!==-1){while(z!==-1){let J=this.continueScalar(z+1);if(J===-1)break;z=X.indexOf(`
|
|
151
|
+
`,J)}if(z!==-1)Z=z-(X[z-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)=>E0(Z)||Z==="#")}*parseBlockScalar(){let $=this.pos-1,Z=0,X;$:for(let J=this.pos;X=this.buffer[J];++J)switch(X){case" ":Z+=1;break;case`
|
|
152
152
|
`:$=J,Z=0;break;case"\r":{let Q=this.buffer[J+1];if(!Q&&!this.atEnd)return this.setNext("block-scalar");if(Q===`
|
|
153
|
-
`)break}default:break $}if(!
|
|
154
|
-
`,J)}while($!==-1);if($===-1){if(!this.atEnd)return this.setNext("block-scalar");$=this.buffer.length}}let
|
|
155
|
-
`)
|
|
156
|
-
`&&J>=this.pos&&J+1+Z>Y)$=J;else break}while(!0);return yield
|
|
157
|
-
`)
|
|
158
|
-
`,J=this.buffer[
|
|
159
|
-
`){let Q=this.continueScalar(
|
|
153
|
+
`)break}default:break $}if(!X&&!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 J=this.continueScalar($+1);if(J===-1)break;$=this.buffer.indexOf(`
|
|
154
|
+
`,J)}while($!==-1);if($===-1){if(!this.atEnd)return this.setNext("block-scalar");$=this.buffer.length}}let z=$+1;X=this.buffer[z];while(X===" ")X=this.buffer[++z];if(X==="\t"){while(X==="\t"||X===" "||X==="\r"||X===`
|
|
155
|
+
`)X=this.buffer[++z];$=z-1}else if(!this.blockScalarKeep)do{let J=$-1,Q=this.buffer[J];if(Q==="\r")Q=this.buffer[--J];let Y=J;while(Q===" ")Q=this.buffer[--J];if(Q===`
|
|
156
|
+
`&&J>=this.pos&&J+1+Z>Y)$=J;else break}while(!0);return yield n1.SCALAR,yield*this.pushToIndex($+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let $=this.flowLevel>0,Z=this.pos-1,X=this.pos-1,z;while(z=this.buffer[++X])if(z===":"){let J=this.buffer[X+1];if(E0(J)||$&&S2.has(J))break;Z=X}else if(E0(z)){let J=this.buffer[X+1];if(z==="\r")if(J===`
|
|
157
|
+
`)X+=1,z=`
|
|
158
|
+
`,J=this.buffer[X+1];else Z=X;if(J==="#"||$&&S2.has(J))break;if(z===`
|
|
159
|
+
`){let Q=this.continueScalar(X+1);if(Q===-1)break;X=Math.max(X,Q-2)}}else{if($&&S2.has(z))break;Z=X}if(!z&&!this.atEnd)return this.setNext("plain-scalar");return yield n1.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 X=this.buffer.slice(this.pos,$);if(X)return yield X,this.pos+=X.length,X.length;else if(Z)yield"";return 0}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(g8))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let $=this.flowLevel>0,Z=this.charAt(1);if(E0(Z)||$&&S2.has(Z)){if(!$)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;return(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}}return 0}*pushTag(){if(this.charAt(1)==="<"){let $=this.pos+2,Z=this.buffer[$];while(!E0(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(jK.has(Z))Z=this.buffer[++$];else if(Z==="%"&&f9.has(this.buffer[$+1])&&f9.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,
|
|
161
|
+
`)return yield*this.pushCount(2);else return 0}*pushSpaces($){let Z=this.pos-1,X;do X=this.buffer[++Z];while(X===" "||$&&X==="\t");let z=Z-this.pos;if(z>0)yield this.buffer.substr(this.pos,z),this.pos=Z;return z}*pushUntil($){let Z=this.pos,X=this.buffer[Z];while(!$(X))X=this.buffer[++Z];return yield*this.pushToIndex(Z,!1)}}bK.Lexer=g9});var v8=A((kK)=>{class h9{constructor(){this.lineStarts=[],this.addNewLine=($)=>this.lineStarts.push($),this.linePos=($)=>{let Z=0,X=this.lineStarts.length;while(Z<X){let J=Z+X>>1;if(this.lineStarts[J]<$)Z=J+1;else X=J}if(this.lineStarts[Z]===$)return{line:Z+1,col:1};if(Z===0)return{line:0,col:$};let z=this.lineStarts[Z-1];return{line:Z,col:$-z+1}}}}kK.LineCounter=h9});var u8=A((hK)=>{var fK=T0("process"),v9=j2(),gK=h8();function Z$($,Z){for(let X=0;X<$.length;++X)if($[X].type===Z)return!0;return!1}function u9($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function c9($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function b2($){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 p$($){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 m9($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!Z$(Z.start,"explicit-key-ind")&&!Z$(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,c9(Z.value))if(Z.value.end)Array.prototype.push.apply(Z.value.end,Z.sep);else Z.value.end=Z.sep;else Array.prototype.push.apply(Z.start,Z.sep);delete Z.sep}}}class d9{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 gK.Lexer,this.onNewLine=$}*parse($,Z=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let X of this.lexer.lex($,Z))yield*this.next(X);if(!Z)yield*this.end()}*next($){if(this.source=$,fK.env.LOG_TOKENS)console.log("|",v9.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=v9.tokenType($);if(!Z){let X=`Not a YAML token: ${$}`;yield*this.pop({type:"error",offset:this.offset,message:X,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 X=this.peek(1);if(Z.type==="block-scalar")Z.indent="indent"in X?X.indent:0;else if(Z.type==="flow-collection"&&X.type==="document")Z.indent=0;if(Z.type==="flow-collection")m9(Z);switch(X.type){case"document":X.value=Z;break;case"block-scalar":X.props.push(Z);break;case"block-map":{let z=X.items[X.items.length-1];if(z.value){X.items.push({start:[],key:Z,sep:[]}),this.onKeyLine=!0;return}else if(z.sep)z.value=Z;else{Object.assign(z,{key:Z,sep:[]}),this.onKeyLine=!z.explicitKey;return}break}case"block-seq":{let z=X.items[X.items.length-1];if(z.value)X.items.push({start:[],value:Z});else z.value=Z;break}case"flow-collection":{let z=X.items[X.items.length-1];if(!z||z.value)X.items.push({start:[],key:Z,sep:[]});else if(z.sep)z.value=Z;else Object.assign(z,{key:Z,sep:[]});return}default:yield*this.pop(),yield*this.pop(Z)}if((X.type==="document"||X.type==="block-map"||X.type==="block-seq")&&(Z.type==="block-map"||Z.type==="block-seq")){let z=Z.items[Z.items.length-1];if(z&&!z.sep&&!z.value&&z.start.length>0&&u9(z.start)===-1&&(Z.indent===0||z.start.every((J)=>J.type!=="comment"||J.indent<Z.indent))){if(X.type==="document")X.end=z.start;else X.items.push({start:z.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(u9($.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=b2(this.peek(2)),X=p$(Z),z;if($.end)z=$.end,z.push(this.sourceToken),delete $.end;else z=[this.sourceToken];let J={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:X,key:$,sep:z}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=J}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
|
|
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 X="end"in Z.value?Z.value.end:void 0;if((Array.isArray(X)?X[X.length-1]:void 0)?.type==="comment")X?.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 z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){Array.prototype.push.apply(z,Z.start),z.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let X=!this.onKeyLine&&this.indent===$.indent,z=X&&(Z.sep||Z.explicitKey)&&this.type!=="seq-item-ind",J=[];if(z&&Z.sep&&!Z.value){let Q=[];for(let Y=0;Y<Z.sep.length;++Y){let G=Z.sep[Y];switch(G.type){case"newline":Q.push(Y);break;case"space":break;case"comment":if(G.indent>$.indent)Q.length=0;break;default:Q.length=0}}if(Q.length>=2)J=Z.sep.splice(Q[1])}switch(this.type){case"anchor":case"tag":if(z||Z.value)J.push(this.sourceToken),$.items.push({start:J}),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(z||Z.value)J.push(this.sourceToken),$.items.push({start:J,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(Z$(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let Q=p$(Z.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:null,sep:[this.sourceToken]}]})}else if(Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Z$(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]});else if(c9(Z.key)&&!Z$(Z.sep,"newline")){let Q=p$(Z.start),Y=Z.key,G=Z.sep;G.push(this.sourceToken),delete Z.key,delete Z.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:Y,sep:G}]})}else if(J.length>0)Z.sep=Z.sep.concat(J,this.sourceToken);else Z.sep.push(this.sourceToken);else if(!Z.sep)Object.assign(Z,{key:null,sep:[this.sourceToken]});else if(Z.value||z)$.items.push({start:J,key:null,sep:[this.sourceToken]});else if(Z$(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 Q=this.flowScalar(this.type);if(z||Z.value)$.items.push({start:J,key:Q,sep:[]}),this.onKeyLine=!0;else if(Z.sep)this.stack.push(Q);else Object.assign(Z,{key:Q,sep:[]}),this.onKeyLine=!0;return}default:{let Q=this.startBlockValue($);if(Q){if(Q.type==="block-seq"){if(!Z.explicitKey&&Z.sep&&!Z$(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(X)$.items.push({start:J});this.stack.push(Q);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(Z.value){let X="end"in Z.value?Z.value.end:void 0;if((Array.isArray(X)?X[X.length-1]:void 0)?.type==="comment")X?.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 z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){Array.prototype.push.apply(z,Z.start),z.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||Z$(Z.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return}if(this.indent>$.indent){let X=this.startBlockValue($);if(X){this.stack.push(X);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let Z=$.items[$.items.length-1];if(this.type==="flow-error-end"){let X;do yield*this.pop(),X=this.peek(1);while(X?.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 z=this.flowScalar(this.type);if(!Z||Z.value)$.items.push({start:[],key:z,sep:[]});else if(Z.sep)this.stack.push(z);else Object.assign(Z,{key:z,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let X=this.startBlockValue($);if(X)this.stack.push(X);else yield*this.pop(),yield*this.step()}else{let X=this.peek(2);if(X.type==="block-map"&&(this.type==="map-value-ind"&&X.indent===$.indent||this.type==="newline"&&!X.items[X.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&X.type!=="flow-collection"){let z=b2(X),J=p$(z);m9($);let Q=$.end.splice(1,$.end.length);Q.push(this.sourceToken);let Y={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:J,key:$,sep:Q}]};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=w2($),z=v$(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=w2($),z=v$(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()}}}aV.Parser=PZ});var SZ=A((QK)=>{var _Z=L8(),tV=x1(),v1=y1(),eV=R6(),$K=m(),ZK=R8(),EZ=P8();function CZ($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new ZK.LineCounter||null,prettyErrors:Z}}function zK($,Z={}){let{lineCounter:z,prettyErrors:X}=CZ(Z),J=new EZ.Parser(z?.addNewLine),Q=new _Z.Composer(Z),Y=Array.from(Q.compose(J.parse($)));if(X&&z)for(let q of Y)q.errors.forEach(v1.prettifyError($,z)),q.warnings.forEach(v1.prettifyError($,z));if(Y.length>0)return Y;return Object.assign([],{empty:!0},Q.streamInfo())}function jZ($,Z={}){let{lineCounter:z,prettyErrors:X}=CZ(Z),J=new EZ.Parser(z?.addNewLine),Q=new _Z.Composer(Z),Y=null;for(let q of Q.compose(J.parse($),!0,$.length))if(!Y)Y=q;else if(Y.options.logLevel!=="silent"){Y.errors.push(new v1.YAMLParseError(q.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(X&&z)Y.errors.forEach(v1.prettifyError($,z)),Y.warnings.forEach(v1.prettifyError($,z));return Y}function XK($,Z,z){let X=void 0;if(typeof Z==="function")X=Z;else if(z===void 0&&Z&&typeof Z==="object")z=Z;let J=jZ($,z);if(!J)return null;if(J.warnings.forEach((Q)=>eV.warn(J.options.logLevel,Q)),J.errors.length>0)if(J.options.logLevel!=="silent")throw J.errors[0];else J.errors=[];return J.toJS(Object.assign({reviver:X},z))}function JK($,Z,z){let X=null;if(typeof Z==="function"||Array.isArray(Z))X=Z;else if(z===void 0&&Z)z=Z;if(typeof z==="string")z=z.length;if(typeof z==="number"){let J=Math.round(z);z=J<1?void 0:J>8?{indent:8}:{indent:J}}if($===void 0){let{keepUndefined:J}=z??Z??{};if(!J)return}if($K.isDocument($)&&!X)return $.toString(z);return new tV.Document($,X,z).toString(z)}QK.parse=XK;QK.parseAllDocuments=zK;QK.parseDocument=jZ;QK.stringify=JK});var fZ={};Y9(fZ,{orange:()=>E0,italic:()=>rK,fafCyanDeep:()=>R2,fafCyan:()=>w,dim:()=>N,bold:()=>k,FAF_HEX:()=>m1});var C8=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,k,N,rK,m1,w=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,R2=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,E0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var p=S(()=>{k=C8("1"),N=C8("2"),rK=C8("3"),m1={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var h8=A((FD,NB)=>{NB.exports={name:"faf-cli",version:"6.7.1",description:"Persistent AI Context Standard — project DNA for AI. IANA-registered. Anthropic-approved.",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",bun:"./src/index.ts",default:"./dist/index.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",build:"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 && 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=30000","test:watch":"bun test --watch --timeout=30000",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)",prepublishOnly:"bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","bi-sync","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational"],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.1","faf-scoring-kernel":"^2.0.3",open:"^11.0.0",yaml:"^2.4.1"},optionalDependencies:{"@anthropic-ai/sdk":"^0.91.1"},devDependencies:{"@types/node":"^22.15.0","@typescript-eslint/eslint-plugin":"^8.41.0","@typescript-eslint/parser":"^8.41.0",eslint:"^9.39.2",prettier:"^3.2.5",typescript:"^5.3.3","typescript-eslint":"^8.59.1"},engines:{node:">=18.0.0"},publishConfig:{access:"public"}}});function I($,Z,z,X,J){if(X==="m")throw TypeError("Private method is not writable");if(X==="a"&&!J)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!J:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return X==="a"?J.call($,z):J?J.value=z:Z.set($,z),z}function H($,Z,z,X){if(z==="a"&&!X)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!X:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return z==="m"?X:z==="a"?X.call($):X?X.value:Z.get($)}var v0=()=>{};var m8=function(){let{crypto:$}=globalThis;if($?.randomUUID)return m8=$.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,(X)=>(+X^z()&15>>+X/4).toString(16))};function u0($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var n1=($)=>{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 P,z0,U0,z$,l$,i$,n$,s$,r$,a$,o$,t$,e$;var B0=S(()=>{P=class P extends Error{};z0=class z0 extends P{constructor($,Z,z,X,J){super(`${z0.makeMessage($,Z,z)}`);this.status=$,this.headers=X,this.requestID=X?.get("request-id"),this.error=Z,this.type=J??null}static makeMessage($,Z,z){let X=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):z;if($&&X)return`${$} ${X}`;if($)return`${$} status code (no body)`;if(X)return X;return"(no status code or body)"}static generate($,Z,z,X){if(!$||!X)return new z$({message:z,cause:n1(Z)});let J=Z,Q=J?.error?.type;if($===400)return new i$($,J,z,X,Q);if($===401)return new n$($,J,z,X,Q);if($===403)return new s$($,J,z,X,Q);if($===404)return new r$($,J,z,X,Q);if($===409)return new a$($,J,z,X,Q);if($===422)return new o$($,J,z,X,Q);if($===429)return new t$($,J,z,X,Q);if($>=500)return new e$($,J,z,X,Q);return new z0($,J,z,X,Q)}};U0=class U0 extends z0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};z$=class z$ extends z0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};l$=class l$ extends z${constructor({message:$}={}){super({message:$??"Request timed out."})}};i$=class i$ extends z0{};n$=class n$ extends z0{};s$=class s$ extends z0{};r$=class r$ extends z0{};a$=class a$ extends z0{};o$=class o$ extends z0{};t$=class t$ extends z0{};e$=class e$ extends z0{}});function y2($){if(typeof $!=="object")return{};return $??{}}function p8($){if(!$)return!0;for(let Z in $)return!1;return!0}function n7($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var cB,i7=($)=>{return cB.test($)},d8=($)=>(d8=Array.isArray,d8($)),c8,s7=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new P(`${$} must be an integer`);if(Z<0)throw new P(`${$} must be a positive integer`);return Z},k2=($)=>{try{return JSON.parse($)}catch(Z){return}};var A$=S(()=>{B0();cB=/^[a-z][a-z0-9+.-]*:/i,c8=d8});var r7=($)=>new Promise((Z)=>setTimeout(Z,$));var X$="0.91.1";function pB(){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 iB(){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 X=z.exec(navigator.userAgent);if(X){let J=X[1]||0,Q=X[2]||0,Y=X[3]||0;return{browser:Z,version:`${J}.${Q}.${Y}`}}}return null}var e7=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},lB=()=>{let $=pB();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":X$,"X-Stainless-OS":o7(Deno.build.os),"X-Stainless-Arch":a7(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":X$,"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":X$,"X-Stainless-OS":o7(globalThis.process.platform??"unknown"),"X-Stainless-Arch":a7(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=iB();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":X$,"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":X$,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},a7=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},o7=($)=>{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"},t7,$z=()=>{return t7??(t7=lB())};var l8=()=>{};function Zz(){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 i8(...$){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 f2($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return i8({start(){},async pull(z){let{done:X,value:J}=await Z.next();if(X)z.close();else z.enqueue(J)},async cancel(){await Z.return?.()}})}function s1($){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 zz($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),z=Z.cancel();Z.releaseLock(),await z}var Xz=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function Jz($){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 P(`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 Qz=S(()=>{B0()});function Wz($){let Z=0;for(let J of $)Z+=J.length;let z=new Uint8Array(Z),X=0;for(let J of $)z.set(J,X),X+=J.length;return z}function r1($){let Z;return(Yz??(Z=new globalThis.TextEncoder,Yz=Z.encode.bind(Z)))($)}function n8($){let Z;return(qz??(Z=new globalThis.TextDecoder,qz=Z.decode.bind(Z)))($)}var Yz,qz;class J${constructor(){T0.set(this,void 0),M0.set(this,void 0),I(this,T0,new Uint8Array,"f"),I(this,M0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?r1($):$;I(this,T0,Wz([H(this,T0,"f"),Z]),"f");let z=[],X;while((X=rB(H(this,T0,"f"),H(this,M0,"f")))!=null){if(X.carriage&&H(this,M0,"f")==null){I(this,M0,X.index,"f");continue}if(H(this,M0,"f")!=null&&(X.index!==H(this,M0,"f")+1||X.carriage)){z.push(n8(H(this,T0,"f").subarray(0,H(this,M0,"f")-1))),I(this,T0,H(this,T0,"f").subarray(H(this,M0,"f")),"f"),I(this,M0,null,"f");continue}let J=H(this,M0,"f")!==null?X.preceding-1:X.preceding,Q=n8(H(this,T0,"f").subarray(0,J));z.push(Q),I(this,T0,H(this,T0,"f").subarray(X.index),"f"),I(this,M0,null,"f")}return z}flush(){if(!H(this,T0,"f").length)return[];return this.decode(`
|
|
166
|
-
`)}}function
|
|
167
|
-
`,"\r"]);
|
|
168
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],J}if(this.chunks.push($),$.startsWith(":"))return null;let[Z,z
|
|
169
|
-
`);
|
|
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=b2($),X=p$(Z);return X.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Z=b2($),X=p$(Z);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Z){if(this.type!=="comment")return!1;if(this.indent<=Z)return!1;return $.every((X)=>X.type==="newline"||X.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()}}}hK.Parser=d9});var s9=A((nK)=>{var p9=E8(),uK=c1(),s1=d1(),mK=v6(),cK=c(),dK=v8(),l9=u8();function i9($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new dK.LineCounter||null,prettyErrors:Z}}function pK($,Z={}){let{lineCounter:X,prettyErrors:z}=i9(Z),J=new l9.Parser(X?.addNewLine),Q=new p9.Composer(Z),Y=Array.from(Q.compose(J.parse($)));if(z&&X)for(let G of Y)G.errors.forEach(s1.prettifyError($,X)),G.warnings.forEach(s1.prettifyError($,X));if(Y.length>0)return Y;return Object.assign([],{empty:!0},Q.streamInfo())}function n9($,Z={}){let{lineCounter:X,prettyErrors:z}=i9(Z),J=new l9.Parser(X?.addNewLine),Q=new p9.Composer(Z),Y=null;for(let G of Q.compose(J.parse($),!0,$.length))if(!Y)Y=G;else if(Y.options.logLevel!=="silent"){Y.errors.push(new s1.YAMLParseError(G.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&X)Y.errors.forEach(s1.prettifyError($,X)),Y.warnings.forEach(s1.prettifyError($,X));return Y}function lK($,Z,X){let z=void 0;if(typeof Z==="function")z=Z;else if(X===void 0&&Z&&typeof Z==="object")X=Z;let J=n9($,X);if(!J)return null;if(J.warnings.forEach((Q)=>mK.warn(J.options.logLevel,Q)),J.errors.length>0)if(J.options.logLevel!=="silent")throw J.errors[0];else J.errors=[];return J.toJS(Object.assign({reviver:z},X))}function iK($,Z,X){let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(X===void 0&&Z)X=Z;if(typeof X==="string")X=X.length;if(typeof X==="number"){let J=Math.round(X);X=J<1?void 0:J>8?{indent:8}:{indent:J}}if($===void 0){let{keepUndefined:J}=X??Z??{};if(!J)return}if(cK.isDocument($)&&!z)return $.toString(X);return new uK.Document($,z,X).toString(X)}nK.parse=lK;nK.parseAllDocuments=pK;nK.parseDocument=n9;nK.stringify=iK});var e9={};RZ(e9,{orange:()=>V0,italic:()=>gH,fafCyanDeep:()=>k2,fafCyan:()=>D,dim:()=>L,bold:()=>w,FAF_HEX:()=>r1});var d8=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,w,L,gH,r1,D=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,k2=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,V0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var d=S(()=>{w=d8("1"),L=d8("2"),gH=d8("3"),r1={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var $3=A((nA,mL)=>{mL.exports={name:"faf-cli",version:"6.9.0",description:"Persistent AI Context Standard — project DNA for AI. IANA-registered. Anthropic-approved.",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"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",build:"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 && 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)",prepublishOnly:"bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","bi-sync","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational"],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.1","faf-scoring-kernel":"^2.0.3",open:"^11.0.0",yaml:"^2.4.1"},optionalDependencies:{"@anthropic-ai/sdk":"^0.91.1"},devDependencies:{"@faf/specification":"github:Wolfe-Jam/faf",ajv:"^8.17.1","@types/node":"^22.15.0","@typescript-eslint/eslint-plugin":"^8.41.0","@typescript-eslint/parser":"^8.41.0",eslint:"^9.39.2",prettier:"^3.2.5",typescript:"^5.3.3","typescript-eslint":"^8.59.1"},engines:{node:">=18.0.0"},publishConfig:{access:"public"}}});function R($,Z,X,z,J){if(z==="m")throw TypeError("Private method is not writable");if(z==="a"&&!J)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!J:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return z==="a"?J.call($,X):J?J.value=X:Z.set($,X),X}function H($,Z,X,z){if(X==="a"&&!z)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!z:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return X==="m"?z:X==="a"?z.call($):z?z.value:Z.get($)}var c0=()=>{};var z3=function(){let{crypto:$}=globalThis;if($?.randomUUID)return z3=$.randomUUID.bind($),$.randomUUID();let Z=new Uint8Array(1),X=$?()=>$.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(z)=>(+z^X()&15>>+z/4).toString(16))};function d0($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var Z4=($)=>{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 _,z0,q0,Y$,$1,Z1,X1,z1,J1,Q1,Y1,G1,U1;var N0=S(()=>{_=class _ extends Error{};z0=class z0 extends _{constructor($,Z,X,z,J){super(`${z0.makeMessage($,Z,X)}`);this.status=$,this.headers=z,this.requestID=z?.get("request-id"),this.error=Z,this.type=J??null}static makeMessage($,Z,X){let z=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):X;if($&&z)return`${$} ${z}`;if($)return`${$} status code (no body)`;if(z)return z;return"(no status code or body)"}static generate($,Z,X,z){if(!$||!z)return new Y$({message:X,cause:Z4(Z)});let J=Z,Q=J?.error?.type;if($===400)return new Z1($,J,X,z,Q);if($===401)return new X1($,J,X,z,Q);if($===403)return new z1($,J,X,z,Q);if($===404)return new J1($,J,X,z,Q);if($===409)return new Q1($,J,X,z,Q);if($===422)return new Y1($,J,X,z,Q);if($===429)return new G1($,J,X,z,Q);if($>=500)return new U1($,J,X,z,Q);return new z0($,J,X,z,Q)}};q0=class q0 extends z0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};Y$=class Y$ extends z0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};$1=class $1 extends Y${constructor({message:$}={}){super({message:$??"Request timed out."})}};Z1=class Z1 extends z0{};X1=class X1 extends z0{};z1=class z1 extends z0{};J1=class J1 extends z0{};Q1=class Q1 extends z0{};Y1=class Y1 extends z0{};G1=class G1 extends z0{};U1=class U1 extends z0{}});function n2($){if(typeof $!=="object")return{};return $??{}}function Y3($){if(!$)return!0;for(let Z in $)return!1;return!0}function wX($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var TN,FX=($)=>{return TN.test($)},J3=($)=>(J3=Array.isArray,J3($)),Q3,PX=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new _(`${$} must be an integer`);if(Z<0)throw new _(`${$} must be a positive integer`);return Z},s2=($)=>{try{return JSON.parse($)}catch(Z){return}};var P$=S(()=>{N0();TN=/^[a-z][a-z0-9+.-]*:/i,Q3=J3});var _X=($)=>new Promise((Z)=>setTimeout(Z,$));var G$="0.91.1";function ON(){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 IN(){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:X}of $){let z=X.exec(navigator.userAgent);if(z){let J=z[1]||0,Q=z[2]||0,Y=z[3]||0;return{browser:Z,version:`${J}.${Q}.${Y}`}}}return null}var SX=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},DN=()=>{let $=ON();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":G$,"X-Stainless-OS":EX(Deno.build.os),"X-Stainless-Arch":CX(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":G$,"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":G$,"X-Stainless-OS":EX(globalThis.process.platform??"unknown"),"X-Stainless-Arch":CX(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=IN();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":G$,"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":G$,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},CX=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},EX=($)=>{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"},jX,bX=()=>{return jX??(jX=DN())};var G3=()=>{};function xX(){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 U3(...$){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 r2($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return U3({start(){},async pull(X){let{done:z,value:J}=await Z.next();if(z)X.close();else X.enqueue(J)},async cancel(){await Z.return?.()}})}function X4($){if($[Symbol.asyncIterator])return $;let Z=$.getReader();return{async next(){try{let X=await Z.read();if(X?.done)Z.releaseLock();return X}catch(X){throw Z.releaseLock(),X}},async return(){let X=Z.cancel();return Z.releaseLock(),await X,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function kX($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),X=Z.cancel();Z.releaseLock(),await X}var yX=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function fX($){return Object.entries($).filter(([Z,X])=>typeof X<"u").map(([Z,X])=>{if(typeof X==="string"||typeof X==="number"||typeof X==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent(X)}`;if(X===null)return`${encodeURIComponent(Z)}=`;throw new _(`Cannot stringify type ${typeof X}; 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 gX=S(()=>{N0()});function uX($){let Z=0;for(let J of $)Z+=J.length;let X=new Uint8Array(Z),z=0;for(let J of $)X.set(J,z),z+=J.length;return X}function z4($){let Z;return(hX??(Z=new globalThis.TextEncoder,hX=Z.encode.bind(Z)))($)}function W3($){let Z;return(vX??(Z=new globalThis.TextDecoder,vX=Z.decode.bind(Z)))($)}var hX,vX;class U${constructor(){O0.set(this,void 0),D0.set(this,void 0),R(this,O0,new Uint8Array,"f"),R(this,D0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?z4($):$;R(this,O0,uX([H(this,O0,"f"),Z]),"f");let X=[],z;while((z=FN(H(this,O0,"f"),H(this,D0,"f")))!=null){if(z.carriage&&H(this,D0,"f")==null){R(this,D0,z.index,"f");continue}if(H(this,D0,"f")!=null&&(z.index!==H(this,D0,"f")+1||z.carriage)){X.push(W3(H(this,O0,"f").subarray(0,H(this,D0,"f")-1))),R(this,O0,H(this,O0,"f").subarray(H(this,D0,"f")),"f"),R(this,D0,null,"f");continue}let J=H(this,D0,"f")!==null?z.preceding-1:z.preceding,Q=W3(H(this,O0,"f").subarray(0,J));X.push(Q),R(this,O0,H(this,O0,"f").subarray(z.index),"f"),R(this,D0,null,"f")}return X}flush(){if(!H(this,O0,"f").length)return[];return this.decode(`
|
|
166
|
+
`)}}function FN($,Z){for(let J=Z??0;J<$.length;J++){if($[J]===10)return{preceding:J,index:J+1,carriage:!1};if($[J]===13)return{preceding:J,index:J+1,carriage:!0}}return null}function mX($){for(let z=0;z<$.length-1;z++){if($[z]===10&&$[z+1]===10)return z+2;if($[z]===13&&$[z+1]===13)return z+2;if($[z]===13&&$[z+1]===10&&z+3<$.length&&$[z+2]===13&&$[z+3]===10)return z+4}return-1}var O0,D0;var q3=S(()=>{c0();O0=new WeakMap,D0=new WeakMap;U$.NEWLINE_CHARS=new Set([`
|
|
167
|
+
`,"\r"]);U$.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function J4(){}function a2($,Z,X){if(!Z||o2[$]>o2[X])return J4;else return Z[$].bind(Z)}function U0($){let Z=$.logger,X=$.logLevel??"off";if(!Z)return wN;let z=cX.get(Z);if(z&&z[0]===X)return z[1];let J={error:a2("error",Z,X),warn:a2("warn",Z,X),info:a2("info",Z,X),debug:a2("debug",Z,X)};return cX.set(Z,[X,J]),J}var o2,V3=($,Z,X)=>{if(!$)return;if(wX(o2,$))return $;U0(X).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(o2))}`);return},wN,cX,p0=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([Z,X])=>[Z,Z.toLowerCase()==="x-api-key"||Z.toLowerCase()==="authorization"||Z.toLowerCase()==="cookie"||Z.toLowerCase()==="set-cookie"?"***":X]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var t2=S(()=>{P$();o2={off:0,error:200,warn:300,info:400,debug:500};wN={error:J4,warn:J4,info:J4,debug:J4},cX=new WeakMap});async function*PN($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new _("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 _("Attempted to iterate over a response with no body")}let X=new dX,z=new U$,J=X4($.body);for await(let Q of _N(J))for(let Y of z.decode(Q)){let G=X.decode(Y);if(G)yield G}for(let Q of z.flush()){let Y=X.decode(Q);if(Y)yield Y}}async function*_N($){let Z=new Uint8Array;for await(let X of $){if(X==null)continue;let z=X instanceof ArrayBuffer?new Uint8Array(X):typeof X==="string"?z4(X):X,J=new Uint8Array(Z.length+z.length);J.set(Z),J.set(z,Z.length),Z=J;let Q;while((Q=mX(Z))!==-1)yield Z.slice(0,Q),Z=Z.slice(Q)}if(Z.length>0)yield Z}class dX{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 J={event:this.event,data:this.data.join(`
|
|
168
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],J}if(this.chunks.push($),$.startsWith(":"))return null;let[Z,X,z]=CN($,":");if(z.startsWith(" "))z=z.substring(1);if(Z==="event")this.event=z;else if(Z==="data")this.data.push(z);return null}}function CN($,Z){let X=$.indexOf(Z);if(X!==-1)return[$.substring(0,X),Z,$.substring(X+Z.length)];return[$,"",""]}var Q4,I0;var K3=S(()=>{c0();N0();q3();P$();t2();N0();I0=class I0{constructor($,Z,X){this.iterator=$,Q4.set(this,void 0),this.controller=Z,R(this,Q4,X,"f")}static fromSSEResponse($,Z,X){let z=!1,J=X?U0(X):console;async function*Q(){if(z)throw new _("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Y=!1;try{for await(let G of PN($,Z)){if(G.event==="completion")try{yield JSON.parse(G.data)}catch(U){throw J.error("Could not parse message into JSON:",G.data),J.error("From chunk:",G.raw),U}if(G.event==="message_start"||G.event==="message_delta"||G.event==="message_stop"||G.event==="content_block_start"||G.event==="content_block_delta"||G.event==="content_block_stop"||G.event==="message"||G.event==="user.message"||G.event==="user.interrupt"||G.event==="user.tool_confirmation"||G.event==="user.custom_tool_result"||G.event==="agent.message"||G.event==="agent.thinking"||G.event==="agent.tool_use"||G.event==="agent.tool_result"||G.event==="agent.mcp_tool_use"||G.event==="agent.mcp_tool_result"||G.event==="agent.custom_tool_use"||G.event==="agent.thread_context_compacted"||G.event==="session.status_running"||G.event==="session.status_idle"||G.event==="session.status_rescheduled"||G.event==="session.status_terminated"||G.event==="session.error"||G.event==="session.deleted"||G.event==="span.model_request_start"||G.event==="span.model_request_end")try{yield JSON.parse(G.data)}catch(U){throw J.error("Could not parse message into JSON:",G.data),J.error("From chunk:",G.raw),U}if(G.event==="ping")continue;if(G.event==="error"){let U=s2(G.data)??G.data,W=U?.error?.type;throw new z0(void 0,U,void 0,$.headers,W)}}Y=!0}catch(G){if(d0(G))return;throw G}finally{if(!Y)Z.abort()}}return new I0(Q,Z,X)}static fromReadableStream($,Z,X){let z=!1;async function*J(){let Y=new U$,G=X4($);for await(let U of G)for(let W of Y.decode(U))yield W;for(let U of Y.flush())yield U}async function*Q(){if(z)throw new _("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Y=!1;try{for await(let G of J()){if(Y)continue;if(G)yield JSON.parse(G)}Y=!0}catch(G){if(d0(G))return;throw G}finally{if(!Y)Z.abort()}}return new I0(Q,Z,X)}[(Q4=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],Z=[],X=this.iterator(),z=(J)=>{return{next:()=>{if(J.length===0){let Q=X.next();$.push(Q),Z.push(Q)}return J.shift()}}};return[new I0(()=>z($),this.controller,H(this,Q4,"f")),new I0(()=>z(Z),this.controller,H(this,Q4,"f"))]}toReadableStream(){let $=this,Z;return U3({async start(){Z=$[Symbol.asyncIterator]()},async pull(X){try{let{value:z,done:J}=await Z.next();if(J)return X.close();let Q=z4(JSON.stringify(z)+`
|
|
169
|
+
`);X.enqueue(Q)}catch(z){X.error(z)}},async cancel(){await Z.return?.()}})}}});async function e2($,Z){let{response:X,requestLogID:z,retryOfRequestLogID:J,startTime:Q}=Z,Y=await(async()=>{if(Z.options.stream){if(U0($).debug("response",X.status,X.url,X.headers,X.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(X,Z.controller);return I0.fromSSEResponse(X,Z.controller)}if(X.status===204)return null;if(Z.options.__binaryResponse)return X;let U=X.headers.get("content-type")?.split(";")[0]?.trim();if(U?.includes("application/json")||U?.endsWith("+json")){if(X.headers.get("content-length")==="0")return;let K=await X.json();return H3(K,X)}return await X.text()})();return U0($).debug(`[${z}] response parsed`,p0({retryOfRequestLogID:J,url:X.url,status:X.status,body:Y,durationMs:Date.now()-Q})),Y}function H3($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var B3=S(()=>{K3();t2()});var Y4,W$;var $6=S(()=>{c0();B3();W$=class W$ extends Promise{constructor($,Z,X=e2){super((z)=>{z(null)});this.responsePromise=Z,this.parseResponse=X,Y4.set(this,void 0),R(this,Y4,$,"f")}_thenUnwrap($){return new W$(H(this,Y4,"f"),this.responsePromise,async(Z,X)=>H3($(await this.parseResponse(Z,X),X),X.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(H(this,Y4,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};Y4=new WeakMap});var Z6,L3,G4,S0,i;var t=S(()=>{c0();N0();B3();$6();P$();L3=class L3{constructor($,Z,X,z){Z6.set(this,void 0),R(this,Z6,$,"f"),this.options=z,this.response=Z,this.body=X}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new _("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await H(this,Z6,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(Z6=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};G4=class G4 extends W${constructor($,Z,X){super($,Z,async(z,J)=>new X(z,J.response,await e2(z,J),J.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};S0=class S0 extends L3{constructor($,Z,X,z){super($,Z,X,z);this.data=X.data||[],this.has_more=X.has_more||!1,this.first_id=X.first_id||null,this.last_id=X.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:{...n2(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...n2(this.options.query),after_id:$}}}};i=class i extends L3{constructor($,Z,X,z){super($,Z,X,z);this.data=X.data||[],this.next_page=X.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let $=this.next_page;if(!$)return null;return{...this.options,query:{...n2(this.options.query),page:$}}}}});function _$($,Z,X){return M3(),new File($,Z??"unknown_file",X)}function U4($,Z){let X=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?X.split(/[\\/]/).pop()||void 0:X}function jN($){let Z=typeof $==="function"?$:$.fetch,X=pX.get(Z);if(X)return X;let z=(async()=>{try{let J="Response"in Z?Z.Response:(await Z("data:,")).constructor,Q=new FormData;if(Q.toString()===await new J(Q).text())return!1;return!0}catch{return!0}})();return pX.set(Z,z),z}var M3=()=>{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`.":""))}},T3=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",W1=async($,Z,X=!0)=>{return{...$,body:await SN($.body,Z,X)}},pX,SN=async($,Z,X=!0)=>{if(!await jN(Z))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let z=new FormData;return await Promise.all(Object.entries($||{}).map(([J,Q])=>N3(z,J,Q,X))),z},bN=($)=>$ instanceof Blob&&("name"in $),N3=async($,Z,X,z)=>{if(X===void 0)return;if(X==null)throw TypeError(`Received null for "${Z}"; to pass null in FormData, you must use the string 'null'`);if(typeof X==="string"||typeof X==="number"||typeof X==="boolean")$.append(Z,String(X));else if(X instanceof Response){let J={},Q=X.headers.get("Content-Type");if(Q)J={type:Q};$.append(Z,_$([await X.blob()],U4(X,z),J))}else if(T3(X))$.append(Z,_$([await new Response(r2(X)).blob()],U4(X,z)));else if(bN(X))$.append(Z,_$([X],U4(X,z),{type:X.type}));else if(Array.isArray(X))await Promise.all(X.map((J)=>N3($,Z+"[]",J,z)));else if(typeof X==="object")await Promise.all(Object.entries(X).map(([J,Q])=>N3($,`${Z}[${J}]`,Q,z)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${X} instead`)};var q1=S(()=>{pX=new WeakMap});async function W4($,Z,X){if(M3(),$=await $,Z||(Z=U4($,!0)),xN($)){if($ instanceof File&&Z==null&&X==null)return $;return _$([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...X})}if(kN($)){let J=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),_$(await O3(J),Z,X)}let z=await O3($);if(!X?.type){let J=z.find((Q)=>typeof Q==="object"&&("type"in Q)&&Q.type);if(typeof J==="string")X={...X,type:J}}return _$(z,Z,X)}async function O3($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(lX($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(T3($))for await(let X of $)Z.push(...await O3(X));else{let X=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${X?`; constructor: ${X}`:""}${yN($)}`)}return Z}function yN($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((X)=>`"${X}"`).join(", ")}]`}var lX=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",xN=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&lX($),kN=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var iX=S(()=>{q1();q1()});var D3=S(()=>{iX()});var nX=()=>{};class f{constructor($){this._client=$}}function*gN($){if(!$)return;if(sX in $){let{values:z,nulls:J}=$;yield*z.entries();for(let Q of J)yield[Q,null];return}let Z=!1,X;if($ instanceof Headers)X=$.entries();else if(Q3($))X=$;else Z=!0,X=Object.entries($??{});for(let z of X){let J=z[0];if(typeof J!=="string")throw TypeError("expected header name to be a string");let Q=Q3(z[1])?z[1]:[z[1]],Y=!1;for(let G of Q){if(G===void 0)continue;if(Z&&!Y)Y=!0,yield[J,null];yield[J,G]}}}var sX,M=($)=>{let Z=new Headers,X=new Set;for(let z of $){let J=new Set;for(let[Q,Y]of gN(z)){let G=Q.toLowerCase();if(!J.has(G))Z.delete(Q),J.add(G);if(Y===null)Z.delete(Q),X.add(G);else Z.append(Q,Y),X.delete(G)}}return{[sX]:!0,values:Z,nulls:X}};var s=S(()=>{P$();sX=Symbol.for("brand.privateNullableHeaders")});function aX($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var rX,hN=($=aX)=>function(X,...z){if(X.length===1)return X[0];let J=!1,Q=[],Y=X.reduce((q,V,K)=>{if(/[?#]/.test(V))J=!0;let N=z[K],O=(J?encodeURIComponent:$)(""+N);if(K!==z.length&&(N==null||typeof N==="object"&&N.toString===Object.getPrototypeOf(Object.getPrototypeOf(N.hasOwnProperty??rX)??rX)?.toString))O=N+"",Q.push({start:q.length+V.length,length:O.length,error:`Value of type ${Object.prototype.toString.call(N).slice(8,-1)} is not a valid path parameter`});return q+V+(K===z.length?"":O)},""),G=Y.split(/[?#]/,1)[0],U=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,W;while((W=U.exec(G))!==null)Q.push({start:W.index,length:W[0].length,error:`Value "${W[0]}" can't be safely passed as a path parameter`});if(Q.sort((q,V)=>q.start-V.start),Q.length>0){let q=0,V=Q.reduce((K,N)=>{let O=" ".repeat(N.start-q),B="^".repeat(N.length);return q=N.start+N.length,K+O+B},"");throw new _(`Path parameters result in path with invalid segments:
|
|
170
170
|
${Q.map((K)=>K.error).join(`
|
|
171
171
|
`)}
|
|
172
172
|
${Y}
|
|
173
|
-
${V}`)}return Y},D;var X0=S(()=>{B0();Tz=Object.freeze(Object.create(null)),D=GL(Mz)});var z4;var Q3=S(()=>{t();s();X0();z4=class z4 extends f{create($,Z){let{betas:z,...X}=$;return this._client.post("/v1/environments?beta=true",{body:X,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:X}=Z??{};return this._client.get(D`/v1/environments/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:X,...J}=Z;return this._client.post(D`/v1/environments/${$}?beta=true`,{body:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...X}=$??{};return this._client.getAPIList("/v1/environments?beta=true",l,{query:X,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:X}=Z??{};return this._client.delete(D`/v1/environments/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:X}=Z??{};return this._client.post(D`/v1/environments/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});function c2($){return typeof $==="object"&&$!==null&&X4 in $}function Y3($,Z){let z=new Set;if($){for(let X of $)if(c2(X))z.add(X[X4])}if(Z)for(let X of Z){if(c2(X))z.add(X[X4]);if(Array.isArray(X.content)){for(let J of X.content)if(c2(J))z.add(J[X4])}}return Array.from(z)}function p2($,Z){let z=Y3($,Z);if(z.length===0)return{};return{"x-stainless-helper":z.join(", ")}}function Oz($){if(c2($))return{"x-stainless-helper":$[X4]};return{}}var X4;var J4=S(()=>{X4=Symbol("anthropic.sdk.stainlessHelper")});var Q4;var q3=S(()=>{t();s();J4();Z1();X0();Q4=class Q4 extends f{list($={},Z){let{betas:z,...X}=$??{};return this._client.getAPIList("/v1/files?beta=true",S0,{query:X,...Z,headers:T([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:X}=Z??{};return this._client.delete(D`/v1/files/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},z?.headers])})}download($,Z={},z){let{betas:X}=Z??{};return this._client.get(D`/v1/files/${$}/content?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},z?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},z){let{betas:X}=Z??{};return this._client.get(D`/v1/files/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},z?.headers])})}upload($,Z){let{betas:z,...X}=$;return this._client.post("/v1/files?beta=true",$1({body:X,...Z,headers:T([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},Oz(X.file),Z?.headers])},this._client))}}});var Y4;var W3=S(()=>{t();s();X0();Y4=class Y4 extends f{retrieve($,Z={},z){let{betas:X}=Z??{};return this._client.get(D`/v1/models/${$}?beta=true`,{...z,headers:T([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...X}=$??{};return this._client.getAPIList("/v1/models?beta=true",S0,{query:X,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var q4;var G3=S(()=>{t();s();X0();q4=class q4 extends f{create($,Z){let{betas:z,...X}=$;return this._client.post("/v1/user_profiles?beta=true",{body:X,...Z,headers:T([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:X}=Z??{};return this._client.get(D`/v1/user_profiles/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}update($,Z,z){let{betas:X,...J}=Z;return this._client.post(D`/v1/user_profiles/${$}?beta=true`,{body:J,...z,headers:T([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...X}=$??{};return this._client.getAPIList("/v1/user_profiles?beta=true",l,{query:X,...Z,headers:T([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},z){let{betas:X}=Z??{};return this._client.post(D`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}}});var W4;var U3=S(()=>{t();s();X0();W4=class W4 extends f{list($,Z={},z){let{betas:X,...J}=Z??{};return this._client.getAPIList(D`/v1/agents/${$}/versions?beta=true`,l,{query:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var z1;var V3=S(()=>{U3();U3();t();s();X0();z1=class z1 extends f{constructor(){super(...arguments);this.versions=new W4(this._client)}create($,Z){let{betas:z,...X}=$;return this._client.post("/v1/agents?beta=true",{body:X,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:X,...J}=Z??{};return this._client.get(D`/v1/agents/${$}?beta=true`,{query:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:X,...J}=Z;return this._client.post(D`/v1/agents/${$}?beta=true`,{body:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...X}=$??{};return this._client.getAPIList("/v1/agents?beta=true",l,{query:X,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},z){let{betas:X}=Z??{};return this._client.post(D`/v1/agents/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};z1.Versions=W4});var G4;var K3=S(()=>{t();s();X0();G4=class G4 extends f{create($,Z,z){let{view:X,betas:J,...Q}=Z;return this._client.post(D`/v1/memory_stores/${$}/memories?beta=true`,{query:{view:X},body:Q,...z,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{memory_store_id:X,betas:J,...Q}=Z;return this._client.get(D`/v1/memory_stores/${X}/memories/${$}?beta=true`,{query:Q,...z,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{memory_store_id:X,view:J,betas:Q,...Y}=Z;return this._client.post(D`/v1/memory_stores/${X}/memories/${$}?beta=true`,{query:{view:J},body:Y,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:X,...J}=Z??{};return this._client.getAPIList(D`/v1/memory_stores/${$}/memories?beta=true`,l,{query:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{memory_store_id:X,expected_content_sha256:J,betas:Q}=Z;return this._client.delete(D`/v1/memory_stores/${X}/memories/${$}?beta=true`,{query:{expected_content_sha256:J},...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var U4;var H3=S(()=>{t();s();X0();U4=class U4 extends f{retrieve($,Z,z){let{memory_store_id:X,betas:J,...Q}=Z;return this._client.get(D`/v1/memory_stores/${X}/memory_versions/${$}?beta=true`,{query:Q,...z,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:X,...J}=Z??{};return this._client.getAPIList(D`/v1/memory_stores/${$}/memory_versions?beta=true`,l,{query:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}redact($,Z,z){let{memory_store_id:X,betas:J}=Z;return this._client.post(D`/v1/memory_stores/${X}/memory_versions/${$}/redact?beta=true`,{...z,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var w$;var B3=S(()=>{K3();K3();H3();H3();t();s();X0();w$=class w$ extends f{constructor(){super(...arguments);this.memories=new G4(this._client),this.memoryVersions=new U4(this._client)}create($,Z){let{betas:z,...X}=$;return this._client.post("/v1/memory_stores?beta=true",{body:X,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:X}=Z??{};return this._client.get(D`/v1/memory_stores/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:X,...J}=Z;return this._client.post(D`/v1/memory_stores/${$}?beta=true`,{body:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...X}=$??{};return this._client.getAPIList("/v1/memory_stores?beta=true",l,{query:X,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:X}=Z??{};return this._client.delete(D`/v1/memory_stores/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:X}=Z??{};return this._client.post(D`/v1/memory_stores/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};w$.Memories=G4;w$.MemoryVersions=U4});var X1=S(()=>{B0()});var l2;var L3=S(()=>{l2={"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 Dz($){return $?.output_format??$?.output_config?.format}function N3($,Z,z){let X=Dz(Z);if(!Z||!("parse"in(X??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text"){let Q=Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(Q,"parsed",{get(){return z.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return J}),parsed_output:null};return T3($,Z,z)}function T3($,Z,z){let X=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=OL(Z,Q.text);if(X===null)X=Y;let q=Object.defineProperty({...Q},"parsed_output",{value:Y,enumerable:!1});return Object.defineProperty(q,"parsed",{get(){return z.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),Y},enumerable:!1})}return Q});return{...$,content:J,parsed_output:X}}function OL($,Z){let z=Dz($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(X){throw new P(`Failed to parse structured output: ${X}`)}}var M3=S(()=>{B0()});var DL=($)=>{let Z=0,z=[];while(Z<$.length){let X=$[Z];if(X==="\\"){Z++;continue}if(X==="{"){z.push({type:"brace",value:"{"}),Z++;continue}if(X==="}"){z.push({type:"brace",value:"}"}),Z++;continue}if(X==="["){z.push({type:"paren",value:"["}),Z++;continue}if(X==="]"){z.push({type:"paren",value:"]"}),Z++;continue}if(X===":"){z.push({type:"separator",value:":"}),Z++;continue}if(X===","){z.push({type:"delimiter",value:","}),Z++;continue}if(X==='"'){let q="",W=!1;X=$[++Z];while(X!=='"'){if(Z===$.length){W=!0;break}if(X==="\\"){if(Z++,Z===$.length){W=!0;break}q+=X+$[Z],X=$[++Z]}else q+=X,X=$[++Z]}if(X=$[++Z],!W)z.push({type:"string",value:q});continue}if(X&&/\s/.test(X)){Z++;continue}let Q=/[0-9]/;if(X&&Q.test(X)||X==="-"||X==="."){let q="";if(X==="-")q+=X,X=$[++Z];while(X&&Q.test(X)||X===".")q+=X,X=$[++Z];z.push({type:"number",value:q});continue}let Y=/[a-z]/i;if(X&&Y.test(X)){let q="";while(X&&Y.test(X)){if(Z===$.length)break;q+=X,X=$[++Z]}if(q=="true"||q=="false"||q==="null")z.push({type:"name",value:q});else{Z++;continue}continue}Z++}return z},J1=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),J1($);break;case"number":let z=Z.value[Z.value.length-1];if(z==="."||z==="-")return $=$.slice(0,$.length-1),J1($);case"string":let X=$[$.length-2];if(X?.type==="delimiter")return $=$.slice(0,$.length-1),J1($);else if(X?.type==="brace"&&X.value==="{")return $=$.slice(0,$.length-1),J1($);break;case"delimiter":return $=$.slice(0,$.length-1),J1($);break}return $},AL=($)=>{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 $},IL=($)=>{let Z="";return $.map((z)=>{switch(z.type){case"string":Z+='"'+z.value+'"';break;default:Z+=z.value;break}}),Z},i2=($)=>JSON.parse(IL(AL(J1(DL($)))));var O3=()=>{};var D3=S(()=>{a8()});function Fz($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function Rz($){}var F0,Y$,Q1,V4,n2,K4,H4,s2,B4,d0,L4,r2,a2,F$,o2,t2,N4,A3,Az,e2,I3,w3,F3,Iz,wz="__json_buf",T4;var Pz=S(()=>{v0();O3();X1();D3();M3();T4=class T4{constructor($,Z){F0.add(this),this.messages=[],this.receivedMessages=[],Y$.set(this,void 0),Q1.set(this,null),this.controller=new AbortController,V4.set(this,void 0),n2.set(this,()=>{}),K4.set(this,()=>{}),H4.set(this,void 0),s2.set(this,()=>{}),B4.set(this,()=>{}),d0.set(this,{}),L4.set(this,!1),r2.set(this,!1),a2.set(this,!1),F$.set(this,!1),o2.set(this,void 0),t2.set(this,void 0),N4.set(this,void 0),e2.set(this,(z)=>{if(I(this,r2,!0,"f"),u0(z))z=new U0;if(z instanceof U0)return I(this,a2,!0,"f"),this._emit("abort",z);if(z instanceof P)return this._emit("error",z);if(z instanceof Error){let X=new P(z.message);return X.cause=z,this._emit("error",X)}return this._emit("error",new P(String(z)))}),I(this,V4,new Promise((z,X)=>{I(this,n2,z,"f"),I(this,K4,X,"f")}),"f"),I(this,H4,new Promise((z,X)=>{I(this,s2,z,"f"),I(this,B4,X,"f")}),"f"),H(this,V4,"f").catch(()=>{}),H(this,H4,"f").catch(()=>{}),I(this,Q1,$,"f"),I(this,N4,Z?.logger??console,"f")}get response(){return H(this,o2,"f")}get request_id(){return H(this,t2,"f")}async withResponse(){I(this,F$,!0,"f");let $=await H(this,V4,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new T4(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:X}={}){let J=new T4(Z,{logger:X});for(let Q of Z.messages)J._addMessageParam(Q);return I(J,Q1,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...z,headers:{...z?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},H(this,e2,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,z){let X=z?.signal,J;if(X){if(X.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),X.addEventListener("abort",J)}try{H(this,F0,"m",I3).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let q of Y)H(this,F0,"m",w3).call(this,q);if(Y.controller.signal?.aborted)throw new U0;H(this,F0,"m",F3).call(this)}finally{if(X&&J)X.removeEventListener("abort",J)}}_connected($){if(this.ended)return;I(this,o2,$,"f"),I(this,t2,$?.headers.get("request-id"),"f"),H(this,n2,"f").call(this,$),this._emit("connect")}get ended(){return H(this,L4,"f")}get errored(){return H(this,r2,"f")}get aborted(){return H(this,a2,"f")}abort(){this.controller.abort()}on($,Z){return(H(this,d0,"f")[$]||(H(this,d0,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=H(this,d0,"f")[$];if(!z)return this;let X=z.findIndex((J)=>J.listener===Z);if(X>=0)z.splice(X,1);return this}once($,Z){return(H(this,d0,"f")[$]||(H(this,d0,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(I(this,F$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){I(this,F$,!0,"f"),await H(this,H4,"f")}get currentMessage(){return H(this,Y$,"f")}async finalMessage(){return await this.done(),H(this,F0,"m",A3).call(this)}async finalText(){return await this.done(),H(this,F0,"m",Az).call(this)}_emit($,...Z){if(H(this,L4,"f"))return;if($==="end")I(this,L4,!0,"f"),H(this,s2,"f").call(this);let z=H(this,d0,"f")[$];if(z)H(this,d0,"f")[$]=z.filter((X)=>!X.once),z.forEach(({listener:X})=>X(...Z));if($==="abort"){let X=Z[0];if(!H(this,F$,"f")&&!z?.length)Promise.reject(X);H(this,K4,"f").call(this,X),H(this,B4,"f").call(this,X),this._emit("end");return}if($==="error"){let X=Z[0];if(!H(this,F$,"f")&&!z?.length)Promise.reject(X);H(this,K4,"f").call(this,X),H(this,B4,"f").call(this,X),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",H(this,F0,"m",A3).call(this))}async _fromReadableStream($,Z){let z=Z?.signal,X;if(z){if(z.aborted)this.controller.abort();X=this.controller.abort.bind(this.controller),z.addEventListener("abort",X)}try{H(this,F0,"m",I3).call(this),this._connected(null);let J=O0.fromReadableStream($,this.controller);for await(let Q of J)H(this,F0,"m",w3).call(this,Q);if(J.controller.signal?.aborted)throw new U0;H(this,F0,"m",F3).call(this)}finally{if(z&&X)z.removeEventListener("abort",X)}}[(Y$=new WeakMap,Q1=new WeakMap,V4=new WeakMap,n2=new WeakMap,K4=new WeakMap,H4=new WeakMap,s2=new WeakMap,B4=new WeakMap,d0=new WeakMap,L4=new WeakMap,r2=new WeakMap,a2=new WeakMap,F$=new WeakMap,o2=new WeakMap,t2=new WeakMap,N4=new WeakMap,e2=new WeakMap,F0=new WeakSet,A3=function(){if(this.receivedMessages.length===0)throw new P("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Az=function(){if(this.receivedMessages.length===0)throw new P("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 P("stream ended without producing a content block with type=text");return Z.join(" ")},I3=function(){if(this.ended)return;I(this,Y$,void 0,"f")},w3=function(Z){if(this.ended)return;let z=H(this,F0,"m",Iz).call(this,Z);switch(this._emit("streamEvent",Z,z),Z.type){case"content_block_delta":{let X=z.content.at(-1);switch(Z.delta.type){case"text_delta":{if(X.type==="text")this._emit("text",Z.delta.text,X.text||"");break}case"citations_delta":{if(X.type==="text")this._emit("citation",Z.delta.citation,X.citations??[]);break}case"input_json_delta":{if(Fz(X)&&X.input)this._emit("inputJson",Z.delta.partial_json,X.input);break}case"thinking_delta":{if(X.type==="thinking")this._emit("thinking",Z.delta.thinking,X.thinking);break}case"signature_delta":{if(X.type==="thinking")this._emit("signature",X.signature);break}case"compaction_delta":{if(X.type==="compaction"&&X.content)this._emit("compaction",X.content);break}default:Rz(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(N3(z,H(this,Q1,"f"),{logger:H(this,N4,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{I(this,Y$,z,"f");break}case"content_block_start":case"message_delta":break}},F3=function(){if(this.ended)throw new P("stream has ended, this shouldn't happen");let Z=H(this,Y$,"f");if(!Z)throw new P("request ended without sending any chunks");return I(this,Y$,void 0,"f"),N3(Z,H(this,Q1,"f"),{logger:H(this,N4,"f")})},Iz=function(Z){let z=H(this,Y$,"f");if(Z.type==="message_start"){if(z)throw new P(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new P(`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 X=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(X?.type==="text")z.content[Z.index]={...X,text:(X.text||"")+Z.delta.text};break}case"citations_delta":{if(X?.type==="text")z.content[Z.index]={...X,citations:[...X.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(X&&Fz(X)){let J=X[wz]||"";J+=Z.delta.partial_json;let Q={...X};if(Object.defineProperty(Q,wz,{value:J,enumerable:!1,writable:!0}),J)try{Q.input=i2(J)}catch(Y){let q=new P(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${J}`);H(this,e2,"f").call(this,q)}z.content[Z.index]=Q}break}case"thinking_delta":{if(X?.type==="thinking")z.content[Z.index]={...X,thinking:X.thinking+Z.delta.thinking};break}case"signature_delta":{if(X?.type==="thinking")z.content[Z.index]={...X,signature:Z.delta.signature};break}case"compaction_delta":{if(X?.type==="compaction")z.content[Z.index]={...X,content:(X.content||"")+Z.delta.content};break}default:Rz(Z.delta)}return z}case"content_block_stop":return z}},Symbol.asyncIterator)](){let $=[],Z=[],z=!1;return this.on("streamEvent",(X)=>{let J=Z.shift();if(J)J.resolve(X);else $.push(X)}),this.on("end",()=>{z=!0;for(let X of Z)X.resolve(void 0);Z.length=0}),this.on("abort",(X)=>{z=!0;for(let J of Z)J.reject(X);Z.length=0}),this.on("error",(X)=>{z=!0;for(let J of Z)J.reject(X);Z.length=0}),{next:async()=>{if(!$.length){if(z)return{value:void 0,done:!0};return new Promise((J,Q)=>Z.push({resolve:J,reject:Q})).then((J)=>J?{value:J,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 O0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var Y1;var $6=S(()=>{Y1=class Y1 extends Error{constructor($){let Z=typeof $==="string"?$:$.map((z)=>{if(z.type==="text")return z.text;return`[${z.type}]`}).join(" ");super(Z);this.name="ToolError",this.content=$}}});var _z=1e5,Ez=`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
|
+
${V}`)}return Y},I;var J0=S(()=>{N0();rX=Object.freeze(Object.create(null)),I=hN(aX)});var q4;var I3=S(()=>{t();s();J0();q4=class q4 extends f{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/environments?beta=true",{body:z,...Z,headers:M([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(I`/v1/environments/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(I`/v1/environments/${$}?beta=true`,{body:J,...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/environments?beta=true",i,{query:z,...Z,headers:M([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(I`/v1/environments/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(I`/v1/environments/${$}/archive?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});function X6($){return typeof $==="object"&&$!==null&&V4 in $}function A3($,Z){let X=new Set;if($){for(let z of $)if(X6(z))X.add(z[V4])}if(Z)for(let z of Z){if(X6(z))X.add(z[V4]);if(Array.isArray(z.content)){for(let J of z.content)if(X6(J))X.add(J[V4])}}return Array.from(X)}function z6($,Z){let X=A3($,Z);if(X.length===0)return{};return{"x-stainless-helper":X.join(", ")}}function oX($){if(X6($))return{"x-stainless-helper":$[V4]};return{}}var V4;var K4=S(()=>{V4=Symbol("anthropic.sdk.stainlessHelper")});var H4;var R3=S(()=>{t();s();K4();q1();J0();H4=class H4 extends f{list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/files?beta=true",S0,{query:z,...Z,headers:M([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(I`/v1/files/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}download($,Z={},X){let{betas:z}=Z??{};return this._client.get(I`/v1/files/${$}/content?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},X?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},X){let{betas:z}=Z??{};return this._client.get(I`/v1/files/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}upload($,Z){let{betas:X,...z}=$;return this._client.post("/v1/files?beta=true",W1({body:z,...Z,headers:M([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},oX(z.file),Z?.headers])},this._client))}}});var B4;var F3=S(()=>{t();s();J0();B4=class B4 extends f{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(I`/v1/models/${$}?beta=true`,{...X,headers:M([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/models?beta=true",S0,{query:z,...Z,headers:M([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var L4;var w3=S(()=>{t();s();J0();L4=class L4 extends f{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/user_profiles?beta=true",{body:z,...Z,headers:M([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(I`/v1/user_profiles/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(I`/v1/user_profiles/${$}?beta=true`,{body:J,...X,headers:M([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/user_profiles?beta=true",i,{query:z,...Z,headers:M([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},X){let{betas:z}=Z??{};return this._client.post(I`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}}});var N4;var P3=S(()=>{t();s();J0();N4=class N4 extends f{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(I`/v1/agents/${$}/versions?beta=true`,i,{query:J,...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var V1;var _3=S(()=>{P3();P3();t();s();J0();V1=class V1 extends f{constructor(){super(...arguments);this.versions=new N4(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/agents?beta=true",{body:z,...Z,headers:M([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z,...J}=Z??{};return this._client.get(I`/v1/agents/${$}?beta=true`,{query:J,...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(I`/v1/agents/${$}?beta=true`,{body:J,...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/agents?beta=true",i,{query:z,...Z,headers:M([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(I`/v1/agents/${$}/archive?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};V1.Versions=N4});var M4;var C3=S(()=>{t();s();J0();M4=class M4 extends f{create($,Z,X){let{view:z,betas:J,...Q}=Z;return this._client.post(I`/v1/memory_stores/${$}/memories?beta=true`,{query:{view:z},body:Q,...X,headers:M([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}retrieve($,Z,X){let{memory_store_id:z,betas:J,...Q}=Z;return this._client.get(I`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:Q,...X,headers:M([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{memory_store_id:z,view:J,betas:Q,...Y}=Z;return this._client.post(I`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:{view:J},body:Y,...X,headers:M([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(I`/v1/memory_stores/${$}/memories?beta=true`,i,{query:J,...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}delete($,Z,X){let{memory_store_id:z,expected_content_sha256:J,betas:Q}=Z;return this._client.delete(I`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:{expected_content_sha256:J},...X,headers:M([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var T4;var E3=S(()=>{t();s();J0();T4=class T4 extends f{retrieve($,Z,X){let{memory_store_id:z,betas:J,...Q}=Z;return this._client.get(I`/v1/memory_stores/${z}/memory_versions/${$}?beta=true`,{query:Q,...X,headers:M([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(I`/v1/memory_stores/${$}/memory_versions?beta=true`,i,{query:J,...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}redact($,Z,X){let{memory_store_id:z,betas:J}=Z;return this._client.post(I`/v1/memory_stores/${z}/memory_versions/${$}/redact?beta=true`,{...X,headers:M([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var C$;var j3=S(()=>{C3();C3();E3();E3();t();s();J0();C$=class C$ extends f{constructor(){super(...arguments);this.memories=new M4(this._client),this.memoryVersions=new T4(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/memory_stores?beta=true",{body:z,...Z,headers:M([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(I`/v1/memory_stores/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(I`/v1/memory_stores/${$}?beta=true`,{body:J,...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/memory_stores?beta=true",i,{query:z,...Z,headers:M([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(I`/v1/memory_stores/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(I`/v1/memory_stores/${$}/archive?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};C$.Memories=M4;C$.MemoryVersions=T4});var K1=S(()=>{N0()});var J6;var S3=S(()=>{J6={"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 tX($){return $?.output_format??$?.output_config?.format}function b3($,Z,X){let z=tX(Z);if(!Z||!("parse"in(z??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text"){let Q=Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(Q,"parsed",{get(){return X.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return J}),parsed_output:null};return x3($,Z,X)}function x3($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=sN(Z,Q.text);if(z===null)z=Y;let G=Object.defineProperty({...Q},"parsed_output",{value:Y,enumerable:!1});return Object.defineProperty(G,"parsed",{get(){return X.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),Y},enumerable:!1})}return Q});return{...$,content:J,parsed_output:z}}function sN($,Z){let X=tX($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new _(`Failed to parse structured output: ${z}`)}}var k3=S(()=>{N0()});var rN=($)=>{let Z=0,X=[];while(Z<$.length){let z=$[Z];if(z==="\\"){Z++;continue}if(z==="{"){X.push({type:"brace",value:"{"}),Z++;continue}if(z==="}"){X.push({type:"brace",value:"}"}),Z++;continue}if(z==="["){X.push({type:"paren",value:"["}),Z++;continue}if(z==="]"){X.push({type:"paren",value:"]"}),Z++;continue}if(z===":"){X.push({type:"separator",value:":"}),Z++;continue}if(z===","){X.push({type:"delimiter",value:","}),Z++;continue}if(z==='"'){let G="",U=!1;z=$[++Z];while(z!=='"'){if(Z===$.length){U=!0;break}if(z==="\\"){if(Z++,Z===$.length){U=!0;break}G+=z+$[Z],z=$[++Z]}else G+=z,z=$[++Z]}if(z=$[++Z],!U)X.push({type:"string",value:G});continue}if(z&&/\s/.test(z)){Z++;continue}let Q=/[0-9]/;if(z&&Q.test(z)||z==="-"||z==="."){let G="";if(z==="-")G+=z,z=$[++Z];while(z&&Q.test(z)||z===".")G+=z,z=$[++Z];X.push({type:"number",value:G});continue}let Y=/[a-z]/i;if(z&&Y.test(z)){let G="";while(z&&Y.test(z)){if(Z===$.length)break;G+=z,z=$[++Z]}if(G=="true"||G=="false"||G==="null")X.push({type:"name",value:G});else{Z++;continue}continue}Z++}return X},H1=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),H1($);break;case"number":let X=Z.value[Z.value.length-1];if(X==="."||X==="-")return $=$.slice(0,$.length-1),H1($);case"string":let z=$[$.length-2];if(z?.type==="delimiter")return $=$.slice(0,$.length-1),H1($);else if(z?.type==="brace"&&z.value==="{")return $=$.slice(0,$.length-1),H1($);break;case"delimiter":return $=$.slice(0,$.length-1),H1($);break}return $},aN=($)=>{let Z=[];if($.map((X)=>{if(X.type==="brace")if(X.value==="{")Z.push("}");else Z.splice(Z.lastIndexOf("}"),1);if(X.type==="paren")if(X.value==="[")Z.push("]");else Z.splice(Z.lastIndexOf("]"),1)}),Z.length>0)Z.reverse().map((X)=>{if(X==="}")$.push({type:"brace",value:"}"});else if(X==="]")$.push({type:"paren",value:"]"})});return $},oN=($)=>{let Z="";return $.map((X)=>{switch(X.type){case"string":Z+='"'+X.value+'"';break;default:Z+=X.value;break}}),Z},Q6=($)=>JSON.parse(oN(aN(H1(rN($)))));var y3=()=>{};var f3=S(()=>{K3()});function Xz($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function zz($){}var P0,q$,B1,O4,Y6,D4,I4,G6,A4,l0,R4,U6,W6,E$,q6,V6,F4,g3,eX,K6,h3,v3,u3,$z,Zz="__json_buf",w4;var Jz=S(()=>{c0();y3();K1();f3();k3();w4=class w4{constructor($,Z){P0.add(this),this.messages=[],this.receivedMessages=[],q$.set(this,void 0),B1.set(this,null),this.controller=new AbortController,O4.set(this,void 0),Y6.set(this,()=>{}),D4.set(this,()=>{}),I4.set(this,void 0),G6.set(this,()=>{}),A4.set(this,()=>{}),l0.set(this,{}),R4.set(this,!1),U6.set(this,!1),W6.set(this,!1),E$.set(this,!1),q6.set(this,void 0),V6.set(this,void 0),F4.set(this,void 0),K6.set(this,(X)=>{if(R(this,U6,!0,"f"),d0(X))X=new q0;if(X instanceof q0)return R(this,W6,!0,"f"),this._emit("abort",X);if(X instanceof _)return this._emit("error",X);if(X instanceof Error){let z=new _(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new _(String(X)))}),R(this,O4,new Promise((X,z)=>{R(this,Y6,X,"f"),R(this,D4,z,"f")}),"f"),R(this,I4,new Promise((X,z)=>{R(this,G6,X,"f"),R(this,A4,z,"f")}),"f"),H(this,O4,"f").catch(()=>{}),H(this,I4,"f").catch(()=>{}),R(this,B1,$,"f"),R(this,F4,Z?.logger??console,"f")}get response(){return H(this,q6,"f")}get request_id(){return H(this,V6,"f")}async withResponse(){R(this,E$,!0,"f");let $=await H(this,O4,"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 w4(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new w4(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return R(J,B1,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},H(this,K6,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal,J;if(z){if(z.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),z.addEventListener("abort",J)}try{H(this,P0,"m",h3).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let G of Y)H(this,P0,"m",v3).call(this,G);if(Y.controller.signal?.aborted)throw new q0;H(this,P0,"m",u3).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;R(this,q6,$,"f"),R(this,V6,$?.headers.get("request-id"),"f"),H(this,Y6,"f").call(this,$),this._emit("connect")}get ended(){return H(this,R4,"f")}get errored(){return H(this,U6,"f")}get aborted(){return H(this,W6,"f")}abort(){this.controller.abort()}on($,Z){return(H(this,l0,"f")[$]||(H(this,l0,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=H(this,l0,"f")[$];if(!X)return this;let z=X.findIndex((J)=>J.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(H(this,l0,"f")[$]||(H(this,l0,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(R(this,E$,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){R(this,E$,!0,"f"),await H(this,I4,"f")}get currentMessage(){return H(this,q$,"f")}async finalMessage(){return await this.done(),H(this,P0,"m",g3).call(this)}async finalText(){return await this.done(),H(this,P0,"m",eX).call(this)}_emit($,...Z){if(H(this,R4,"f"))return;if($==="end")R(this,R4,!0,"f"),H(this,G6,"f").call(this);let X=H(this,l0,"f")[$];if(X)H(this,l0,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!H(this,E$,"f")&&!X?.length)Promise.reject(z);H(this,D4,"f").call(this,z),H(this,A4,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!H(this,E$,"f")&&!X?.length)Promise.reject(z);H(this,D4,"f").call(this,z),H(this,A4,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",H(this,P0,"m",g3).call(this))}async _fromReadableStream($,Z){let X=Z?.signal,z;if(X){if(X.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),X.addEventListener("abort",z)}try{H(this,P0,"m",h3).call(this),this._connected(null);let J=I0.fromReadableStream($,this.controller);for await(let Q of J)H(this,P0,"m",v3).call(this,Q);if(J.controller.signal?.aborted)throw new q0;H(this,P0,"m",u3).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(q$=new WeakMap,B1=new WeakMap,O4=new WeakMap,Y6=new WeakMap,D4=new WeakMap,I4=new WeakMap,G6=new WeakMap,A4=new WeakMap,l0=new WeakMap,R4=new WeakMap,U6=new WeakMap,W6=new WeakMap,E$=new WeakMap,q6=new WeakMap,V6=new WeakMap,F4=new WeakMap,K6=new WeakMap,P0=new WeakSet,g3=function(){if(this.receivedMessages.length===0)throw new _("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},eX=function(){if(this.receivedMessages.length===0)throw new _("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new _("stream ended without producing a content block with type=text");return Z.join(" ")},h3=function(){if(this.ended)return;R(this,q$,void 0,"f")},v3=function(Z){if(this.ended)return;let X=H(this,P0,"m",$z).call(this,Z);switch(this._emit("streamEvent",Z,X),Z.type){case"content_block_delta":{let z=X.content.at(-1);switch(Z.delta.type){case"text_delta":{if(z.type==="text")this._emit("text",Z.delta.text,z.text||"");break}case"citations_delta":{if(z.type==="text")this._emit("citation",Z.delta.citation,z.citations??[]);break}case"input_json_delta":{if(Xz(z)&&z.input)this._emit("inputJson",Z.delta.partial_json,z.input);break}case"thinking_delta":{if(z.type==="thinking")this._emit("thinking",Z.delta.thinking,z.thinking);break}case"signature_delta":{if(z.type==="thinking")this._emit("signature",z.signature);break}case"compaction_delta":{if(z.type==="compaction"&&z.content)this._emit("compaction",z.content);break}default:zz(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(b3(X,H(this,B1,"f"),{logger:H(this,F4,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{R(this,q$,X,"f");break}case"content_block_start":case"message_delta":break}},u3=function(){if(this.ended)throw new _("stream has ended, this shouldn't happen");let Z=H(this,q$,"f");if(!Z)throw new _("request ended without sending any chunks");return R(this,q$,void 0,"f"),b3(Z,H(this,B1,"f"),{logger:H(this,F4,"f")})},$z=function(Z){let X=H(this,q$,"f");if(Z.type==="message_start"){if(X)throw new _(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new _(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":if(X.container=Z.delta.container,X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,X.context_management=Z.context_management,Z.usage.input_tokens!=null)X.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)X.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)X.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)X.usage.server_tool_use=Z.usage.server_tool_use;if(Z.usage.iterations!=null)X.usage.iterations=Z.usage.iterations;return X;case"content_block_start":return X.content.push(Z.content_block),X;case"content_block_delta":{let z=X.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(z?.type==="text")X.content[Z.index]={...z,text:(z.text||"")+Z.delta.text};break}case"citations_delta":{if(z?.type==="text")X.content[Z.index]={...z,citations:[...z.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(z&&Xz(z)){let J=z[Zz]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,Zz,{value:J,enumerable:!1,writable:!0}),J)try{Q.input=Q6(J)}catch(Y){let G=new _(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${J}`);H(this,K6,"f").call(this,G)}X.content[Z.index]=Q}break}case"thinking_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,thinking:z.thinking+Z.delta.thinking};break}case"signature_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,signature:Z.delta.signature};break}case"compaction_delta":{if(z?.type==="compaction")X.content[Z.index]={...z,content:(z.content||"")+Z.delta.content};break}default:zz(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let J=Z.shift();if(J)J.resolve(z);else $.push(z)}),this.on("end",()=>{X=!0;for(let z of Z)z.resolve(void 0);Z.length=0}),this.on("abort",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((J,Q)=>Z.push({resolve:J,reject:Q})).then((J)=>J?{value:J,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 I0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var L1;var H6=S(()=>{L1=class L1 extends Error{constructor($){let Z=typeof $==="string"?$:$.map((X)=>{if(X.type==="text")return X.text;return`[${X.type}]`}).join(" ");super(Z);this.name="ToolError",this.content=$}}});var Qz=1e5,Yz=`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,49 +192,67 @@ 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
|
|
196
|
-
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(RL.includes(J.model)&&J.thinking&&J.thinking.type==="enabled")console.warn(`Using Claude with ${J.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 Q=this._client._options.timeout;if(!J.stream&&Q==null){let q=l2[J.model]??void 0;Q=this._client.calculateNonstreamingTimeout(J.max_tokens,q)}let Y=p2(J.tools,J.messages);return this._client.post("/v1/messages?beta=true",{body:J,timeout:Q??600000,...Z,headers:T([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Y,Z?.headers]),stream:z.stream??!1})}parse($,Z){return Z={...Z,headers:T([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((z)=>T3(z,$,{logger:this._client.logger??console}))}stream($,Z){return T4.createMessage(this,$,Z)}countTokens($,Z){let z=bz($),{betas:X,...J}=z;return this._client.post("/v1/messages/count_tokens?beta=true",{body:J,...Z,headers:T([{"anthropic-beta":[...X??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new D4(this._client,$,Z)}};W$.Batches=A4;W$.BetaToolRunner=D4;W$.ToolError=Y1});var I4;var j3=S(()=>{t();s();X0();I4=class I4 extends f{list($,Z={},z){let{betas:X,...J}=Z??{};return this._client.getAPIList(D`/v1/sessions/${$}/events?beta=true`,l,{query:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}send($,Z,z){let{betas:X,...J}=Z;return this._client.post(D`/v1/sessions/${$}/events?beta=true`,{body:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}stream($,Z={},z){let{betas:X}=Z??{};return this._client.get(D`/v1/sessions/${$}/events/stream?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers]),stream:!0})}}});var w4;var S3=S(()=>{t();s();X0();w4=class w4 extends f{retrieve($,Z,z){let{session_id:X,betas:J}=Z;return this._client.get(D`/v1/sessions/${X}/resources/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{session_id:X,betas:J,...Q}=Z;return this._client.post(D`/v1/sessions/${X}/resources/${$}?beta=true`,{body:Q,...z,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:X,...J}=Z??{};return this._client.getAPIList(D`/v1/sessions/${$}/resources?beta=true`,l,{query:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{session_id:X,betas:J}=Z;return this._client.delete(D`/v1/sessions/${X}/resources/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}add($,Z,z){let{betas:X,...J}=Z;return this._client.post(D`/v1/sessions/${$}/resources?beta=true`,{body:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var P$;var b3=S(()=>{j3();j3();S3();S3();t();s();X0();P$=class P$ extends f{constructor(){super(...arguments);this.events=new I4(this._client),this.resources=new w4(this._client)}create($,Z){let{betas:z,...X}=$;return this._client.post("/v1/sessions?beta=true",{body:X,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:X}=Z??{};return this._client.get(D`/v1/sessions/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:X,...J}=Z;return this._client.post(D`/v1/sessions/${$}?beta=true`,{body:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...X}=$??{};return this._client.getAPIList("/v1/sessions?beta=true",l,{query:X,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:X}=Z??{};return this._client.delete(D`/v1/sessions/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:X}=Z??{};return this._client.post(D`/v1/sessions/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};P$.Events=I4;P$.Resources=w4});var F4;var x3=S(()=>{t();s();Z1();X0();F4=class F4 extends f{create($,Z={},z){let{betas:X,...J}=Z??{};return this._client.post(D`/v1/skills/${$}/versions?beta=true`,$1({body:J,...z,headers:T([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])},this._client))}retrieve($,Z,z){let{skill_id:X,betas:J}=Z;return this._client.get(D`/v1/skills/${X}/versions/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},z?.headers])})}list($,Z={},z){let{betas:X,...J}=Z??{};return this._client.getAPIList(D`/v1/skills/${$}/versions?beta=true`,l,{query:J,...z,headers:T([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}delete($,Z,z){let{skill_id:X,betas:J}=Z;return this._client.delete(D`/v1/skills/${X}/versions/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},z?.headers])})}}});var G1;var y3=S(()=>{x3();x3();t();s();Z1();X0();G1=class G1 extends f{constructor(){super(...arguments);this.versions=new F4(this._client)}create($={},Z){let{betas:z,...X}=$??{};return this._client.post("/v1/skills?beta=true",$1({body:X,...Z,headers:T([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},z){let{betas:X}=Z??{};return this._client.get(D`/v1/skills/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}list($={},Z){let{betas:z,...X}=$??{};return this._client.getAPIList("/v1/skills?beta=true",l,{query:X,...Z,headers:T([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:X}=Z??{};return this._client.delete(D`/v1/skills/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}};G1.Versions=F4});var R4;var k3=S(()=>{t();s();X0();R4=class R4 extends f{create($,Z,z){let{betas:X,...J}=Z;return this._client.post(D`/v1/vaults/${$}/credentials?beta=true`,{body:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{vault_id:X,betas:J}=Z;return this._client.get(D`/v1/vaults/${X}/credentials/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{vault_id:X,betas:J,...Q}=Z;return this._client.post(D`/v1/vaults/${X}/credentials/${$}?beta=true`,{body:Q,...z,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:X,...J}=Z??{};return this._client.getAPIList(D`/v1/vaults/${$}/credentials?beta=true`,l,{query:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{vault_id:X,betas:J}=Z;return this._client.delete(D`/v1/vaults/${X}/credentials/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z,z){let{vault_id:X,betas:J}=Z;return this._client.post(D`/v1/vaults/${X}/credentials/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var U1;var f3=S(()=>{k3();k3();t();s();X0();U1=class U1 extends f{constructor(){super(...arguments);this.credentials=new R4(this._client)}create($,Z){let{betas:z,...X}=$;return this._client.post("/v1/vaults?beta=true",{body:X,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:X}=Z??{};return this._client.get(D`/v1/vaults/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:X,...J}=Z;return this._client.post(D`/v1/vaults/${$}?beta=true`,{body:J,...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...X}=$??{};return this._client.getAPIList("/v1/vaults?beta=true",l,{query:X,...Z,headers:T([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:X}=Z??{};return this._client.delete(D`/v1/vaults/${$}?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:X}=Z??{};return this._client.post(D`/v1/vaults/${$}/archive?beta=true`,{...z,headers:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};U1.Credentials=R4});var K0;var g3=S(()=>{Q3();Q3();q3();q3();W3();W3();G3();G3();V3();V3();B3();B3();C3();C3();b3();b3();y3();y3();f3();f3();K0=class K0 extends f{constructor(){super(...arguments);this.models=new Y4(this._client),this.messages=new W$(this._client),this.agents=new z1(this._client),this.environments=new z4(this._client),this.sessions=new P$(this._client),this.vaults=new U1(this._client),this.memoryStores=new w$(this._client),this.files=new Q4(this._client),this.skills=new G1(this._client),this.userProfiles=new q4(this._client)}};K0.Models=Y4;K0.Messages=W$;K0.Agents=z1;K0.Environments=z4;K0.Sessions=P$;K0.Vaults=U1;K0.MemoryStores=w$;K0.Files=Q4;K0.Skills=G1;K0.UserProfiles=q4});var V1;var h3=S(()=>{s();V1=class V1 extends f{create($,Z){let{betas:z,...X}=$;return this._client.post("/v1/complete",{body:X,timeout:this._client._options.timeout??600000,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function xz($){return $?.output_config?.format}function v3($,Z,z){let X=xz(Z);if(!Z||!("parse"in(X??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text")return Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return J}),parsed_output:null};return u3($,Z,z)}function u3($,Z,z){let X=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=yL(Z,Q.text);if(X===null)X=Y;return Object.defineProperty({...Q},"parsed_output",{value:Y,enumerable:!1})}return Q});return{...$,content:J,parsed_output:X}}function yL($,Z){let z=xz($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(X){throw new P(`Failed to parse structured output: ${X}`)}}var m3=S(()=>{B0()});function gz($){return $.type==="tool_use"||$.type==="server_tool_use"}function hz($){}var R0,G$,K1,P4,Z6,_4,E4,z6,C4,p0,j4,X6,J6,_$,Q6,Y6,S4,d3,yz,c3,p3,l3,i3,kz,fz="__json_buf",b4;var vz=S(()=>{v0();X1();D3();O3();m3();b4=class b4{constructor($,Z){R0.add(this),this.messages=[],this.receivedMessages=[],G$.set(this,void 0),K1.set(this,null),this.controller=new AbortController,P4.set(this,void 0),Z6.set(this,()=>{}),_4.set(this,()=>{}),E4.set(this,void 0),z6.set(this,()=>{}),C4.set(this,()=>{}),p0.set(this,{}),j4.set(this,!1),X6.set(this,!1),J6.set(this,!1),_$.set(this,!1),Q6.set(this,void 0),Y6.set(this,void 0),S4.set(this,void 0),c3.set(this,(z)=>{if(I(this,X6,!0,"f"),u0(z))z=new U0;if(z instanceof U0)return I(this,J6,!0,"f"),this._emit("abort",z);if(z instanceof P)return this._emit("error",z);if(z instanceof Error){let X=new P(z.message);return X.cause=z,this._emit("error",X)}return this._emit("error",new P(String(z)))}),I(this,P4,new Promise((z,X)=>{I(this,Z6,z,"f"),I(this,_4,X,"f")}),"f"),I(this,E4,new Promise((z,X)=>{I(this,z6,z,"f"),I(this,C4,X,"f")}),"f"),H(this,P4,"f").catch(()=>{}),H(this,E4,"f").catch(()=>{}),I(this,K1,$,"f"),I(this,S4,Z?.logger??console,"f")}get response(){return H(this,Q6,"f")}get request_id(){return H(this,Y6,"f")}async withResponse(){I(this,_$,!0,"f");let $=await H(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 b4(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:X}={}){let J=new b4(Z,{logger:X});for(let Q of Z.messages)J._addMessageParam(Q);return I(J,K1,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...z,headers:{...z?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},H(this,c3,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,z){let X=z?.signal,J;if(X){if(X.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),X.addEventListener("abort",J)}try{H(this,R0,"m",p3).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let q of Y)H(this,R0,"m",l3).call(this,q);if(Y.controller.signal?.aborted)throw new U0;H(this,R0,"m",i3).call(this)}finally{if(X&&J)X.removeEventListener("abort",J)}}_connected($){if(this.ended)return;I(this,Q6,$,"f"),I(this,Y6,$?.headers.get("request-id"),"f"),H(this,Z6,"f").call(this,$),this._emit("connect")}get ended(){return H(this,j4,"f")}get errored(){return H(this,X6,"f")}get aborted(){return H(this,J6,"f")}abort(){this.controller.abort()}on($,Z){return(H(this,p0,"f")[$]||(H(this,p0,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=H(this,p0,"f")[$];if(!z)return this;let X=z.findIndex((J)=>J.listener===Z);if(X>=0)z.splice(X,1);return this}once($,Z){return(H(this,p0,"f")[$]||(H(this,p0,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(I(this,_$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){I(this,_$,!0,"f"),await H(this,E4,"f")}get currentMessage(){return H(this,G$,"f")}async finalMessage(){return await this.done(),H(this,R0,"m",d3).call(this)}async finalText(){return await this.done(),H(this,R0,"m",yz).call(this)}_emit($,...Z){if(H(this,j4,"f"))return;if($==="end")I(this,j4,!0,"f"),H(this,z6,"f").call(this);let z=H(this,p0,"f")[$];if(z)H(this,p0,"f")[$]=z.filter((X)=>!X.once),z.forEach(({listener:X})=>X(...Z));if($==="abort"){let X=Z[0];if(!H(this,_$,"f")&&!z?.length)Promise.reject(X);H(this,_4,"f").call(this,X),H(this,C4,"f").call(this,X),this._emit("end");return}if($==="error"){let X=Z[0];if(!H(this,_$,"f")&&!z?.length)Promise.reject(X);H(this,_4,"f").call(this,X),H(this,C4,"f").call(this,X),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",H(this,R0,"m",d3).call(this))}async _fromReadableStream($,Z){let z=Z?.signal,X;if(z){if(z.aborted)this.controller.abort();X=this.controller.abort.bind(this.controller),z.addEventListener("abort",X)}try{H(this,R0,"m",p3).call(this),this._connected(null);let J=O0.fromReadableStream($,this.controller);for await(let Q of J)H(this,R0,"m",l3).call(this,Q);if(J.controller.signal?.aborted)throw new U0;H(this,R0,"m",i3).call(this)}finally{if(z&&X)z.removeEventListener("abort",X)}}[(G$=new WeakMap,K1=new WeakMap,P4=new WeakMap,Z6=new WeakMap,_4=new WeakMap,E4=new WeakMap,z6=new WeakMap,C4=new WeakMap,p0=new WeakMap,j4=new WeakMap,X6=new WeakMap,J6=new WeakMap,_$=new WeakMap,Q6=new WeakMap,Y6=new WeakMap,S4=new WeakMap,c3=new WeakMap,R0=new WeakSet,d3=function(){if(this.receivedMessages.length===0)throw new P("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},yz=function(){if(this.receivedMessages.length===0)throw new P("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 P("stream ended without producing a content block with type=text");return Z.join(" ")},p3=function(){if(this.ended)return;I(this,G$,void 0,"f")},l3=function(Z){if(this.ended)return;let z=H(this,R0,"m",kz).call(this,Z);switch(this._emit("streamEvent",Z,z),Z.type){case"content_block_delta":{let X=z.content.at(-1);switch(Z.delta.type){case"text_delta":{if(X.type==="text")this._emit("text",Z.delta.text,X.text||"");break}case"citations_delta":{if(X.type==="text")this._emit("citation",Z.delta.citation,X.citations??[]);break}case"input_json_delta":{if(gz(X)&&X.input)this._emit("inputJson",Z.delta.partial_json,X.input);break}case"thinking_delta":{if(X.type==="thinking")this._emit("thinking",Z.delta.thinking,X.thinking);break}case"signature_delta":{if(X.type==="thinking")this._emit("signature",X.signature);break}default:hz(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(v3(z,H(this,K1,"f"),{logger:H(this,S4,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{I(this,G$,z,"f");break}case"content_block_start":case"message_delta":break}},i3=function(){if(this.ended)throw new P("stream has ended, this shouldn't happen");let Z=H(this,G$,"f");if(!Z)throw new P("request ended without sending any chunks");return I(this,G$,void 0,"f"),v3(Z,H(this,K1,"f"),{logger:H(this,S4,"f")})},kz=function(Z){let z=H(this,G$,"f");if(Z.type==="message_start"){if(z)throw new P(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new P(`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 X=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(X?.type==="text")z.content[Z.index]={...X,text:(X.text||"")+Z.delta.text};break}case"citations_delta":{if(X?.type==="text")z.content[Z.index]={...X,citations:[...X.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(X&&gz(X)){let J=X[fz]||"";J+=Z.delta.partial_json;let Q={...X};if(Object.defineProperty(Q,fz,{value:J,enumerable:!1,writable:!0}),J)Q.input=i2(J);z.content[Z.index]=Q}break}case"thinking_delta":{if(X?.type==="thinking")z.content[Z.index]={...X,thinking:X.thinking+Z.delta.thinking};break}case"signature_delta":{if(X?.type==="thinking")z.content[Z.index]={...X,signature:Z.delta.signature};break}default:hz(Z.delta)}return z}case"content_block_stop":return z}},Symbol.asyncIterator)](){let $=[],Z=[],z=!1;return this.on("streamEvent",(X)=>{let J=Z.shift();if(J)J.resolve(X);else $.push(X)}),this.on("end",()=>{z=!0;for(let X of Z)X.resolve(void 0);Z.length=0}),this.on("abort",(X)=>{z=!0;for(let J of Z)J.reject(X);Z.length=0}),this.on("error",(X)=>{z=!0;for(let J of Z)J.reject(X);Z.length=0}),{next:async()=>{if(!$.length){if(z)return{value:void 0,done:!0};return new Promise((J,Q)=>Z.push({resolve:J,reject:Q})).then((J)=>J?{value:J,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 O0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var x4;var n3=S(()=>{t();s();_3();X1();X0();x4=class x4 extends f{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(D`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",S0,{query:$,...Z})}delete($,Z){return this._client.delete(D`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(D`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let z=await this.retrieve($);if(!z.results_url)throw new P(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);return this._client.get(z.results_url,{...Z,headers:T([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((X,J)=>W1.fromResponse(J.response,J.controller))}}});var E$,uz,fL;var s3=S(()=>{s();J4();vz();m3();n3();n3();L3();E$=class E$ extends f{constructor(){super(...arguments);this.batches=new x4(this._client)}create($,Z){if($.model in uz)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${uz[$.model]}
|
|
197
|
-
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(
|
|
195
|
+
Wrap your summary in <summary></summary> tags.`;function Uz(){let $,Z;return{promise:new Promise((z,J)=>{$=z,Z=J}),resolve:$,reject:Z}}async function tN($,Z=$.messages.at(-1),X){if(!Z||Z.role!=="assistant"||!Z.content||typeof Z.content==="string")return null;let z=Z.content.filter((Q)=>Q.type==="tool_use");if(z.length===0)return null;return{role:"user",content:await Promise.all(z.map(async(Q)=>{let Y=$.tools.find((G)=>("name"in G?G.name:G.mcp_server_name)===Q.name);if(!Y||!("run"in Y))return{type:"tool_result",tool_use_id:Q.id,content:`Error: Tool '${Q.name}' not found`,is_error:!0};try{let G=Q.input;if("parse"in Y&&Y.parse)G=Y.parse(G);let U=await Y.run(G,{toolUseBlock:Q,signal:X?.signal});return{type:"tool_result",tool_use_id:Q.id,content:U}}catch(G){return{type:"tool_result",tool_use_id:Q.id,content:G instanceof L1?G.content:`Error: ${G instanceof Error?G.message:String(G)}`,is_error:!0}}}))}}var P4,N1,j$,G0,M0,A0,i0,V$,_4,Gz,m3,C4;var c3=S(()=>{c0();H6();N0();s();K4();C4=class C4{constructor($,Z,X){P4.add(this),this.client=$,N1.set(this,!1),j$.set(this,!1),G0.set(this,void 0),M0.set(this,void 0),A0.set(this,void 0),i0.set(this,void 0),V$.set(this,void 0),_4.set(this,0),R(this,G0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let J=["BetaToolRunner",...A3(Z.tools,Z.messages)].join(", ");if(R(this,M0,{...X,headers:M([{"x-stainless-helper":J},X?.headers])},"f"),R(this,V$,Uz(),"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*[(N1=new WeakMap,j$=new WeakMap,G0=new WeakMap,M0=new WeakMap,A0=new WeakMap,i0=new WeakMap,V$=new WeakMap,_4=new WeakMap,P4=new WeakSet,Gz=async function(){let Z=H(this,G0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let X=0;if(H(this,A0,"f")!==void 0)try{let U=await H(this,A0,"f");X=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 z=Z.contextTokenThreshold??Qz;if(X<z)return!1;let J=Z.model??H(this,G0,"f").params.model,Q=Z.summaryPrompt??Yz,Y=H(this,G0,"f").params.messages;if(Y[Y.length-1].role==="assistant"){let U=Y[Y.length-1];if(Array.isArray(U.content)){let W=U.content.filter((q)=>q.type!=="tool_use");if(W.length===0)Y.pop();else U.content=W}}let G=await this.client.beta.messages.create({model:J,messages:[...Y,{role:"user",content:[{type:"text",text:Q}]}],max_tokens:H(this,G0,"f").params.max_tokens},{signal:H(this,M0,"f").signal,headers:M([H(this,M0,"f").headers,{"x-stainless-helper":"compaction"}])});if(G.content[0]?.type!=="text")throw new _("Expected text response for compaction");return H(this,G0,"f").params.messages=[{role:"user",content:G.content}],!0},Symbol.asyncIterator)](){var $;if(H(this,N1,"f"))throw new _("Cannot iterate over a consumed stream");R(this,N1,!0,"f"),R(this,j$,!0,"f"),R(this,i0,void 0,"f");try{while(!0){let Z;try{if(H(this,G0,"f").params.max_iterations&&H(this,_4,"f")>=H(this,G0,"f").params.max_iterations)break;R(this,j$,!1,"f"),R(this,i0,void 0,"f"),R(this,_4,($=H(this,_4,"f"),$++,$),"f"),R(this,A0,void 0,"f");let{max_iterations:X,compactionControl:z,...J}=H(this,G0,"f").params;if(J.stream)Z=this.client.beta.messages.stream({...J},H(this,M0,"f")),R(this,A0,Z.finalMessage(),"f"),H(this,A0,"f").catch(()=>{}),yield Z;else R(this,A0,this.client.beta.messages.create({...J,stream:!1},H(this,M0,"f")),"f"),yield H(this,A0,"f");if(!await H(this,P4,"m",Gz).call(this)){if(!H(this,j$,"f")){let{role:G,content:U}=await H(this,A0,"f");H(this,G0,"f").params.messages.push({role:G,content:U})}let Y=await H(this,P4,"m",m3).call(this,H(this,G0,"f").params.messages.at(-1));if(Y)H(this,G0,"f").params.messages.push(Y);else if(!H(this,j$,"f"))break}}finally{if(Z)Z.abort()}}if(!H(this,A0,"f"))throw new _("ToolRunner concluded without a message from the server");H(this,V$,"f").resolve(await H(this,A0,"f"))}catch(Z){throw R(this,N1,!1,"f"),H(this,V$,"f").promise.catch(()=>{}),H(this,V$,"f").reject(Z),R(this,V$,Uz(),"f"),Z}}setMessagesParams($){if(typeof $==="function")H(this,G0,"f").params=$(H(this,G0,"f").params);else H(this,G0,"f").params=$;R(this,j$,!0,"f"),R(this,i0,void 0,"f")}setRequestOptions($){if(typeof $==="function")R(this,M0,$(H(this,M0,"f")),"f");else R(this,M0,{...H(this,M0,"f"),...$},"f")}async generateToolResponse($=H(this,M0,"f").signal){let Z=await H(this,A0,"f")??this.params.messages.at(-1);if(!Z)return null;return H(this,P4,"m",m3).call(this,Z,$)}done(){return H(this,V$,"f").promise}async runUntilDone(){if(!H(this,N1,"f"))for await(let $ of this);return this.done()}get params(){return H(this,G0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};m3=async function(Z,X=H(this,M0,"f").signal){if(H(this,i0,"f")!==void 0)return H(this,i0,"f");return R(this,i0,tN(H(this,G0,"f").params,Z,{...H(this,M0,"f"),signal:X}),"f"),H(this,i0,"f")}});var M1;var d3=S(()=>{N0();q3();M1=class M1{constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new U$;for await(let Z of this.iterator)for(let X of $.decode(Z))yield JSON.parse(X);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 _("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 _("Attempted to iterate over a response with no body")}return new M1(X4($.body),Z)}}});var E4;var p3=S(()=>{t();s();d3();K1();J0();E4=class E4 extends f{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/messages/batches?beta=true",{body:z,...Z,headers:M([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(I`/v1/messages/batches/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",S0,{query:z,...Z,headers:M([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(I`/v1/messages/batches/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}cancel($,Z={},X){let{betas:z}=Z??{};return this._client.post(I`/v1/messages/batches/${$}/cancel?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}async results($,Z={},X){let z=await this.retrieve($);if(!z.results_url)throw new _(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);let{betas:J}=Z??{};return this._client.get(z.results_url,{...X,headers:M([{"anthropic-beta":[...J??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},X?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,Y)=>M1.fromResponse(Y.response,Y.controller))}}});function qz($){if(!$.output_format)return $;if($.output_config?.format)throw new _("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...X}=$;return{...X,output_config:{...$.output_config,format:Z}}}var Wz,$M,K$;var l3=S(()=>{K1();S3();s();K4();k3();Jz();c3();H6();p3();p3();c3();H6();Wz={"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"},$M=["claude-mythos-preview","claude-opus-4-6"];K$=class K$ extends f{constructor(){super(...arguments);this.batches=new E4(this._client)}create($,Z){let X=qz($),{betas:z,...J}=X;if(J.model in Wz)console.warn(`The model '${J.model}' is deprecated and will reach end-of-life on ${Wz[J.model]}
|
|
196
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if($M.includes(J.model)&&J.thinking&&J.thinking.type==="enabled")console.warn(`Using Claude with ${J.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 Q=this._client._options.timeout;if(!J.stream&&Q==null){let G=J6[J.model]??void 0;Q=this._client.calculateNonstreamingTimeout(J.max_tokens,G)}let Y=z6(J.tools,J.messages);return this._client.post("/v1/messages?beta=true",{body:J,timeout:Q??600000,...Z,headers:M([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Y,Z?.headers]),stream:X.stream??!1})}parse($,Z){return Z={...Z,headers:M([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((X)=>x3(X,$,{logger:this._client.logger??console}))}stream($,Z){return w4.createMessage(this,$,Z)}countTokens($,Z){let X=qz($),{betas:z,...J}=X;return this._client.post("/v1/messages/count_tokens?beta=true",{body:J,...Z,headers:M([{"anthropic-beta":[...z??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new C4(this._client,$,Z)}};K$.Batches=E4;K$.BetaToolRunner=C4;K$.ToolError=L1});var j4;var i3=S(()=>{t();s();J0();j4=class j4 extends f{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(I`/v1/sessions/${$}/events?beta=true`,i,{query:J,...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}send($,Z,X){let{betas:z,...J}=Z;return this._client.post(I`/v1/sessions/${$}/events?beta=true`,{body:J,...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}stream($,Z={},X){let{betas:z}=Z??{};return this._client.get(I`/v1/sessions/${$}/events/stream?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers]),stream:!0})}}});var S4;var n3=S(()=>{t();s();J0();S4=class S4 extends f{retrieve($,Z,X){let{session_id:z,betas:J}=Z;return this._client.get(I`/v1/sessions/${z}/resources/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{session_id:z,betas:J,...Q}=Z;return this._client.post(I`/v1/sessions/${z}/resources/${$}?beta=true`,{body:Q,...X,headers:M([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(I`/v1/sessions/${$}/resources?beta=true`,i,{query:J,...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}delete($,Z,X){let{session_id:z,betas:J}=Z;return this._client.delete(I`/v1/sessions/${z}/resources/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}add($,Z,X){let{betas:z,...J}=Z;return this._client.post(I`/v1/sessions/${$}/resources?beta=true`,{body:J,...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var S$;var s3=S(()=>{i3();i3();n3();n3();t();s();J0();S$=class S$ extends f{constructor(){super(...arguments);this.events=new j4(this._client),this.resources=new S4(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/sessions?beta=true",{body:z,...Z,headers:M([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(I`/v1/sessions/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(I`/v1/sessions/${$}?beta=true`,{body:J,...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/sessions?beta=true",i,{query:z,...Z,headers:M([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(I`/v1/sessions/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(I`/v1/sessions/${$}/archive?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};S$.Events=j4;S$.Resources=S4});var b4;var r3=S(()=>{t();s();q1();J0();b4=class b4 extends f{create($,Z={},X){let{betas:z,...J}=Z??{};return this._client.post(I`/v1/skills/${$}/versions?beta=true`,W1({body:J,...X,headers:M([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])},this._client))}retrieve($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.get(I`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(I`/v1/skills/${$}/versions?beta=true`,i,{query:J,...X,headers:M([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}delete($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.delete(I`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}}});var T1;var a3=S(()=>{r3();r3();t();s();q1();J0();T1=class T1 extends f{constructor(){super(...arguments);this.versions=new b4(this._client)}create($={},Z){let{betas:X,...z}=$??{};return this._client.post("/v1/skills?beta=true",W1({body:z,...Z,headers:M([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(I`/v1/skills/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/skills?beta=true",i,{query:z,...Z,headers:M([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(I`/v1/skills/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}};T1.Versions=b4});var x4;var o3=S(()=>{t();s();J0();x4=class x4 extends f{create($,Z,X){let{betas:z,...J}=Z;return this._client.post(I`/v1/vaults/${$}/credentials?beta=true`,{body:J,...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}retrieve($,Z,X){let{vault_id:z,betas:J}=Z;return this._client.get(I`/v1/vaults/${z}/credentials/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{vault_id:z,betas:J,...Q}=Z;return this._client.post(I`/v1/vaults/${z}/credentials/${$}?beta=true`,{body:Q,...X,headers:M([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(I`/v1/vaults/${$}/credentials?beta=true`,i,{query:J,...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}delete($,Z,X){let{vault_id:z,betas:J}=Z;return this._client.delete(I`/v1/vaults/${z}/credentials/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z,X){let{vault_id:z,betas:J}=Z;return this._client.post(I`/v1/vaults/${z}/credentials/${$}/archive?beta=true`,{...X,headers:M([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var O1;var t3=S(()=>{o3();o3();t();s();J0();O1=class O1 extends f{constructor(){super(...arguments);this.credentials=new x4(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/vaults?beta=true",{body:z,...Z,headers:M([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(I`/v1/vaults/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(I`/v1/vaults/${$}?beta=true`,{body:J,...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/vaults?beta=true",i,{query:z,...Z,headers:M([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(I`/v1/vaults/${$}?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(I`/v1/vaults/${$}/archive?beta=true`,{...X,headers:M([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};O1.Credentials=x4});var B0;var e3=S(()=>{I3();I3();R3();R3();F3();F3();w3();w3();_3();_3();j3();j3();l3();l3();s3();s3();a3();a3();t3();t3();B0=class B0 extends f{constructor(){super(...arguments);this.models=new B4(this._client),this.messages=new K$(this._client),this.agents=new V1(this._client),this.environments=new q4(this._client),this.sessions=new S$(this._client),this.vaults=new O1(this._client),this.memoryStores=new C$(this._client),this.files=new H4(this._client),this.skills=new T1(this._client),this.userProfiles=new L4(this._client)}};B0.Models=B4;B0.Messages=K$;B0.Agents=V1;B0.Environments=q4;B0.Sessions=S$;B0.Vaults=O1;B0.MemoryStores=C$;B0.Files=H4;B0.Skills=T1;B0.UserProfiles=L4});var D1;var $Z=S(()=>{s();D1=class D1 extends f{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/complete",{body:z,timeout:this._client._options.timeout??600000,...Z,headers:M([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function Vz($){return $?.output_config?.format}function ZZ($,Z,X){let z=Vz(Z);if(!Z||!("parse"in(z??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text")return Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return J}),parsed_output:null};return XZ($,Z,X)}function XZ($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=WM(Z,Q.text);if(z===null)z=Y;return Object.defineProperty({...Q},"parsed_output",{value:Y,enumerable:!1})}return Q});return{...$,content:J,parsed_output:z}}function WM($,Z){let X=Vz($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new _(`Failed to parse structured output: ${z}`)}}var zZ=S(()=>{N0()});function Lz($){return $.type==="tool_use"||$.type==="server_tool_use"}function Nz($){}var _0,H$,I1,k4,B6,y4,f4,L6,g4,n0,h4,N6,M6,b$,T6,O6,v4,JZ,Kz,QZ,YZ,GZ,UZ,Hz,Bz="__json_buf",u4;var Mz=S(()=>{c0();K1();f3();y3();zZ();u4=class u4{constructor($,Z){_0.add(this),this.messages=[],this.receivedMessages=[],H$.set(this,void 0),I1.set(this,null),this.controller=new AbortController,k4.set(this,void 0),B6.set(this,()=>{}),y4.set(this,()=>{}),f4.set(this,void 0),L6.set(this,()=>{}),g4.set(this,()=>{}),n0.set(this,{}),h4.set(this,!1),N6.set(this,!1),M6.set(this,!1),b$.set(this,!1),T6.set(this,void 0),O6.set(this,void 0),v4.set(this,void 0),QZ.set(this,(X)=>{if(R(this,N6,!0,"f"),d0(X))X=new q0;if(X instanceof q0)return R(this,M6,!0,"f"),this._emit("abort",X);if(X instanceof _)return this._emit("error",X);if(X instanceof Error){let z=new _(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new _(String(X)))}),R(this,k4,new Promise((X,z)=>{R(this,B6,X,"f"),R(this,y4,z,"f")}),"f"),R(this,f4,new Promise((X,z)=>{R(this,L6,X,"f"),R(this,g4,z,"f")}),"f"),H(this,k4,"f").catch(()=>{}),H(this,f4,"f").catch(()=>{}),R(this,I1,$,"f"),R(this,v4,Z?.logger??console,"f")}get response(){return H(this,T6,"f")}get request_id(){return H(this,O6,"f")}async withResponse(){R(this,b$,!0,"f");let $=await H(this,k4,"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 u4(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new u4(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return R(J,I1,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},H(this,QZ,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal,J;if(z){if(z.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),z.addEventListener("abort",J)}try{H(this,_0,"m",YZ).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let G of Y)H(this,_0,"m",GZ).call(this,G);if(Y.controller.signal?.aborted)throw new q0;H(this,_0,"m",UZ).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;R(this,T6,$,"f"),R(this,O6,$?.headers.get("request-id"),"f"),H(this,B6,"f").call(this,$),this._emit("connect")}get ended(){return H(this,h4,"f")}get errored(){return H(this,N6,"f")}get aborted(){return H(this,M6,"f")}abort(){this.controller.abort()}on($,Z){return(H(this,n0,"f")[$]||(H(this,n0,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=H(this,n0,"f")[$];if(!X)return this;let z=X.findIndex((J)=>J.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(H(this,n0,"f")[$]||(H(this,n0,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(R(this,b$,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){R(this,b$,!0,"f"),await H(this,f4,"f")}get currentMessage(){return H(this,H$,"f")}async finalMessage(){return await this.done(),H(this,_0,"m",JZ).call(this)}async finalText(){return await this.done(),H(this,_0,"m",Kz).call(this)}_emit($,...Z){if(H(this,h4,"f"))return;if($==="end")R(this,h4,!0,"f"),H(this,L6,"f").call(this);let X=H(this,n0,"f")[$];if(X)H(this,n0,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!H(this,b$,"f")&&!X?.length)Promise.reject(z);H(this,y4,"f").call(this,z),H(this,g4,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!H(this,b$,"f")&&!X?.length)Promise.reject(z);H(this,y4,"f").call(this,z),H(this,g4,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",H(this,_0,"m",JZ).call(this))}async _fromReadableStream($,Z){let X=Z?.signal,z;if(X){if(X.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),X.addEventListener("abort",z)}try{H(this,_0,"m",YZ).call(this),this._connected(null);let J=I0.fromReadableStream($,this.controller);for await(let Q of J)H(this,_0,"m",GZ).call(this,Q);if(J.controller.signal?.aborted)throw new q0;H(this,_0,"m",UZ).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(H$=new WeakMap,I1=new WeakMap,k4=new WeakMap,B6=new WeakMap,y4=new WeakMap,f4=new WeakMap,L6=new WeakMap,g4=new WeakMap,n0=new WeakMap,h4=new WeakMap,N6=new WeakMap,M6=new WeakMap,b$=new WeakMap,T6=new WeakMap,O6=new WeakMap,v4=new WeakMap,QZ=new WeakMap,_0=new WeakSet,JZ=function(){if(this.receivedMessages.length===0)throw new _("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Kz=function(){if(this.receivedMessages.length===0)throw new _("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new _("stream ended without producing a content block with type=text");return Z.join(" ")},YZ=function(){if(this.ended)return;R(this,H$,void 0,"f")},GZ=function(Z){if(this.ended)return;let X=H(this,_0,"m",Hz).call(this,Z);switch(this._emit("streamEvent",Z,X),Z.type){case"content_block_delta":{let z=X.content.at(-1);switch(Z.delta.type){case"text_delta":{if(z.type==="text")this._emit("text",Z.delta.text,z.text||"");break}case"citations_delta":{if(z.type==="text")this._emit("citation",Z.delta.citation,z.citations??[]);break}case"input_json_delta":{if(Lz(z)&&z.input)this._emit("inputJson",Z.delta.partial_json,z.input);break}case"thinking_delta":{if(z.type==="thinking")this._emit("thinking",Z.delta.thinking,z.thinking);break}case"signature_delta":{if(z.type==="thinking")this._emit("signature",z.signature);break}default:Nz(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(ZZ(X,H(this,I1,"f"),{logger:H(this,v4,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{R(this,H$,X,"f");break}case"content_block_start":case"message_delta":break}},UZ=function(){if(this.ended)throw new _("stream has ended, this shouldn't happen");let Z=H(this,H$,"f");if(!Z)throw new _("request ended without sending any chunks");return R(this,H$,void 0,"f"),ZZ(Z,H(this,I1,"f"),{logger:H(this,v4,"f")})},Hz=function(Z){let X=H(this,H$,"f");if(Z.type==="message_start"){if(X)throw new _(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new _(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":if(X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,Z.usage.input_tokens!=null)X.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)X.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)X.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)X.usage.server_tool_use=Z.usage.server_tool_use;return X;case"content_block_start":return X.content.push({...Z.content_block}),X;case"content_block_delta":{let z=X.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(z?.type==="text")X.content[Z.index]={...z,text:(z.text||"")+Z.delta.text};break}case"citations_delta":{if(z?.type==="text")X.content[Z.index]={...z,citations:[...z.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(z&&Lz(z)){let J=z[Bz]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,Bz,{value:J,enumerable:!1,writable:!0}),J)Q.input=Q6(J);X.content[Z.index]=Q}break}case"thinking_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,thinking:z.thinking+Z.delta.thinking};break}case"signature_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,signature:Z.delta.signature};break}default:Nz(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let J=Z.shift();if(J)J.resolve(z);else $.push(z)}),this.on("end",()=>{X=!0;for(let z of Z)z.resolve(void 0);Z.length=0}),this.on("abort",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((J,Q)=>Z.push({resolve:J,reject:Q})).then((J)=>J?{value:J,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 I0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var m4;var WZ=S(()=>{t();s();d3();K1();J0();m4=class m4 extends f{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(I`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",S0,{query:$,...Z})}delete($,Z){return this._client.delete(I`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(I`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let X=await this.retrieve($);if(!X.results_url)throw new _(`No batch \`results_url\`; Has it finished processing? ${X.processing_status} - ${X.id}`);return this._client.get(X.results_url,{...Z,headers:M([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((z,J)=>M1.fromResponse(J.response,J.controller))}}});var x$,Tz,VM;var qZ=S(()=>{s();K4();Mz();zZ();WZ();WZ();S3();x$=class x$ extends f{constructor(){super(...arguments);this.batches=new m4(this._client)}create($,Z){if($.model in Tz)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${Tz[$.model]}
|
|
197
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(VM.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 X=this._client._options.timeout;if(!$.stream&&X==null){let J=J6[$.model]??void 0;X=this._client.calculateNonstreamingTimeout($.max_tokens,J)}let z=z6($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:X??600000,...Z,headers:M([z,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((X)=>XZ(X,$,{logger:this._client.logger??console}))}stream($,Z){return u4.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};Tz={"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"},VM=["claude-mythos-preview","claude-opus-4-6"];x$.Batches=m4});var A1;var VZ=S(()=>{t();s();J0();A1=class A1 extends f{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(I`/v1/models/${$}`,{...X,headers:M([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/models",S0,{query:z,...Z,headers:M([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var Oz=S(()=>{e3();$Z();qZ();VZ();nX()});var c4=($)=>{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 a{constructor({baseURL:$=c4("ANTHROPIC_BASE_URL"),apiKey:Z=c4("ANTHROPIC_API_KEY")??null,authToken:X=c4("ANTHROPIC_AUTH_TOKEN")??null,...z}={}){KZ.add(this),D6.set(this,void 0);let J={apiKey:Z,authToken:X,...z,baseURL:$||"https://api.anthropic.com"};if(!J.dangerouslyAllowBrowser&&SX())throw new _(`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=J.baseURL,this.timeout=J.timeout??o3.DEFAULT_TIMEOUT,this.logger=J.logger??console;let Q="warn";this.logLevel=Q,this.logLevel=r8(J.logLevel,"ClientOptions.logLevel",this)??r8(y4("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??Q,this.fetchOptions=J.fetchOptions,this.maxRetries=J.maxRetries??2,this.fetch=J.fetch??Zz(),I(this,q6,Xz,"f"),this._options=J,this.apiKey=typeof Z==="string"?Z:null,this.authToken=z}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders($){return T([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return T([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return T([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return Jz($)}getUserAgent(){return`${this.constructor.name}/JS ${X$}`}defaultIdempotencyKey(){return`stainless-node-retry-${m8()}`}makeStatusError($,Z,z,X){return z0.generate($,Z,z,X)}buildURL($,Z,z){let X=!H(this,a3,"m",dz).call(this)&&z||this.baseURL,J=i7($)?new URL($):new URL(X+(X.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),Q=this.defaultQuery(),Y=Object.fromEntries(J.searchParams);if(!p8(Q)||!p8(Y))Z={...Y,...Q,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))J.search=this.stringifyQuery(Z);return J.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new P("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((X)=>{return{method:$,path:Z,...X}}))}request($,Z=null){return new Q$(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,z){let X=await $,J=X.maxRetries??this.maxRetries;if(Z==null)Z=J;await this.prepareOptions(X);let{req:Q,url:Y,timeout:q}=await this.buildRequest(X,{retryCount:J-Z});await this.prepareRequest(Q,{url:Y,options:X});let W="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),G=z===void 0?"":`, retryOf: ${z}`,U=Date.now();if(q0(this).debug(`[${W}] sending request`,m0({retryOfRequestLogID:z,method:X.method,url:Y,options:X,headers:Q.headers})),X.signal?.aborted)throw new U0;let V=new AbortController,K=await this.fetchWithTimeout(Y,Q,q,V).catch(n1),L=Date.now();if(K instanceof globalThis.Error){let M=`retrying, ${Z} attempts remaining`;if(X.signal?.aborted)throw new U0;let F=u0(K)||/timed? ?out/i.test(String(K)+("cause"in K?String(K.cause):""));if(Z)return q0(this).info(`[${W}] connection ${F?"timed out":"failed"} - ${M}`),q0(this).debug(`[${W}] connection ${F?"timed out":"failed"} (${M})`,m0({retryOfRequestLogID:z,url:Y,durationMs:L-U,message:K.message})),this.retryRequest(X,Z,z??W);if(q0(this).info(`[${W}] connection ${F?"timed out":"failed"} - error; no more retries left`),q0(this).debug(`[${W}] connection ${F?"timed out":"failed"} (error; no more retries left)`,m0({retryOfRequestLogID:z,url:Y,durationMs:L-U,message:K.message})),F)throw new l$;throw new z$({cause:K})}let O=[...K.headers.entries()].filter(([M])=>M==="request-id").map(([M,F])=>", "+M+": "+JSON.stringify(F)).join(""),B=`[${W}${G}${O}] ${Q.method} ${Y} ${K.ok?"succeeded":"failed"} with status ${K.status} in ${L-U}ms`;if(!K.ok){let M=await this.shouldRetry(K);if(Z&&M){let R=`retrying, ${Z} attempts remaining`;return await zz(K.body),q0(this).info(`${B} - ${R}`),q0(this).debug(`[${W}] response error (${R})`,m0({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,durationMs:L-U})),this.retryRequest(X,Z,z??W,K.headers)}let F=M?"error; no more retries left":"error; not retryable";q0(this).info(`${B} - ${F}`);let E=await K.text().catch((R)=>n1(R).message),b=k2(E),x=b?void 0:E;throw q0(this).debug(`[${W}] response error (${F})`,m0({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,message:x,durationMs:Date.now()-U})),this.makeStatusError(K.status,b,x,K.headers)}return q0(this).info(B),q0(this).debug(`[${W}] response start`,m0({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,durationMs:L-U})),{response:K,options:X,controller:V,requestLogID:W,retryOfRequestLogID:z,startTime:U}}getAPIList($,Z,z){return this.requestAPIList(Z,z&&"then"in z?z.then((X)=>({method:"get",path:$,...X})):{method:"get",path:$,...z})}requestAPIList($,Z){let z=this.makeRequest(Z,null,void 0);return new e1(this,z,$)}async fetchWithTimeout($,Z,z,X){let{signal:J,method:Q,...Y}=Z||{},q=this._makeAbort(X);if(J)J.addEventListener("abort",q,{once:!0});let W=setTimeout(q,z),G=globalThis.ReadableStream&&Y.body instanceof globalThis.ReadableStream||typeof Y.body==="object"&&Y.body!==null&&Symbol.asyncIterator in Y.body,U={signal:X.signal,...G?{duplex:"half"}:{},method:"GET",...Y};if(Q)U.method=Q.toUpperCase();try{return await this.fetch.call(void 0,$,U)}finally{clearTimeout(W)}}async shouldRetry($){let Z=$.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,Z,z,X){let J,Q=X?.get("retry-after-ms");if(Q){let q=parseFloat(Q);if(!Number.isNaN(q))J=q}let Y=X?.get("retry-after");if(Y&&!J){let q=parseFloat(Y);if(!Number.isNaN(q))J=q*1000;else J=Date.parse(Y)-Date.now()}if(J===void 0){let q=$.maxRetries??this.maxRetries;J=this.calculateDefaultRetryTimeoutMillis(Z,q)}return await r7(J),this.makeRequest($,Z-1,z)}calculateDefaultRetryTimeoutMillis($,Z){let J=Z-$,Q=Math.min(0.5*Math.pow(2,J),8),Y=1-Math.random()*0.25;return Q*Y*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new P("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:X,path:J,query:Q,defaultBaseURL:Y}=z,q=this.buildURL(J,Q,Y);if("timeout"in z)s7("timeout",z.timeout);z.timeout=z.timeout??this.timeout;let{bodyHeaders:W,body:G}=this.buildBody({options:z}),U=await this.buildHeaders({options:$,method:X,bodyHeaders:W,retryCount:Z});return{req:{method:X,headers:U,...z.signal&&{signal:z.signal},...globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"},...G&&{body:G},...this.fetchOptions??{},...z.fetchOptions??{}},url:q,timeout:z.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:z,retryCount:X}){let J={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();J[this.idempotencyHeader]=$.idempotencyKey}let Q=T([J,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(X),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...$z(),...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(Q),Q.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let z=T([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&z.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:f2($)};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 H(this,q6,"f").call(this,{body:$,headers:z})}}var a3,o3,q6,dz,t3="\\n\\nHuman:",e3="\\n\\nAssistant:",U$;var $9=S(()=>{v0();A$();l8();Qz();B0();t();J3();mz();m2();h3();r3();g3();s3();l8();s();v2();A$();o3=a,q6=new WeakMap,a3=new WeakSet,dz=function(){return this.baseURL!=="https://api.anthropic.com"};a.Anthropic=o3;a.HUMAN_PROMPT=t3;a.AI_PROMPT=e3;a.DEFAULT_TIMEOUT=600000;a.AnthropicError=P;a.APIError=z0;a.APIConnectionError=z$;a.APIConnectionTimeoutError=l$;a.APIUserAbortError=U0;a.NotFoundError=r$;a.ConflictError=a$;a.RateLimitError=t$;a.BadRequestError=i$;a.AuthenticationError=n$;a.InternalServerError=e$;a.PermissionDeniedError=s$;a.UnprocessableEntityError=o$;a.toFile=Z4;U$=class U$ extends a{constructor(){super(...arguments);this.completions=new V1(this),this.messages=new E$(this),this.models=new H1(this),this.beta=new K0(this)}};U$.Completions=V1;U$.Messages=E$;U$.Models=H1;U$.Beta=K0});var cz={};Y9(cz,{toFile:()=>Z4,default:()=>U$,UnprocessableEntityError:()=>o$,RateLimitError:()=>t$,PermissionDeniedError:()=>s$,PagePromise:()=>e1,NotFoundError:()=>r$,InternalServerError:()=>e$,HUMAN_PROMPT:()=>t3,ConflictError:()=>a$,BaseAnthropic:()=>a,BadRequestError:()=>i$,AuthenticationError:()=>n$,AnthropicError:()=>P,Anthropic:()=>U$,APIUserAbortError:()=>U0,APIPromise:()=>Q$,APIError:()=>z0,APIConnectionTimeoutError:()=>l$,APIConnectionError:()=>z$,AI_PROMPT:()=>e3});var pz=S(()=>{$9();J3();m2();$9();t();B0()});var w9=QX(I9(),1),{program:LN,createCommand:NN,createArgument:TN,createOption:MN,CommanderError:ON,InvalidArgumentError:DN,InvalidOptionArgumentError:AN,Command:F9,Argument:IN,Option:wN,Help:FN}=w9.default;import{readFileSync as kZ,writeFileSync as nK,existsSync as xZ}from"fs";import{join as yZ,dirname as sK}from"path";var UK=L8(),VK=x1(),KK=e6(),_8=y1(),HK=M1(),e0=m(),BK=s0(),LK=$0(),NK=a0(),TK=o0(),cT=A2(),MK=F8(),OK=R8(),DK=P8(),F2=SZ(),bZ=N1();var AK=UK.Composer,IK=VK.Document,wK=KK.Schema,FK=_8.YAMLError,RK=_8.YAMLParseError,PK=_8.YAMLWarning,_K=HK.Alias,EK=e0.isAlias,CK=e0.isCollection,jK=e0.isDocument,SK=e0.isMap,bK=e0.isNode,xK=e0.isPair,yK=e0.isScalar,kK=e0.isSeq,fK=BK.Pair,gK=LK.Scalar,hK=NK.YAMLMap,vK=TK.YAMLSeq;var uK=MK.Lexer,mK=OK.LineCounter,dK=DK.Parser,u1=F2.parse,cK=F2.parseAllDocuments,pK=F2.parseDocument,E8=F2.stringify,lK=bZ.visit,iK=bZ.visitAsync;function c($){let Z=kZ($,"utf-8");return u1(Z)}function r($,Z){let z=Z._meta,X={...Z};delete X._meta;let J=E8(X,{lineWidth:0});if(z?.found&&z.found.length>0){let Q=z.found.join(" + ");J=J.replace(/^(\s+type:\s+\S+)(\s*)$/m,(Y,q,W)=>{if(W.includes("#"))return Y;return`${q} # found: ${Q}`})}nK($,J,"utf-8")}function u($){return kZ($,"utf-8")}function v($=process.cwd()){let Z=["project.faf",".faf"];for(let X of Z){let J=yZ($,X);if(xZ(J))return J}let z=sK($);if(z!==$)for(let X of Z){let J=yZ(z,X);if(xZ(J))return J}return null}p();var u$=[{name:"TROPHY",indicator:`${E0("\uD83C\uDFC6")} ${E0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${E0(k("★"))} ${E0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${w("◆")} ${w("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${R2("◇")} ${R2("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${k("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${N("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${N("○")} RED`,threshold:1},{name:"WHITE",indicator:`${N("♡")}`,threshold:0}];function P2($){return $.indicator}function j8($){for(let Z of u$)if($>=Z.threshold)return Z;return u$[u$.length-1]}var S8=null;function d1(){if(S8)return S8;try{let $=N0("faf-scoring-kernel");return S8=$,$}catch{throw Error(`faf-scoring-kernel not installed.
|
|
204
|
+
`);this.baseURL=J.baseURL,this.timeout=J.timeout??HZ.DEFAULT_TIMEOUT,this.logger=J.logger??console;let Q="warn";this.logLevel=Q,this.logLevel=V3(J.logLevel,"ClientOptions.logLevel",this)??V3(c4("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??Q,this.fetchOptions=J.fetchOptions,this.maxRetries=J.maxRetries??2,this.fetch=J.fetch??xX(),R(this,D6,yX,"f"),this._options=J,this.apiKey=typeof Z==="string"?Z:null,this.authToken=X}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 M([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return M([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return M([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return fX($)}getUserAgent(){return`${this.constructor.name}/JS ${G$}`}defaultIdempotencyKey(){return`stainless-node-retry-${z3()}`}makeStatusError($,Z,X,z){return z0.generate($,Z,X,z)}buildURL($,Z,X){let z=!H(this,KZ,"m",Dz).call(this)&&X||this.baseURL,J=FX($)?new URL($):new URL(z+(z.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),Q=this.defaultQuery(),Y=Object.fromEntries(J.searchParams);if(!Y3(Q)||!Y3(Y))Z={...Y,...Q,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))J.search=this.stringifyQuery(Z);return J.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new _("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:X}){}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,X){return this.request(Promise.resolve(X).then((z)=>{return{method:$,path:Z,...z}}))}request($,Z=null){return new W$(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,X){let z=await $,J=z.maxRetries??this.maxRetries;if(Z==null)Z=J;await this.prepareOptions(z);let{req:Q,url:Y,timeout:G}=await this.buildRequest(z,{retryCount:J-Z});await this.prepareRequest(Q,{url:Y,options:z});let U="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),W=X===void 0?"":`, retryOf: ${X}`,q=Date.now();if(U0(this).debug(`[${U}] sending request`,p0({retryOfRequestLogID:X,method:z.method,url:Y,options:z,headers:Q.headers})),z.signal?.aborted)throw new q0;let V=new AbortController,K=await this.fetchWithTimeout(Y,Q,G,V).catch(Z4),N=Date.now();if(K instanceof globalThis.Error){let T=`retrying, ${Z} attempts remaining`;if(z.signal?.aborted)throw new q0;let F=d0(K)||/timed? ?out/i.test(String(K)+("cause"in K?String(K.cause):""));if(Z)return U0(this).info(`[${U}] connection ${F?"timed out":"failed"} - ${T}`),U0(this).debug(`[${U}] connection ${F?"timed out":"failed"} (${T})`,p0({retryOfRequestLogID:X,url:Y,durationMs:N-q,message:K.message})),this.retryRequest(z,Z,X??U);if(U0(this).info(`[${U}] connection ${F?"timed out":"failed"} - error; no more retries left`),U0(this).debug(`[${U}] connection ${F?"timed out":"failed"} (error; no more retries left)`,p0({retryOfRequestLogID:X,url:Y,durationMs:N-q,message:K.message})),F)throw new $1;throw new Y$({cause:K})}let O=[...K.headers.entries()].filter(([T])=>T==="request-id").map(([T,F])=>", "+T+": "+JSON.stringify(F)).join(""),B=`[${U}${W}${O}] ${Q.method} ${Y} ${K.ok?"succeeded":"failed"} with status ${K.status} in ${N-q}ms`;if(!K.ok){let T=await this.shouldRetry(K);if(Z&&T){let y=`retrying, ${Z} attempts remaining`;return await kX(K.body),U0(this).info(`${B} - ${y}`),U0(this).debug(`[${U}] response error (${y})`,p0({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,durationMs:N-q})),this.retryRequest(z,Z,X??U,K.headers)}let F=T?"error; no more retries left":"error; not retryable";U0(this).info(`${B} - ${F}`);let j=await K.text().catch((y)=>Z4(y).message),b=s2(j),x=b?void 0:j;throw U0(this).debug(`[${U}] response error (${F})`,p0({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,message:x,durationMs:Date.now()-q})),this.makeStatusError(K.status,b,x,K.headers)}return U0(this).info(B),U0(this).debug(`[${U}] response start`,p0({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,durationMs:N-q})),{response:K,options:z,controller:V,requestLogID:U,retryOfRequestLogID:X,startTime:q}}getAPIList($,Z,X){return this.requestAPIList(Z,X&&"then"in X?X.then((z)=>({method:"get",path:$,...z})):{method:"get",path:$,...X})}requestAPIList($,Z){let X=this.makeRequest(Z,null,void 0);return new G4(this,X,$)}async fetchWithTimeout($,Z,X,z){let{signal:J,method:Q,...Y}=Z||{},G=this._makeAbort(z);if(J)J.addEventListener("abort",G,{once:!0});let U=setTimeout(G,X),W=globalThis.ReadableStream&&Y.body instanceof globalThis.ReadableStream||typeof Y.body==="object"&&Y.body!==null&&Symbol.asyncIterator in Y.body,q={signal:z.signal,...W?{duplex:"half"}:{},method:"GET",...Y};if(Q)q.method=Q.toUpperCase();try{return await this.fetch.call(void 0,$,q)}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,X,z){let J,Q=z?.get("retry-after-ms");if(Q){let G=parseFloat(Q);if(!Number.isNaN(G))J=G}let Y=z?.get("retry-after");if(Y&&!J){let G=parseFloat(Y);if(!Number.isNaN(G))J=G*1000;else J=Date.parse(Y)-Date.now()}if(J===void 0){let G=$.maxRetries??this.maxRetries;J=this.calculateDefaultRetryTimeoutMillis(Z,G)}return await _X(J),this.makeRequest($,Z-1,X)}calculateDefaultRetryTimeoutMillis($,Z){let J=Z-$,Q=Math.min(0.5*Math.pow(2,J),8),Y=1-Math.random()*0.25;return Q*Y*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new _("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 X={...$},{method:z,path:J,query:Q,defaultBaseURL:Y}=X,G=this.buildURL(J,Q,Y);if("timeout"in X)PX("timeout",X.timeout);X.timeout=X.timeout??this.timeout;let{bodyHeaders:U,body:W}=this.buildBody({options:X}),q=await this.buildHeaders({options:$,method:z,bodyHeaders:U,retryCount:Z});return{req:{method:z,headers:q,...X.signal&&{signal:X.signal},...globalThis.ReadableStream&&W instanceof globalThis.ReadableStream&&{duplex:"half"},...W&&{body:W},...this.fetchOptions??{},...X.fetchOptions??{}},url:G,timeout:X.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:X,retryCount:z}){let J={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();J[this.idempotencyHeader]=$.idempotencyKey}let Q=M([J,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(z),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...bX(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,X,$.headers]);return this.validateHeaders(Q),Q.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let X=M([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&X.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:r2($)};else if(typeof $==="object"&&X.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery($)};else return H(this,D6,"f").call(this,{body:$,headers:X})}}var KZ,HZ,D6,Dz,BZ="\\n\\nHuman:",LZ="\\n\\nAssistant:",B$;var NZ=S(()=>{c0();P$();G3();gX();N0();t();D3();Oz();$6();$Z();VZ();e3();qZ();G3();s();t2();P$();HZ=a,D6=new WeakMap,KZ=new WeakSet,Dz=function(){return this.baseURL!=="https://api.anthropic.com"};a.Anthropic=HZ;a.HUMAN_PROMPT=BZ;a.AI_PROMPT=LZ;a.DEFAULT_TIMEOUT=600000;a.AnthropicError=_;a.APIError=z0;a.APIConnectionError=Y$;a.APIConnectionTimeoutError=$1;a.APIUserAbortError=q0;a.NotFoundError=J1;a.ConflictError=Q1;a.RateLimitError=G1;a.BadRequestError=Z1;a.AuthenticationError=X1;a.InternalServerError=U1;a.PermissionDeniedError=z1;a.UnprocessableEntityError=Y1;a.toFile=W4;B$=class B$ extends a{constructor(){super(...arguments);this.completions=new D1(this),this.messages=new x$(this),this.models=new A1(this),this.beta=new B0(this)}};B$.Completions=D1;B$.Messages=x$;B$.Models=A1;B$.Beta=B0});var Iz={};RZ(Iz,{toFile:()=>W4,default:()=>B$,UnprocessableEntityError:()=>Y1,RateLimitError:()=>G1,PermissionDeniedError:()=>z1,PagePromise:()=>G4,NotFoundError:()=>J1,InternalServerError:()=>U1,HUMAN_PROMPT:()=>BZ,ConflictError:()=>Q1,BaseAnthropic:()=>a,BadRequestError:()=>Z1,AuthenticationError:()=>X1,AnthropicError:()=>_,Anthropic:()=>B$,APIUserAbortError:()=>q0,APIPromise:()=>W$,APIError:()=>z0,APIConnectionTimeoutError:()=>$1,APIConnectionError:()=>Y$,AI_PROMPT:()=>LZ});var Az=S(()=>{NZ();D3();$6();NZ();t();N0()});var uZ=nz(vZ(),1),{program:QT,createCommand:YT,createArgument:GT,createOption:UT,CommanderError:WT,InvalidArgumentError:qT,InvalidOptionArgumentError:VT,Command:mZ,Argument:KT,Option:HT,Help:BT}=uZ.default;import{readFileSync as t9,writeFileSync as yH,existsSync as a9}from"fs";import{join as o9,dirname as fH}from"path";var tK=E8(),eK=c1(),$H=H8(),m8=d1(),ZH=_1(),X$=c(),XH=o0(),zH=Z0(),JH=e0(),QH=$$(),xO=j2(),YH=h8(),GH=v8(),UH=u8(),x2=s9(),r9=w1();var WH=tK.Composer,qH=eK.Document,VH=$H.Schema,KH=m8.YAMLError,HH=m8.YAMLParseError,BH=m8.YAMLWarning,LH=ZH.Alias,NH=X$.isAlias,MH=X$.isCollection,TH=X$.isDocument,OH=X$.isMap,DH=X$.isNode,IH=X$.isPair,AH=X$.isScalar,RH=X$.isSeq,FH=XH.Pair,wH=zH.Scalar,PH=JH.YAMLMap,_H=QH.YAMLSeq;var CH=YH.Lexer,EH=GH.LineCounter,jH=UH.Parser,z$=x2.parse,SH=x2.parseAllDocuments,bH=x2.parseDocument,c8=x2.stringify,xH=r9.visit,kH=r9.visitAsync;function l($){let Z=t9($,"utf-8");return z$(Z)}function r($,Z){let X=Z._meta,z={...Z};delete z._meta;let J=c8(z,{lineWidth:0});if(X?.found&&X.found.length>0){let Q=X.found.join(" + ");J=J.replace(/^(\s+type:\s+\S+)(\s*)$/m,(Y,G,U)=>{if(U.includes("#"))return Y;return`${G} # found: ${Q}`})}yH($,J,"utf-8")}function u($){return t9($,"utf-8")}function v($=process.cwd()){let Z=["project.faf",".faf"];for(let z of Z){let J=o9($,z);if(a9(J))return J}let X=fH($);if(X!==$)for(let z of Z){let J=o9(X,z);if(a9(J))return J}return null}d();var l$=[{name:"TROPHY",indicator:`${V0("\uD83C\uDFC6")} ${V0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${V0(w("★"))} ${V0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${D("◆")} ${D("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${k2("◇")} ${k2("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${w("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${L("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${L("○")} RED`,threshold:1},{name:"WHITE",indicator:`${L("♡")}`,threshold:0}];function i$($){return $.indicator}function p8($){for(let Z of l$)if($>=Z.threshold)return Z;return l$[l$.length-1]}var l8=null;function a1(){if(l8)return l8;try{let $=T0("faf-scoring-kernel");return l8=$,$}catch{throw Error(`faf-scoring-kernel not installed.
|
|
205
205
|
|
|
206
206
|
Run: npm install faf-scoring-kernel
|
|
207
|
-
`)}}function W0($){return JSON.parse(
|
|
208
|
-
|
|
209
|
-
Run 'faf init' to create one.`),process.exit(2);let X=u(z),J=w0(X);if(Z.json){console.log(JSON.stringify(J,null,2));return}if(Z.status){console.log(`${P2(J.tier)} ${k(`${J.score}%`)}`);return}Z0(J,z,Z.verbose)}import{existsSync as KH}from"fs";import{join as $7}from"path";var G0=[{index:1,path:"project.name",description:"Project name",category:"project"},{index:2,path:"project.goal",description:"Goal (use case)",category:"project"},{index:3,path:"project.main_language",description:"Primary language",category:"project"},{index:4,path:"human_context.who",description:"Who is this for?",category:"human"},{index:5,path:"human_context.what",description:"What are they building",category:"human"},{index:6,path:"human_context.why",description:"Why does it exist",category:"human"},{index:7,path:"human_context.where",description:"Where does it run",category:"human"},{index:8,path:"human_context.when",description:"When was it started / timeline",category:"human"},{index:9,path:"human_context.how",description:"How is it built",category:"human"},{index:10,path:"stack.frontend",canonical:"stack.framework",description:"Framework (React, Svelte, etc.)",category:"frontend"},{index:11,path:"stack.css_framework",canonical:"stack.css",description:"CSS framework",category:"frontend"},{index:12,path:"stack.ui_library",description:"UI component library",category:"frontend"},{index:13,path:"stack.state_management",canonical:"stack.state",description:"State management",category:"frontend"},{index:14,path:"stack.backend",description:"Backend framework",category:"backend"},{index:15,path:"stack.api_type",canonical:"stack.api",description:"API style (REST, GraphQL, etc.)",category:"backend"},{index:16,path:"stack.runtime",description:"Runtime (Node, Bun, Python, etc.)",category:"backend"},{index:17,path:"stack.database",canonical:"stack.db",description:"Database",category:"backend"},{index:18,path:"stack.connection",description:"Connection method (Prisma, etc.)",category:"backend"},{index:19,path:"stack.hosting",description:"Hosting platform",category:"universal"},{index:20,path:"stack.build",description:"Build tool",category:"universal"},{index:21,path:"stack.cicd",description:"CI/CD",category:"universal"},{index:22,path:"stack.monorepo_tool",description:"Monorepo tool",category:"enterprise_infra"},{index:23,path:"stack.package_manager",canonical:"stack.pkg_manager",description:"Package manager",category:"enterprise_infra"},{index:24,path:"stack.workspaces",description:"Workspace configuration",category:"enterprise_infra"},{index:25,path:"monorepo.packages_count",description:"Number of packages",category:"enterprise_infra"},{index:26,path:"monorepo.build_orchestrator",description:"Build orchestration tool",category:"enterprise_infra"},{index:27,path:"stack.admin",description:"Admin panel",category:"enterprise_app"},{index:28,path:"stack.cache",description:"Caching layer",category:"enterprise_app"},{index:29,path:"stack.search",description:"Search engine",category:"enterprise_app"},{index:30,path:"stack.storage",description:"Object storage",category:"enterprise_app"},{index:31,path:"monorepo.versioning_strategy",description:"Version strategy",category:"enterprise_ops"},{index:32,path:"monorepo.shared_configs",description:"Shared configs",category:"enterprise_ops"},{index:33,path:"monorepo.remote_cache",description:"Remote build cache",category:"enterprise_ops"}],GM=new Map(G0.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),UM=new Map(G0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),VM=new Map(G0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));var KM=G0.filter(($)=>$.index<=21);var oK=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","n/a","not applicable"]);function $$($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return oK.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var m$={about:[],documentation:["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"],frontend:["project","frontend","human","universal"],website:["project","frontend","human","universal"],mobile:["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"]};import{existsSync as j,readFileSync as Z$,readdirSync as dZ}from"fs";import{join as _}from"path";var mZ=[{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:"file",pattern:"app.py"}]},{name:"FastAPI",slug:"fastapi",category:"backend",signals:[{type:"file",pattern:"main.py"}]},{name:"Rails",slug:"rails",category:"backend",signals:[{type:"file",pattern:"Gemfile"},{type:"file",pattern:"config/routes.rb"}]},{name:"Spring Boot",slug:"spring",category:"backend",signals:[{type:"file",pattern:"pom.xml"},{type:"file",pattern:"build.gradle"}]},{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"}]}];function tK($){let Z=_($,"Cargo.toml");if(!j(Z))return null;try{let X=Z$(Z,"utf-8").match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return X?X[1]:null}catch{return null}}function eK($){let Z=_($,"Cargo.toml");if(!j(Z))return!1;try{let z=Z$(Z,"utf-8");return/^\s*\[\[bin\]\]/m.test(z)}catch{return!1}}function $H($,Z){if(Z?.keywords?.some((X)=>/^sdk(?:\s|-|$)|\-sdk$/i.test(X)))return'package.json keywords contains "sdk"';if(Z?.name&&/(?:^|[-_/])sdk(?:[-_/]|$)/i.test(Z.name))return`package.json name "${Z.name}" → sdk`;let z=tK($);if(z&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(z))return`Cargo.toml name "${z}" → sdk`;return null}function ZH($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,z=_($,"pyproject.toml");if(j(z))try{let Q=Z$(z,"utf-8").match(Z);if(Q)return`pyproject.toml depends on ${Q[1]}`}catch{}let X=_($,"requirements.txt");if(j(X))try{let Q=Z$(X,"utf-8").match(Z);if(Q)return`requirements.txt contains ${Q[1]}`}catch{}return null}function zH($,Z){let z=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let X of z)if(Z.dependencies?.[X]||Z.devDependencies?.[X])return`${X} dependency`}if(j(_($,"pubspec.yaml")))return"pubspec.yaml (Flutter)";if(j(_($,"ios"))&&j(_($,"android")))return"ios/ + android/ dirs";return null}function XH($,Z){let z=_($,"Cargo.toml");if(j(z))try{let J=Z$(z,"utf-8");if(/crate-type\s*=\s*\[[^\]]*"cdylib"/.test(J))return'Cargo.toml crate-type = ["cdylib"]';if(/wasm-bindgen|wasm-pack/i.test(J))return"Cargo.toml wasm-bindgen/wasm-pack"}catch{}let X=_($,"build.zig");if(j(X))try{let J=Z$(X,"utf-8");if(/\.wasm\b|wasm32|setOutputFormat\(\.wasm/i.test(J))return"build.zig wasm target"}catch{}if(Z?.keywords?.some((J)=>/^wasm(?:-|$)|webassembly/i.test(J)))return'package.json keywords contains "wasm"';return null}function JH($,Z){if(!j(_($,"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((J)=>z[J]))return null}return"index.html (vanilla, no frontend framework)"}function QH($,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?.files&&Z.files.length>0){let z=/^(dist|src|lib|build|bin)\/|\.(js|ts|tsx|jsx|mjs|cjs|py|rs|go)$/,X=Z.files.some((Q)=>z.test(Q)),J=Z.files.some((Q)=>/\.(md|MD)|examples?\//.test(Q));if(!X&&J)return"package.json files = docs/examples only (no source)"}return null}function YH($,Z,z){let X=z.find((J)=>J.slug==="astro"||J.slug==="gatsby");if(X)return`${X.name} (static-site framework)`;if(Z?.keywords?.some((J)=>/^(website|marketing|landing|brochure|portfolio)$/i.test(J)))return'package keywords contains "website"/"marketing"/"landing"';return null}function qH($,Z){if(!Z)return null;let z={...Z.dependencies??{},...Z.devDependencies??{}},X=["@clerk/nextjs","@clerk/clerk-react","next-auth","@auth/core","auth0","@auth0/nextjs-auth0"],J=["stripe","@stripe/stripe-js","lemonsqueezy"],Q=X.some((q)=>z[q]),Y=J.some((q)=>z[q]);if(Q&&Y)return"auth + payment dependencies";return null}function WH($,Z,z){if(Z?.keywords?.some((Q)=>/mcpaas/i.test(Q)))return'package keywords contains "mcpaas"';if(Z?.name&&/mcpaas/i.test(Z.name))return`package name "${Z.name}" → mcpaas`;let X=z.some((Q)=>Q.slug==="mcp"),J=z.some((Q)=>Q.category==="database");if(X&&J&&Z?.dependencies&&Object.keys(Z.dependencies).length>10)return"MCP + database + complex deps (platform shape)";return null}function GH($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||j(_($,"pnpm-workspace.yaml"))))return null;return"private workspace + multi-package"}function M$($){let Z=_($,"package.json");if(!j(Z))return null;try{return JSON.parse(Z$(Z,"utf-8"))}catch{return null}}function UH($,Z){if(!Z.includes("*"))return j(_($,Z));let z=Z.split("/");if(z.length===1){let q=Z.split("*")[0];try{return dZ($).some((W)=>W.startsWith(q))}catch{return!1}}let X=_($,...z.slice(0,-1)),J=z[z.length-1],Q=J.split("*")[0],Y=J.split("*")[1]||"";try{return dZ(X).some((q)=>q.startsWith(Q)&&q.endsWith(Y))}catch{return!1}}function VH($,Z,z){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return UH(z,$.pattern);default:return!1}}function b8($){let Z=M$($);return mZ.map((z)=>{let J=z.signals.filter((Q)=>VH(Q,Z,$)).length/z.signals.length;return{name:z.name,slug:z.slug,category:z.category,confidence:J}}).filter((z)=>z.confidence>0).sort((z,X)=>X.confidence-z.confidence)}function cZ($){let Z=M$($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(j(_($,"tsconfig.json")))return"TypeScript";if(j(_($,"Cargo.toml")))return"Rust";if(j(_($,"go.mod")))return"Go";if(j(_($,"pyproject.toml"))||j(_($,"setup.py")))return"Python";if(j(_($,"Gemfile")))return"Ruby";if(j(_($,"pom.xml"))||j(_($,"build.gradle")))return"Java";if(j(_($,"Package.swift")))return"Swift";if(j(_($,"build.zig")))return"Zig";if(Z)return"JavaScript";return"Unknown"}function pZ($){let Z=M$($),z=b8($),X=[],J=QH($,Z);if(J)return X.push(J),{type:"documentation",found:X};let Q=$H($,Z);if(Q)return X.push(Q),{type:"sdk",found:X};let Y=WH($,Z,z);if(Y)return X.push(Y),{type:"mcpaas",found:X};let q=qH($,Z);if(q)return X.push(q),{type:"saas",found:X};let W=XH($,Z);if(W)return X.push(W),{type:"wasm",found:X};let G=zH($,Z);if(G)return X.push(G),{type:"mobile",found:X};if(z.some((R)=>R.slug==="mcp"))return X.push("MCP SDK signal"),{type:"mcp",found:X};if(Z?.bin)return X.push("package.json bin"),{type:"cli",found:X};if(eK($))return X.push("Cargo.toml [[bin]]"),{type:"cli",found:X};if(j(_($,"build.zig"))){if(X.push("build.zig"),j(_($,"src/main.zig")))return X.push("src/main.zig"),{type:"cli",found:X};if(j(_($,"src/root.zig")))return X.push("src/root.zig"),{type:"library",found:X}}let V=z.some((R)=>R.slug==="svelte"||R.slug==="sveltekit");if(Z?.private===!0&&(j(_($,"pnpm-workspace.yaml"))||Z?.workspaces!==void 0)&&V)return X.push("private workspace","Svelte"),{type:"framework",found:X};if(V)return X.push("Svelte/SvelteKit"),{type:"svelte",found:X};let L=z.some((R)=>R.category==="frontend"),O=z.some((R)=>R.category==="backend");if(Z?.private&&(Z.workspaces||j(_($,"pnpm-workspace.yaml")))&&L&&O)return X.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:X};let B=GH($,Z);if(B)return X.push(B),{type:"monorepo-root",found:X};let M=YH($,Z,z);if(M)return X.push(M),{type:"website",found:X};if(z.some((R)=>R.slug==="nextjs"||R.slug==="nuxt"))return X.push(z.find((R)=>R.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:X};let E=z.some((R)=>R.category==="frontend"),b=z.some((R)=>R.category==="backend");if(E&&b)return X.push("frontend framework","backend framework"),{type:"fullstack",found:X};if(E)return X.push("frontend framework"),{type:"frontend",found:X};if(b)return X.push("backend framework"),{type:"backend",found:X};let x=ZH($);if(x)return X.push(x),{type:"data-science",found:X};let y=JH($,Z);if(y)return X.push(y),{type:"html",found:X};if(Z?.main&&!Z?.bin)return X.push("package.json main (no bin)"),{type:"library",found:X};return X.push("no classifying signals — fallback"),{type:"library",found:X}}function lZ($){if(j(_($,"bunfig.toml")))return"Bun";if(j(_($,"deno.json"))||j(_($,"deno.jsonc")))return"Deno";if(M$($))return"Node.js";if(j(_($,"Cargo.toml")))return"Rust";if(j(_($,"go.mod")))return"Go";return"Unknown"}function iZ($){if(j(_($,"bun.lockb"))||j(_($,"bun.lock")))return"bun";if(j(_($,"pnpm-lock.yaml")))return"pnpm";if(j(_($,"yarn.lock")))return"yarn";if(j(_($,"package-lock.json")))return"npm";return"npm"}function nZ($){if(j(_($,".github/workflows")))return"GitHub Actions";if(j(_($,".gitlab-ci.yml")))return"GitLab CI";if(j(_($,".circleci")))return"CircleCI";if(j(_($,"Jenkinsfile")))return"Jenkins";return null}function sZ($){if(j(_($,"vercel.json")))return"Vercel";if(j(_($,"netlify.toml")))return"Netlify";if(j(_($,"wrangler.toml")))return"Cloudflare";if(j(_($,"Dockerfile")))return"Docker";if(j(_($,"fly.toml")))return"Fly.io";if(j(_($,"render.yaml")))return"Render";return null}function rZ($){let Z=_($,"svelte.config.js");if(!j(Z))return null;try{let X=Z$(Z,"utf-8").match(/@sveltejs\/adapter-(\w+)/);if(X){let J=X[1];switch(J){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 J}}return null}catch{return null}}function aZ($){let Z=M$($);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(j(_($,"tsconfig.json"))&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function oZ($){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)=>j(_($,z)))}function tZ($,Z){let z={};if(Z?.scripts){for(let X of["build","test","lint","dev","start"])if(Z.scripts[X]){let J=j(_($,"bun.lock"))||j(_($,"bun.lockb"))?"bun run":"npm run";z[X]=`${J} ${X}`}}if(j(_($,"Cargo.toml"))){if(!z.build)z.build="cargo build --release";if(!z.test)z.test="cargo test";if(!z.lint)z.lint="cargo clippy"}if(j(_($,"build.zig"))){if(!z.build)z.build="zig build";if(!z.test)z.test="zig build test"}if(j(_($,"go.mod"))){if(!z.build)z.build="go build ./...";if(!z.test)z.test="go test ./..."}if(j(_($,"pyproject.toml"))||j(_($,"pytest.ini"))){if(!z.test)z.test="pytest"}return z}function eZ($,Z,z,X){let J=[];if(X&&X!=="Unknown")J.push(X);let Q=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let Y of z)if(Q.has(Y.category))J.push(Y.name);if(j(_($,"bunfig.toml")))J.push("Bun");else if(j(_($,"deno.json"))||j(_($,"deno.jsonc")))J.push("Deno");if(J.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let q of Y)if(!J.some((W)=>W.toLowerCase().includes(q.toLowerCase())))J.push(q)}return J}function d$($){let Z=M$($),z=b8($),X=cZ($),J=pZ($),Q=J.type,Y=lZ($),q=iZ($),W=nZ($),G=sZ($),U=aZ($),V=z.find((n)=>n.category==="frontend"),K=z.find((n)=>n.category==="css"),L=z.find((n)=>n.category==="ui"),O=z.find((n)=>n.category==="state"),B=z.find((n)=>n.category==="backend"),M=z.find((n)=>n.category==="database"),F=m$[Q]||m$.library,E=Q==="framework",b=z.some((n)=>n.slug==="svelte"||n.slug==="sveltekit"),x=E&&b?"svelte":E?null:null,y=Q==="svelte"||x==="svelte",R=y?rZ($):null,i=y&&z.some((n)=>n.slug==="sveltekit"),C=new Set(["css_framework","ui_library","database","connection","hosting"]),g={},b0=G0.filter((n)=>n.path.startsWith("stack."));for(let n of b0){let o=n.path.replace("stack.","");if(!F.includes(n.category)){g[o]="slotignored";continue}if(E&&C.has(o)){g[o]="slotignored";continue}switch(o){case"frontend":g[o]=V?.name??(Q==="cli"?"CLI":"");break;case"css_framework":g[o]=K?.name??"";break;case"ui_library":g[o]=L?.name??"";break;case"state_management":g[o]=y?O?.name??"Runes":O?.name??"";break;case"backend":g[o]=y?i?"SvelteKit":B?.name??"":B?.name??"";break;case"api_type":g[o]=i?"Server Routes":"";break;case"runtime":g[o]=Y!=="Unknown"?Y:"";break;case"database":g[o]=M?.name??"";break;case"connection":g[o]=M?.name??"";break;case"hosting":if(y&&R)g[o]=R;else g[o]=G??"";break;case"build":g[o]=y?"Vite":U??"";break;case"cicd":g[o]=W??"";break;case"package_manager":g[o]=q;break;default:g[o]="";break}}let x0={},e=G0.filter((n)=>n.path.startsWith("monorepo."));for(let n of e){let o=n.path.replace("monorepo.","");if(!F.includes(n.category))x0[o]="slotignored";else x0[o]=""}let B1={name:Z?.name??$.split("/").pop()??"project",goal:Z?.description??"",main_language:X,type:Q};if(E&&x)B1.framework=x;let X9=eZ($,Z,z,X),J9=oZ($),Q9=tZ($,Z),k4={faf_version:"2.5.0",project:B1,stack:g,human_context:{who:"",what:Z?.description??"",why:"",where:"",when:"",how:""},monorepo:x0,_meta:{found:J.found}};if(X9.length>0)k4.tech_stack=X9;if(J9.length>0)k4.key_files=J9;if(Object.keys(Q9).length>0)k4.commands=Q9;return k4}p();function x8($={}){let Z=process.cwd(),z=$.output?$.output.endsWith(".faf")?$.output:$7(Z,$.output):$7(Z,"project.faf");if(KH(z)&&!$.force)console.error(`project.faf already exists. Use ${k("--force")} to overwrite.`),process.exit(1);let X=d$(Z);r(z,X);let J=u(z),Q=w0(J);if(console.log(`${w("created")} ${z}`),Z0(Q,z),Q.score<100)console.log(N(`
|
|
210
|
-
|
|
211
|
-
`).length
|
|
212
|
-
`)
|
|
213
|
-
`)
|
|
214
|
-
`),X=[];
|
|
215
|
-
`),X=0;while(X<z.length){let Q=z[X].trim().match(/^(#{1,6})\s+(.+)$/);if(Q&&Z.test(Q[2])){let Y=Q[1].length,q=[];X++;while(X<z.length){let W=z[X].trim(),G=W.match(/^(#{1,6})\s+/);if(G&&G[1].length<=Y)break;if(W===""){if(q.length>0)break;X++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(W))break;q.push(W),X++}if(q.length===0)return null;return q.join(" ").trim()}X++}return null}function OH($){let Z=O$($,/^(use\s+cases?|goal)\b/i);if(Z&&j0(Z))return Z;let z=MH($);if(z&&j0(z))return z;return}function DH($){let Z=O$($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&j0(Z))return Z;return}function AH($){let Z=O$($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&j0(Z))return Z;return}function IH($){let Z=O$($,/^(why|motivation|problem|rationale)\b/i);if(Z&&j0(Z))return Z;return}function wH($){let Z=O$($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&j0(Z))return Z;return}function FH($){let Z=O$($,/^(status|history|timeline|since|launched)\b/i);if(Z&&j0(Z))return Z;return}function RH($){let Z=O$($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&j0(Z))return Z;return}function y8($){let Z=["README.md","README.MD","Readme.md","readme.md"],z=null;for(let L of Z){let O=NH($,L);if(BH(O)){z=O;break}}if(!z)return{};let X;try{X=LH(z,"utf-8")}catch{return{}}let J={},Q=OH(X);if(Q)J.project={goal:Q};let Y={},q=DH(X);if(q)Y.what=q;let W=AH(X);if(W)Y.who=W;let G=IH(X);if(G)Y.why=G;let U=wH(X);if(U)Y.where=U;let V=FH(X);if(V)Y.when=V;let K=RH(X);if(K)Y.how=K;if(Object.keys(Y).length>0)J.human_context=Y;return J}import{existsSync as PH,readFileSync as _H}from"fs";import{join as EH}from"path";function CH($,Z){let z=$.split(`
|
|
216
|
-
`)
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
207
|
+
`)}}function W0($){return JSON.parse(a1().score_faf($))}function $7($){return a1().validate_faf($)}function y2($){return a1().compile_fafb($)}function Z7($){return JSON.parse(a1().decompile_fafb($))}function X7(){return a1().sdk_version()}function K0($){return{score:$.score,tier:p8($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function H0($){if(/^\s*app_type:\s*about\s*$/m.test($)){let X=$.match(/^\s+source_score:\s*(\d+)\s*$/m),z=X?parseInt(X[1],10):-1,J=z>=0&&z<=100?z:-1,Q=$.match(/^\s+represents:\s*(\S+)\s*$/m),Y=Q?Q[1]:void 0;return{score:J,tier:J>=0?p8(J):l$[l$.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Y}}return K0(W0($))}d();function X0($,Z,X=!1){let z=i$($.tier),J=w(`${$.score}%`);if(console.log(`${z} ${J} ${L(`${$.populated}/${$.active} slots`)} ${L("—")} ${Z}`),$.tier.name==="TROPHY")console.log(L(" Trophy. AI never has to guess."));else if($.empty>0){let Q=Object.entries($.slots).filter(([,W])=>W==="empty").map(([W])=>W),Y=Q.slice(0,3).join(", "),G=Q.length>3?`, +${Q.length-3} more`:"",U=$.empty===1?"slot":"slots";console.log(L(` ${$.empty} ${U} from Trophy: ${Y}${G}`))}if(X)console.log(""),hH($)}function hH($){for(let[Z,X]of Object.entries($.slots)){let z=X==="populated"?D("●"):X==="slotignored"?L("—"):L("○");console.log(` ${z} ${X==="slotignored"?L(Z):Z}`)}}d();function f2($,Z={}){let X=$??v();if(!X)console.error(`Error: project.faf not found
|
|
208
|
+
|
|
209
|
+
Run 'faf init' to create one.`),process.exit(2);let z=u(X),J=H0(z);if(Z.json){console.log(JSON.stringify(J,null,2));return}if(Z.status){console.log(`${i$(J.tier)} ${w(`${J.score}%`)}`);return}X0(J,X,Z.verbose)}import{existsSync as cB}from"fs";import{join as P7}from"path";var $0=[{index:1,path:"project.name",description:"Project name",category:"project"},{index:2,path:"project.goal",description:"Goal (use case)",category:"project"},{index:3,path:"project.main_language",description:"Primary language",category:"project"},{index:4,path:"human_context.who",description:"Who is this for?",category:"human"},{index:5,path:"human_context.what",description:"What are they building",category:"human"},{index:6,path:"human_context.why",description:"Why does it exist",category:"human"},{index:7,path:"human_context.where",description:"Where does it run",category:"human"},{index:8,path:"human_context.when",description:"When was it started / timeline",category:"human"},{index:9,path:"human_context.how",description:"How is it built",category:"human"},{index:10,path:"stack.frontend",canonical:"stack.framework",description:"Framework (React, Svelte, etc.)",category:"frontend"},{index:11,path:"stack.css_framework",canonical:"stack.css",description:"CSS framework",category:"frontend"},{index:12,path:"stack.ui_library",description:"UI component library",category:"frontend"},{index:13,path:"stack.state_management",canonical:"stack.state",description:"State management",category:"frontend"},{index:14,path:"stack.backend",description:"Backend framework",category:"backend"},{index:15,path:"stack.api_type",canonical:"stack.api",description:"API style (REST, GraphQL, etc.)",category:"backend"},{index:16,path:"stack.runtime",description:"Runtime (Node, Bun, Python, etc.)",category:"backend"},{index:17,path:"stack.database",canonical:"stack.db",description:"Database",category:"backend"},{index:18,path:"stack.connection",description:"Connection method (Prisma, etc.)",category:"backend"},{index:19,path:"stack.hosting",description:"Hosting platform",category:"universal"},{index:20,path:"stack.build",description:"Build tool",category:"universal"},{index:21,path:"stack.cicd",description:"CI/CD",category:"universal"},{index:22,path:"stack.monorepo_tool",description:"Monorepo tool",category:"enterprise_infra"},{index:23,path:"stack.package_manager",canonical:"stack.pkg_manager",description:"Package manager",category:"enterprise_infra"},{index:24,path:"stack.workspaces",description:"Workspace configuration",category:"enterprise_infra"},{index:25,path:"monorepo.packages_count",description:"Number of packages",category:"enterprise_infra"},{index:26,path:"monorepo.build_orchestrator",description:"Build orchestration tool",category:"enterprise_infra"},{index:27,path:"stack.admin",description:"Admin panel",category:"enterprise_app"},{index:28,path:"stack.cache",description:"Caching layer",category:"enterprise_app"},{index:29,path:"stack.search",description:"Search engine",category:"enterprise_app"},{index:30,path:"stack.storage",description:"Object storage",category:"enterprise_app"},{index:31,path:"monorepo.versioning_strategy",description:"Version strategy",category:"enterprise_ops"},{index:32,path:"monorepo.shared_configs",description:"Shared configs",category:"enterprise_ops"},{index:33,path:"monorepo.remote_cache",description:"Remote build cache",category:"enterprise_ops"}],z7=new Map($0.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),eO=new Map($0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),$D=new Map($0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function J7($,Z){let X=(J)=>{let Q=J.split("."),Y=$;for(let G of Q)if(Y&&typeof Y==="object"&&G in Y)Y=Y[G];else return;return Y},z=X(Z.path);if(z!==void 0)return z;if(Z.canonical)return X(Z.canonical);return}var ZD=$0.filter(($)=>$.index<=21);var i8=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","n/a","not applicable"]);function J$($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return i8.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var n$={about:[],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"],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"]};import{existsSync as C,readFileSync as v0,readdirSync as Y7}from"fs";import{join as P}from"path";var Q7=[{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:"file",pattern:"app.py"}]},{name:"FastAPI",slug:"fastapi",category:"backend",signals:[{type:"file",pattern:"main.py"}]},{name:"Rails",slug:"rails",category:"backend",signals:[{type:"file",pattern:"Gemfile"},{type:"file",pattern:"config/routes.rb"}]},{name:"Spring Boot",slug:"spring",category:"backend",signals:[{type:"file",pattern:"pom.xml"},{type:"file",pattern:"build.gradle"}]},{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"}]}];function vH($){let Z=P($,"Cargo.toml");if(!C(Z))return null;try{let z=v0(Z,"utf-8").match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return z?z[1]:null}catch{return null}}function uH($){let Z=P($,"Cargo.toml");if(!C(Z))return!1;try{let X=v0(Z,"utf-8");return/^\s*\[\[bin\]\]/m.test(X)}catch{return!1}}function mH($,Z){if(Z?.keywords?.some((z)=>/^sdk(?:\s|-|$)|\-sdk$/i.test(z)))return'package.json keywords contains "sdk"';if(Z?.name&&/(?:^|[-_/])sdk(?:[-_/]|$)/i.test(Z.name))return`package.json name "${Z.name}" → sdk`;let X=vH($);if(X&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(X))return`Cargo.toml name "${X}" → sdk`;return null}function cH($){let Z=["manifest.json","public/manifest.json","src/manifest.json","app/manifest.json","extension/manifest.json","dist/manifest.json"];for(let X of Z){let z=P($,X);if(!C(z))continue;try{let J=JSON.parse(v0(z,"utf-8"));if(typeof J.manifest_version==="number")return`${X} manifest_version ${J.manifest_version} (browser extension)`}catch{}}return null}function dH($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,X=P($,"pyproject.toml");if(C(X))try{let Q=v0(X,"utf-8").match(Z);if(Q)return`pyproject.toml depends on ${Q[1]}`}catch{}let z=P($,"requirements.txt");if(C(z))try{let Q=v0(z,"utf-8").match(Z);if(Q)return`requirements.txt contains ${Q[1]}`}catch{}return null}function pH($,Z){let X=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let z of X)if(Z.dependencies?.[z]||Z.devDependencies?.[z])return`${z} dependency`}if(C(P($,"pubspec.yaml")))return"pubspec.yaml (Flutter)";if(C(P($,"ios"))&&C(P($,"android")))return"ios/ + android/ dirs";return null}function lH($,Z){let X=P($,"Cargo.toml");if(C(X))try{let J=v0(X,"utf-8");if(/crate-type\s*=\s*\[[^\]]*"cdylib"/.test(J))return'Cargo.toml crate-type = ["cdylib"]';if(/wasm-bindgen|wasm-pack/i.test(J))return"Cargo.toml wasm-bindgen/wasm-pack"}catch{}let z=P($,"build.zig");if(C(z))try{let J=v0(z,"utf-8");if(/\.wasm\b|wasm32|setOutputFormat\(\.wasm/i.test(J))return"build.zig wasm target"}catch{}if(Z?.keywords?.some((J)=>/^wasm(?:-|$)|webassembly/i.test(J)))return'package.json keywords contains "wasm"';return null}function iH($,Z){if(!C(P($,"index.html")))return null;if(Z?.dependencies||Z?.devDependencies){let X={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((J)=>X[J]))return null}return"index.html (vanilla, no frontend framework)"}function nH($,Z){if(Z?.name&&/specification|^@.*\/spec/i.test(Z.name))return`package name "${Z.name}" → documentation`;if(Z?.keywords?.some((X)=>/^(specification|format-spec|standard)$/i.test(X)))return'package keywords contains "specification"';if(Z?.files&&Z.files.length>0){let X=/^(dist|src|lib|build|bin)\/|\.(js|ts|tsx|jsx|mjs|cjs|py|rs|go)$/,z=Z.files.some((Q)=>X.test(Q)),J=Z.files.some((Q)=>/\.(md|MD)|examples?\//.test(Q));if(!z&&J)return"package.json files = docs/examples only (no source)"}return null}function sH($,Z,X){let z=X.find((J)=>J.slug==="astro"||J.slug==="gatsby");if(z)return`${z.name} (static-site framework)`;if(Z?.keywords?.some((J)=>/^(website|marketing|landing|brochure|portfolio)$/i.test(J)))return'package keywords contains "website"/"marketing"/"landing"';return null}function rH($,Z){if(!Z)return null;let X={...Z.dependencies??{},...Z.devDependencies??{}},z=["@clerk/nextjs","@clerk/clerk-react","next-auth","@auth/core","auth0","@auth0/nextjs-auth0"],J=["stripe","@stripe/stripe-js","lemonsqueezy"],Q=z.some((G)=>X[G]),Y=J.some((G)=>X[G]);if(Q&&Y)return"auth + payment dependencies";return null}function aH($,Z,X){if(Z?.keywords?.some((Q)=>/mcpaas/i.test(Q)))return'package keywords contains "mcpaas"';if(Z?.name&&/mcpaas/i.test(Z.name))return`package name "${Z.name}" → mcpaas`;let z=X.some((Q)=>Q.slug==="mcp"),J=X.some((Q)=>Q.category==="database");if(z&&J&&Z?.dependencies&&Object.keys(Z.dependencies).length>10)return"MCP + database + complex deps (platform shape)";return null}function oH($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||C(P($,"pnpm-workspace.yaml"))))return null;return"private workspace + multi-package"}function A$($){let Z=P($,"package.json");if(!C(Z))return null;try{return JSON.parse(v0(Z,"utf-8"))}catch{return null}}function tH($,Z){if(!Z.includes("*"))return C(P($,Z));let X=Z.split("/");if(X.length===1){let G=Z.split("*")[0];try{return Y7($).some((U)=>U.startsWith(G))}catch{return!1}}let z=P($,...X.slice(0,-1)),J=X[X.length-1],Q=J.split("*")[0],Y=J.split("*")[1]||"";try{return Y7(z).some((G)=>G.startsWith(Q)&&G.endsWith(Y))}catch{return!1}}function eH($,Z,X){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return tH(X,$.pattern);default:return!1}}function n8($){let Z=A$($);return Q7.map((X)=>{let J=X.signals.filter((Q)=>eH(Q,Z,$)).length/X.signals.length;return{name:X.name,slug:X.slug,category:X.category,confidence:J}}).filter((X)=>X.confidence>0).sort((X,z)=>z.confidence-X.confidence)}function G7($){let Z=A$($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(C(P($,"tsconfig.json")))return"TypeScript";if(C(P($,"Cargo.toml")))return"Rust";if(C(P($,"go.mod")))return"Go";if(C(P($,"pyproject.toml"))||C(P($,"setup.py")))return"Python";if(C(P($,"Gemfile")))return"Ruby";if(C(P($,"pom.xml"))||C(P($,"build.gradle")))return"Java";if(C(P($,"Package.swift")))return"Swift";if(C(P($,"build.zig")))return"Zig";if(Z)return"JavaScript";return"Unknown"}function U7($){let Z=A$($),X=n8($),z=[],J=nH($,Z);if(J)return z.push(J),{type:"documentation",found:z};let Q=mH($,Z);if(Q)return z.push(Q),{type:"sdk",found:z};let Y=cH($);if(Y)return z.push(Y),{type:"extension",found:z};let G=aH($,Z,X);if(G)return z.push(G),{type:"mcpaas",found:z};let U=rH($,Z);if(U)return z.push(U),{type:"saas",found:z};let W=lH($,Z);if(W)return z.push(W),{type:"wasm",found:z};let q=pH($,Z);if(q)return z.push(q),{type:"mobile",found:z};if(X.some((g)=>g.slug==="mcp"))return z.push("MCP SDK signal"),{type:"mcp",found:z};if(Z?.bin)return z.push("package.json bin"),{type:"cli",found:z};if(uH($))return z.push("Cargo.toml [[bin]]"),{type:"cli",found:z};if(C(P($,"build.zig"))){if(z.push("build.zig"),C(P($,"src/main.zig")))return z.push("src/main.zig"),{type:"cli",found:z};if(C(P($,"src/root.zig")))return z.push("src/root.zig"),{type:"library",found:z}}let K=X.some((g)=>g.slug==="svelte"||g.slug==="sveltekit");if(Z?.private===!0&&(C(P($,"pnpm-workspace.yaml"))||Z?.workspaces!==void 0)&&K)return z.push("private workspace","Svelte"),{type:"framework",found:z};if(K)return z.push("Svelte/SvelteKit"),{type:"svelte",found:z};let O=X.some((g)=>g.category==="frontend"),B=X.some((g)=>g.category==="backend");if(Z?.private&&(Z.workspaces||C(P($,"pnpm-workspace.yaml")))&&O&&B)return z.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:z};let T=oH($,Z);if(T)return z.push(T),{type:"monorepo-root",found:z};let F=sH($,Z,X);if(F)return z.push(F),{type:"website",found:z};if(X.some((g)=>g.slug==="nextjs"||g.slug==="nuxt"))return z.push(X.find((g)=>g.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:z};let b=X.some((g)=>g.category==="frontend"),x=X.some((g)=>g.category==="backend");if(b&&x)return z.push("frontend framework","backend framework"),{type:"fullstack",found:z};if(b)return z.push("frontend framework"),{type:"frontend",found:z};if(x)return z.push("backend framework"),{type:"backend",found:z};let k=dH($);if(k)return z.push(k),{type:"data-science",found:z};let y=iH($,Z);if(y)return z.push(y),{type:"html",found:z};if(Z?.main&&!Z?.bin)return z.push("package.json main (no bin)"),{type:"library",found:z};return z.push("no classifying signals — fallback"),{type:"library",found:z}}function W7($){if(C(P($,"bunfig.toml")))return"Bun";if(C(P($,"deno.json"))||C(P($,"deno.jsonc")))return"Deno";if(A$($))return"Node.js";if(C(P($,"Cargo.toml")))return"Rust";if(C(P($,"go.mod")))return"Go";return"Unknown"}function q7($){if(C(P($,"bun.lockb"))||C(P($,"bun.lock")))return"bun";if(C(P($,"pnpm-lock.yaml")))return"pnpm";if(C(P($,"yarn.lock")))return"yarn";if(C(P($,"package-lock.json")))return"npm";return"npm"}function V7($){if(C(P($,".github/workflows")))return"GitHub Actions";if(C(P($,".gitlab-ci.yml")))return"GitLab CI";if(C(P($,".circleci")))return"CircleCI";if(C(P($,"Jenkinsfile")))return"Jenkins";return null}function K7($){if(C(P($,"vercel.json")))return"Vercel";if(C(P($,"netlify.toml")))return"Netlify";if(C(P($,"wrangler.toml")))return"Cloudflare";if(C(P($,"Dockerfile")))return"Docker";if(C(P($,"fly.toml")))return"Fly.io";if(C(P($,"render.yaml")))return"Render";return null}function H7($){let Z=P($,"svelte.config.js");if(!C(Z))return null;try{let z=v0(Z,"utf-8").match(/@sveltejs\/adapter-(\w+)/);if(z){let J=z[1];switch(J){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 J}}return null}catch{return null}}function B7($){let Z=A$($);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(C(P($,"tsconfig.json"))&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function L7($){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((X)=>C(P($,X)))}function N7($,Z){let X={};if(Z?.scripts){for(let z of["build","test","lint","dev","start"])if(Z.scripts[z]){let J=C(P($,"bun.lock"))||C(P($,"bun.lockb"))?"bun run":"npm run";X[z]=`${J} ${z}`}}if(C(P($,"Cargo.toml"))){if(!X.build)X.build="cargo build --release";if(!X.test)X.test="cargo test";if(!X.lint)X.lint="cargo clippy"}if(C(P($,"build.zig"))){if(!X.build)X.build="zig build";if(!X.test)X.test="zig build test"}if(C(P($,"go.mod"))){if(!X.build)X.build="go build ./...";if(!X.test)X.test="go test ./..."}if(C(P($,"pyproject.toml"))||C(P($,"pytest.ini"))){if(!X.test)X.test="pytest"}return X}function M7($,Z,X,z){let J=[];if(z&&z!=="Unknown")J.push(z);let Q=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let Y of X)if(Q.has(Y.category))J.push(Y.name);if(C(P($,"bunfig.toml")))J.push("Bun");else if(C(P($,"deno.json"))||C(P($,"deno.jsonc")))J.push("Deno");if(J.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let G of Y)if(!J.some((U)=>U.toLowerCase().includes(G.toLowerCase())))J.push(G)}return J}function g2($){let Z=A$($),X=n8($),z=G7($),J=U7($),Q=J.type,Y=W7($),G=q7($),U=V7($),W=K7($),q=B7($),V=X.find((n)=>n.category==="frontend"),K=X.find((n)=>n.category==="css"),N=X.find((n)=>n.category==="ui"),O=X.find((n)=>n.category==="state"),B=X.find((n)=>n.category==="backend"),T=X.find((n)=>n.category==="database"),F=n$[Q]||n$.library,j=Q==="framework",b=X.some((n)=>n.slug==="svelte"||n.slug==="sveltekit"),x=j&&b?"svelte":j?null:null,k=Q==="svelte"||x==="svelte",y=k?H7($):null,g=k&&X.some((n)=>n.slug==="sveltekit"),E=new Set(["css_framework","ui_library","database","connection","hosting"]),m={},b0=$0.filter((n)=>n.path.startsWith("stack."));for(let n of b0){let o=n.path.replace("stack.","");if(!F.includes(n.category)){m[o]="slotignored";continue}if(j&&E.has(o)){m[o]="slotignored";continue}switch(o){case"frontend":m[o]=V?.name??(Q==="cli"?"CLI":"");break;case"css_framework":m[o]=K?.name??"";break;case"ui_library":m[o]=N?.name??"";break;case"state_management":m[o]=k?O?.name??"Runes":O?.name??"";break;case"backend":m[o]=k?g?"SvelteKit":B?.name??"":B?.name??"";break;case"api_type":m[o]=g?"Server Routes":"";break;case"runtime":m[o]=Y!=="Unknown"?Y:"";break;case"database":m[o]=T?.name??"";break;case"connection":m[o]=T?.name??"";break;case"hosting":if(k&&y)m[o]=y;else m[o]=W??"";break;case"build":m[o]=k?"Vite":q??"";break;case"cicd":m[o]=U??"";break;case"package_manager":m[o]=G;break;default:m[o]="";break}}let x0={},e=$0.filter((n)=>n.path.startsWith("monorepo."));for(let n of e){let o=n.path.replace("monorepo.","");if(!F.includes(n.category))x0[o]="slotignored";else x0[o]=""}let R1={name:Z?.name??$.split("/").pop()??"project",goal:Z?.description??"",main_language:z,type:Q};if(j&&x)R1.framework=x;let DZ=M7($,Z,X,z),IZ=L7($),AZ=N7($,Z),p4={faf_version:"2.5.0",project:R1,stack:m,human_context:{who:"",what:Z?.description??"",why:"",where:"",when:"",how:""},monorepo:x0,_meta:{found:J.found}};if(DZ.length>0)p4.tech_stack=DZ;if(IZ.length>0)p4.key_files=IZ;if(Object.keys(AZ).length>0)p4.commands=AZ;return p4}import{existsSync as ZB,readFileSync as XB}from"fs";import{join as zB}from"path";var T7={MIN_LENGTH:8,MAX_LENGTH:280},$B=[/^(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 j0($){let Z=$.trim();if(Z.length<T7.MIN_LENGTH)return!1;if(Z.length>T7.MAX_LENGTH)return!1;if($B.some((X)=>X.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
|
|
210
|
+
`).length>4)return!1;return!0}function JB($){let Z=$.split(`
|
|
211
|
+
`),X=0;while(X<Z.length&&/^(#\s|$)/.test(Z[X].trim()))X++;while(X<Z.length){let z=Z[X].trim();if(/^\[!\[/.test(z)){X++;continue}if(/^!\[/.test(z)){X++;continue}if(/^<img\s/i.test(z)){X++;continue}if(z===""){X++;continue}break}return Z.slice(X).join(`
|
|
212
|
+
`)}function QB($){let X=JB($).split(`
|
|
213
|
+
`),z=[];for(let J of X){let Q=J.trim();if(Q===""){if(z.length>0)break;continue}if(/^(#|>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(Q))break;if(/^\*\*[^*]+\*\*\s*$/.test(Q)&&z.length===0)continue;z.push(Q)}if(z.length===0)return null;return z.join(" ").trim()}function R$($,Z){let X=$.split(`
|
|
214
|
+
`),z=0;while(z<X.length){let Q=X[z].trim().match(/^(#{1,6})\s+(.+)$/);if(Q&&Z.test(Q[2])){let Y=Q[1].length,G=[];z++;while(z<X.length){let U=X[z].trim(),W=U.match(/^(#{1,6})\s+/);if(W&&W[1].length<=Y)break;if(U===""){if(G.length>0)break;z++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(U))break;G.push(U),z++}if(G.length===0)return null;return G.join(" ").trim()}z++}return null}function YB($){let Z=R$($,/^(use\s+cases?|goal)\b/i);if(Z&&j0(Z))return Z;let X=QB($);if(X&&j0(X))return X;return}function GB($){let Z=R$($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&j0(Z))return Z;return}function UB($){let Z=R$($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&j0(Z))return Z;return}function WB($){let Z=R$($,/^(why|motivation|problem|rationale)\b/i);if(Z&&j0(Z))return Z;return}function qB($){let Z=R$($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&j0(Z))return Z;return}function VB($){let Z=R$($,/^(status|history|timeline|since|launched)\b/i);if(Z&&j0(Z))return Z;return}function KB($){let Z=R$($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&j0(Z))return Z;return}function s8($){let Z=["README.md","README.MD","Readme.md","readme.md"],X=null;for(let N of Z){let O=zB($,N);if(ZB(O)){X=O;break}}if(!X)return{};let z;try{z=XB(X,"utf-8")}catch{return{}}let J={},Q=YB(z);if(Q)J.project={goal:Q};let Y={},G=GB(z);if(G)Y.what=G;let U=UB(z);if(U)Y.who=U;let W=WB(z);if(W)Y.why=W;let q=qB(z);if(q)Y.where=q;let V=VB(z);if(V)Y.when=V;let K=KB(z);if(K)Y.how=K;if(Object.keys(Y).length>0)J.human_context=Y;return J}import{existsSync as HB,readFileSync as BB}from"fs";import{join as LB}from"path";function NB($,Z){let X=$.split(`
|
|
215
|
+
`),z=!1;for(let J of X){let Q=J.trim();if(/^\[/.test(Q)){z=Q==="[package]";continue}if(!z)continue;let Y=Q.match(new RegExp(`^${Z}\\s*=\\s*(.+)$`));if(Y){let G=Y[1].trim();G=G.replace(/\s*#.*$/,"").trim();let U=G.match(/^"((?:[^"\\]|\\.)*)"$/)||G.match(/^'((?:[^'\\]|\\.)*)'$/);if(U)return U[1];return G}}return null}function r8($){let Z=LB($,"Cargo.toml");if(!HB(Z))return{};let X;try{X=BB(Z,"utf-8")}catch{return{}}let z=NB(X,"description");if(z&&j0(z))return{project:{goal:z}};return{}}function MB($,Z){let X={project:{...Z.project??{},...$.project??{}},human_context:{...Z.human_context??{},...$.human_context??{}}};if(X.project&&Object.keys(X.project).length===0)delete X.project;if(X.human_context&&Object.keys(X.human_context).length===0)delete X.human_context;return X}function h2($){return MB(s8($),r8($))}import{existsSync as TB,readdirSync as O7}from"fs";import{join as D7,dirname as OB,extname as DB,resolve as IB}from"path";var a8={"package.json":{frameworks:["Node.js","JavaScript","TypeScript"],slots:{packageManager:"npm/yarn/pnpm",mainLanguage:"JavaScript/TypeScript"},priority:35,intelligence:"ultra-high"},"README.md":{frameworks:[],slots:{targetUser:"developers",coreProblem:"understanding project",missionPurpose:"project documentation"},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",backend:"Python"},priority:36,intelligence:"ultra-high"},Gemfile:{frameworks:["Ruby","Rails"],slots:{packageManager:"bundler",mainLanguage:"Ruby"},priority:35,intelligence:"ultra-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"},"pubspec.yaml":{frameworks:["Flutter","Dart"],slots:{packageManager:"pub",mainLanguage:"Dart",framework:"Flutter"},priority:35,intelligence:"ultra-high"},"pom.xml":{frameworks:["Java","Spring","Maven"],slots:{packageManager:"maven",mainLanguage:"Java",buildTool:"maven"},priority:35,intelligence:"ultra-high"},"build.gradle":{frameworks:["Java","Kotlin","Spring","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Java/Kotlin",buildTool:"gradle"},priority:35,intelligence:"ultra-high"},"next.config.js":{frameworks:["Next.js"],slots:{framework:"Next.js",runtime:"Node.js",buildTool:"Next.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"next.config.mjs":{frameworks:["Next.js"],slots:{framework:"Next.js",runtime:"Node.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+",runtime:"Node.js",buildTool:"Next.js",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.js":{frameworks:["Nuxt 2"],slots:{framework:"Nuxt 2",runtime:"Node.js",buildTool:"Nuxt",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.ts":{frameworks:["Nuxt 3"],slots:{framework:"Nuxt 3",runtime:"Node.js",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",runtime:"Node.js",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",database:"Required",server:"Node.js"},priority:30,intelligence:"high"},Dockerfile:{frameworks:["Docker"],slots:{hosting:"Docker",connection:"Containerized"},priority:30,intelligence:"high"},"docker-compose.yml":{frameworks:["Docker Compose"],slots:{hosting:"Docker",connection:"Multi-container"},priority:30,intelligence:"high"},"docker-compose.yaml":{frameworks:["Docker Compose"],slots:{hosting:"Docker",connection:"Multi-container"},priority:30,intelligence:"high"},"kubernetes.yml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes",connection:"Orchestrated"},priority:30,intelligence:"high"},"k8s.yaml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes",connection:"Orchestrated"},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:{cicd:"Jest"},priority:25,intelligence:"medium"},"jest.config.ts":{frameworks:["Jest"],slots:{cicd:"Jest",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"vitest.config.ts":{frameworks:["Vitest"],slots:{cicd:"Vitest",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"cypress.config.js":{frameworks:["Cypress"],slots:{cicd:"Cypress"},priority:25,intelligence:"medium"},"playwright.config.ts":{frameworks:["Playwright"],slots:{cicd:"Playwright",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"karma.conf.js":{frameworks:["Karma"],slots:{cicd:"Karma"},priority:20,intelligence:"medium"},"mocha.opts":{frameworks:["Mocha"],slots:{cicd:"Mocha"},priority:20,intelligence:"medium"},".rspec":{frameworks:["RSpec"],slots:{cicd:"RSpec",mainLanguage:"Ruby"},priority:25,intelligence:"medium"},"pytest.ini":{frameworks:["Pytest"],slots:{cicd:"Pytest",mainLanguage:"Python"},priority:25,intelligence:"medium"},"phpunit.xml":{frameworks:["PHPUnit"],slots:{cicd:"PHPUnit",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",framework:"Zig",build:"zig build"},priority:35,intelligence:"ultra-high"},"openapi.json":{frameworks:["OpenAPI"],slots:{apiType:"REST API",backend:"API Server"},priority:30,intelligence:"high"},"openapi.yaml":{frameworks:["OpenAPI"],slots:{apiType:"REST API",backend:"API Server"},priority:30,intelligence:"high"},"swagger.json":{frameworks:["Swagger"],slots:{apiType:"REST API",backend:"API Server"},priority:30,intelligence:"high"},"graphql.schema":{frameworks:["GraphQL"],slots:{apiType:"GraphQL",backend:"GraphQL Server"},priority:30,intelligence:"high"},"schema.graphql":{frameworks:["GraphQL"],slots:{apiType:"GraphQL",backend:"GraphQL Server"},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","iOS"],slots:{packageManager:"CocoaPods",mainLanguage:"Swift/Objective-C",framework:"iOS Native"},priority:30,intelligence:"high"},"build.gradle.kts":{frameworks:["Gradle Kotlin DSL","Android","Kotlin"],slots:{packageManager:"Gradle",mainLanguage:"Kotlin",buildTool:"Gradle Kotlin DSL",framework:"Android"},priority:30,intelligence:"high"},"*.ipynb":{frameworks:["Jupyter","Python"],slots:{mainLanguage:"Python",framework:"Jupyter Notebook"},priority:30,intelligence:"high"},MLproject:{frameworks:["MLflow"],slots:{mainLanguage:"Python",framework:"MLflow",backend:"MLflow",cicd:"MLflow"},priority:30,intelligence:"high"},"dvc.yaml":{frameworks:["DVC","Data Version Control"],slots:{mainLanguage:"Python",framework:"DVC",cicd:"DVC Pipelines"},priority:30,intelligence:"high"},"dvc.lock":{frameworks:["DVC"],slots:{framework:"DVC"},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:{cicd:"Codecov"},priority:25,intelligence:"high"},"dependabot.yml":{frameworks:["Dependabot","GitHub"],slots:{cicd:"Dependabot"},priority:25,intelligence:"high"},"renovate.json":{frameworks:["Renovate"],slots:{cicd:"Renovate"},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",backend:"Helm"},priority:30,intelligence:"high"},"values.yaml":{frameworks:["Helm","Kubernetes"],slots:{hosting:"Kubernetes"},priority:25,intelligence:"high",confirmWith:["Chart.yaml"]},"pulumi.yaml":{frameworks:["Pulumi"],slots:{hosting:"Cloud",cicd:"Pulumi"},priority:30,intelligence:"high"},"Pulumi.yaml":{frameworks:["Pulumi"],slots:{hosting:"Cloud",cicd:"Pulumi"},priority:30,intelligence:"high"},"terragrunt.hcl":{frameworks:["Terragrunt","Terraform"],slots:{hosting:"Cloud",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:{cicd:"SonarQube"},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:{cicd:"pre-commit"},priority:25,intelligence:"high"},"CLAUDE.md":{frameworks:["Claude Code"],slots:{},priority:30,intelligence:"high",confirmWith:[".claude"]}};var AB=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),RB=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),FB={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"]};function wB($){let Z=[],X=IB($),z=TB(D7($,".git"));for(let J=0;J<10;J++){let Q;try{Q=O7(X)}catch{break}for(let G of Q){let U=a8[G];if(U)Z.push({slots:U.slots||{},priority:U.priority,frameworks:U.frameworks})}if(z&&J===0)break;let Y=OB(X);if(Y===X)break;X=Y}return Z}function PB($){let Z=[];for(let X of I7($,2,{count:0})){let z=a8[`*${X}`],J=z?.slots?.mainLanguage;if(J)Z.push({slots:{mainLanguage:J},priority:z.priority,frameworks:z.frameworks})}return Z}function _B($){let Z=[...wB($),...PB($)],X={},z={},J=new Set;for(let Q of Z){Q.frameworks.forEach((Y)=>J.add(Y));for(let[Y,G]of Object.entries(Q.slots))if(G&&!G.includes("/")&&(!(Y in X)||Q.priority>z[Y]))X[Y]=G,z[Y]=Q.priority}return{slotFills:X,frameworks:[...J],confirmedCount:Z.length}}function v2($){let{slotFills:Z}=_B($),X={};for(let[z,J]of Object.entries(Z)){let Q=FB[z];if(!Q||!J)continue;let[Y,G]=Q;if(Y==="project")(X.project??={})[G]=J;else(X.stack??={})[G]=J}return X}function I7($,Z,X){let z=new Set;if(Z<0||X.count>400)return z;let J;try{J=O7($,{withFileTypes:!0})}catch{return z}for(let Q of J){if(X.count++>400)break;if(!Q.isDirectory()){let Y=DB(Q.name);if(RB.has(Y))z.add(Y);continue}if(AB.has(Q.name)||Q.name.startsWith("."))continue;for(let Y of I7(D7($,Q.name),Z-1,X))z.add(Y)}return z}import{existsSync as A7,readFileSync as R7}from"fs";import{join as F7}from"path";function u2($){let Z=CB($),X=EB($),z={},J=(Q,Y)=>{if(Y)z[Q]=Y};return J("what",jB(Z,X)),J("who",SB(X)),J("why",bB(X)),J("where",xB(Z,X)),J("when",kB(X)),J("how",yB(Z,X)),z}function CB($){let Z=F7($,"package.json");if(!A7(Z))return null;try{return JSON.parse(R7(Z,"utf-8"))}catch{return null}}function EB($){let Z=F7($,"README.md");if(!A7(Z))return"";let X;try{X=R7(Z,"utf-8")}catch{return""}return X.split(`
|
|
216
|
+
`).filter((z)=>!/^\s*\[!\[/.test(z)&&!/^\s*!\[/.test(z)).join(`
|
|
217
|
+
`).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function F$($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function s$($,Z){let X=new RegExp(`##?\\s+(?:${Z})\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n##?|$)`,"i"),z=$.match(X);return z&&z[1]&&z[1].trim().length>20?F$(z[1]):null}function o1($,Z,X=30){for(let z of Z){let J=$.match(z);if(J&&J[1]&&J[1].trim().length>=X)return F$(J[1])}return null}function jB($,Z){if($?.description&&$.description.length>20)return F$($.description);let X=s$(Z,"Purpose|What|About|Overview|Description");if(X)return X;let z=Z.split(/\n\s*\n/).map((J)=>J.trim()).find((J)=>J.length>30&&!J.startsWith("#"));if(z)return F$(z);return o1(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])}function SB($){let Z=s$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return Z;return o1($,[/\b(?:designed|built|made)\s+for\s+((?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i,/\bfor\s+((?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i],8)}function bB($){let Z=s$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return Z;return o1($,[/(?:our\s+)?(?:mission|purpose|goal)(?:\s+is)?\s*:?\s*([^.\n]{30,})/i,/(?:built|created|designed)\s+(?:because|to)\s+([^.\n]{30,})/i])}function xB($,Z){let X=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(X)return F$(X.replace(/^git\+/,"").replace(/\.git$/,""));if($?.homepage)return F$($.homepage);return o1(Z,[/\b(?:deployed|hosted|available|published)\s+(?:on|at|via)\s+([^.\n]{4,80})/i],4)}function kB($){let Z=s$($,"Timeline|Status|Release|Roadmap");if(Z)return Z;return o1($,[/\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)}function yB($,Z){let X=$?.scripts?Object.keys($.scripts):[],z=["start","dev","build"].filter((Q)=>X.includes(Q));if(z.length)return F$(z.map((Q)=>`npm run ${Q}`).join(", "));let J=s$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(J)return J;return s$(Z,"Architecture|Approach|How it works|Methodology|How")}function r$($){let Z=g2($),X=h2($),z=u0(Z,X);fB(z);let J=u0(z,v2($));return u0(J,{human_context:u2($)})}function fB($){let Z=$.project?.type??"library",X=n$[Z]||n$.library;for(let z of $0){if(X.includes(z.category))continue;let[J,Q]=z.path.split(".");if(J==="stack"&&$.stack)$.stack[Q]="slotignored";if(J==="monorepo"&&$.monorepo)$.monorepo[Q]="slotignored"}}function u0($,Z){let X={...$};for(let[z,J]of Object.entries(Z)){let Q=X[z];if(J$(Q))X[z]=J;else if(typeof J==="object"&&J!==null&&!Array.isArray(J)&&typeof Q==="object"&&Q!==null&&!Array.isArray(Q))X[z]=u0(Q,J)}return X}import{existsSync as w7,readFileSync as gB,writeFileSync as hB}from"fs";import{join as vB,basename as uB}from"path";import{createHash as mB}from"crypto";class m0{projectPath;dnaPath;dna=null;constructor($){this.projectPath=$,this.dnaPath=vB($,".faf-dna")}exists(){return w7(this.dnaPath)}birth($){let Z=new Date().toISOString();return 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}recordGrowth($,Z){if(!this.dna&&!this.load())return null;let X=this.dna;if($===X.current.score)return X;let z=new Date().toISOString(),J=X.birthCertificate.birthDNA,Q=$-J,Y=this.incrementVersion(X.versions[X.versions.length-1].version);return X.versions.push({version:Y,timestamp:z,score:$,changes:Z,growth:Q}),X.current={version:Y,score:$,lastSync:z},X.growth.totalGrowth=Q,X.growth.daysActive=this.daysSince(X.birthCertificate.born),this.updateMilestones($,Y,z),this.save(),X}getJourney(){if(!this.dna&&!this.load())return"";let $=this.dna,Z=$.birthCertificate.birthDNA,X=$.growth.milestones.find((Q)=>Q.type==="peak"),z=$.current.score,J=`${Z}%`;if(X&&X.score!==Z){if(J+=` → ${X.score}%`,z<X.score)J+=` ← ${z}%`}else if(z!==Z)J+=` → ${z}%`;return J}getBirthDNADisplay(){if(!this.dna&&!this.load())return null;let $=this.dna;return{current:$.current.score,birthDNA:$.birthCertificate.birthDNA,growth:$.current.score-$.birthCertificate.birthDNA,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";return`${$.version} — ${$.score}% ${Z} (${$.timestamp.split("T")[0]}) ${$.changes.join(", ")}`})}load(){if(this.dna)return this.dna;if(!w7(this.dnaPath))return null;try{return this.dna=JSON.parse(gB(this.dnaPath,"utf-8")),this.dna}catch{return null}}save(){if(!this.dna)return;this.dna.lastModified=new Date().toISOString(),hB(this.dnaPath,JSON.stringify(this.dna,null,2)+`
|
|
218
|
+
`,"utf-8")}generateProjectDNA(){return mB("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(),X=uB(this.projectPath).replace(/[^A-Z0-9]/gi,"").toUpperCase().substring(0,8).padEnd(4,"X");return`FAF-${$}-${X}-${Z}`}incrementVersion($){let[Z,X,z]=$.replace("v","").split(".").map(Number);return`v${Z}.${X}.${z+1}`}daysSince($){return Math.floor((Date.now()-new Date($).getTime())/86400000)}updateMilestones($,Z,X){if(!this.dna)return;let z=this.dna.growth.milestones,J=(U)=>z.some((W)=>W.type===U),Q=(U,W,q)=>z.push({type:U,score:$,date:X,version:Z,label:W,emoji:q});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!J("doubled"))Q("doubled","Doubled","2️⃣");if($>=70&&!J("championship"))Q("championship","Championship","\uD83C\uDFC6");if($>=85&&!J("elite"))Q("elite","Elite","◆");if($>=100&&!J("perfect"))Q("perfect","Perfect","\uD83C\uDFC6");let Y=z.find((U)=>U.type==="peak");if(!Y||$>Y.score){if(Y)z.splice(z.indexOf(Y),1);Q("peak","Peak","\uD83C\uDFD4️")}let G=z.findIndex((U)=>U.type==="current");if(G>=0)z.splice(G,1);Q("current","Current","\uD83D\uDCCD")}}d();function o8($={}){let Z=process.cwd(),X=$.output?$.output.endsWith(".faf")?$.output:P7(Z,$.output):P7(Z,"project.faf");if(cB(X)&&!$.force)console.error(`project.faf already exists. Use ${w("--force")} to overwrite.`),process.exit(1);let z=r$(Z);r(X,z);let J=u(X),Q=H0(J),Y=new m0(Z);if(!Y.exists()||$.force)Y.birth(Q.score);if(console.log(`${D("created")} ${X}`),X0(Q,X),console.log(L(` \uD83E\uDDEC Birth DNA ${Q.score}% — your journey starts here (faf dna)`)),Q.score<100)console.log(L(`
|
|
219
|
+
run ${w("'faf go'")} to fill empty slots`))}d();function _7(){let $=new m0(process.cwd());if(!$.load())console.error(`${w("×")} No FAF DNA found. Run ${w("'faf init'")} to start your journey.`),process.exit(1);let Z=$.getJourney(),X=$.getBirthDNADisplay(),z=X.born.split("T")[0];console.log(),console.log(V0(w("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${D(w(Z))}`),console.log(),console.log(L(` Birth DNA ${X.birthDNA}% (born ${z}) · current ${X.current}% · growth ${X.growth>=0?"+":""}${X.growth}%`));let J=$.getLog();if(J.length>1){console.log(),console.log(L(" history:"));for(let Q of J)console.log(L(` ${Q}`))}console.log()}import{existsSync as dB}from"fs";import{join as pB}from"path";d();function C7(){let $=process.cwd(),Z=pB($,"project.faf");if(dB(Z)){let Q=l(Z),Y=u0(Q,h2($)),G=u0(Y,g2($)),U=u0(G,v2($)),W=u0(U,{human_context:u2($)});r(Z,W),console.log(`${D("updated")} ${Z}`)}else r(Z,r$($)),console.log(`${D("created")} ${Z}`);let X=u(Z),z=K0(W0(X)),J=new m0($);if(J.exists())J.recordGrowth(z.score,["faf auto"]);if(X0(z,Z),z.score<100)console.log(L(`
|
|
220
|
+
run ${w("'faf go'")} to reach \uD83C\uDFC6 Trophy`))}import{existsSync as d2,statSync as f7}from"fs";import{join as g7,dirname as ZL}from"path";import{readFileSync as aB,existsSync as oB,statSync as MI}from"fs";import{join as j7}from"path";import{readFileSync as lB,writeFileSync as m2,existsSync as iB}from"fs";var nB="<!-- faf:start -->",sB="<!-- faf:end -->",rB="<!-- faf:";function Q$($,Z,X=nB,z=sB){let J=`${X}
|
|
221
|
+
${Z.trim()}
|
|
222
|
+
${z}`;if(!iB($)){m2($,`${J}
|
|
223
|
+
`,"utf-8");return}let Q=lB($,"utf-8"),Y=Q.indexOf(X),G=Q.indexOf(z);if(Y!==-1&&G!==-1&&G>Y){let U=Q.slice(0,Y),W=Q.slice(G+z.length);m2($,`${U}${J}${W}`,"utf-8");return}if(Q.trimStart().startsWith(rB)){m2($,`${J}
|
|
224
|
+
`,"utf-8");return}m2($,`${J}
|
|
225
|
+
|
|
226
|
+
${Q}`,"utf-8")}var S7="CLAUDE.md",tB="STATUS: BI-SYNC ACTIVE";function b7($){let Z=j7($,S7);if(!oB(Z))return null;return aB(Z,"utf-8")}function x7($,Z){Q$(j7($,S7),Z)}function w$($,Z={}){let X=String($.project?.name??"").trim(),z=String($.project?.main_language??"").trim(),J=String($.project?.type??"").trim(),Q=String($.project?.goal??"").trim(),Y=`<!-- faf: ${[X,z,J,Q].join(" | ")} -->`,G=[];if(Z.doc)G.push(`doc=${Z.doc}`);else G.push(`claim=${Z.claim??"project.faf"}`);if(typeof Z.score==="number")G.push(`score=${Z.score}`);if(G.push(`family=${Z.family??"FAF"}`),Z.siblings&&Z.siblings.length>0)G.push(`siblings=${Z.siblings.join(",")}`);let U=`<!-- faf: ${G.join(" | ")} -->`;return`${Y}
|
|
227
|
+
${U}`}function k7($){let Z=[],X=$.project?.name??"Project",z=$.project?.main_language??"",J=$.project?.goal??"";if(Z.push(w$($)),Z.push(""),Z.push(`# CLAUDE.md — ${X}`),Z.push(""),J)Z.push("## What This Is"),Z.push(""),Z.push(J),Z.push("");let Q=$.stack??{},Y=[];if(z)Y.push(`**Language:** ${z}`);for(let[W,q]of Object.entries(Q))if(q&&q!=="slotignored"&&String(q).trim()){let V=W.replace(/_/g," ").replace(/\b\w/g,(K)=>K.toUpperCase());Y.push(`**${V}:** ${q}`)}if(Y.length>0){Z.push("## Stack"),Z.push("");for(let W of Y)Z.push(`- ${W}`);Z.push("")}let G=$.human_context??{},U=[["Who",G.who],["What",G.what],["Why",G.why],["Where",G.where],["When",G.when],["How",G.how]].filter(([W,q])=>q&&String(q).trim());if(U.length>0){Z.push("## Context"),Z.push("");for(let[W,q]of U)Z.push(`- **${W}:** ${q}`);Z.push("")}return Z.push("---"),Z.push(""),Z.push(`*${tB} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
|
|
228
|
+
`)}function E7($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function c2($){let Z={project:{}},X=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(X)Z.project.name=E7(X[1].trim());if(!Z.project.name){let Q=$.match(/\*\*Name:\*\*\s*(.+)/);if(Q)Z.project.name=E7(Q[1].trim())}let z=$.match(/## What This Is\s*\n\s*\n(.+)/);if(z)Z.project.goal=z[1].trim();if(!Z.project.goal){let Q=$.match(/\*\*What Building:\*\*\s*(.+)/);if(Q)Z.project.goal=Q[1].trim()}let J=$.match(/\*\*Language:\*\*\s*(.+)/);if(J)Z.project.main_language=J[1].trim();if(!Z.project.main_language){let Q=$.match(/\*\*Main Language:\*\*\s*(.+)/);if(Q)Z.project.main_language=Q[1].trim()}return Z}import{readFileSync as AI,writeFileSync as eB,existsSync as RI}from"fs";import{join as $L}from"path";function y7($,Z){eB($L($,"MEMORY.md"),Z,"utf-8")}d();function a$(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function t8($={}){let Z=process.cwd(),X=v(Z);if(!X)console.error(`Error: project.faf not found
|
|
229
|
+
|
|
230
|
+
Run 'faf init' to create one.`),process.exit(2);let z=g7(Z,"CLAUDE.md"),J=g7(Z,"MEMORY.md"),Q=$.direction??"auto";if(Q==="auto")h7(X,z,Z);else if(Q==="push")v7(X,Z);else if(Q==="pull")XL(X,z);if(a$())u7(X,J,Z);if($.watch)console.log(L("watching for changes... (Ctrl+C to stop)")),JL(X,z,J,Z)}function h7($,Z,X){v7($,X)}function v7($,Z){let X=l($),z=k7(X);x7(Z,z),console.log(`${D("◆")} sync .faf → CLAUDE.md ${L("← bi-sync")}`);let J=K0(W0(u($)));X0(J,$)}function XL($,Z){let X=K0(W0(u($)));if(X.tier.name!=="TROPHY")console.error(`${w("×")} sync --pull blocked: requires \uD83C\uDFC6 Trophy (currently ${X.score}%)`),console.error(L(" MD → .faf backfill only runs at 100%. Reach Trophy with 'faf go', then retry.")),process.exit(1);let z=b7(ZL(Z));if(!z){console.error("CLAUDE.md not found.");return}let J=c2(z),Q=l($);if(J.project?.name)Q.project={...Q.project,name:J.project.name};if(J.project?.goal)Q.project={...Q.project,goal:J.project.goal};if(J.project?.main_language)Q.project={...Q.project,main_language:J.project.main_language};r($,Q),console.log(`${D("◆")} sync CLAUDE.md → .faf ${L("← bi-sync (Trophy-gated)")}`);let Y=K0(W0(u($)));X0(Y,$)}function u7($,Z,X){let z=l($),J=f7($).mtimeMs,Q=d2(Z)?f7(Z).mtimeMs:0;if(!d2(Z)||J>Q){let Y=zL(z);y7(X,Y),console.log(`${D("◆")} sync .faf → MEMORY.md ${L("← tri-sync")}`)}else console.log(`${D("◆")} sync MEMORY.md → .faf ${L("← tri-sync")}`)}function zL($){let Z=$.project??{},X=[`# ${Z.name??"Project"} — Memory Topics`,"","> Generated by faf sync (tri-sync)",""];if(Z.name)X.push(`- **Project:** ${Z.name}`);if(Z.goal)X.push(`- **Goal:** ${Z.goal}`);if(Z.main_language)X.push(`- **Language:** ${Z.main_language}`);if(Z.type)X.push(`- **Type:** ${Z.type}`);return X.join(`
|
|
222
231
|
`)+`
|
|
223
|
-
`}function
|
|
232
|
+
`}function JL($,Z,X,z){let{watch:J}=T0("fs"),Q=null,Y=()=>{if(Q)clearTimeout(Q);Q=setTimeout(()=>{if(console.log(L("change detected...")),h7($,Z,z),a$())u7($,X,z)},200)};if(J($,Y),d2(Z))J(Z,Y);if(a$()&&d2(X))J(X,Y)}import{writeFileSync as QL}from"fs";d();function m7($,Z={}){let X=$??v();if(!X)console.error(`Error: project.faf not found
|
|
224
233
|
|
|
225
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
234
|
+
Run 'faf init' to create one.`),process.exit(2);let z=u(X),J=y2(z),Q=Z.output??X.replace(/\.faf$/,".fafb");QL(Q,J),console.log(`${D("compiled")} ${Q} ${L(`(${J.length} bytes)`)}`)}import{readFileSync as YL}from"fs";function c7($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let X=new Uint8Array(YL($));if(String.fromCharCode(X[0],X[1],X[2],X[3])!=="FAFB")console.error("Error: Not a valid .fafb file (missing FAFB magic bytes)."),process.exit(3);let z=Z7(X);console.log(JSON.stringify(z,null,2))}function d7($){let Z=[];if(!$||typeof $!=="object")return Z.push("File is not a valid YAML mapping"),{valid:!1,errors:Z};let X=$;if(!X.faf_version)Z.push("Missing required field: faf_version");if(!X.project?.name)Z.push("Missing required field: project.name");if(X.app_type==="about"){if(!X.about?.represents)Z.push("app_type 'about' requires about.represents (owner/repo of the source codebase)");else if(!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(X.about.represents))Z.push(`about.represents must be "owner/repo" format (got: ${X.about.represents})`);if(X.about?.source_score!==void 0){let z=X.about.source_score;if(typeof z!=="number"||z<0||z>100)Z.push(`about.source_score must be a number 0-100 (got: ${z})`)}}return{valid:Z.length===0,errors:Z}}d();function e8($,Z={}){let X=$??v();if(!X)console.error(`Error: project.faf not found
|
|
226
235
|
|
|
227
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
228
|
-
--strict requires 100%`)),process.exit(1)}import{
|
|
229
|
-
`)}function
|
|
230
|
-
`)}function
|
|
231
|
-
`)}function
|
|
232
|
-
`)}function
|
|
236
|
+
Run 'faf init' to create one.`),process.exit(2);let z=l(X),J=d7(z);if(!J.valid){console.log(`${w("invalid")} ${X}`);for(let G of J.errors)console.log(` ${L("x")} ${G}`);process.exit(3)}let Q=u(X);if(!$7(Q))console.log(`${w("invalid yaml")} ${X}`),process.exit(3);console.log(`${D("valid")} ${X}`);let Y=H0(Q);if(X0(Y,X),Z.strict&&Y.score<100)console.log(L(`
|
|
237
|
+
--strict requires 100%`)),process.exit(1)}import{join as GL}from"path";function UL($){let Z=[];if(Z.push(w$($)),Z.push(""),Z.push(`# AGENTS.md — ${$.project?.name??"Project"}`),Z.push(""),Z.push("> Auto-generated from project.faf — do not edit directly"),Z.push(""),Z.push("## Project Context"),Z.push(""),$.project?.name)Z.push(`- **Name:** ${$.project.name}`);if($.project?.goal)Z.push(`- **Goal:** ${$.project.goal}`);if($.project?.main_language)Z.push(`- **Language:** ${$.project.main_language}`);if(Z.push(""),Z.push("## Stack"),Z.push(""),$.stack){for(let[X,z]of Object.entries($.stack))if(z&&z!=="slotignored"&&z!=="")Z.push(`- **${X}:** ${z}`)}if($.human_context){Z.push(""),Z.push("## Human Context"),Z.push("");for(let[X,z]of Object.entries($.human_context))if(z&&z!=="")Z.push(`- **${X}:** ${z}`)}return Z.push(""),Z.join(`
|
|
238
|
+
`)}function p7($,Z){Q$(GL($,"AGENTS.md"),UL(Z))}import{join as WL}from"path";function qL($){let Z=[];if(Z.push(w$($)),Z.push(""),Z.push("# .cursorrules"),Z.push(`# Auto-generated 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[X,z]of Object.entries($.stack))if(z&&z!=="slotignored"&&z!=="")Z.push(`# ${X}: ${z}`)}return Z.push(""),Z.join(`
|
|
239
|
+
`)}function l7($,Z){Q$(WL($,".cursorrules"),qL(Z),"# faf:start","# faf:end")}import{join as VL}from"path";function KL($){let Z=[];if(Z.push(w$($)),Z.push(""),Z.push(`# GEMINI.md — ${$.project?.name??"Project"}`),Z.push(""),Z.push("> Auto-generated from project.faf"),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($.stack){Z.push(""),Z.push("## Stack");for(let[X,z]of Object.entries($.stack))if(z&&z!=="slotignored"&&z!=="")Z.push(`- ${X}: ${z}`)}return Z.push(""),Z.join(`
|
|
240
|
+
`)}function i7($,Z){Q$(VL($,"GEMINI.md"),KL(Z))}import{existsSync as HL,mkdirSync as BL,readFileSync as LL,writeFileSync as n7}from"fs";import{join as s7}from"path";var NL="https://mcpaas.live/grok/mcp/v1",r7="mcp_servers.grok-faf-mcp";function ML($){return[`[${r7}]`,`url = "${NL}"`,""].join(`
|
|
241
|
+
`)}function a7($,Z){let X=s7($,".grok"),z=s7(X,"config.toml"),J=ML(Z);if(!HL(z))return BL(X,{recursive:!0}),n7(z,`# grok-faf-mcp — wired by FAF from project.faf
|
|
242
|
+
|
|
243
|
+
`+J,"utf-8"),"created";let Q=LL(z,"utf-8");if(Q.includes(`[${r7}]`))return"unchanged";let Y=Q.endsWith(`
|
|
244
|
+
|
|
245
|
+
`)?"":Q.endsWith(`
|
|
246
|
+
`)?`
|
|
247
|
+
`:`
|
|
248
|
+
|
|
249
|
+
`;return n7(z,Q+Y+J,"utf-8"),"merged"}d();import{writeFileSync as TL}from"fs";import{join as OL}from"path";var o7=r1.orange,DL=r1.cyan,IL=r1.cyanDeep,AL="#FF9500",RL="#FF3B30",FL="#E6EDF3",wL="#6E7681",t7={TROPHY:{glyph:"\uD83C\uDFC6",color:o7},GOLD:{glyph:"★",color:o7},SILVER:{glyph:"◆",color:DL},BRONZE:{glyph:"◇",color:IL},GREEN:{glyph:"●",color:FL},YELLOW:{glyph:"●",color:AL},RED:{glyph:"○",color:RL},WHITE:{glyph:"♡",color:wL}};function o$($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var e7=["who","what","why","where","when","how"];function p2($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,X])=>`<div class="row"><div class="k">${o$(Z)}</div><div class="v">${o$(X)}</div></div>`).join(`
|
|
250
|
+
`)}function PL($,Z,X="project.faf"){let z=o$($.project?.name??"Project"),J=Z.tier?.name??"WHITE",Q=t7[J]??t7.WHITE,Y=Z.inherited?Z.represents?`inherited from ${o$(Z.represents)}`:"inherited":`${Z.score}%`,G=J==="TROPHY"&&!Z.inherited,U=$.human_context??{},W=e7.map((B)=>[B,U[B]]),q=Object.entries(U).filter(([B])=>!e7.includes(B)),V=[["goal",$.project?.goal],["main_language",$.project?.main_language],["type",$.project?.type],["framework",$.project?.framework],["faf_version",$.faf_version]],K=Object.entries($.stack??{}),N=K.filter(([,B])=>B&&B!=="slotignored"&&String(B).trim()!==""),O=K.filter(([,B])=>B==="slotignored").length;return`<!DOCTYPE html>
|
|
233
251
|
<html lang="en">
|
|
234
252
|
<head>
|
|
235
253
|
<meta charset="UTF-8">
|
|
236
254
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
237
|
-
<title>${
|
|
255
|
+
<title>${z} — project.faf</title>
|
|
238
256
|
<meta name="description" content="Visual render of project.faf. Generated by faf — humans like visuals, we gave them one.">
|
|
239
257
|
<meta name="robots" content="index,follow">
|
|
240
258
|
<style>
|
|
@@ -269,70 +287,71 @@ footer strong{color:#e6edf3}
|
|
|
269
287
|
<div class="bar"></div>
|
|
270
288
|
<div class="eyebrow">project.faf · visual render</div>
|
|
271
289
|
<header>
|
|
272
|
-
<h1>${
|
|
273
|
-
<span class="badge">${Q.glyph} ${
|
|
290
|
+
<h1>${z}</h1>
|
|
291
|
+
<span class="badge">${Q.glyph} ${o$(J)}</span>
|
|
274
292
|
<span class="score">${Y}</span>
|
|
275
293
|
</header>
|
|
276
294
|
<div class="meter"><span></span></div>
|
|
277
|
-
${
|
|
295
|
+
${G?'<p class="award statline"><span class="awd-pre">✅ All Required slots filled.</span> <span class="awd-win">100% Trophy \uD83C\uDFC6 Awarded</span></p>':`<p class="muted statline">${Z.populated}/${Z.active} slots populated · ${Z.total} total${O?` · ${O} slotignored`:""}</p>`}
|
|
278
296
|
|
|
279
297
|
<section>
|
|
280
298
|
<h2>The 6 W's</h2>
|
|
281
|
-
${
|
|
282
|
-
${
|
|
299
|
+
${p2(W)||'<p class="muted">No human_context yet.</p>'}
|
|
300
|
+
${q.length?p2(q):""}
|
|
283
301
|
</section>
|
|
284
302
|
|
|
285
303
|
<section>
|
|
286
304
|
<h2>Project</h2>
|
|
287
|
-
${
|
|
305
|
+
${p2(V)||'<p class="muted">—</p>'}
|
|
288
306
|
</section>
|
|
289
307
|
|
|
290
308
|
<section>
|
|
291
309
|
<h2>Stack</h2>
|
|
292
|
-
${
|
|
310
|
+
${N.length?p2(N):'<p class="muted">No active stack slots.</p>'}
|
|
293
311
|
</section>
|
|
294
312
|
|
|
295
313
|
<footer>
|
|
296
|
-
Rendered on-demand from your current <strong>${
|
|
314
|
+
Rendered on-demand from your current <strong>${o$(X)}</strong><br>
|
|
297
315
|
<strong>Humans like visuals. <span style="color:#00D4D4">We gave them one.</span></strong>
|
|
298
316
|
</footer>
|
|
299
317
|
</div>
|
|
300
318
|
</body>
|
|
301
319
|
</html>
|
|
302
|
-
`}function
|
|
320
|
+
`}function l2($,Z,X,z="project.faf"){TL(OL($,"project.html"),PL(Z,X,z),"utf-8")}import{writeFileSync as _L}from"fs";import{join as CL}from"path";var $X="application/vnd.faf+yaml",EL="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",jL=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function SL($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&jL.test(Z))return Z;let X=$.project?.homepage??$.project?.website??$.project?.url,z="local";if(X)try{z=new URL(X).hostname.replace(/^www\./,"").split(".").reverse().join(".")}catch{}let J=Z.replace(/[^a-zA-Z0-9._-]/g,"-").replace(/^-+|-+$/g,"")||"project";return`${z}/${J}`}function bL($){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 xL($,Z={}){let X={$schema:EL,name:SL($),version:String($.project?.version??"0.1.0"),description:bL($)},z=$.project?.name;if(z&&z.length<=100)X.title=z;let J=$.project?.homepage??$.project?.website??$.project?.url;if(J)X.websiteUrl=J;if(Z.remoteUrl)X.remotes=[{type:"streamable-http",url:Z.remoteUrl}];return X._meta={"one.faf/context":{faf:Z.fafPointer??"./project.faf",mediaType:$X,iana:`https://www.iana.org/assignments/media-types/${$X}`,deterministic:!0,generated:$.generated??Z.now??new Date().toISOString()}},X}function ZX($,Z,X={}){let z=xL(Z,X),J=CL($,"server-card");return _L(J,JSON.stringify(z,null,2)+`
|
|
321
|
+
`,"utf-8"),J}d();function t$($={}){let Z=v();if(!Z)console.error(`Error: project.faf not found
|
|
303
322
|
|
|
304
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
323
|
+
Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=l(Z),J=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.grok&&!$.conductor&&!$.html&&!$.card;if(J||$.agents)p7(X,z),console.log(" AGENTS.md");if(J||$.cursor)l7(X,z),console.log(" .cursorrules");if(J||$.gemini)i7(X,z),console.log(" GEMINI.md");if($.grok){let Y=a7(X,z);console.log(` .grok/config.toml (${Y})`)}if(J||$.html){let Y=H0(u(Z));l2(X,z,Y,Z),console.log(" project.html")}let Q=z.app_type==="server-card"||z.project?.type==="server-card";if($.card||J&&Q){let Y=ZX(X,z);console.log(` ${Y.replace(`${X}/`,"")}`)}console.log(`${D("exported")} ${L(`from ${Z}`)}`)}import{join as kL}from"path";import yL from"open";d();function fL($){if(process.env.CI)return!1;try{return yL($).catch(()=>{return}),!0}catch{return!1}}function XX(){let $=v();if(!$)console.error(`Error: project.faf not found
|
|
305
324
|
|
|
306
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),
|
|
325
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=l($),z=H0(u($));l2(Z,X,z,$);let J=kL(Z,"project.html"),Q=fL(J);console.log(" project.html"),console.log(Q?`${D("opened")} ${L("in your browser")}`:`${D("rendered")} ${L(`file://${J}`)}`)}import{mkdirSync as gL,rmSync as hL}from"fs";import{join as zX}from"path";import{execSync as vL}from"child_process";import{tmpdir as uL}from"os";d();function JX($){if(!$)console.error(`Error: Please provide a GitHub URL.
|
|
307
326
|
|
|
308
|
-
Usage: faf git <url>`),process.exit(1);let Z=$.endsWith(".git")?$:`${$}.git`,
|
|
327
|
+
Usage: faf git <url>`),process.exit(1);let Z=$.endsWith(".git")?$:`${$}.git`,X=zX(uL(),`faf-git-${Date.now()}`);gL(X,{recursive:!0});try{console.log(L(`cloning ${$}...`));try{vL(`git clone --depth 1 ${Z} ${X}`,{stdio:"pipe"})}catch(G){let W=(G?.stderr?.toString()??"").trim().split(`
|
|
309
328
|
`).slice(-2).join(" ").trim()||"git clone failed";console.error(`Error: could not clone ${$}
|
|
310
329
|
|
|
311
|
-
${
|
|
312
|
-
`);let $=new Map;for(let Z of
|
|
330
|
+
${W}`),process.exit(1)}let z=r$(X),J=zX(process.cwd(),"project.faf");r(J,z),console.log(`${D("created")} ${J}`);let Q=u(J),Y=K0(W0(Q));X0(Y,J)}finally{hL(X,{recursive:!0,force:!0})}}d();function QX($={}){if($.version||Object.keys($).length===0)cL()}function cL(){let $=$3();console.log(`${D(w("faf"))} v${$.version}`),console.log(L(`kernel ${X7()} IANA application/vnd.faf+yaml`))}var t1=[{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:"mobile"},{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"}];d();function YX(){console.log(`${D("formats")} ${L("— supported file types")}
|
|
331
|
+
`);let $=new Map;for(let Z of t1){let X=$.get(Z.category)??[];X.push(Z),$.set(Z.category,X)}for(let[Z,X]of $){console.log(` ${w(Z)}`);for(let z of X)console.log(` ${z.name} ${L(z.extensions.join(", "))}`);console.log()}console.log(L(` ${t1.length} formats across ${$.size} categories`))}d();import{readdirSync as dL,rmSync as pL}from"fs";import{tmpdir as lL}from"os";import{join as iL}from"path";function GX(){let $=lL(),Z=0;try{let X=dL($);for(let z of X)if(z.startsWith("faf-git-"))pL(iL($,z),{recursive:!0,force:!0}),Z++}catch{}if(Z>0)console.log(`${D("cleared")} ${Z} cached director${Z===1?"y":"ies"}`);else console.log(L("nothing to clear"))}function UX($={}){let Z=v();if(!Z)console.error(`Error: project.faf not found
|
|
313
332
|
|
|
314
|
-
Run 'faf init' to create one.`),process.exit(2);if($.json){let
|
|
333
|
+
Run 'faf init' to create one.`),process.exit(2);if($.json){let X=l(Z);console.log(JSON.stringify(X,null,2))}else{let X=u(Z);console.log(X)}}d();function WX(){let $=v();if(!$)console.error(`Error: project.faf not found
|
|
315
334
|
|
|
316
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=
|
|
317
|
-
`))}import{existsSync as
|
|
335
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=l($),X=[];for(let z of $0){let[J,Q]=z.path.split("."),G=Z[J]?.[Q];if(J$(G)||G==="slotignored")continue;X.push(`${z.path}: ${G}`)}if(X.length===0){console.log(L("no populated slots"));return}console.log(X.join(`
|
|
336
|
+
`))}import{existsSync as nL,statSync as qX}from"fs";import{join as sL}from"path";d();var rL=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"];function VX(){let $=v();if(!$)console.error(`Error: project.faf not found
|
|
318
337
|
|
|
319
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),
|
|
320
|
-
`),console.log(` ${
|
|
321
|
-
run ${
|
|
338
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=qX($).mtimeMs;console.log(`${D("drift")} ${L("— context file sync status")}
|
|
339
|
+
`),console.log(` ${w(".faf")} ${L(Z3(X))}`);let z=0;for(let J of rL){let Q=sL(Z,J);if(!nL(Q)){console.log(` ${L("○")} ${J} ${L("missing")}`);continue}let Y=qX(Q).mtimeMs,G=Y-X;if(Math.abs(G)<1000)console.log(` ${D("●")} ${J} ${L("in sync")}`);else if(G>0)console.log(` ${w("!")} ${J} ${w("newer")} ${L(Z3(Y))}`),z++;else console.log(` ${L("○")} ${J} ${L("older")} ${L(Z3(Y))}`),z++}if(z>0)console.log(L(`
|
|
340
|
+
run ${w("'faf sync'")} to resolve drift`))}function Z3($){let Z=Date.now()-$,X=Math.floor(Z/1000);if(X<60)return`${X}s ago`;let z=Math.floor(X/60);if(z<60)return`${z}m ago`;let J=Math.floor(z/60);if(J<24)return`${J}h ago`;return`${Math.floor(J/24)}d ago`}d();function KX($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
|
|
322
341
|
|
|
323
|
-
Example: faf edit project.name "My Project"`),process.exit(1);let
|
|
342
|
+
Example: faf edit project.name "My Project"`),process.exit(1);let X=v();if(!X)console.error(`Error: project.faf not found
|
|
324
343
|
|
|
325
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
344
|
+
Run 'faf init' to create one.`),process.exit(2);let z=l(X),J=$.split(".");if(J.length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let[Q,Y]=J;if(!z[Q]||typeof z[Q]!=="object")z[Q]={};z[Q][Y]=Z,r(X,z),console.log(`${D("updated")} ${$} ${L("→")} ${Z}`)}import{existsSync as i2,readFileSync as X3}from"fs";import{join as e1}from"path";d();function HX(){let $=process.cwd(),Z=[],X={faf_version:"2.5.0",project:{}},z=e1($,"CLAUDE.md");if(i2(z)){let U=X3(z,"utf-8"),W=c2(U);if(W.project?.name)X.project.name=W.project.name;if(W.project?.goal)X.project.goal=W.project.goal;if(W.project?.main_language)X.project.main_language=W.project.main_language;Z.push("CLAUDE.md")}let J=e1($,"AGENTS.md");if(i2(J)){let U=X3(J,"utf-8");if(!X.project.name){let W=U.match(/^#\s+(.+)/m);if(W)X.project.name=W[1].trim()}Z.push("AGENTS.md")}let Q=e1($,"GEMINI.md");if(i2(Q)){let U=X3(Q,"utf-8");if(!X.project.name){let W=U.match(/^#\s+(.+)/m);if(W)X.project.name=W[1].trim()}Z.push("GEMINI.md")}let Y=e1($,".cursorrules");if(i2(Y))Z.push(".cursorrules");if(Z.length===0)console.error("No context files found (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules)."),process.exit(2);let G=v($);if(G){let U=l(G);if(!U.project)U.project={};if(X.project.name&&!U.project.name)U.project.name=X.project.name;if(X.project.goal&&!U.project.goal)U.project.goal=X.project.goal;if(X.project.main_language&&!U.project.main_language)U.project.main_language=X.project.main_language;r(G,U),console.log(`${D("◆")} recover merged into ${G}`)}else{let U=e1($,"project.faf");r(U,X),console.log(`${D("◆")} recover created ${U}`)}console.log(L(` sources: ${Z.join(", ")}`))}d();var $4="2.5.0";function BX($={}){let Z=v();if(!Z)console.error(`Error: project.faf not found
|
|
326
345
|
|
|
327
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
328
|
-
`),console.log(` Status: ${$?
|
|
329
|
-
`);let $=[["tri-sync",".faf ↔ CLAUDE.md ↔ MEMORY.md"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,
|
|
330
|
-
`),console.log(" Set FAF_PRO=1 in your environment to enable Pro features."),console.log(""),console.log(
|
|
346
|
+
Run 'faf init' to create one.`),process.exit(2);let X=l(Z),z=X.faf_version??"unknown";if(z===$4){console.log(`${D("◆")} migrate already at v${$4}`);return}if(X.faf_version=$4,!X.project)X.project={};if(!X.stack)X.stack={};if(!X.human_context)X.human_context={};if(!X.monorepo)X.monorepo={};if($.dryRun){console.log(`${D("◆")} migrate ${L("(dry run)")} v${z} → v${$4}`),console.log(L(` would update ${Z}`));return}r(Z,X),console.log(`${D("◆")} migrate v${z} → v${$4}`),console.log(L(` updated ${Z}`))}d();function LX($){if($==="features")oL();else if($==="activate")tL();else aL()}function aL(){let $=a$();if(console.log(`${D("pro")} ${L("— FAF Pro status")}
|
|
347
|
+
`),console.log(` Status: ${$?V0(w("PRO")):w("Free")}`),console.log(""),!$)console.log(L(" Upgrade: faf pro activate"))}function oL(){console.log(`${D("pro")} ${L("— Pro features")}
|
|
348
|
+
`);let $=[["tri-sync",".faf ↔ CLAUDE.md ↔ MEMORY.md"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,X]of $)console.log(` ${D("◆")} ${w(Z)} ${L("—")} ${X}`);console.log("")}function tL(){console.log(`${D("pro")} ${L("— activate")}
|
|
349
|
+
`),console.log(" Set FAF_PRO=1 in your environment to enable Pro features."),console.log(""),console.log(L(" export FAF_PRO=1")),console.log(""),console.log(L(" Visit: https://faf.one/pro")),import("open").then(({default:$})=>$("https://faf.one/pro")).catch(()=>{})}import{gzipSync as eL}from"zlib";d();function NX($={}){let Z=v();if(!Z)console.error(`Error: project.faf not found
|
|
331
350
|
|
|
332
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
333
|
-
`),console.log(` ${Q}`),$.copy)try{let{execSync:Y}=
|
|
334
|
-
copied to clipboard`))}catch{console.log(
|
|
335
|
-
copy failed — install xclip or pbcopy`))}}import{mkdirSync as
|
|
351
|
+
Run 'faf init' to create one.`),process.exit(2);let X=u(Z),J=eL(Buffer.from(X)).toString("base64url");if($.raw){console.log(J);return}let Q=`https://faf.one/share?d=${J}`;if(console.log(`${D("◆")} share ${L(Z)}
|
|
352
|
+
`),console.log(` ${Q}`),$.copy)try{let{execSync:Y}=T0("child_process"),G=process.platform;if(G==="darwin")Y("pbcopy",{input:Q});else if(G==="linux")Y("xclip -selection clipboard",{input:Q});console.log(L(`
|
|
353
|
+
copied to clipboard`))}catch{console.log(L(`
|
|
354
|
+
copy failed — install xclip or pbcopy`))}}import{mkdirSync as $N,writeFileSync as ZN,rmSync as XN}from"fs";import{tmpdir as zN}from"os";import{join as MX}from"path";d();function TX(){let $=MX(zN(),`faf-demo-${Date.now()}`);$N($,{recursive:!0}),console.log(`${D("demo")} ${L("— FAF in action")}
|
|
336
355
|
`);let Z=`faf_version: 2.5.0
|
|
337
356
|
project:
|
|
338
357
|
name: acme-app
|
|
@@ -358,25 +377,25 @@ human_context:
|
|
|
358
377
|
where: Cloud (Vercel + AWS)
|
|
359
378
|
when: "2026"
|
|
360
379
|
how: Agile sprints with CI/CD
|
|
361
|
-
`,
|
|
362
|
-
`)),console.log(` ${
|
|
363
|
-
${
|
|
364
|
-
`);for(let Y of Q)console.log(` ${
|
|
365
|
-
`);for(let Y of Q)console.log(` ${
|
|
380
|
+
`,X=MX($,"project.faf");ZN(X,Z),console.log(` ${w("1.")} Created sample project.faf`),console.log(L(` ${X}
|
|
381
|
+
`)),console.log(` ${w("2.")} Scoring...`);let z=K0(W0(u(X)));console.log(""),X0(z,"project.faf",!0),XN($,{recursive:!0,force:!0}),console.log(`
|
|
382
|
+
${L(' Demo complete. Run "faf init" in your project to get started.')}`)}d();function OX($,Z={}){if(!$)console.error("Usage: faf search <keyword>"),process.exit(2);let X=$.toLowerCase(),z=!Z.slots&&!Z.formats,J=0;if(z||Z.slots){let Q=$0.filter((Y)=>Y.path.toLowerCase().includes(X)||Y.description.toLowerCase().includes(X)||Y.category.toLowerCase().includes(X));if(Q.length>0){console.log(`${D("slots")} ${L(`— ${Q.length} match${Q.length===1?"":"es"}`)}
|
|
383
|
+
`);for(let Y of Q)console.log(` ${w(`#${Y.index}`)} ${Y.path} ${L("—")} ${Y.description} ${L(`[${Y.category}]`)}`);console.log(""),J+=Q.length}}if(z||Z.formats){let Q=t1.filter((Y)=>Y.name.toLowerCase().includes(X)||Y.extensions.some((G)=>G.toLowerCase().includes(X))||Y.category.toLowerCase().includes(X));if(Q.length>0){console.log(`${D("formats")} ${L(`— ${Q.length} match${Q.length===1?"":"es"}`)}
|
|
384
|
+
`);for(let Y of Q)console.log(` ${w(Y.name)} ${L(Y.extensions.join(", "))} ${L(`[${Y.category}]`)}`);console.log(""),J+=Q.length}}if(J===0)console.log(L(` No results for "${$}"`))}import{writeFileSync as JN}from"fs";d();function DX($={}){let Z=v();if(!Z)console.error(`Error: project.faf not found
|
|
366
385
|
|
|
367
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
386
|
+
Run 'faf init' to create one.`),process.exit(2);let X=l(Z),z=u(Z),J=H0(z),Q={taf_version:"1.0.0",generated:new Date().toISOString(),source:Z,project:X.project?.name??"unknown",faf_version:X.faf_version??"unknown",score:J.score,tier:J.tier.name,populated:J.populated,active:J.active,total:J.total,slots:J.slots},Y=JSON.stringify(Q,null,2);if($.output)JN($.output,Y,"utf-8"),console.log(`${D("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as WN}from"readline";import{existsSync as AX,readFileSync as qN,writeFileSync as VN,unlinkSync as KN}from"fs";import{join as HN}from"path";var e$="(terse — 3-4 words)",QN=[{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? ${e$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${e$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${e$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${e$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${e$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${e$}`,header:"How",type:"text",required:!0}],YN=[{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}],GN=[...QN,...YN],UN=new Map(GN.map(($)=>[$.path,$]));function IX($){let Z=UN.get($);if(Z)return Z.question;let X=z7.get($)??$0.find((z)=>z.canonical===$);return X?`${X.description}?`.replace(/\?\?$/,"?"):`${$}?`}d();var BN=".faf-session.json";function LN($,Z){let X=Z.split("."),z=$;for(let J of X){if(z===null||z===void 0||typeof z!=="object")return;z=z[J]}return z}function NN($,Z,X){let z=Z.split("."),J=$;for(let Q=0;Q<z.length-1;Q++){if(!J[z[Q]]||typeof J[z[Q]]!=="object")J[z[Q]]={};J=J[z[Q]]}J[z[z.length-1]]=X}async function RX($={}){let Z=v();if(!Z)console.error(`Error: project.faf not found
|
|
368
387
|
|
|
369
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
370
|
-
`));let
|
|
371
|
-
session saved. Resume with: faf go --resume`));break}if(B.toLowerCase()==="skip"||B.trim()==="")continue;
|
|
372
|
-
${
|
|
373
|
-
`),console.log(` ${
|
|
388
|
+
Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=HN(X,BN),J=0;if($.resume&&AX(z))try{J=JSON.parse(qN(z,"utf-8")).slotIndex,console.log(L(` resuming from slot #${J+1}`))}catch{}let Q=l(Z),Y=$0.filter((N)=>{let O=LN(Q,N.path);return J$(O)&&O!=="slotignored"});if(Y.length===0){console.log(`${D("◆")} go all slots populated — \uD83C\uDFC6 Trophy`);let N=K0(W0(u(Z)));X0(N,Z);return}console.log(`${D("go")} ${L("— guided interview to \uD83C\uDFC6 Trophy")}`);let G=Y.length===1?"slot":"slots";console.log(L(` ${Y.length} ${G} from Trophy. Enter a value, "skip" to skip, or "quit" to stop.
|
|
389
|
+
`));let U=WN({input:process.stdin,output:process.stdout}),W=(N)=>new Promise((O)=>U.question(N,O)),q=0,V=Y.slice(J);for(let N=0;N<V.length;N++){let O=V[N],B=await W(` ${w(`#${O.index}`)} ${IX(O.path)} ${L(`(${O.path})`)}: `);if(B.toLowerCase()==="quit"){let T={slotIndex:J+N,fafPath:Z};VN(z,JSON.stringify(T),"utf-8"),console.log(L(`
|
|
390
|
+
session saved. Resume with: faf go --resume`));break}if(B.toLowerCase()==="skip"||B.trim()==="")continue;NN(Q,O.path,B.trim()),q++}if(U.close(),q>0)r(Z,Q),console.log(`
|
|
391
|
+
${D("◆")} go filled ${q} slot${q===1?"":"s"}`);let K=K0(W0(u(Z)));if(X0(K,Z),AX(z))try{KN(z)}catch{}}d();var HM=[/^(tbd|see\s+readme|todo|fixme|coming\s+soon|n\/a|unknown|none|null|not\s+specified)\b/i,/^(software|application|app|project|tool|library|framework)\.?$/i,/^(for\s+(users|developers|teams|engineers))\.?$/i,/^(general\s+purpose|various|multiple|description|goal|name|title)\.?$/i];function BM($){if(typeof $!=="string")return!1;let Z=$.trim();if(Z.length<4||Z.length>280)return!1;return!HM.some((X)=>X.test(Z))}function LM($,Z){let X=Z.split("."),z=$;for(let J of X){if(z===null||z===void 0||typeof z!=="object")return;z=z[J]}return z}function NM($,Z,X){let z=Z.split("."),J=$;for(let Q=0;Q<z.length-1;Q++){if(!J[z[Q]]||typeof J[z[Q]]!=="object")J[z[Q]]={};J=J[z[Q]]}J[z[z.length-1]]=X}async function Rz($){if($==="analyze")await TM();else if($==="enhance")await MM();else console.log(`${D("ai")} ${L("— AI-powered features")}
|
|
392
|
+
`),console.log(` ${w("faf ai enhance")} ${L("— fill empty slots via Claude")}`),console.log(` ${w("faf ai analyze")} ${L("— get improvement suggestions")}`),console.log(""),console.log(L(" Requires ANTHROPIC_API_KEY environment variable."))}async function Fz(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
|
|
374
393
|
|
|
375
|
-
export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (
|
|
394
|
+
export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (Az(),Iz));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
|
|
376
395
|
|
|
377
|
-
npm install @anthropic-ai/sdk`),process.exit(2)}}async function
|
|
396
|
+
npm install @anthropic-ai/sdk`),process.exit(2)}}async function MM(){let $=v();if(!$)console.error(`Error: project.faf not found
|
|
378
397
|
|
|
379
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=
|
|
398
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=l($),X=u($),z=$0.filter((U)=>{let W=LM(Z,U.path);return J$(W)&&W!=="slotignored"});if(z.length===0){console.log(`${D("◆")} ai enhance all slots populated`);return}console.log(`${D("ai")} enhance ${L(`extracting from ${z.length} empty slots...`)}`);let J=await Fz(),Q=z.map((U)=>`- ${U.path}: ${U.description}`).join(`
|
|
380
399
|
`),Y=`You are extracting concrete content from a project's .faf file to fill empty slots. STRICT RULES:
|
|
381
400
|
|
|
382
401
|
1. Return JSON mapping dot-paths to values OR null.
|
|
@@ -387,24 +406,46 @@ ${w("◆")} go filled ${U} slot${U===1?"":"s"}`);let K=V0(W0(u(Z)));if(Z0(K,Z),
|
|
|
387
406
|
|
|
388
407
|
The .faf source:
|
|
389
408
|
|
|
390
|
-
${
|
|
409
|
+
${X}
|
|
391
410
|
|
|
392
411
|
Empty slots to fill (return null if no concrete evidence):
|
|
393
412
|
${Q}
|
|
394
413
|
|
|
395
|
-
Respond with ONLY valid JSON, no markdown fences. Each value is either a short string (with concrete evidence) or null (leave empty).`,
|
|
396
|
-
${
|
|
397
|
-
${
|
|
398
|
-
${
|
|
414
|
+
Respond with ONLY valid JSON, no markdown fences. Each value is either a short string (with concrete evidence) or null (leave empty).`,G=await J.messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:Y}]});try{let U=G.content[0].text,W=JSON.parse(U),q=0,V=0;for(let K of z){let N=W[K.path];if(N===null||N===void 0)continue;if(BM(N))NM(Z,K.path,N),console.log(` ${D("●")} ${K.path} ${L("←")} ${N}`),q++;else console.log(` ${L("○")} ${K.path} ${L("— rejected as slop, left empty")}`),V++}if(q>0){r($,Z),console.log(`
|
|
415
|
+
${D("◆")} ai enhance filled ${q} slot${q===1?"":"s"}${V>0?` (${V} rejected)`:""}`);let K=K0(W0(u($)));X0(K,$)}else if(V>0)console.log(`
|
|
416
|
+
${L("all extractions rejected as slop. Run")} ${w("'faf go'")} ${L("for interview-fill.")}`);else console.log(`
|
|
417
|
+
${L("no concrete evidence for empty slots. Run")} ${w("'faf go'")} ${L("for interview-fill.")}`)}catch{console.error("Error: Could not parse AI response.")}}async function TM(){let $=v();if(!$)console.error(`Error: project.faf not found
|
|
399
418
|
|
|
400
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=u($);console.log(`${
|
|
419
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=u($);console.log(`${D("ai")} analyze ${L("getting suggestions...")}`);let z=await(await Fz()).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.
|
|
401
420
|
|
|
402
421
|
${Z}
|
|
403
422
|
|
|
404
|
-
Be concise. One line per suggestion.`}]});console.log(""),console.log(
|
|
405
|
-
`),console.log(` ${
|
|
406
|
-
|
|
407
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=c($),z={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(z,null,2))}p();import{readdirSync as nL,readFileSync as sL,existsSync as rL}from"fs";import{join as aL}from"path";var oL=["BRAKE","ENGINE","AERO","PIT"],tL=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|PIT)(?:[^A-Za-z]|$)/i;function eL($){let Z=$.match(tL);if(!Z)return null;return Z[1].toUpperCase()}function $N($){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 ZN($,Z){let z=[];switch(Z){case"typescript":{let X=/\b(describe|test|it)\s*\(\s*(['"`])((?:\\.|(?!\2).)*)\2/g,J=[],Q;while((Q=X.exec($))!==null)J.push({idx:Q.index,type:Q[1]==="describe"?"describe":"test",name:Q[3]});let Y=[],q=0,W=null,G=0;for(let U=0;U<$.length;U++){while(G<J.length&&J[G].idx===U){let K=J[G];if(K.type==="describe")W=K.name;else{let L=Y.map((B)=>B.name),O=L.length>0?`${L.join(" > ")} > ${K.name}`:K.name;z.push(O)}G++}let V=$[U];if(V==="{"){if(q++,W!==null)Y.push({name:W,openDepth:q}),W=null}else if(V==="}"){q--;while(Y.length>0&&q<Y[Y.length-1].openDepth)Y.pop()}}break}case"rust":{let X=/#\[test\]\s*(?:\r?\n)\s*(?:pub\s+)?fn\s+([a-zA-Z_][a-zA-Z_0-9]*)/g,J;while((J=X.exec($))!==null)z.push(J[1]);break}case"python":{let X=/^\s*def\s+(test_[a-zA-Z_0-9]+)\s*\(/gm,J;while((J=X.exec($))!==null)z.push(J[1]);break}case"zig":{let X=/\btest\s+"((?:\\.|[^"\\])+)"/g,J;while((J=X.exec($))!==null)z.push(J[1]);break}case"go":{let X=/\bfunc\s+(Test[A-Z][a-zA-Z_0-9]*)\s*\(/g,J;while((J=X.exec($))!==null)z.push(J[1]);break}}return z}var zN=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function rz($,Z=[]){let z;try{z=nL($,{withFileTypes:!0})}catch{return Z}for(let X of z){if(zN.has(X.name))continue;if(X.name.startsWith(".")&&X.name!==".")continue;let J=aL($,X.name);if(X.isDirectory())rz(J,Z);else if(X.isFile())Z.push(J)}return Z}function XN($){let Z=[];if(!rL($))return Z;let z=rz($);for(let X of z){let J=X.split("/").pop()??"",Q=$N(J);if(!Q.ok||!Q.lang)continue;let Y;try{Y=sL(X,"utf-8")}catch{continue}if(Q.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(Q.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let q=ZN(Y,Q.lang),W=X.replace(`${$}/`,"");for(let G of q)Z.push({file:W,language:Q.lang,testName:G,tier:eL(G)})}return Z}function JN($){let Z={BRAKE:0,ENGINE:0,AERO:0,PIT:0},z={},X=0,J=[],Q=new Set;for(let Y of $)if(Q.add(Y.file),z[Y.language]=(z[Y.language]??0)+1,Y.tier)Z[Y.tier]++;else if(X++,J.length<5)J.push(`${Y.file}: ${Y.testName}`);return{totalTests:$.length,byTier:Z,untiered:X,untieredExamples:J,filesScanned:Q.size,byLanguage:z}}function QN($){if(console.log(`${w(k("faf wjttc"))} ${N("— vendor-neutral test audit")}`),console.log(""),console.log(` Files scanned: ${k(String($.filesScanned))}`),console.log(` Tests found: ${k(String($.totalTests))}`),console.log(""),$.totalTests===0){console.log(N(" no tests found"));return}console.log(N(" Tiers:"));for(let Z of oL){let z=$.byTier[Z],X=(z/$.totalTests*100).toFixed(0),J=Z==="BRAKE"?E0("●"):Z==="ENGINE"?w("●"):Z==="AERO"?N("●"):N("○");console.log(` ${J} ${Z.padEnd(7)} ${k(String(z).padStart(4))} ${N(`(${X}%)`)}`)}if($.untiered>0){let Z=($.untiered/$.totalTests*100).toFixed(0);console.log(` ${N("○")} ${"untiered".padEnd(7)} ${k(String($.untiered).padStart(4))} ${N(`(${Z}%)`)}`)}if($.untiered>0&&$.untieredExamples.length>0){console.log(""),console.log(N(` Untiered examples (first ${$.untieredExamples.length}):`));for(let Z of $.untieredExamples)console.log(` ${N("·")} ${Z}`)}if(Object.keys($.byLanguage).length>1){console.log(""),console.log(N(" Languages:"));for(let[Z,z]of Object.entries($.byLanguage))console.log(` ${N("·")} ${Z.padEnd(12)} ${k(String(z))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(E0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function az($={}){let Z=$.path??"tests",z=XN(Z),X=JN(z);if($.json)console.log(JSON.stringify(X,null,2));else QN(X);if($.strict&&X.untiered>0)process.exit(1)}var{version:oz}=h8(),h=new F9;h.name("faf").description("Foundational AI-Context Format — project DNA for any AI").version(oz,"-v, --version");h.command("init").description("Create .faf from your project").option("--yolo","Quick init with sensible defaults").option("--quick","Alias for --yolo").option("--force","Overwrite existing project.faf").option("--output <path>","Output path").action(($)=>x8($));h.command("auto").description("Zero to 100% in one command").action(()=>X7());h.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>l7($));h.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>_2($,Z));h.command("show").description("Render project.faf → project.html and open it").action(()=>R7());h.command("sync").description(".faf ↔ CLAUDE.md (bi-sync, mtime auto-direction)").option("--watch","Watch for changes").option("--direction <dir>","Force direction: auto|push|pull","auto").action(($)=>f8($));h.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").action(($,Z)=>N7($,Z));h.command("decompile <file>").description("Decompile .fafb to JSON").option("--output <path>","Output path").action(($,Z)=>T7($,Z));h.command("git <url>").description("Instant .faf from any GitHub repo").action(($)=>_7($));h.command("export").description("Export context files from .faf").option("--agents","Generate AGENTS.md").option("--cursor","Generate .cursorrules").option("--gemini","Generate GEMINI.md").option("--conductor","Generate conductor config").option("--html","Generate project.html (visual render of project.faf)").option("--all","Generate all formats").action(($)=>c1($));h.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--fix","Auto-fix issues").option("--doctor","Full diagnostic").option("--trust","Verify trust chain").action(($,Z)=>g8($,Z));h.command("info").description("Show version and system info").option("--version","Show version").option("--faq","Show FAQ").option("--index","Show command index").option("--stacks","Show supported stacks").action(($)=>E7($));h.command("formats").description("Show supported formats").action(()=>C7());h.command("clear").description("Clear cached data").action(()=>j7());h.command("convert").description("Convert .faf to other formats").option("--json","Output as JSON").action(($)=>S7($));h.command("context").description("Generate context output").action(()=>b7());h.command("drift").description("Check context drift").action(()=>y7());h.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>k7($,Z));h.command("recover").description("Recover .faf from context files").action(()=>f7());h.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>g7($));h.command("pro [subcommand]").description("Pro features & licensing").action(($)=>h7($));h.command("share").description("Share .faf via URL").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>v7($));h.command("demo").description("Demo walkthrough").action(()=>m7());h.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>d7($,Z));h.command("taf").description("Test Archive Format receipt").option("--output <path>","Write receipt to file").action(($)=>c7($));h.command("ai [subcommand]").description("AI-powered features (enhance|analyze)").action(($)=>lz($));h.command("conductor [subcommand] [path]").description("Conductor integration").action(($,Z)=>sz($,Z));h.command("wjttc").description("Audit test suite for WJTTC tier coverage (vendor-neutral)").option("--path <path>","Test directory (default: tests)").option("--strict","Exit non-zero if any tests are untiered").option("--json","Output as JSON for CI consumption").action(($)=>az($));h.command("bi-sync",{hidden:!0}).action(()=>f8());h.command("status",{hidden:!0}).action(()=>_2(void 0,{status:!0}));h.command("agents",{hidden:!0}).action(()=>c1({agents:!0}));h.command("cursor",{hidden:!0}).action(()=>c1({cursor:!0}));h.command("gemini",{hidden:!0}).action(()=>c1({gemini:!0}));h.command("validate",{hidden:!0}).action(($)=>g8($));h.command("yolo",{hidden:!0}).action(()=>x8({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:z}=await Promise.resolve().then(() => (p(),fZ)),X=process.cwd().replace(process.env.HOME??"","~"),J="\x1B[38;2;150;150;150m",Q="\x1B[48;2;150;150;150m",Y="\x1B[38;2;29;29;29m",q="\x1B[48;2;29;29;29m",W="\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${oz}`)}`);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(" "+X)}`),console.log("");try{await _2(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${z("faf --help")} ${Z("for commands")}`)})();else h.parse(process.argv);
|
|
408
|
-
|
|
409
|
-
|
|
423
|
+
Be concise. One line per suggestion.`}]});console.log(""),console.log(z.content[0].text)}import{existsSync as MZ,readFileSync as TZ,readdirSync as OM}from"fs";import{join as wz}from"path";d();function Pz($,Z){if($==="import")DM(Z);else if($==="export")IM();else console.log(`${D("conductor")} ${L("— conductor integration")}
|
|
424
|
+
`),console.log(` ${w("faf conductor import <path>")} ${L("— import conductor config into .faf")}`),console.log(` ${w("faf conductor export")} ${L("— generate conductor config from .faf")}`)}function DM($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!MZ($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:"2.5.0",project:{}};if(MZ($)&&$.endsWith(".json")){let J=JSON.parse(TZ($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)Z.project.goal=J.description;if(J.language)Z.project.main_language=J.language}else if(MZ($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let J=z$(TZ($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)Z.project.goal=J.description;if(J.language)Z.project.main_language=J.language}else try{let J=OM($);for(let Q of J){let Y=wz($,Q);if(Q.endsWith(".json"))try{let G=JSON.parse(TZ(Y,"utf-8"));if(G.name&&!Z.project.name)Z.project.name=G.name;if(G.description&&!Z.project.goal)Z.project.goal=G.description}catch{}}}catch{console.error(`Error: could not read directory: ${$}`),process.exit(2)}let X=process.cwd(),z=v(X);if(z){let J=l(z);if(!J.project)J.project={};if(Z.project.name&&!J.project.name)J.project.name=Z.project.name;if(Z.project.goal&&!J.project.goal)J.project.goal=Z.project.goal;if(Z.project.main_language&&!J.project.main_language)J.project.main_language=Z.project.main_language;r(z,J),console.log(`${D("◆")} conductor import merged into ${z}`)}else{let J=wz(X,"project.faf");r(J,Z),console.log(`${D("◆")} conductor import created ${J}`)}}function IM(){let $=v();if(!$)console.error(`Error: project.faf not found
|
|
425
|
+
|
|
426
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=l($),X={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(X,null,2))}d();import{readdirSync as AM,readFileSync as RM,existsSync as FM}from"fs";import{join as wM}from"path";var PM=["BRAKE","ENGINE","AERO","PIT"],_M=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|PIT)(?:[^A-Za-z]|$)/i;function CM($){let Z=$.match(_M);if(!Z)return null;return Z[1].toUpperCase()}function EM($){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 jM($,Z){let X=[];switch(Z){case"typescript":{let z=/\b(describe|test|it)\s*\(\s*(['"`])((?:\\.|(?!\2).)*)\2/g,J=[],Q;while((Q=z.exec($))!==null)J.push({idx:Q.index,type:Q[1]==="describe"?"describe":"test",name:Q[3]});let Y=[],G=0,U=null,W=0;for(let q=0;q<$.length;q++){while(W<J.length&&J[W].idx===q){let K=J[W];if(K.type==="describe")U=K.name;else{let N=Y.map((B)=>B.name),O=N.length>0?`${N.join(" > ")} > ${K.name}`:K.name;X.push(O)}W++}let V=$[q];if(V==="{"){if(G++,U!==null)Y.push({name:U,openDepth:G}),U=null}else if(V==="}"){G--;while(Y.length>0&&G<Y[Y.length-1].openDepth)Y.pop()}}break}case"rust":{let z=/#\[test\]\s*(?:\r?\n)\s*(?:pub\s+)?fn\s+([a-zA-Z_][a-zA-Z_0-9]*)/g,J;while((J=z.exec($))!==null)X.push(J[1]);break}case"python":{let z=/^\s*def\s+(test_[a-zA-Z_0-9]+)\s*\(/gm,J;while((J=z.exec($))!==null)X.push(J[1]);break}case"zig":{let z=/\btest\s+"((?:\\.|[^"\\])+)"/g,J;while((J=z.exec($))!==null)X.push(J[1]);break}case"go":{let z=/\bfunc\s+(Test[A-Z][a-zA-Z_0-9]*)\s*\(/g,J;while((J=z.exec($))!==null)X.push(J[1]);break}}return X}var SM=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function _z($,Z=[]){let X;try{X=AM($,{withFileTypes:!0})}catch{return Z}for(let z of X){if(SM.has(z.name))continue;if(z.name.startsWith(".")&&z.name!==".")continue;let J=wM($,z.name);if(z.isDirectory())_z(J,Z);else if(z.isFile())Z.push(J)}return Z}function bM($){let Z=[];if(!FM($))return Z;let X=_z($);for(let z of X){let J=z.split("/").pop()??"",Q=EM(J);if(!Q.ok||!Q.lang)continue;let Y;try{Y=RM(z,"utf-8")}catch{continue}if(Q.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(Q.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let G=jM(Y,Q.lang),U=z.replace(`${$}/`,"");for(let W of G)Z.push({file:U,language:Q.lang,testName:W,tier:CM(W)})}return Z}function xM($){let Z={BRAKE:0,ENGINE:0,AERO:0,PIT:0},X={},z=0,J=[],Q=new Set;for(let Y of $)if(Q.add(Y.file),X[Y.language]=(X[Y.language]??0)+1,Y.tier)Z[Y.tier]++;else if(z++,J.length<5)J.push(`${Y.file}: ${Y.testName}`);return{totalTests:$.length,byTier:Z,untiered:z,untieredExamples:J,filesScanned:Q.size,byLanguage:X}}function kM($){if(console.log(`${D(w("faf wjttc"))} ${L("— vendor-neutral test audit")}`),console.log(""),console.log(` Files scanned: ${w(String($.filesScanned))}`),console.log(` Tests found: ${w(String($.totalTests))}`),console.log(""),$.totalTests===0){console.log(L(" no tests found"));return}console.log(L(" Tiers:"));for(let Z of PM){let X=$.byTier[Z],z=(X/$.totalTests*100).toFixed(0),J=Z==="BRAKE"?V0("●"):Z==="ENGINE"?D("●"):Z==="AERO"?L("●"):L("○");console.log(` ${J} ${Z.padEnd(7)} ${w(String(X).padStart(4))} ${L(`(${z}%)`)}`)}if($.untiered>0){let Z=($.untiered/$.totalTests*100).toFixed(0);console.log(` ${L("○")} ${"untiered".padEnd(7)} ${w(String($.untiered).padStart(4))} ${L(`(${Z}%)`)}`)}if($.untiered>0&&$.untieredExamples.length>0){console.log(""),console.log(L(` Untiered examples (first ${$.untieredExamples.length}):`));for(let Z of $.untieredExamples)console.log(` ${L("·")} ${Z}`)}if(Object.keys($.byLanguage).length>1){console.log(""),console.log(L(" Languages:"));for(let[Z,X]of Object.entries($.byLanguage))console.log(` ${L("·")} ${Z.padEnd(12)} ${w(String(X))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(V0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function Cz($={}){let Z=$.path??"tests",X=bM(Z),z=xM(X);if($.json)console.log(JSON.stringify(z,null,2));else kM(z);if($.strict&&z.untiered>0)process.exit(1)}import{createHash as Sz}from"crypto";import{readFileSync as bz,writeFileSync as yM,existsSync as xz}from"fs";import{join as kz,dirname as fM}from"path";d();var Ez="faf-bench/1",gM={"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 hM($,Z){return gM[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var vM=[["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"]],d4=new Map;vM.forEach(($,Z)=>$.forEach((X)=>d4.set(X,Z)));var uM=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function OZ($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function jz($){return OZ($).split(" ").filter((Z)=>Z&&!uM.has(Z))}function mM($,Z){let X=OZ($),z=OZ(Z);if(!X||!z)return!1;if(X===z)return!0;let J=d4.get(X);if(J!==void 0&&d4.get(z)===J)return!0;let Q=jz($);if(Q.length===0)return!1;let Y=new Set(jz(Z));return Q.every((G)=>{if(Y.has(G))return!0;let U=d4.get(G);return U!==void 0&&[...Y].some((W)=>d4.get(W)===U)})}function cM($){let Z=H0($),X=z$($),z=[],J={},Q=0;for(let U of $0){if(Z.slots[U.path]!=="populated")continue;let W=J7(X,U);if(typeof W!=="string")continue;let q=W.trim();if(!q||i8.has(q.toLowerCase()))continue;Q+=1,z.push({n:Q,path:U.path,question:hM(U.path,U.description)}),J[Q]=q}let Y=JSON.stringify({v:Ez,q:z.map((U)=>[U.path,U.question])}),G=Sz("sha256").update(Y).digest("hex").slice(0,12);return{version:Ez,qsetHash:G,questions:z,answers:J}}function dM($,Z){let X=$.questions.map((J)=>{let Q=Z[String(J.n)]??Z[J.path]??"";return{n:J.n,path:J.path,ok:typeof Q==="string"&&Q.trim()!==""&&mM($.answers[J.n],Q)}}),z=$.questions.filter((J)=>!X[J.n-1].ok);return{correct:X.filter((J)=>J.ok).length,total:$.questions.length,misses:z,perQuestion:X}}var yz=".faf-bench.json";function pM($){let Z=kz($,yz);if(!xz(Z))return null;try{return JSON.parse(bz(Z,"utf-8"))}catch{return null}}function lM($,Z){yM(kz($,yz),JSON.stringify(Z,null,2)+`
|
|
427
|
+
`,"utf-8")}function fz($){let Z=JSON.stringify({v:$.version,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:Z,hash:Sz("sha256").update(Z).digest("hex")}}var I6=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function iM($,Z){let{cold:X,faf:z}=$;console.log(`
|
|
428
|
+
${w(`faf bench — ${Z}`)}
|
|
429
|
+
`),console.log(` ${L("without context")} ${D("with .faf")}`),console.log(`answers ${X.score}/${X.total} ${w(`${z.score}/${z.total}`)}`),console.log(`tokens ${I6(X.tokens)} ${I6(z.tokens)}`);let J=X.total-X.score;if(J>0)console.log(`
|
|
430
|
+
${L(`The ${J} missing answer${J===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(L("Structured context closes the gap."));let Q=fz($);console.log(`
|
|
431
|
+
${V0("✪ BENCH RECEIPT")}`),console.log(L(` qset: ${$.qsetHash} protocol: ${$.protocol} model: ${z.model??X.model??"unreported"}`)),console.log(L(` cold ${X.score}/${X.total} · faf ${z.score}/${z.total} · sha256: ${Q.hash.slice(0,16)}…`))}function nM($,Z){let X=$.cold,z=X.total-X.score;if(console.log(`
|
|
432
|
+
${w(`faf bench — ${Z}`)} ${V0("Trouble ahead, expensive trouble.")}
|
|
433
|
+
`),console.log(` ${L("without context")}`),console.log(`answers ${X.score}/${X.total} ${L("— the AI is guessing at what you are building")}`),X.tokens!==void 0)console.log(`tokens ${I6(X.tokens)} ${L("— re-derivation burn, paid again EVERY session")}`);if(z>0)console.log(`
|
|
434
|
+
${z} answer${z===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(`
|
|
435
|
+
${D("→ faf init && faf bench")} ${L("(close the gap, get the receipt)")}`)}function gz($,Z,X={}){let z=X.file??v();if(!z)console.error(`Error: project.faf not found
|
|
436
|
+
|
|
437
|
+
Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let J=u(z),Q=cM(J),Y=fM(z),G=z$(J)?.project?.name??Y.split("/").pop();if(Q.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(X.json){console.log(JSON.stringify({version:Q.version,qsetHash:Q.qsetHash,questions:Q.questions.map(({n:U,question:W})=>({n:U,question:W}))},null,2));return}console.log(`
|
|
438
|
+
${w(`faf bench — ${Q.questions.length} questions`)} ${L(`qset ${Q.qsetHash}`)}
|
|
439
|
+
`);for(let U of Q.questions)console.log(` ${String(U.n).padStart(2)}. ${U.question}`);console.log(`
|
|
440
|
+
${L('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!xz(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(bz(Z,"utf-8")),W=U.answers??U,q=dM(Q,W),V={score:q.correct,total:q.total,...X.tokens?{tokens:parseInt(X.tokens,10)}:{},...X.model?{model:X.model}:{}},K=pM(Y),N=K&&K.qsetHash===Q.qsetHash?K:{version:Q.version,qsetHash:Q.qsetHash,protocol:"in-session"};if(X.cold)N.cold=V;else if(X.faf)N.faf=V;else console.error("Error: specify the run mode — --cold (no context) or --faf (after reading project.faf)."),process.exit(2);if(lM(Y,N),X.json){let O=fz(N);console.log(JSON.stringify({...N,receipt:O.hash,perQuestion:q.perQuestion},null,2));return}if(N.cold&&N.faf)iM(N,G);else if(N.cold)nM(N,G);else console.log(`
|
|
441
|
+
${w(`faf bench — ${G}`)} ${D("with .faf")}: ${w(`${V.score}/${V.total}`)} ${L(`tokens ${I6(V.tokens)}`)}`),console.log(L("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
|
|
442
|
+
${w("faf bench — agent-native protocol")} ${L(`qset ${Q.qsetHash} · ${Q.questions.length} questions`)}
|
|
443
|
+
`),console.log(`${w("COLD phase")} ${L("(fresh AI session, repo access)")}`),console.log(' 1. Instruct: "Answer these questions from the repository.'),console.log(' Do NOT read project.faf, CLAUDE.md, AGENTS.md, or any *.faf file."'),console.log(` 2. ${D("faf bench questions")} — hand them over; answers terse, saved as cold.json`),console.log(` 3. ${D("faf bench grade cold.json --cold --tokens <used> --model <name>")}
|
|
444
|
+
`),console.log(`${w("FAF phase")} ${L("(same questions, context first)")}`),console.log(' 4. Instruct: "Read project.faf, then answer the same questions." → faf.json'),console.log(` 5. ${D("faf bench grade faf.json --faf --tokens <used> --model <name>")}
|
|
445
|
+
`),console.log(L("Grading is mechanical against your own project.faf — the .faf IS the answer key.")),console.log(L(`Receipts carry protocol: in-session (honor-system cold). qset ${Q.qsetHash}.`))}import{existsSync as sM,writeFileSync as rM}from"fs";d();function hz($={}){let Z=v();if(!Z)console.error(`Error: project.faf not found
|
|
446
|
+
|
|
447
|
+
Run 'faf init' to create one.`),process.exit(2);let X=u(Z),z=H0(X),J=new m0(process.cwd()),Q=J.load()?J.getBirthDNADisplay():null,Y=Q?Q.current:null,G=Y!=null?z.score-Y:0,U=Y!=null&&G!==0,W=Z.replace(/\.faf$/,".fafb"),q=null;if(sM(W)){let V=y2(X);rM(W,V),q=V.length}if($.json)console.log(JSON.stringify({reGrounded:!0,score:z.score,tier:z.tier,baseline:Y,delta:G,drifted:U,fafb:q!=null?{reCompiled:!0,bytes:q}:{reCompiled:!1},journey:J.getJourney()||null},null,2));else{if(console.log(`${D("refresh")} ${L("— re-grounding on the live .faf")}
|
|
448
|
+
`),U){let V=G>0?"↑":"↓";console.log(` drift: ${L(`${Y}%`)} ${V} ${w(`${z.score}%`)} ${L(`(${G>0?"+":""}${G})`)}`)}else if(Y!=null)console.log(` no drift ${L(`— steady at ${z.score}%`)}`);else console.log(` baseline set ${L(`— ${z.score}%`)}`);if(q!=null)console.log(` .fafb re-compiled ${L(`(${q} bytes — fast tier current)`)}`);console.log(` re-grounded: ${i$(z.tier)} ${w(`${z.score}%`)}`)}if(J.exists())J.recordGrowth(z.score,["refresh — re-grounded"]);else J.birth(z.score)}var{version:vz}=$3(),h=new mZ;h.name("faf").description("Foundational AI-Context Format — project DNA for any AI").version(vz,"-v, --version");h.command("init").description("Create .faf from your project").option("--yolo","Quick init with sensible defaults").option("--quick","Alias for --yolo").option("--force","Overwrite existing project.faf").option("--output <path>","Output path").action(($)=>o8($));h.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>_7());h.command("auto").description("Zero to 100% in one command").action(()=>C7());h.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>RX($));h.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>f2($,Z));h.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key)").option("--json","Output as JSON").option("--cold","Grade as the without-context run").option("--faf","Grade as the with-context run").option("--tokens <n>","Tokens used in the run (reported by the agent)").option("--model <name>","Model that answered (reported)").option("--file <path>","Path to project.faf (default: discovered)").action(($,Z,X)=>gz($,Z,X));h.command("show").description("Render project.faf → project.html and open it").action(()=>XX());h.command("sync").description(".faf ↔ CLAUDE.md (bi-sync, mtime auto-direction)").option("--watch","Watch for changes").option("--direction <dir>","Force direction: auto|push|pull","auto").action(($)=>t8($));h.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").action(($,Z)=>m7($,Z));h.command("decompile <file>").description("Decompile .fafb to JSON").option("--output <path>","Output path").action(($,Z)=>c7($,Z));h.command("git <url>").description("Instant .faf from any GitHub repo").action(($)=>JX($));h.command("export").description("Export context files from .faf").option("--agents","Generate AGENTS.md").option("--cursor","Generate .cursorrules").option("--gemini","Generate GEMINI.md").option("--grok","Wire grok-faf-mcp into .grok/config.toml").option("--conductor","Generate conductor config").option("--html","Generate project.html (visual render of project.faf)").option("--card","Generate MCP Server Card (.well-known/mcp/server-card) with the FAF context-block").option("--all","Generate all formats").action(($)=>t$($));h.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--fix","Auto-fix issues").option("--doctor","Full diagnostic").option("--trust","Verify trust chain").action(($,Z)=>e8($,Z));h.command("info").description("Show version and system info").option("--version","Show version").option("--faq","Show FAQ").option("--index","Show command index").option("--stacks","Show supported stacks").action(($)=>QX($));h.command("formats").description("Show supported formats").action(()=>YX());h.command("clear").description("Clear cached data").action(()=>GX());h.command("convert").description("Convert .faf to other formats").option("--json","Output as JSON").action(($)=>UX($));h.command("context").description("Generate context output").action(()=>WX());h.command("refresh").description("Re-ground on the live .faf — re-score, measure drift vs the DNA baseline, keep .fafb current").option("--json","Output as JSON").action(($)=>hz($));h.command("drift").description("Check context drift").action(()=>VX());h.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>KX($,Z));h.command("recover").description("Recover .faf from context files").action(()=>HX());h.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>BX($));h.command("pro [subcommand]").description("Pro features & licensing").action(($)=>LX($));h.command("share").description("Share .faf via URL").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>NX($));h.command("demo").description("Demo walkthrough").action(()=>TX());h.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>OX($,Z));h.command("taf").description("Test Archive Format receipt").option("--output <path>","Write receipt to file").action(($)=>DX($));h.command("ai [subcommand]").description("AI-powered features (enhance|analyze)").action(($)=>Rz($));h.command("conductor [subcommand] [path]").description("Conductor integration").action(($,Z)=>Pz($,Z));h.command("wjttc").description("Audit test suite for WJTTC tier coverage (vendor-neutral)").option("--path <path>","Test directory (default: tests)").option("--strict","Exit non-zero if any tests are untiered").option("--json","Output as JSON for CI consumption").action(($)=>Cz($));h.command("bi-sync",{hidden:!0}).action(()=>t8());h.command("status",{hidden:!0}).action(()=>f2(void 0,{status:!0}));h.command("agents",{hidden:!0}).action(()=>t$({agents:!0}));h.command("cursor",{hidden:!0}).action(()=>t$({cursor:!0}));h.command("gemini",{hidden:!0}).action(()=>t$({gemini:!0}));h.command("grok",{hidden:!0}).action(()=>t$({grok:!0}));h.command("validate",{hidden:!0}).action(($)=>e8($));h.command("yolo",{hidden:!0}).action(()=>o8({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:X}=await Promise.resolve().then(() => (d(),e9)),z=process.cwd().replace(process.env.HOME??"","~"),J="\x1B[38;2;150;150;150m",Q="\x1B[48;2;150;150;150m",Y="\x1B[38;2;29;29;29m",G="\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"} ${X($("faf"))} ${Z(`v${vz}`)}`);let W="\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(`${W}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`),console.log(`${Z(" "+z)}`),console.log("");try{await f2(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${X("faf --help")} ${Z("for commands")}`)})();else h.parse(process.argv);
|
|
449
|
+
|
|
450
|
+
//# debugId=853839718EB14EFF64756E2164756E21
|
|
410
451
|
//# sourceMappingURL=cli.js.map
|