faf-cli 7.8.0 → 7.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 +16 -10
- package/dist/cli.js +218 -218
- package/dist/cli.js.map +10 -10
- package/dist/core/types.d.ts +2 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/project.faf +3 -3
package/dist/cli.js
CHANGED
|
@@ -1,100 +1,100 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as QW}from"node:module";var sY=Object.create;var{getPrototypeOf:aY,defineProperty:
|
|
3
|
-
`)}displayWidth($){return
|
|
2
|
+
import{createRequire as QW}from"node:module";var sY=Object.create;var{getPrototypeOf:aY,defineProperty:h4,getOwnPropertyNames:oY}=Object;var tY=Object.prototype.hasOwnProperty;function eY($){return this[$]}var $W,ZW,XW=($,Z,X)=>{var z=$!=null&&typeof $==="object";if(z){var J=Z?$W??=new WeakMap:ZW??=new WeakMap,Q=J.get($);if(Q)return Q}X=$!=null?sY(aY($)):{};let Y=Z||!$||!$.__esModule?h4(X,"default",{value:$,enumerable:!0}):X;for(let W of oY($))if(!tY.call(Y,W))h4(Y,W,{get:eY.bind($,W),enumerable:!0});if(z)J.set($,Y);return Y};var C=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var zW=($)=>$;function JW($,Z){this[$]=zW.bind(null,Z)}var O9=($,Z)=>{for(var X in Z)h4($,X,{get:Z[X],enumerable:!0,configurable:!0,set:JW.bind(Z,X)})};var v=($,Z)=>()=>($&&(Z=$($=0)),Z);var F0=QW(import.meta.url);var o$=C((YW)=>{class u4 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 L9 extends u4{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}YW.CommanderError=u4;YW.InvalidArgumentError=L9});var v6=C((VW)=>{var{InvalidArgumentError:qW}=o$();class N9{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 qW(`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 GW($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}VW.Argument=N9;VW.humanReadableArgName=GW});var m4=C((MW)=>{var{humanReadableArgName:BW}=v6();class D9{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)=>BW(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(G,V){return Z.formatItem(G,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 W=Z.visibleArguments($).map((G)=>{return J(Z.styleArgumentTerm(Z.argumentTerm(G)),Z.styleArgumentDescription(Z.argumentDescription(G)))});if(Q=Q.concat(this.formatItemList("Arguments:",W,Z)),this.groupItems($.options,Z.visibleOptions($),(G)=>G.helpGroupHeading??"Options:").forEach((G,V)=>{let K=G.map((H)=>{return J(Z.styleOptionTerm(Z.optionTerm(H)),Z.styleOptionDescription(Z.optionDescription(H)))});Q=Q.concat(this.formatItemList(V,K,Z))}),Z.showGlobalOptions){let G=Z.visibleGlobalOptions($).map((V)=>{return J(Z.styleOptionTerm(Z.optionTerm(V)),Z.styleOptionDescription(Z.optionDescription(V)))});Q=Q.concat(this.formatItemList("Global Options:",G,Z))}return this.groupItems($.commands,Z.visibleCommands($),(G)=>G.helpGroup()||"Commands:").forEach((G,V)=>{let K=G.map((H)=>{return J(Z.styleSubcommandTerm(Z.subcommandTerm(H)),Z.styleSubcommandDescription(Z.subcommandDescription(H)))});Q=Q.concat(this.formatItemList(V,K,Z))}),Q.join(`
|
|
3
|
+
`)}displayWidth($){return I9($).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($)),W=2,q=(this.helpWidth??80)-Z-W-2,G;if(q<this.minWidthToWrap||z.preformatted(X))G=X;else G=z.boxWrap(X,q).replace(/\n/g,`
|
|
4
4
|
`+" ".repeat(Z+W));return Q+Y+" ".repeat(W)+G.replace(/\n/g,`
|
|
5
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 W=[Y.shift()],U=this.displayWidth(W[0]);Y.forEach((q)=>{let G=this.displayWidth(q);if(U+G<=Z){W.push(q),U+=G;return}J.push(W.join(""));let V=q.trimStart();W=[V],U=this.displayWidth(V)}),J.push(W.join(""))}),J.join(`
|
|
6
|
-
`)}}function
|
|
6
|
+
`)}}function I9($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}MW.Help=D9;MW.stripColor=I9});var c4=C((IW)=>{var{InvalidArgumentError:NW}=o$();class A9{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let X=DW($);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 NW(`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 T9(this.name().replace(/^no-/,""));return T9(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class R9{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 T9($){return $.split("-").reduce((Z,X)=>{return Z+X[0].toUpperCase()+X.slice(1)})}function DW($){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],W=`option creation failed due to '${Y}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${W}
|
|
7
7
|
- a short flag is a single dash and a single character
|
|
8
8
|
- either use a single dash and a single character (for a short flag)
|
|
9
9
|
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(z.test(Y))throw Error(`${W}
|
|
10
10
|
- too many short flags`);if(J.test(Y))throw Error(`${W}
|
|
11
11
|
- too many long flags`);throw Error(`${W}
|
|
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}}IW.Option=
|
|
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}}IW.Option=A9;IW.DualOptions=R9});var _9=C((FW)=>{function RW($,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 _W($,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 W=RW($,Y),U=Math.max($.length,Y.length);if((U-W)/U>Q){if(W<J)J=W,z=[Y];else if(W===J)z.push(Y)}}),z.sort((Y,W)=>Y.localeCompare(W)),X)z=z.map((Y)=>`--${Y}`);if(z.length>1)return`
|
|
13
13
|
(Did you mean one of ${z.join(", ")}?)`;if(z.length===1)return`
|
|
14
|
-
(Did you mean ${z[0]}?)`;return""}FW.suggestSimilar=_W});var
|
|
14
|
+
(Did you mean ${z[0]}?)`;return""}FW.suggestSimilar=_W});var E9=C((bW)=>{var PW=F0("node:events").EventEmitter,l4=F0("node:child_process"),$1=F0("node:path"),f6=F0("node:fs"),n=F0("node:process"),{Argument:EW,humanReadableArgName:wW}=v6(),{CommanderError:d4}=o$(),{Help:SW,stripColor:jW}=m4(),{Option:F9,DualOptions:xW}=c4(),{suggestSimilar:C9}=_9();class i4 extends PW{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)=>n.stdout.write(Z),writeErr:(Z)=>n.stderr.write(Z),outputError:(Z,X)=>X(Z),getOutHelpWidth:()=>n.stdout.isTTY?n.stdout.columns:void 0,getErrHelpWidth:()=>n.stderr.isTTY?n.stderr.columns:void 0,getOutHasColors:()=>p4()??(n.stdout.isTTY&&n.stdout.hasColors?.()),getErrHasColors:()=>p4()??(n.stderr.isTTY&&n.stderr.hasColors?.()),stripColor:(Z)=>jW(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(/([^ ]+) *(.*)/),W=this.createCommand(Q);if(z)W.description(z),W._executableHandler=!0;if(J.isDefault)this._defaultCommandName=W._name;if(W._hidden=!!(J.noHelp||J.hidden),W._executableFile=J.executableFile||null,Y)W.arguments(Y);if(this._registerCommand(W),W.parent=this,W.copyInheritedSettings(this),z)return this;return W}createCommand($){return new i4($)}createHelp(){return Object.assign(new SW,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
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 EW($,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
|
|
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 W=this.getOptionValue(X);if(J!==null&&$.parseArg)J=this._callParseArg($,J,W,Q);else if(J!==null&&$.variadic)J=$._collectValue(J,W);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
|
|
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(
|
|
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 d4($,Z,X));n.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 F9($,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 W=this.getOptionValue(X);if(J!==null&&$.parseArg)J=this._callParseArg($,J,W,Q);else if(J!==null&&$.variadic)J=$._collectValue(J,W);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 F9)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=(W,U)=>{let q=Y.exec(W);return q?q[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(n.versions?.electron)Z.from="electron";let z=n.execArgv??[];if(z.includes("-e")||z.includes("--eval")||z.includes("-p")||z.includes("--print"))Z.from="eval"}if($===void 0)$=n.argv;this.rawArgs=$.slice();let X;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],X=$.slice(2);break;case"electron":if(n.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(f6.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
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
|
-
- ${z}`;throw Error(J)}_executeSubCommand($,Z){Z=Z.slice();let X=!1,z=[".js",".ts",".tsx",".mjs",".cjs"];function J(q,G){let V
|
|
21
|
+
- ${z}`;throw Error(J)}_executeSubCommand($,Z){Z=Z.slice();let X=!1,z=[".js",".ts",".tsx",".mjs",".cjs"];function J(q,G){let V=$1.resolve(q,G);if(f6.existsSync(V))return V;if(z.includes($1.extname(G)))return;let K=z.find((H)=>f6.existsSync(`${V}${H}`));if(K)return`${V}${K}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Q=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let q;try{q=f6.realpathSync(this._scriptPath)}catch{q=this._scriptPath}Y=$1.resolve($1.dirname(q),Y)}if(Y){let q=J(Y,Q);if(!q&&!$._executableFile&&this._scriptPath){let G=$1.basename(this._scriptPath,$1.extname(this._scriptPath));if(G!==this._name)q=J(Y,`${G}-${$._name}`)}Q=q||Q}X=z.includes($1.extname(Q));let W;if(n.platform!=="win32")if(X)Z.unshift(Q),Z=P9(n.execArgv).concat(Z),W=l4.spawn(n.argv[0],Z,{stdio:"inherit"});else W=l4.spawn(Q,Z,{stdio:"inherit"});else this._checkForMissingExecutable(Q,Y,$._name),Z.unshift(Q),Z=P9(n.execArgv).concat(Z),W=l4.spawn(n.execPath,Z,{stdio:"inherit"});if(!W.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((G)=>{n.on(G,()=>{if(W.killed===!1&&W.exitCode===null)W.kill(G)})});let U=this._exitCallback;W.on("close",(q)=>{if(q=q??1,!U)n.exit(q);else U(new d4(q,"commander.executeSubCommandAsync","(close)"))}),W.on("error",(q)=>{if(q.code==="ENOENT")this._checkForMissingExecutable(Q,Y,$._name);else if(q.code==="EACCES")throw Error(`'${Q}' not executable`);if(!U)n.exit(1);else{let G=new d4(1,"commander.executeSubCommandAsync","(error)");G.nestedError=q,U(G)}}),this.runningCommand=W}_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(q){return q.length>1&&q[0]==="-"}let Q=(q)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(q))return!1;return!this._getCommandAndAncestors().some((G)=>G.options.map((V)=>V.short).some((V)=>/^-\d$/.test(V)))},Y=null,W=null,U=0;while(U<$.length||W){let q=W??$[U++];if(W=null,q==="--"){if(z===X)z.push(q);z.push(...$.slice(U));break}if(Y&&(!J(q)||Q(q))){this.emit(`option:${Y.name()}`,q);continue}if(Y=null,J(q)){let G=this._findOption(q);if(G){if(G.required){let V=$[U++];if(V===void 0)this.optionMissingArgument(G);this.emit(`option:${G.name()}`,V)}else if(G.optional){let V=null;if(U<$.length&&(!J($[U])||Q($[U])))V=$[U++];this.emit(`option:${G.name()}`,V)}else this.emit(`option:${G.name()}`);Y=G.variadic?G:null;continue}}if(q.length>2&&q[0]==="-"&&q[1]!=="-"){let G=this._findOption(`-${q[1]}`);if(G){if(G.required||G.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${G.name()}`,q.slice(2));else this.emit(`option:${G.name()}`),W=`-${q.slice(2)}`;continue}}if(/^--[^=]+=/.test(q)){let G=q.indexOf("="),V=this._findOption(q.slice(0,G));if(V&&(V.required||V.optional)){this.emit(`option:${V.name()}`,q.slice(G+1));continue}}if(z===Z&&J(q)&&!(this.commands.length===0&&Q(q)))z=X;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&X.length===0){if(this._findCommand(q)){Z.push(q),X.push(...$.slice(U));break}else if(this._getHelpCommand()&&q===this._getHelpCommand().name()){Z.push(q,...$.slice(U));break}else if(this._defaultCommandName){X.push(q,...$.slice(U));break}}if(this._passThroughOptions){z.push(q,...$.slice(U));break}z.push(q)}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 X=Z||{},z=X.exitCode||1,J=X.code||"commander.error";this._exit(z,J,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in n.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,n.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new xW(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(),W=this.getOptionValue(Y),U=this.options.find((G)=>G.negate&&Y===G.attributeName()),q=this.options.find((G)=>!G.negate&&Y===G.attributeName());if(U&&(U.presetArg===void 0&&W===!1||U.presetArg!==void 0&&W===U.presetArg))return U;return q||Q},z=(Q)=>{let Y=X(Q),W=Y.attributeName();if(this.getOptionValueSource(W)==="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=
|
|
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 wW(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
|
|
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 n.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,n.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new xW(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(),W=this.getOptionValue(Y),U=this.options.find((G)=>G.negate&&Y===G.attributeName()),q=this.options.find((G)=>!G.negate&&Y===G.attributeName());if(U&&(U.presetArg===void 0&&W===!1||U.presetArg!==void 0&&W===U.presetArg))return U;return q||Q},z=(Q)=>{let Y=X(Q),W=Y.attributeName();if(this.getOptionValueSource(W)==="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=C9($,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=C9($,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 wW(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=$1.basename($,$1.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(n.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
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
|
|
28
|
-
`)}}
|
|
29
|
-
`)?
|
|
27
|
+
`)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((z)=>Z.is(z)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function P9($){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 p4(){if(n.env.NO_COLOR||n.env.FORCE_COLOR==="0"||n.env.FORCE_COLOR==="false")return!1;if(n.env.FORCE_COLOR||n.env.CLICOLOR_FORCE!==void 0)return!0;return}bW.Command=i4;bW.useColor=p4});var x9=C((gW)=>{var{Argument:w9}=v6(),{Command:n4}=E9(),{CommanderError:vW,InvalidArgumentError:S9}=o$(),{Help:fW}=m4(),{Option:j9}=c4();gW.program=new n4;gW.createCommand=($)=>new n4($);gW.createOption=($,Z)=>new j9($,Z);gW.createArgument=($,Z)=>new w9($,Z);gW.Command=n4;gW.Option=j9;gW.Argument=w9;gW.Help=fW;gW.CommanderError=vW;gW.InvalidArgumentError=S9;gW.InvalidOptionArgumentError=S9});var i=C((zU)=>{var r4=Symbol.for("yaml.alias"),y9=Symbol.for("yaml.document"),g6=Symbol.for("yaml.map"),v9=Symbol.for("yaml.pair"),s4=Symbol.for("yaml.scalar"),h6=Symbol.for("yaml.seq"),Z1=Symbol.for("yaml.node.type"),aW=($)=>!!$&&typeof $==="object"&&$[Z1]===r4,oW=($)=>!!$&&typeof $==="object"&&$[Z1]===y9,tW=($)=>!!$&&typeof $==="object"&&$[Z1]===g6,eW=($)=>!!$&&typeof $==="object"&&$[Z1]===v9,f9=($)=>!!$&&typeof $==="object"&&$[Z1]===s4,$U=($)=>!!$&&typeof $==="object"&&$[Z1]===h6;function g9($){if($&&typeof $==="object")switch($[Z1]){case g6:case h6:return!0}return!1}function ZU($){if($&&typeof $==="object")switch($[Z1]){case r4:case g6:case s4:case h6:return!0}return!1}var XU=($)=>(f9($)||g9($))&&!!$.anchor;zU.ALIAS=r4;zU.DOC=y9;zU.MAP=g6;zU.NODE_TYPE=Z1;zU.PAIR=v9;zU.SCALAR=s4;zU.SEQ=h6;zU.hasAnchor=XU;zU.isAlias=aW;zU.isCollection=g9;zU.isDocument=oW;zU.isMap=tW;zU.isNode=ZU;zU.isPair=eW;zU.isScalar=f9;zU.isSeq=$U});var t$=C((IU)=>{var W0=i(),T0=Symbol("break visit"),h9=Symbol("skip children"),n0=Symbol("remove node");function u6($,Z){let X=u9(Z);if(W0.isDocument($)){if(X$(null,$.contents,X,Object.freeze([$]))===n0)$.contents=null}else X$(null,$,X,Object.freeze([]))}u6.BREAK=T0;u6.SKIP=h9;u6.REMOVE=n0;function X$($,Z,X,z){let J=m9($,Z,X,z);if(W0.isNode(J)||W0.isPair(J))return c9($,z,J),X$($,J,X,z);if(typeof J!=="symbol"){if(W0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let Q=0;Q<Z.items.length;++Q){let Y=X$(Q,Z.items[Q],X,z);if(typeof Y==="number")Q=Y-1;else if(Y===T0)return T0;else if(Y===n0)Z.items.splice(Q,1),Q-=1}}else if(W0.isPair(Z)){z=Object.freeze(z.concat(Z));let Q=X$("key",Z.key,X,z);if(Q===T0)return T0;else if(Q===n0)Z.key=null;let Y=X$("value",Z.value,X,z);if(Y===T0)return T0;else if(Y===n0)Z.value=null}}return J}async function m6($,Z){let X=u9(Z);if(W0.isDocument($)){if(await z$(null,$.contents,X,Object.freeze([$]))===n0)$.contents=null}else await z$(null,$,X,Object.freeze([]))}m6.BREAK=T0;m6.SKIP=h9;m6.REMOVE=n0;async function z$($,Z,X,z){let J=await m9($,Z,X,z);if(W0.isNode(J)||W0.isPair(J))return c9($,z,J),z$($,J,X,z);if(typeof J!=="symbol"){if(W0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let Q=0;Q<Z.items.length;++Q){let Y=await z$(Q,Z.items[Q],X,z);if(typeof Y==="number")Q=Y-1;else if(Y===T0)return T0;else if(Y===n0)Z.items.splice(Q,1),Q-=1}}else if(W0.isPair(Z)){z=Object.freeze(z.concat(Z));let Q=await z$("key",Z.key,X,z);if(Q===T0)return T0;else if(Q===n0)Z.key=null;let Y=await z$("value",Z.value,X,z);if(Y===T0)return T0;else if(Y===n0)Z.value=null}}return J}function u9($){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 m9($,Z,X,z){if(typeof X==="function")return X($,Z,z);if(W0.isMap(Z))return X.Map?.($,Z,z);if(W0.isSeq(Z))return X.Seq?.($,Z,z);if(W0.isPair(Z))return X.Pair?.($,Z,z);if(W0.isScalar(Z))return X.Scalar?.($,Z,z);if(W0.isAlias(Z))return X.Alias?.($,Z,z);return}function c9($,Z,X){let z=Z[Z.length-1];if(W0.isCollection(z))z.items[$]=X;else if(W0.isPair(z))if($==="key")z.key=X;else z.value=X;else if(W0.isDocument(z))z.contents=X;else{let J=W0.isAlias(z)?"alias":"scalar";throw Error(`Cannot replace node with ${J} parent`)}}IU.visit=u6;IU.visitAsync=m6});var a4=C((CU)=>{var l9=i(),RU=t$(),_U={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},FU=($)=>$.replace(/[!,[\]{}]/g,(Z)=>_U[Z]);class k0{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},k0.defaultYaml,$),this.tags=Object.assign({},k0.defaultTags,Z)}clone(){let $=new k0(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new k0(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:k0.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},k0.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:k0.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},k0.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+FU($.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&&l9.isNode($.contents)){let J={};RU.visit($.contents,(Q,Y)=>{if(l9.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
|
+
`)}}k0.defaultYaml={explicit:!1,version:"1.2"};k0.defaultTags={"!!":"tag:yaml.org,2002:"};CU.Directives=k0});var c6=C((jU)=>{var d9=i(),EU=t$();function wU($){if(/[\x00-\x19\s,[\]{}]/.test($)){let X=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(X)}return!0}function p9($){let Z=new Set;return EU.visit($,{Value(X,z){if(z.anchor)Z.add(z.anchor)}}),Z}function i9($,Z){for(let X=1;;++X){let z=`${$}${X}`;if(!Z.has(z))return z}}function SU($,Z){let X=[],z=new Map,J=null;return{onAnchor:(Q)=>{X.push(Q),J??(J=p9($));let Y=i9(Z,J);return J.add(Y),Y},setAnchors:()=>{for(let Q of X){let Y=z.get(Q);if(typeof Y==="object"&&Y.anchor&&(d9.isScalar(Y.node)||d9.isCollection(Y.node)))Y.node.anchor=Y.anchor;else{let W=Error("Failed to resolve repeated object (this should not happen)");throw W.source=Q,W}}},sourceObjects:z}}jU.anchorIsValid=wU;jU.anchorNames=p9;jU.createNodeAnchors=SU;jU.findNewAnchor=i9});var o4=C((vU)=>{function e$($,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],W=e$($,z,String(J),Y);if(W===void 0)delete z[J];else if(W!==Y)z[J]=W}else if(z instanceof Map)for(let J of Array.from(z.keys())){let Q=z.get(J),Y=e$($,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=e$($,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=e$($,z,J,Q);if(Y===void 0)delete z[J];else if(Y!==Q)z[J]=Y}return $.call(Z,X,z)}vU.applyReviver=e$});var H1=C((hU)=>{var gU=i();function n9($,Z,X){if(Array.isArray($))return $.map((z,J)=>n9(z,String(J),X));if($&&typeof $.toJSON==="function"){if(!X||!gU.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 $}hU.toJS=n9});var l6=C((lU)=>{var mU=o4(),r9=i(),cU=H1();class s9{constructor($){Object.defineProperty(this,r9.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(!r9.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=cU.toJS(this,"",Q);if(typeof z==="function")for(let{count:W,res:U}of Q.anchors.values())z(U,W);return typeof J==="function"?mU.applyReviver(J,{"":Y},"",Y):Y}}lU.NodeBase=s9});var $2=C((sU)=>{var pU=c6(),iU=t$(),J$=i(),nU=l6(),rU=H1();class a9 extends nU.NodeBase{constructor($){super(J$.ALIAS);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,Z){if(Z?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let X;if(Z?.aliasResolveCache)X=Z.aliasResolveCache;else if(X=[],iU.visit($,{Node:(J,Q)=>{if(J$.isAlias(Q)||J$.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 W=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(W)}let Y=X.get(Q);if(!Y)rU.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=d6(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(pU.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 d6($,Z,X){if(J$.isAlias(Z)){let z=Z.resolve($),J=X&&z&&X.get(z);return J?J.count*J.aliasCount:0}else if(J$.isCollection(Z)){let z=0;for(let J of Z.items){let Q=d6($,J,X);if(Q>z)z=Q}return z}else if(J$.isPair(Z)){let z=d6($,Z.key,X),J=d6($,Z.value,X);return Math.max(z,J)}return 1}sU.Alias=a9});var X0=C((Zq)=>{var oU=i(),tU=l6(),eU=H1(),$q=($)=>!$||typeof $!=="function"&&typeof $!=="object";class k1 extends tU.NodeBase{constructor($){super(oU.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:eU.toJS(this.value,$,Z)}toString(){return String(this.value)}}k1.BLOCK_FOLDED="BLOCK_FOLDED";k1.BLOCK_LITERAL="BLOCK_LITERAL";k1.PLAIN="PLAIN";k1.QUOTE_DOUBLE="QUOTE_DOUBLE";k1.QUOTE_SINGLE="QUOTE_SINGLE";Zq.Scalar=k1;Zq.isScalarValue=$q});var Z2=C((Uq)=>{var Jq=$2(),y1=i(),o9=X0(),Qq="tag:yaml.org,2002:";function Yq($,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 Wq($,Z,X){if(y1.isDocument($))$=$.contents;if(y1.isNode($))return $;if(y1.isPair($)){let V=X.schema[y1.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:W}=X,U=void 0;if(z&&$&&typeof $==="object")if(U=W.get($),U)return U.anchor??(U.anchor=J($)),new Jq.Alias(U.anchor);else U={anchor:null,node:null},W.set($,U);if(Z?.startsWith("!!"))Z=Qq+Z.slice(2);let q=Yq($,Z,Y.tags);if(!q){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let V=new o9.Scalar($);if(U)U.node=V;return V}q=$ instanceof Map?Y[y1.MAP]:(Symbol.iterator in Object($))?Y[y1.SEQ]:Y[y1.MAP]}if(Q)Q(q),delete X.onTagObj;let G=q?.createNode?q.createNode(X.schema,$,X):typeof q?.nodeClass?.from==="function"?q.nodeClass.from(X.schema,$,X):new o9.Scalar($);if(Z)G.tag=Z;else if(!q.default)G.tag=q.tag;if(U)U.node=G;return G}Uq.createNode=Wq});var p6=C((Kq)=>{var Gq=Z2(),r0=i(),Vq=l6();function t4($,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 Gq.createNode(z,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var t9=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class e9 extends Vq.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)=>r0.isNode(X)||r0.isPair(X)?X.clone($):X),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(t9($))this.add(Z);else{let[X,...z]=$,J=this.get(X,!0);if(r0.isCollection(J))J.addIn(z,Z);else if(J===void 0&&this.schema)this.set(X,t4(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(r0.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&&r0.isScalar(J)?J.value:J;else return r0.isCollection(J)?J.getIn(z,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!r0.isPair(Z))return!1;let X=Z.value;return X==null||$&&r0.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 r0.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(r0.isCollection(J))J.setIn(z,Z);else if(J===void 0&&this.schema)this.set(X,t4(this.schema,z,Z));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${z}`)}}}Kq.Collection=e9;Kq.collectionFromPath=t4;Kq.isEmptyPath=t9});var X2=C((Nq)=>{var Oq=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function e4($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var Lq=($,Z,X)=>$.endsWith(`
|
|
29
|
+
`)?e4(X,Z):X.includes(`
|
|
30
30
|
`)?`
|
|
31
|
-
`+
|
|
32
|
-
`){if(X==="block")B
|
|
33
|
-
`&&H!=="\t"){let
|
|
34
|
-
`&&
|
|
35
|
-
${Z}${$.slice(0,y)}`;else{if(X==="quoted"&&G[
|
|
36
|
-
${Z}${$.slice(
|
|
37
|
-
`);z=Z,J=Z+1,Q=$[J]}return z}Rq.FOLD_BLOCK="block";Rq.FOLD_FLOW="flow";Rq.FOLD_QUOTED="quoted";Rq.foldFlowLines=Aq});var
|
|
38
|
-
`){if(Q-Y>z)return!0;if(Y=Q+1,J-Y<=z)return!1}return!0}function
|
|
31
|
+
`+e4(X,Z):($.endsWith(" ")?"":" ")+X;Nq.indentComment=e4;Nq.lineComment=Lq;Nq.stringifyComment=Oq});var Z7=C((Rq)=>{function Aq($,Z,X="flow",{indentAtStart:z,lineWidth:J=80,minContentWidth:Q=20,onFold:Y,onOverflow:W}={}){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 q=[],G={},V=J-Z.length;if(typeof z==="number")if(z>J-Math.max(2,Q))q.push(0);else V=J-z;let K=void 0,H=void 0,N=!1,B=-1,O=-1,T=-1;if(X==="block"){if(B=$7($,B,Z.length),B!==-1)V=B+U}for(let w;w=$[B+=1];){if(X==="quoted"&&w==="\\"){switch(O=B,$[B+1]){case"x":B+=3;break;case"u":B+=5;break;case"U":B+=9;break;default:B+=1}T=B}if(w===`
|
|
32
|
+
`){if(X==="block")B=$7($,B,Z.length);V=B+Z.length+U,K=void 0}else{if(w===" "&&H&&H!==" "&&H!==`
|
|
33
|
+
`&&H!=="\t"){let S=$[B+1];if(S&&S!==" "&&S!==`
|
|
34
|
+
`&&S!=="\t")K=B}if(B>=V)if(K)q.push(K),V=K+U,K=void 0;else if(X==="quoted"){while(H===" "||H==="\t")H=w,w=$[B+=1],N=!0;let S=B>T+1?B-2:O-1;if(G[S])return $;q.push(S),G[S]=!0,V=S+U,K=void 0}else N=!0}H=w}if(N&&W)W();if(q.length===0)return $;if(Y)Y();let F=$.slice(0,q[0]);for(let w=0;w<q.length;++w){let S=q[w],y=q[w+1]||$.length;if(S===0)F=`
|
|
35
|
+
${Z}${$.slice(0,y)}`;else{if(X==="quoted"&&G[S])F+=`${$[S]}\\`;F+=`
|
|
36
|
+
${Z}${$.slice(S+1,y)}`}}return F}function $7($,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}Rq.FOLD_BLOCK="block";Rq.FOLD_FLOW="flow";Rq.FOLD_QUOTED="quoted";Rq.foldFlowLines=Aq});var J2=C((jq)=>{var u0=X0(),B1=Z7(),n6=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),r6=($)=>/^(%|---|\.\.\.)/m.test($);function Eq($,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 z2($,Z){let X=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return X;let{implicitKey:z}=Z,J=Z.options.doubleQuotedMinMultiLineLength,Q=Z.indent||(r6($)?" ":""),Y="",W=0;for(let U=0,q=X[U];q;q=X[++U]){if(q===" "&&X[U+1]==="\\"&&X[U+2]==="n")Y+=X.slice(W,U)+"\\ ",U+=1,W=U,q="\\";if(q==="\\")switch(X[U+1]){case"u":{Y+=X.slice(W,U);let G=X.substr(U+2,4);switch(G){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(G.substr(0,2)==="00")Y+="\\x"+G.substr(2);else Y+=X.substr(U,6)}U+=5,W=U+1}break;case"n":if(z||X[U+2]==='"'||X.length<J)U+=1;else{Y+=X.slice(W,U)+`
|
|
39
39
|
|
|
40
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,W=U+1}break;default:U+=1}}return Y=W?Y+X.slice(W):X,z?Y:
|
|
42
|
-
`)||/[ \t]\n|\n[ \t]/.test($))return
|
|
43
|
-
${X}`)+"'";return Z.implicitKey?z:
|
|
41
|
+
`,U+=2;if(Y+=Q,X[U+2]===" ")Y+="\\";U+=1,W=U+1}break;default:U+=1}}return Y=W?Y+X.slice(W):X,z?Y:B1.foldFlowLines(Y,Q,B1.FOLD_QUOTED,n6(Z,!1))}function $3($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
|
|
42
|
+
`)||/[ \t]\n|\n[ \t]/.test($))return z2($,Z);let X=Z.indent||(r6($)?" ":""),z="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
43
|
+
${X}`)+"'";return Z.implicitKey?z:B1.foldFlowLines(z,X,B1.FOLD_FLOW,n6(Z,!1))}function Q$($,Z){let{singleQuote:X}=Z.options,z;if(X===!1)z=z2;else{let J=$.includes('"'),Q=$.includes("'");if(J&&!Q)z=$3;else if(Q&&!J)z=z2;else z=X?$3:z2}return z($,Z)}var Z3;try{Z3=new RegExp(`(^|(?<!
|
|
44
44
|
))
|
|
45
45
|
+(?!
|
|
46
|
-
|$)`,"g")}catch{
|
|
46
|
+
|$)`,"g")}catch{Z3=/\n+(?!\n|$)/g}function i6({comment:$,type:Z,value:X},z,J,Q){let{blockQuote:Y,commentString:W,lineWidth:U}=z.options;if(!Y||/\n[\t ]+$/.test(X))return Q$(X,z);let q=z.indent||(z.forceBlockIndent||r6(X)?" ":""),G=Y==="literal"?!0:Y==="folded"||Z===u0.Scalar.BLOCK_FOLDED?!1:Z===u0.Scalar.BLOCK_LITERAL?!0:!Eq(X,U,q.length);if(!X)return G?`|
|
|
47
47
|
`:`>
|
|
48
48
|
`;let V,K;for(K=X.length;K>0;--K){let y=X[K-1];if(y!==`
|
|
49
49
|
`&&y!=="\t"&&y!==" ")break}let H=X.substring(K),N=H.indexOf(`
|
|
50
50
|
`);if(N===-1)V="-";else if(X===H||N!==H.length-1){if(V="+",Q)Q()}else V="";if(H){if(X=X.slice(0,-H.length),H[H.length-1]===`
|
|
51
|
-
`)H=H.slice(0,-1);H=H.replace(
|
|
52
|
-
`)T=O;else break}let
|
|
53
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${q}`),
|
|
54
|
-
${q}${_}`}return X=X.replace(/\n+/g,`$&${q}`),`|${
|
|
55
|
-
${q}${
|
|
56
|
-
`)||G&&/[[\]{},]/.test(Q))return
|
|
57
|
-
`)?
|
|
58
|
-
`))return
|
|
59
|
-
${U}`);if(Y){let K=(B)=>B.default&&B.tag!=="tag:yaml.org,2002:str"&&B.test?.test(V),{compat:H,tags:N}=Z.doc.schema;if(N.some(K)||H?.some(K))return
|
|
60
|
-
${Z.indent}${W}`}uq.createStringifyContext=vq;uq.stringify=hq});var
|
|
61
|
-
${W}:`}else if(O=`${O}:`,K)O+=
|
|
62
|
-
`:"",
|
|
63
|
-
${
|
|
64
|
-
`&&
|
|
65
|
-
|
|
66
|
-
`}else
|
|
67
|
-
${X.indent}`}else if(!H
|
|
68
|
-
`),
|
|
51
|
+
`)H=H.slice(0,-1);H=H.replace(Z3,`$&${q}`)}let B=!1,O,T=-1;for(O=0;O<X.length;++O){let y=X[O];if(y===" ")B=!0;else if(y===`
|
|
52
|
+
`)T=O;else break}let F=X.substring(0,T<O?T+1:O);if(F)X=X.substring(F.length),F=F.replace(/\n+/g,`$&${q}`);let S=(B?q?"2":"1":"")+V;if($){if(S+=" "+W($.replace(/ ?[\r\n]+/g," ")),J)J()}if(!G){let y=X.replace(/\n+/g,`
|
|
53
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${q}`),b=!1,l=n6(z,!0);if(Y!=="folded"&&Z!==u0.Scalar.BLOCK_FOLDED)l.onOverflow=()=>{b=!0};let _=B1.foldFlowLines(`${F}${y}${H}`,q,B1.FOLD_BLOCK,l);if(!b)return`>${S}
|
|
54
|
+
${q}${_}`}return X=X.replace(/\n+/g,`$&${q}`),`|${S}
|
|
55
|
+
${q}${F}${X}${H}`}function wq($,Z,X,z){let{type:J,value:Q}=$,{actualString:Y,implicitKey:W,indent:U,indentStep:q,inFlow:G}=Z;if(W&&Q.includes(`
|
|
56
|
+
`)||G&&/[[\]{},]/.test(Q))return Q$(Q,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(Q))return W||G||!Q.includes(`
|
|
57
|
+
`)?Q$(Q,Z):i6($,Z,X,z);if(!W&&!G&&J!==u0.Scalar.PLAIN&&Q.includes(`
|
|
58
|
+
`))return i6($,Z,X,z);if(r6(Q)){if(U==="")return Z.forceBlockIndent=!0,i6($,Z,X,z);else if(W&&U===q)return Q$(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:H,tags:N}=Z.doc.schema;if(N.some(K)||H?.some(K))return Q$(Q,Z)}return W?V:B1.foldFlowLines(V,U,B1.FOLD_FLOW,n6(Z,!1))}function Sq($,Z,X,z){let{implicitKey:J,inFlow:Q}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:W}=$;if(W!==u0.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))W=u0.Scalar.QUOTE_DOUBLE}let U=(G)=>{switch(G){case u0.Scalar.BLOCK_FOLDED:case u0.Scalar.BLOCK_LITERAL:return J||Q?Q$(Y.value,Z):i6(Y,Z,X,z);case u0.Scalar.QUOTE_DOUBLE:return z2(Y.value,Z);case u0.Scalar.QUOTE_SINGLE:return $3(Y.value,Z);case u0.Scalar.PLAIN:return wq(Y,Z,X,z);default:return null}},q=U(W);if(q===null){let{defaultKeyType:G,defaultStringType:V}=Z.options,K=J&&G||V;if(q=U(K),q===null)throw Error(`Unsupported default string type ${K}`)}return q}jq.stringifyString=Sq});var Q2=C((uq)=>{var bq=c6(),M1=i(),kq=X2(),yq=J2();function vq($,Z){let X=Object.assign({blockQuote:!0,commentString:kq.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},$.schema.toStringOptions,Z),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 fq($,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(M1.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 gq($,Z,{anchors:X,doc:z}){if(!z.directives)return"";let J=[],Q=(M1.isScalar($)||M1.isCollection($))&&$.anchor;if(Q&&bq.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 hq($,Z,X,z){if(M1.isPair($))return $.toString(Z,X,z);if(M1.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=M1.isNode($)?$:Z.doc.createNode($,{onTagObj:(U)=>J=U});J??(J=fq(Z.doc.schema.tags,Q));let Y=gq(Q,J,Z);if(Y.length>0)Z.indentAtStart=(Z.indentAtStart??0)+Y.length+1;let W=typeof J.stringify==="function"?J.stringify(Q,Z,X,z):M1.isScalar(Q)?yq.stringifyString(Q,Z,X,z):Q.toString(Z,X,z);if(!Y)return W;return M1.isScalar(Q)||W[0]==="{"||W[0]==="["?`${Y} ${W}`:`${Y}
|
|
60
|
+
${Z.indent}${W}`}uq.createStringifyContext=vq;uq.stringify=hq});var J7=C((dq)=>{var X1=i(),X7=X0(),z7=Q2(),Y2=X2();function lq({key:$,value:Z},X,z,J){let{allNullValues:Q,doc:Y,indent:W,indentStep:U,options:{commentString:q,indentSeq:G,simpleKeys:V}}=X,K=X1.isNode($)&&$.comment||null;if(V){if(K)throw Error("With simple keys, key nodes cannot have comments");if(X1.isCollection($)||!X1.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let H=!V&&(!$||K&&Z==null&&!X.inFlow||X1.isCollection($)||(X1.isScalar($)?$.type===X7.Scalar.BLOCK_FOLDED||$.type===X7.Scalar.BLOCK_LITERAL:typeof $==="object"));X=Object.assign({},X,{allNullValues:!1,implicitKey:!H&&(V||!Q),indent:W+U});let N=!1,B=!1,O=z7.stringify($,X,()=>N=!0,()=>B=!0);if(!H&&!X.inFlow&&O.length>1024){if(V)throw Error("With simple keys, single line scalar must not span more than 1024 characters");H=!0}if(X.inFlow){if(Q||Z==null){if(N&&z)z();return O===""?"?":H?`? ${O}`:O}}else if(Q&&!V||Z==null&&H){if(O=`? ${O}`,K&&!N)O+=Y2.lineComment(O,X.indent,q(K));else if(B&&J)J();return O}if(N)K=null;if(H){if(K)O+=Y2.lineComment(O,X.indent,q(K));O=`? ${O}
|
|
61
|
+
${W}:`}else if(O=`${O}:`,K)O+=Y2.lineComment(O,X.indent,q(K));let T,F,w;if(X1.isNode(Z))T=!!Z.spaceBefore,F=Z.commentBefore,w=Z.comment;else if(T=!1,F=null,w=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(X.implicitKey=!1,!H&&!K&&X1.isScalar(Z))X.indentAtStart=O.length+1;if(B=!1,!G&&U.length>=2&&!X.inFlow&&!H&&X1.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)X.indent=X.indent.substring(2);let S=!1,y=z7.stringify(Z,X,()=>S=!0,()=>B=!0),b=" ";if(K||T||F){if(b=T?`
|
|
62
|
+
`:"",F){let l=q(F);b+=`
|
|
63
|
+
${Y2.indentComment(l,X.indent)}`}if(y===""&&!X.inFlow){if(b===`
|
|
64
|
+
`&&w)b=`
|
|
65
|
+
|
|
66
|
+
`}else b+=`
|
|
67
|
+
${X.indent}`}else if(!H&&X1.isCollection(Z)){let l=y[0],_=y.indexOf(`
|
|
68
|
+
`),u=_!==-1,V0=X.inFlow??Z.flow??Z.items.length===0;if(u||!V0){let O0=!1;if(u&&(l==="&"||l==="!")){let E=y.indexOf(" ");if(l==="&"&&E!==-1&&E<_&&y[E+1]==="!")E=y.indexOf(" ",E+1);if(E===-1||_<E)O0=!0}if(!O0)b=`
|
|
69
69
|
${X.indent}`}}else if(y===""||y[0]===`
|
|
70
|
-
`)
|
|
70
|
+
`)b="";if(O+=b+y,X.inFlow){if(S&&z)z()}else if(w&&!S)O+=Y2.lineComment(O,X.indent,q(w));else if(B&&J)J();return O}dq.stringifyPair=lq});var X3=C((rq)=>{var Q7=F0("process");function iq($,...Z){if($==="debug")console.log(...Z)}function nq($,Z){if($==="debug"||$==="warn")if(typeof Q7.emitWarning==="function")Q7.emitWarning(Z);else console.warn(Z)}rq.debug=iq;rq.warn=nq});var t6=C((tq)=>{var o6=i(),Y7=X0(),s6="<<",a6={identify:($)=>$===s6||typeof $==="symbol"&&$.description===s6,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Y7.Scalar(Symbol(s6)),{addToJSMap:W7}),stringify:()=>s6},oq=($,Z)=>(a6.identify(Z)||o6.isScalar(Z)&&(!Z.type||Z.type===Y7.Scalar.PLAIN)&&a6.identify(Z.value))&&$?.doc.schema.tags.some((X)=>X.tag===a6.tag&&X.default);function W7($,Z,X){let z=U7($,X);if(o6.isSeq(z))for(let J of z.items)z3($,Z,J);else if(Array.isArray(z))for(let J of z)z3($,Z,J);else z3($,Z,z)}function z3($,Z,X){let z=U7($,X);if(!o6.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}function U7($,Z){return $&&o6.isAlias(Z)?Z.resolve($.doc,$):Z}tq.addMergeToJSMap=W7;tq.isMergeKey=oq;tq.merge=a6});var Q3=C((YG)=>{var XG=X3(),q7=t6(),zG=Q2(),G7=i(),J3=H1();function JG($,Z,{key:X,value:z}){if(G7.isNode(X)&&X.addToJSMap)X.addToJSMap($,Z,z);else if(q7.isMergeKey($,X))q7.addMergeToJSMap($,Z,z);else{let J=J3.toJS(X,"",$);if(Z instanceof Map)Z.set(J,J3.toJS(z,J,$));else if(Z instanceof Set)Z.add(J);else{let Q=QG(X,J,$),Y=J3.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 QG($,Z,X){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(G7.isNode($)&&X?.doc){let z=zG.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)+'..."';XG.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)}YG.addPairToJSMap=JG});var O1=C((VG)=>{var V7=Z2(),UG=J7(),qG=Q3(),e6=i();function GG($,Z,X){let z=V7.createNode($,void 0,X),J=V7.createNode(Z,void 0,X);return new $8(z,J)}class $8{constructor($,Z=null){Object.defineProperty(this,e6.NODE_TYPE,{value:e6.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:X}=this;if(e6.isNode(Z))Z=Z.clone($);if(e6.isNode(X))X=X.clone($);return new $8(Z,X)}toJSON($,Z){let X=Z?.mapAsMap?new Map:{};return qG.addPairToJSMap(Z,X,this)}toString($,Z,X){return $?.doc?UG.stringifyPair(this,$,Z,X):JSON.stringify(this)}}VG.Pair=$8;VG.createPair=GG});var Y3=C((LG)=>{var v1=i(),K7=Q2(),Z8=X2();function BG($,Z,X){return(Z.inFlow??$.flow?OG:MG)($,Z,X)}function MG({comment:$,items:Z},X,{blockItemPrefix:z,flowChars:J,itemIndent:Q,onChompKeep:Y,onComment:W}){let{indent:U,options:{commentString:q}}=X,G=Object.assign({},X,{indent:Q,type:null}),V=!1,K=[];for(let N=0;N<Z.length;++N){let B=Z[N],O=null;if(v1.isNode(B)){if(!V&&B.spaceBefore)K.push("");if(X8(X,K,B.commentBefore,V),B.comment)O=B.comment}else if(v1.isPair(B)){let F=v1.isNode(B.key)?B.key:null;if(F){if(!V&&F.spaceBefore)K.push("");X8(X,K,F.commentBefore,V)}}V=!1;let T=K7.stringify(B,G,()=>O=null,()=>V=!0);if(O)T+=Z8.lineComment(T,Q,q(O));if(V&&O)V=!1;K.push(z+T)}let H;if(K.length===0)H=J.start+J.end;else{H=K[0];for(let N=1;N<K.length;++N){let B=K[N];H+=B?`
|
|
71
71
|
${U}${B}`:`
|
|
72
72
|
`}}if($){if(H+=`
|
|
73
|
-
|
|
74
|
-
`)),N<$.length-1)T+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)q||(q=V.reduce((
|
|
73
|
+
`+Z8.indentComment(q($),U),W)W()}else if(V&&Y)Y();return H}function OG({items:$},Z,{flowChars:X,itemIndent:z}){let{indent:J,indentStep:Q,flowCollectionPadding:Y,options:{commentString:W}}=Z;z+=Q;let U=Object.assign({},Z,{indent:z,inFlow:!0,type:null}),q=!1,G=0,V=[];for(let N=0;N<$.length;++N){let B=$[N],O=null;if(v1.isNode(B)){if(B.spaceBefore)V.push("");if(X8(Z,V,B.commentBefore,!1),B.comment)O=B.comment}else if(v1.isPair(B)){let F=v1.isNode(B.key)?B.key:null;if(F){if(F.spaceBefore)V.push("");if(X8(Z,V,F.commentBefore,!1),F.comment)q=!0}let w=v1.isNode(B.value)?B.value:null;if(w){if(w.comment)O=w.comment;if(w.commentBefore)q=!0}else if(B.value==null&&F?.comment)O=F.comment}if(O)q=!0;let T=K7.stringify(B,U,()=>O=null);if(q||(q=V.length>G||T.includes(`
|
|
74
|
+
`)),N<$.length-1)T+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)q||(q=V.reduce((F,w)=>F+w.length+2,2)+(T.length+2)>Z.options.lineWidth);if(q)T+=","}if(O)T+=Z8.lineComment(T,z,W(O));V.push(T),G=V.length}let{start:K,end:H}=X;if(V.length===0)return K+H;else{if(!q){let N=V.reduce((B,O)=>B+O.length+2,2);q=Z.options.lineWidth>0&&N>Z.options.lineWidth}if(q){let N=K;for(let B of V)N+=B?`
|
|
75
75
|
${Q}${J}${B}`:`
|
|
76
76
|
`;return`${N}
|
|
77
|
-
${J}${H}`}else return`${K}${Y}${V.join(" ")}${Y}${H}`}}function
|
|
78
|
-
`:" ")}return SV.stringifyString({comment:$,type:Z,value:W},z,J,Q)}};xV.binary=jV});var
|
|
77
|
+
${J}${H}`}else return`${K}${Y}${V.join(" ")}${Y}${H}`}}function X8({indent:$,options:{commentString:Z}},X,z,J){if(z&&J)z=z.replace(/^\n+/,"");if(z){let Q=Z8.indentComment(Z(z),$);X.push(Q.trimStart())}}LG.stringifyCollection=BG});var N1=C((RG)=>{var DG=Y3(),IG=Q3(),TG=p6(),L1=i(),z8=O1(),AG=X0();function W2($,Z){let X=L1.isScalar(Z)?Z.value:Z;for(let z of $)if(L1.isPair(z)){if(z.key===Z||z.key===X)return z;if(L1.isScalar(z.key)&&z.key.value===X)return z}return}class H7 extends TG.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(L1.MAP,$);this.items=[]}static from($,Z,X){let{keepUndefined:z,replacer:J}=X,Q=new this($),Y=(W,U)=>{if(typeof J==="function")U=J.call(Z,W,U);else if(Array.isArray(J)&&!J.includes(W))return;if(U!==void 0||z)Q.items.push(z8.createPair(W,U,X))};if(Z instanceof Map)for(let[W,U]of Z)Y(W,U);else if(Z&&typeof Z==="object")for(let W of Object.keys(Z))Y(W,Z[W]);if(typeof $.sortMapEntries==="function")Q.items.sort($.sortMapEntries);return Q}add($,Z){let X;if(L1.isPair($))X=$;else if(!$||typeof $!=="object"||!("key"in $))X=new z8.Pair($,$?.value);else X=new z8.Pair($.key,$.value);let z=W2(this.items,X.key),J=this.schema?.sortMapEntries;if(z){if(!Z)throw Error(`Key ${X.key} already set`);if(L1.isScalar(z.value)&&AG.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=W2(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let z=W2(this.items,$)?.value;return(!Z&&L1.isScalar(z)?z.value:z)??void 0}has($){return!!W2(this.items,$)}set($,Z){this.add(new z8.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)IG.addPairToJSMap(Z,z,J);return z}toString($,Z,X){if(!$)return JSON.stringify(this);for(let z of this.items)if(!L1.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 DG.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:X,onComment:Z})}}RG.YAMLMap=H7;RG.findPair=W2});var Y$=C((EG)=>{var CG=i(),B7=N1(),PG={collection:"map",default:!0,nodeClass:B7.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!CG.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,X)=>B7.YAMLMap.from($,Z,X)};EG.map=PG});var D1=C((yG)=>{var SG=Z2(),jG=Y3(),xG=p6(),Q8=i(),bG=X0(),kG=H1();class M7 extends xG.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(Q8.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=J8($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let X=J8($);if(typeof X!=="number")return;let z=this.items[X];return!Z&&Q8.isScalar(z)?z.value:z}has($){let Z=J8($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let X=J8($);if(typeof X!=="number")throw Error(`Expected a valid index, not ${$}.`);let z=this.items[X];if(Q8.isScalar(z)&&bG.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(kG.toJS(J,String(z++),Z));return X}toString($,Z,X){if(!$)return JSON.stringify(this);return jG.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 W=Z instanceof Set?Y:String(Q++);Y=z.call(Z,W,Y)}J.items.push(SG.createNode(Y,void 0,X))}}return J}}function J8($){let Z=Q8.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}yG.YAMLSeq=M7});var W$=C((hG)=>{var fG=i(),O7=D1(),gG={collection:"seq",default:!0,nodeClass:O7.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!fG.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,X)=>O7.YAMLSeq.from($,Z,X)};hG.seq=gG});var U2=C((lG)=>{var mG=J2(),cG={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,X,z){return Z=Object.assign({actualString:!0},Z),mG.stringifyString($,Z,X,z)}};lG.string=cG});var Y8=C((pG)=>{var L7=X0(),N7={identify:($)=>$==null,createNode:()=>new L7.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new L7.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&N7.test.test($)?$:Z.options.nullStr};pG.nullTag=N7});var W3=C((rG)=>{var nG=X0(),D7={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new nG.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},X){if($&&D7.test.test($)){let z=$[0]==="t"||$[0]==="T";if(Z===z)return $}return Z?X.options.trueStr:X.options.falseStr}};rG.boolTag=D7});var U$=C((oG)=>{function aG({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)&&!Q.includes("e")){let Y=Q.indexOf(".");if(Y<0)Y=Q.length,Q+=".";let W=Z-(Q.length-Y-1);while(W-- >0)Q+="0"}return Q}oG.stringifyNumber=aG});var q3=C((zV)=>{var eG=X0(),U3=U$(),$V={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:U3.stringifyNumber},ZV={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():U3.stringifyNumber($)}},XV={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new eG.Scalar(parseFloat($)),X=$.indexOf(".");if(X!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-X-1;return Z},stringify:U3.stringifyNumber};zV.float=XV;zV.floatExp=ZV;zV.floatNaN=$V});var V3=C((GV)=>{var I7=U$(),W8=($)=>typeof $==="bigint"||Number.isInteger($),G3=($,Z,X,{intAsBigInt:z})=>z?BigInt($):parseInt($.substring(Z),X);function T7($,Z,X){let{value:z}=$;if(W8(z)&&z>=0)return X+z.toString(Z);return I7.stringifyNumber($)}var WV={identify:($)=>W8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,X)=>G3($,2,8,X),stringify:($)=>T7($,8,"0o")},UV={identify:W8,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,X)=>G3($,0,10,X),stringify:I7.stringifyNumber},qV={identify:($)=>W8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,X)=>G3($,2,16,X),stringify:($)=>T7($,16,"0x")};GV.int=UV;GV.intHex=qV;GV.intOct=WV});var A7=C((IV)=>{var BV=Y$(),MV=Y8(),OV=W$(),LV=U2(),NV=W3(),K3=q3(),H3=V3(),DV=[BV.map,OV.seq,LV.string,MV.nullTag,NV.boolTag,H3.intOct,H3.int,H3.intHex,K3.floatNaN,K3.floatExp,K3.float];IV.schema=DV});var _7=C((EV)=>{var AV=X0(),RV=Y$(),_V=W$();function R7($){return typeof $==="bigint"||Number.isInteger($)}var U8=({value:$})=>JSON.stringify($),FV=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:U8},{identify:($)=>$==null,createNode:()=>new AV.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:U8},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:U8},{identify:R7,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:X})=>X?BigInt($):parseInt($,10),stringify:({value:$})=>R7($)?$.toString():JSON.stringify($)},{identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:($)=>parseFloat($),stringify:U8}],CV={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},PV=[RV.map,_V.seq].concat(FV,CV);EV.schema=PV});var M3=C((xV)=>{var q2=F0("buffer"),B3=X0(),SV=J2(),jV={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof q2.Buffer==="function")return q2.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,W;if(typeof q2.Buffer==="function")W=Y instanceof q2.Buffer?Y.toString("base64"):q2.Buffer.from(Y.buffer).toString("base64");else if(typeof btoa==="function"){let U="";for(let q=0;q<Y.length;++q)U+=String.fromCharCode(Y[q]);W=btoa(U)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(Z??(Z=B3.Scalar.BLOCK_LITERAL),Z!==B3.Scalar.QUOTE_DOUBLE){let U=Math.max(z.options.lineWidth-z.indent.length,z.options.minContentWidth),q=Math.ceil(W.length/U),G=Array(q);for(let V=0,K=0;V<q;++V,K+=U)G[V]=W.substr(K,U);W=G.join(Z===B3.Scalar.BLOCK_LITERAL?`
|
|
78
|
+
`:" ")}return SV.stringifyString({comment:$,type:Z,value:W},z,J,Q)}};xV.binary=jV});var G8=C((fV)=>{var q8=i(),O3=O1(),kV=X0(),yV=D1();function F7($,Z){if(q8.isSeq($))for(let X=0;X<$.items.length;++X){let z=$.items[X];if(q8.isPair(z))continue;else if(q8.isMap(z)){if(z.items.length>1)Z("Each pair must have its own sequence indicator");let J=z.items[0]||new O3.Pair(new kV.Scalar(null));if(z.commentBefore)J.key.commentBefore=J.key.commentBefore?`${z.commentBefore}
|
|
79
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]=U8.isPair(z)?z:new M3.Pair(z)}else Z("Expected a sequence for this tag");return $}function F7($,Z,X){let{replacer:z}=X,J=new yV.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 W,U;if(Array.isArray(Y))if(Y.length===2)W=Y[0],U=Y[1];else throw TypeError(`Expected [key, value] tuple: ${Y}`);else if(Y&&Y instanceof Object){let q=Object.keys(Y);if(q.length===1)W=q[0],U=Y[W];else throw TypeError(`Expected tuple with one key, not ${q.length} keys`)}else W=Y;J.items.push(M3.createPair(W,U,X))}return J}var vV={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:_7,createNode:F7};fV.createPairs=F7;fV.pairs=vV;fV.resolvePairs=_7});var L3=C((lV)=>{var C7=i(),O3=V1(),q2=O1(),mV=L1(),P7=q8();class y1 extends mV.YAMLSeq{constructor(){super();this.add=q2.YAMLMap.prototype.add.bind(this),this.delete=q2.YAMLMap.prototype.delete.bind(this),this.get=q2.YAMLMap.prototype.get.bind(this),this.has=q2.YAMLMap.prototype.has.bind(this),this.set=q2.YAMLMap.prototype.set.bind(this),this.tag=y1.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(C7.isPair(z))J=O3.toJS(z.key,"",Z),Q=O3.toJS(z.value,J,Z);else J=O3.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=P7.createPairs($,Z,X),J=new this;return J.items=z.items,J}}y1.tag="tag:yaml.org,2002:omap";var cV={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:y1,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let X=P7.resolvePairs($,Z),z=[];for(let{key:J}of X.items)if(C7.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 y1,X)},createNode:($,Z,X)=>y1.from($,Z,X)};lV.YAMLOMap=y1;lV.omap=cV});var x7=C((iV)=>{var E7=z0();function w7({value:$,source:Z},X){if(Z&&($?S7:j7).test.test(Z))return Z;return $?X.options.trueStr:X.options.falseStr}var S7={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new E7.Scalar(!0),stringify:w7},j7={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new E7.Scalar(!1),stringify:w7};iV.falseTag=j7;iV.trueTag=S7});var b7=C((eV)=>{var sV=z0(),N3=Y$(),aV={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:N3.stringifyNumber},oV={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():N3.stringifyNumber($)}},tV={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new sV.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:N3.stringifyNumber};eV.float=tV;eV.floatExp=oV;eV.floatNaN=aV});var y7=C((WK)=>{var k7=Y$(),G2=($)=>typeof $==="bigint"||Number.isInteger($);function G8($,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 D3($,Z,X){let{value:z}=$;if(G2(z)){let J=z.toString(Z);return z<0?"-"+X+J.substr(1):X+J}return k7.stringifyNumber($)}var zK={identify:G2,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,X)=>G8($,2,2,X),stringify:($)=>D3($,2,"0b")},JK={identify:G2,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,X)=>G8($,1,8,X),stringify:($)=>D3($,8,"0")},QK={identify:G2,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,X)=>G8($,0,10,X),stringify:k7.stringifyNumber},YK={identify:G2,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,X)=>G8($,2,16,X),stringify:($)=>D3($,16,"0x")};WK.int=QK;WK.intBin=zK;WK.intHex=YK;WK.intOct=JK});var I3=C((HK)=>{var H8=i(),V8=B1(),K8=O1();class v1 extends K8.YAMLMap{constructor($){super($);this.tag=v1.tag}add($){let Z;if(H8.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new V8.Pair($.key,null);else Z=new V8.Pair($,null);if(!K8.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let X=K8.findPair(this.items,$);return!Z&&H8.isPair(X)?H8.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=K8.findPair(this.items,$);if(X&&!Z)this.items.splice(this.items.indexOf(X),1);else if(!X&&Z)this.items.push(new V8.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(V8.createPair(Q,null,X))}return J}}v1.tag="tag:yaml.org,2002:set";var KK={collection:"map",identify:($)=>$ instanceof Set,nodeClass:v1,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,X)=>v1.from($,Z,X),resolve($,Z){if(H8.isMap($))if($.hasAllNullValues(!0))return Object.assign(new v1,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};HK.YAMLSet=v1;HK.set=KK});var A3=C((DK)=>{var OK=Y$();function T3($,Z){let X=$[0],z=X==="-"||X==="+"?$.substring(1):$,J=(Y)=>Z?BigInt(Y):Number(Y),Q=z.replace(/_/g,"").split(":").reduce((Y,W)=>Y*J(60)+J(W),J(0));return X==="-"?J(-1)*Q:Q}function v7($){let{value:Z}=$,X=(Y)=>Y;if(typeof Z==="bigint")X=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return OK.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 LK={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})=>T3($,X),stringify:v7},NK={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:($)=>T3($,!1),stringify:v7},f7={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(f7.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,X,z,J,Q,Y,W]=Z.map(Number),U=Z[7]?Number((Z[7]+"00").substr(1,3)):0,q=Date.UTC(X,z-1,J,Q||0,Y||0,W||0,U),G=Z[8];if(G&&G!=="Z"){let V=T3(G,!1);if(Math.abs(V)<30)V*=60;q-=60000*V}return new Date(q)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};DK.floatTime=NK;DK.intTime=LK;DK.timestamp=f7});var h7=C((bK)=>{var RK=J$(),_K=Q8(),FK=Q$(),CK=W2(),PK=B3(),g7=x7(),R3=b7(),B8=y7(),EK=o6(),wK=L3(),SK=q8(),jK=I3(),_3=A3(),xK=[RK.map,FK.seq,CK.string,_K.nullTag,g7.trueTag,g7.falseTag,B8.intBin,B8.intOct,B8.int,B8.intHex,R3.floatNaN,R3.floatExp,R3.float,PK.binary,EK.merge,wK.omap,SK.pairs,jK.set,_3.intTime,_3.floatTime,_3.timestamp];bK.schema=xK});var s7=C((cK)=>{var l7=J$(),yK=Q8(),d7=Q$(),vK=W2(),fK=Y3(),F3=U3(),C3=G3(),gK=T7(),hK=R7(),p7=B3(),V2=o6(),i7=L3(),n7=q8(),u7=h7(),r7=I3(),M8=A3(),m7=new Map([["core",gK.schema],["failsafe",[l7.map,d7.seq,vK.string]],["json",hK.schema],["yaml11",u7.schema],["yaml-1.1",u7.schema]]),c7={binary:p7.binary,bool:fK.boolTag,float:F3.float,floatExp:F3.floatExp,floatNaN:F3.floatNaN,floatTime:M8.floatTime,int:C3.int,intHex:C3.intHex,intOct:C3.intOct,intTime:M8.intTime,map:l7.map,merge:V2.merge,null:yK.nullTag,omap:i7.omap,pairs:n7.pairs,seq:d7.seq,set:r7.set,timestamp:M8.timestamp},uK={"tag:yaml.org,2002:binary":p7.binary,"tag:yaml.org,2002:merge":V2.merge,"tag:yaml.org,2002:omap":i7.omap,"tag:yaml.org,2002:pairs":n7.pairs,"tag:yaml.org,2002:set":r7.set,"tag:yaml.org,2002:timestamp":M8.timestamp};function mK($,Z,X){let z=m7.get(Z);if(z&&!$)return X&&!z.includes(V2.merge)?z.concat(V2.merge):z.slice();let J=z;if(!J)if(Array.isArray($))J=[];else{let Q=Array.from(m7.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(V2.merge);return J.reduce((Q,Y)=>{let W=typeof Y==="string"?c7[Y]:Y;if(!W){let U=JSON.stringify(Y),q=Object.keys(c7).map((G)=>JSON.stringify(G)).join(", ");throw Error(`Unknown custom tag ${U}; use one of ${q}`)}if(!Q.includes(W))Q.push(W);return Q},[])}cK.coreKnownTags=uK;cK.getTags=mK});var w3=C((sK)=>{var P3=i(),pK=J$(),iK=Q$(),nK=W2(),O8=s7(),rK=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class E3{constructor({compat:$,customTags:Z,merge:X,resolveKnownTags:z,schema:J,sortMapEntries:Q,toStringDefaults:Y}){this.compat=Array.isArray($)?O8.getTags($,"compat"):$?O8.getTags(null,$):null,this.name=typeof J==="string"&&J||"core",this.knownTags=z?O8.coreKnownTags:{},this.tags=O8.getTags(Z,this.name,X),this.toStringOptions=Y??null,Object.defineProperty(this,P3.MAP,{value:pK.map}),Object.defineProperty(this,P3.SCALAR,{value:nK.string}),Object.defineProperty(this,P3.SEQ,{value:iK.seq}),this.sortMapEntries=typeof Q==="function"?Q:Q===!0?rK:null}clone(){let $=Object.create(E3.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}sK.Schema=E3});var a7=C((eK)=>{var oK=i(),S3=J2(),K2=Z2();function tK($,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=S3.createStringifyContext($,Z),{commentString:Q}=J.options;if($.commentBefore){if(X.length!==1)X.unshift("");let U=Q($.commentBefore);X.unshift(K2.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(oK.isNode($.contents)){if($.contents.spaceBefore&&z)X.push("");if($.contents.commentBefore){let G=Q($.contents.commentBefore);X.push(K2.indentComment(G,""))}J.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,q=S3.stringify($.contents,J,()=>W=null,U);if(W)q+=K2.lineComment(q,"",Q(W));if((q[0]==="|"||q[0]===">")&&X[X.length-1]==="---")X[X.length-1]=`--- ${q}`;else X.push(q)}else X.push(S3.stringify($.contents,J));if($.directives?.docEnd)if($.comment){let U=Q($.comment);if(U.includes(`
|
|
81
|
-
`))X.push("..."),X.push(
|
|
80
|
+
${Q.comment}`:z.comment}z=J}$.items[X]=q8.isPair(z)?z:new O3.Pair(z)}else Z("Expected a sequence for this tag");return $}function C7($,Z,X){let{replacer:z}=X,J=new yV.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 W,U;if(Array.isArray(Y))if(Y.length===2)W=Y[0],U=Y[1];else throw TypeError(`Expected [key, value] tuple: ${Y}`);else if(Y&&Y instanceof Object){let q=Object.keys(Y);if(q.length===1)W=q[0],U=Y[W];else throw TypeError(`Expected tuple with one key, not ${q.length} keys`)}else W=Y;J.items.push(O3.createPair(W,U,X))}return J}var vV={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:F7,createNode:C7};fV.createPairs=C7;fV.pairs=vV;fV.resolvePairs=F7});var N3=C((lV)=>{var P7=i(),L3=H1(),G2=N1(),mV=D1(),E7=G8();class f1 extends mV.YAMLSeq{constructor(){super();this.add=G2.YAMLMap.prototype.add.bind(this),this.delete=G2.YAMLMap.prototype.delete.bind(this),this.get=G2.YAMLMap.prototype.get.bind(this),this.has=G2.YAMLMap.prototype.has.bind(this),this.set=G2.YAMLMap.prototype.set.bind(this),this.tag=f1.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(P7.isPair(z))J=L3.toJS(z.key,"",Z),Q=L3.toJS(z.value,J,Z);else J=L3.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=E7.createPairs($,Z,X),J=new this;return J.items=z.items,J}}f1.tag="tag:yaml.org,2002:omap";var cV={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:f1,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let X=E7.resolvePairs($,Z),z=[];for(let{key:J}of X.items)if(P7.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 f1,X)},createNode:($,Z,X)=>f1.from($,Z,X)};lV.YAMLOMap=f1;lV.omap=cV});var b7=C((iV)=>{var w7=X0();function S7({value:$,source:Z},X){if(Z&&($?j7:x7).test.test(Z))return Z;return $?X.options.trueStr:X.options.falseStr}var j7={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new w7.Scalar(!0),stringify:S7},x7={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new w7.Scalar(!1),stringify:S7};iV.falseTag=x7;iV.trueTag=j7});var k7=C((eV)=>{var sV=X0(),D3=U$(),aV={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:D3.stringifyNumber},oV={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():D3.stringifyNumber($)}},tV={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new sV.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:D3.stringifyNumber};eV.float=tV;eV.floatExp=oV;eV.floatNaN=aV});var v7=C((WK)=>{var y7=U$(),V2=($)=>typeof $==="bigint"||Number.isInteger($);function V8($,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 I3($,Z,X){let{value:z}=$;if(V2(z)){let J=z.toString(Z);return z<0?"-"+X+J.substr(1):X+J}return y7.stringifyNumber($)}var zK={identify:V2,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,X)=>V8($,2,2,X),stringify:($)=>I3($,2,"0b")},JK={identify:V2,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,X)=>V8($,1,8,X),stringify:($)=>I3($,8,"0")},QK={identify:V2,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,X)=>V8($,0,10,X),stringify:y7.stringifyNumber},YK={identify:V2,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,X)=>V8($,2,16,X),stringify:($)=>I3($,16,"0x")};WK.int=QK;WK.intBin=zK;WK.intHex=YK;WK.intOct=JK});var T3=C((HK)=>{var B8=i(),K8=O1(),H8=N1();class g1 extends H8.YAMLMap{constructor($){super($);this.tag=g1.tag}add($){let Z;if(B8.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new K8.Pair($.key,null);else Z=new K8.Pair($,null);if(!H8.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let X=H8.findPair(this.items,$);return!Z&&B8.isPair(X)?B8.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=H8.findPair(this.items,$);if(X&&!Z)this.items.splice(this.items.indexOf(X),1);else if(!X&&Z)this.items.push(new K8.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(K8.createPair(Q,null,X))}return J}}g1.tag="tag:yaml.org,2002:set";var KK={collection:"map",identify:($)=>$ instanceof Set,nodeClass:g1,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,X)=>g1.from($,Z,X),resolve($,Z){if(B8.isMap($))if($.hasAllNullValues(!0))return Object.assign(new g1,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};HK.YAMLSet=g1;HK.set=KK});var R3=C((DK)=>{var OK=U$();function A3($,Z){let X=$[0],z=X==="-"||X==="+"?$.substring(1):$,J=(Y)=>Z?BigInt(Y):Number(Y),Q=z.replace(/_/g,"").split(":").reduce((Y,W)=>Y*J(60)+J(W),J(0));return X==="-"?J(-1)*Q:Q}function f7($){let{value:Z}=$,X=(Y)=>Y;if(typeof Z==="bigint")X=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return OK.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 LK={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})=>A3($,X),stringify:f7},NK={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:($)=>A3($,!1),stringify:f7},g7={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(g7.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,X,z,J,Q,Y,W]=Z.map(Number),U=Z[7]?Number((Z[7]+"00").substr(1,3)):0,q=Date.UTC(X,z-1,J,Q||0,Y||0,W||0,U),G=Z[8];if(G&&G!=="Z"){let V=A3(G,!1);if(Math.abs(V)<30)V*=60;q-=60000*V}return new Date(q)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};DK.floatTime=NK;DK.intTime=LK;DK.timestamp=g7});var u7=C((bK)=>{var RK=Y$(),_K=Y8(),FK=W$(),CK=U2(),PK=M3(),h7=b7(),_3=k7(),M8=v7(),EK=t6(),wK=N3(),SK=G8(),jK=T3(),F3=R3(),xK=[RK.map,FK.seq,CK.string,_K.nullTag,h7.trueTag,h7.falseTag,M8.intBin,M8.intOct,M8.int,M8.intHex,_3.floatNaN,_3.floatExp,_3.float,PK.binary,EK.merge,wK.omap,SK.pairs,jK.set,F3.intTime,F3.floatTime,F3.timestamp];bK.schema=xK});var a7=C((cK)=>{var d7=Y$(),yK=Y8(),p7=W$(),vK=U2(),fK=W3(),C3=q3(),P3=V3(),gK=A7(),hK=_7(),i7=M3(),K2=t6(),n7=N3(),r7=G8(),m7=u7(),s7=T3(),O8=R3(),c7=new Map([["core",gK.schema],["failsafe",[d7.map,p7.seq,vK.string]],["json",hK.schema],["yaml11",m7.schema],["yaml-1.1",m7.schema]]),l7={binary:i7.binary,bool:fK.boolTag,float:C3.float,floatExp:C3.floatExp,floatNaN:C3.floatNaN,floatTime:O8.floatTime,int:P3.int,intHex:P3.intHex,intOct:P3.intOct,intTime:O8.intTime,map:d7.map,merge:K2.merge,null:yK.nullTag,omap:n7.omap,pairs:r7.pairs,seq:p7.seq,set:s7.set,timestamp:O8.timestamp},uK={"tag:yaml.org,2002:binary":i7.binary,"tag:yaml.org,2002:merge":K2.merge,"tag:yaml.org,2002:omap":n7.omap,"tag:yaml.org,2002:pairs":r7.pairs,"tag:yaml.org,2002:set":s7.set,"tag:yaml.org,2002:timestamp":O8.timestamp};function mK($,Z,X){let z=c7.get(Z);if(z&&!$)return X&&!z.includes(K2.merge)?z.concat(K2.merge):z.slice();let J=z;if(!J)if(Array.isArray($))J=[];else{let Q=Array.from(c7.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(K2.merge);return J.reduce((Q,Y)=>{let W=typeof Y==="string"?l7[Y]:Y;if(!W){let U=JSON.stringify(Y),q=Object.keys(l7).map((G)=>JSON.stringify(G)).join(", ");throw Error(`Unknown custom tag ${U}; use one of ${q}`)}if(!Q.includes(W))Q.push(W);return Q},[])}cK.coreKnownTags=uK;cK.getTags=mK});var S3=C((sK)=>{var E3=i(),pK=Y$(),iK=W$(),nK=U2(),L8=a7(),rK=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class w3{constructor({compat:$,customTags:Z,merge:X,resolveKnownTags:z,schema:J,sortMapEntries:Q,toStringDefaults:Y}){this.compat=Array.isArray($)?L8.getTags($,"compat"):$?L8.getTags(null,$):null,this.name=typeof J==="string"&&J||"core",this.knownTags=z?L8.coreKnownTags:{},this.tags=L8.getTags(Z,this.name,X),this.toStringOptions=Y??null,Object.defineProperty(this,E3.MAP,{value:pK.map}),Object.defineProperty(this,E3.SCALAR,{value:nK.string}),Object.defineProperty(this,E3.SEQ,{value:iK.seq}),this.sortMapEntries=typeof Q==="function"?Q:Q===!0?rK:null}clone(){let $=Object.create(w3.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}sK.Schema=w3});var o7=C((eK)=>{var oK=i(),j3=Q2(),H2=X2();function tK($,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=j3.createStringifyContext($,Z),{commentString:Q}=J.options;if($.commentBefore){if(X.length!==1)X.unshift("");let U=Q($.commentBefore);X.unshift(H2.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(oK.isNode($.contents)){if($.contents.spaceBefore&&z)X.push("");if($.contents.commentBefore){let G=Q($.contents.commentBefore);X.push(H2.indentComment(G,""))}J.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,q=j3.stringify($.contents,J,()=>W=null,U);if(W)q+=H2.lineComment(q,"",Q(W));if((q[0]==="|"||q[0]===">")&&X[X.length-1]==="---")X[X.length-1]=`--- ${q}`;else X.push(q)}else X.push(j3.stringify($.contents,J));if($.directives?.docEnd)if($.comment){let U=Q($.comment);if(U.includes(`
|
|
81
|
+
`))X.push("..."),X.push(H2.indentComment(U,""));else X.push(`... ${U}`)}else X.push("...");else{let U=$.comment;if(U&&Y)U=U.replace(/^\n+/,"");if(U){if((!Y||W)&&X[X.length-1]!=="")X.push("");X.push(H2.indentComment(Q(U),""))}}return X.join(`
|
|
82
82
|
`)+`
|
|
83
|
-
`}eK.stringifyDocument=tK});var
|
|
83
|
+
`}eK.stringifyDocument=tK});var B2=C((UH)=>{var ZH=$2(),q$=p6(),y0=i(),XH=O1(),zH=H1(),JH=S3(),QH=o7(),x3=c6(),YH=o4(),WH=Z2(),b3=a4();class k3{constructor($,Z,X){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,y0.NODE_TYPE,{value:y0.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 b3.Directives({version:Q});this.setSchema(Q,X),this.contents=$===void 0?null:this.createNode($,z,X)}clone(){let $=Object.create(k3.prototype,{[y0.NODE_TYPE]:{value:y0.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=y0.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(G$(this.contents))this.contents.add($)}addIn($,Z){if(G$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let X=x3.anchorNames(this);$.anchor=!Z||X.has(Z)?x3.findNewAnchor(Z||"a",X):Z}return new ZH.Alias($.anchor)}createNode($,Z,X){let z=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),z=Z;else if(Array.isArray(Z)){let B=(T)=>typeof T==="number"||T instanceof String||T instanceof Number,O=Z.filter(B).map(String);if(O.length>0)Z=Z.concat(O);z=Z}else if(X===void 0&&Z)X=Z,Z=void 0;let{aliasDuplicateObjects:J,anchorPrefix:Q,flow:Y,keepUndefined:W,onTagObj:U,tag:q}=X??{},{onAnchor:G,setAnchors:V,sourceObjects:K}=x3.createNodeAnchors(this,Q||"a"),H={aliasDuplicateObjects:J??!0,keepUndefined:W??!1,onAnchor:G,onTagObj:U,replacer:z,schema:this.schema,sourceObjects:K},N=WH.createNode($,q,H);if(Y&&y0.isCollection(N))N.flow=!0;return V(),N}createPair($,Z,X={}){let z=this.createNode($,null,X),J=this.createNode(Z,null,X);return new XH.Pair(z,J)}delete($){return G$(this.contents)?this.contents.delete($):!1}deleteIn($){if(q$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return G$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return y0.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(q$.isEmptyPath($))return!Z&&y0.isScalar(this.contents)?this.contents.value:this.contents;return y0.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return y0.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(q$.isEmptyPath($))return this.contents!==void 0;return y0.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=q$.collectionFromPath(this.schema,[$],Z);else if(G$(this.contents))this.contents.set($,Z)}setIn($,Z){if(q$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=q$.collectionFromPath(this.schema,Array.from($),Z);else if(G$(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 b3.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 b3.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 JH.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},W=zH.toJS(this.contents,Z??"",Y);if(typeof J==="function")for(let{count:U,res:q}of Y.anchors.values())J(q,U);return typeof Q==="function"?YH.applyReviver(Q,{"":W},"",W):W}toJSON($,Z){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:Z})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let Z=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${Z}`)}return QH.stringifyDocument(this,$)}}function G$($){if(y0.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}UH.Document=k3});var M2=C((VH)=>{class N8 extends Error{constructor($,Z,X,z){super();this.name=$,this.code=X,this.message=z,this.pos=Z}}class t7 extends N8{constructor($,Z,X){super("YAMLParseError",$,Z,X)}}class e7 extends N8{constructor($,Z,X){super("YAMLWarning",$,Z,X)}}var GH=($,Z)=>(X)=>{if(X.pos[0]===-1)return;X.linePos=X.pos.map((W)=>Z.linePos(W));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 W=Math.min(Q-39,Y.length-79);Y="…"+Y.substring(W),Q-=W-1}if(Y.length>80)Y=Y.substring(0,79)+"…";if(z>1&&/^ *$/.test(Y.substring(0,Q))){let W=$.substring(Z.lineStarts[z-2],Z.lineStarts[z-1]);if(W.length>80)W=W.substring(0,79)+`…
|
|
84
84
|
`;Y=W+Y}if(/[^ ]/.test(Y)){let W=1,U=X.linePos[1];if(U?.line===z&&U.col>J)W=Math.max(1,Math.min(U.col-J,80-Q));let q=" ".repeat(Q)+"^".repeat(W);X.message+=`:
|
|
85
85
|
|
|
86
86
|
${Y}
|
|
87
87
|
${q}
|
|
88
|
-
`}};VH.YAMLError=
|
|
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(
|
|
90
|
-
`+B.comment;else W.comment=B.comment;continue}if(B.newlineAfterProp||wH.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",
|
|
91
|
-
`+
|
|
92
|
-
`+
|
|
93
|
-
`+
|
|
94
|
-
`+
|
|
95
|
-
`+O.comment;else q.comment=O.comment;q.range=[z.offset,B,O.offset]}else q.range=[z.offset,B,B];return q}aH.resolveFlowCollection=sH});var
|
|
88
|
+
`}};VH.YAMLError=N8;VH.YAMLParseError=t7;VH.YAMLWarning=e7;VH.prettifyError=GH});var O2=C((LH)=>{function OH($,{flow:Z,indicator:X,next:z,offset:J,onError:Q,parentIndent:Y,startOnNewline:W}){let U=!1,q=W,G=W,V="",K="",H=!1,N=!1,B=null,O=null,T=null,F=null,w=null,S=null,y=null;for(let _ of $){if(N){if(_.type!=="space"&&_.type!=="newline"&&_.type!=="comma")Q(_.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");N=!1}if(B){if(q&&_.type!=="comment"&&_.type!=="newline")Q(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");B=null}switch(_.type){case"space":if(!Z&&(X!=="doc-start"||z?.type!=="flow-collection")&&_.source.includes("\t"))B=_;G=!0;break;case"comment":{if(!G)Q(_,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=_.source.substring(1)||" ";if(!V)V=u;else V+=K+u;K="",q=!1;break}case"newline":if(q){if(V)V+=_.source;else if(!S||X!=="seq-item-ind")U=!0}else K+=_.source;if(q=!0,H=!0,O||T)F=_;G=!0;break;case"anchor":if(O)Q(_,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(_.source.endsWith(":"))Q(_.offset+_.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);O=_,y??(y=_.offset),q=!1,G=!1,N=!0;break;case"tag":{if(T)Q(_,"MULTIPLE_TAGS","A node can have at most one tag");T=_,y??(y=_.offset),q=!1,G=!1,N=!0;break}case X:if(O||T)Q(_,"BAD_PROP_ORDER",`Anchors and tags must be after the ${_.source} indicator`);if(S)Q(_,"UNEXPECTED_TOKEN",`Unexpected ${_.source} in ${Z??"collection"}`);S=_,q=X==="seq-item-ind"||X==="explicit-key-ind",G=!1;break;case"comma":if(Z){if(w)Q(_,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);w=_,q=!1,G=!1;break}default:Q(_,"UNEXPECTED_TOKEN",`Unexpected ${_.type} token`),q=!1,G=!1}}let b=$[$.length-1],l=b?b.offset+b.source.length:J;if(N&&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&&(q&&B.indent<=Y||z?.type==="block-map"||z?.type==="block-seq"))Q(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:w,found:S,spaceBefore:U,comment:V,hasNewline:H,anchor:O,tag:T,newlineAfterProp:F,end:l,start:y??l}}LH.resolveProps=OH});var D8=C((DH)=>{function y3($){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(y3(Z.key)||y3(Z.value))return!0}return!1;default:return!0}}DH.containsNewline=y3});var v3=C((RH)=>{var TH=D8();function AH($,Z,X){if(Z?.type==="flow-collection"){let z=Z.end[0];if(z.indent===$&&(z.source==="]"||z.source==="}")&&TH.containsNewline(Z))X(z,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}RH.flowIndentCheck=AH});var f3=C((CH)=>{var $X=i();function FH($,Z,X){let{uniqueKeys:z}=$.options;if(z===!1)return!1;let J=typeof z==="function"?z:(Q,Y)=>Q===Y||$X.isScalar(Q)&&$X.isScalar(Y)&&Q.value===Y.value;return Z.some((Q)=>J(Q.key,X))}CH.mapIncludes=FH});var QX=C((xH)=>{var ZX=O1(),EH=N1(),XX=O2(),wH=D8(),zX=v3(),SH=f3(),JX="All mapping items must start at the same column";function jH({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let W=new(Q?.nodeClass??EH.YAMLMap)(X.schema);if(X.atRoot)X.atRoot=!1;let U=z.offset,q=null;for(let G of z.items){let{start:V,key:K,sep:H,value:N}=G,B=XX.resolveProps(V,{indicator:"explicit-key-ind",next:K??H?.[0],offset:U,onError:J,parentIndent:z.indent,startOnNewline:!0}),O=!B.found;if(O){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",JX)}if(!B.anchor&&!B.tag&&!H){if(q=B.end,B.comment)if(W.comment)W.comment+=`
|
|
90
|
+
`+B.comment;else W.comment=B.comment;continue}if(B.newlineAfterProp||wH.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",JX);X.atKey=!0;let T=B.end,F=K?$(X,K,B,J):Z(X,T,V,null,B,J);if(X.schema.compat)zX.flowIndentCheck(z.indent,K,J);if(X.atKey=!1,SH.mapIncludes(X,W.items,F))J(T,"DUPLICATE_KEY","Map keys must be unique");let w=XX.resolveProps(H??[],{indicator:"map-value-ind",next:N,offset:F.range[2],onError:J,parentIndent:z.indent,startOnNewline:!K||K.type==="block-scalar"});if(U=w.end,w.found){if(O){if(N?.type==="block-map"&&!w.hasNewline)J(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(X.options.strict&&B.start<w.found.offset-1024)J(F.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let S=N?$(X,N,w,J):Z(X,U,H,null,w,J);if(X.schema.compat)zX.flowIndentCheck(z.indent,N,J);U=S.range[2];let y=new ZX.Pair(F,S);if(X.options.keepSourceTokens)y.srcToken=G;W.items.push(y)}else{if(O)J(F.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(w.comment)if(F.comment)F.comment+=`
|
|
91
|
+
`+w.comment;else F.comment=w.comment;let S=new ZX.Pair(F);if(X.options.keepSourceTokens)S.srcToken=G;W.items.push(S)}}if(q&&q<U)J(q,"IMPOSSIBLE","Map comment with trailing content");return W.range=[z.offset,U,q??U],W}xH.resolveBlockMap=jH});var YX=C((gH)=>{var kH=D1(),yH=O2(),vH=v3();function fH({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let W=new(Q?.nodeClass??kH.YAMLSeq)(X.schema);if(X.atRoot)X.atRoot=!1;if(X.atKey)X.atKey=!1;let U=z.offset,q=null;for(let{start:G,value:V}of z.items){let K=yH.resolveProps(G,{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(q=K.end,K.comment)W.comment=K.comment;continue}let H=V?$(X,V,K,J):Z(X,K.end,G,null,K,J);if(X.schema.compat)vH.flowIndentCheck(z.indent,V,J);U=H.range[2],W.items.push(H)}return W.range=[z.offset,U,q??U],W}gH.resolveBlockSeq=fH});var V$=C((mH)=>{function uH($,Z,X,z){let J="";if($){let Q=!1,Y="";for(let W of $){let{source:U,type:q}=W;switch(q){case"space":Q=!0;break;case"comment":{if(X&&!Q)z(W,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let G=U.substring(1)||" ";if(!J)J=G;else J+=Y+G;Y="";break}case"newline":if(J)Y+=U;Q=!0;break;default:z(W,"UNEXPECTED_TOKEN",`Unexpected ${q} at node end`)}Z+=U.length}}return{comment:J,offset:Z}}mH.resolveEnd=uH});var qX=C((aH)=>{var lH=i(),dH=O1(),WX=N1(),pH=D1(),iH=V$(),UX=O2(),nH=D8(),rH=f3(),g3="Block collections are not allowed within flow collections",h3=($)=>$&&($.type==="block-map"||$.type==="block-seq");function sH({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let Y=z.start.source==="{",W=Y?"flow map":"flow sequence",q=new(Q?.nodeClass??(Y?WX.YAMLMap:pH.YAMLSeq))(X.schema);q.flow=!0;let G=X.atRoot;if(G)X.atRoot=!1;if(X.atKey)X.atKey=!1;let V=z.offset+z.start.source.length;for(let O=0;O<z.items.length;++O){let T=z.items[O],{start:F,key:w,sep:S,value:y}=T,b=UX.resolveProps(F,{flow:W,indicator:"explicit-key-ind",next:w??S?.[0],offset:V,onError:J,parentIndent:z.indent,startOnNewline:!1});if(!b.found){if(!b.anchor&&!b.tag&&!S&&!y){if(O===0&&b.comma)J(b.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`);else if(O<z.items.length-1)J(b.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${W}`);if(b.comment)if(q.comment)q.comment+=`
|
|
92
|
+
`+b.comment;else q.comment=b.comment;V=b.end;continue}if(!Y&&X.options.strict&&nH.containsNewline(w))J(w,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(O===0){if(b.comma)J(b.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`)}else{if(!b.comma)J(b.start,"MISSING_CHAR",`Missing , between ${W} items`);if(b.comment){let l="";$:for(let _ of F)switch(_.type){case"comma":case"space":break;case"comment":l=_.source.substring(1);break $;default:break $}if(l){let _=q.items[q.items.length-1];if(lH.isPair(_))_=_.value??_.key;if(_.comment)_.comment+=`
|
|
93
|
+
`+l;else _.comment=l;b.comment=b.comment.substring(l.length+1)}}}if(!Y&&!S&&!b.found){let l=y?$(X,y,b,J):Z(X,b.end,S,null,b,J);if(q.items.push(l),V=l.range[2],h3(y))J(l.range,"BLOCK_IN_FLOW",g3)}else{X.atKey=!0;let l=b.end,_=w?$(X,w,b,J):Z(X,l,F,null,b,J);if(h3(w))J(_.range,"BLOCK_IN_FLOW",g3);X.atKey=!1;let u=UX.resolveProps(S??[],{flow:W,indicator:"map-value-ind",next:y,offset:_.range[2],onError:J,parentIndent:z.indent,startOnNewline:!1});if(u.found){if(!Y&&!b.found&&X.options.strict){if(S)for(let E of S){if(E===u.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(b.start<u.found.offset-1024)J(u.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(y)if("source"in y&&y.source?.[0]===":")J(y,"MISSING_CHAR",`Missing space after : in ${W}`);else J(u.start,"MISSING_CHAR",`Missing , or : between ${W} items`);let V0=y?$(X,y,u,J):u.found?Z(X,u.end,S,null,u,J):null;if(V0){if(h3(y))J(V0.range,"BLOCK_IN_FLOW",g3)}else if(u.comment)if(_.comment)_.comment+=`
|
|
94
|
+
`+u.comment;else _.comment=u.comment;let O0=new dH.Pair(_,V0);if(X.options.keepSourceTokens)O0.srcToken=T;if(Y){let E=q;if(rH.mapIncludes(X,E.items,_))J(l,"DUPLICATE_KEY","Map keys must be unique");E.items.push(O0)}else{let E=new WX.YAMLMap(X.schema);E.flow=!0,E.items.push(O0);let f=(V0??_).range;E.range=[_.range[0],f[1],f[2]],q.items.push(E)}V=V0?V0.range[2]:u.end}}let K=Y?"}":"]",[H,...N]=z.end,B=V;if(H?.source===K)B=H.offset+H.source.length;else{let O=W[0].toUpperCase()+W.substring(1),T=G?`${O} must end with a ${K}`:`${O} in block collection must be sufficiently indented and end with a ${K}`;if(J(V,G?"MISSING_CHAR":"BAD_INDENT",T),H&&H.source.length!==1)N.unshift(H)}if(N.length>0){let O=iH.resolveEnd(N,B,X.options.strict,J);if(O.comment)if(q.comment)q.comment+=`
|
|
95
|
+
`+O.comment;else q.comment=O.comment;q.range=[z.offset,B,O.offset]}else q.range=[z.offset,B,B];return q}aH.resolveFlowCollection=sH});var GX=C((YB)=>{var tH=i(),eH=X0(),$B=N1(),ZB=D1(),XB=QX(),zB=YX(),JB=qX();function u3($,Z,X,z,J,Q){let Y=X.type==="block-map"?XB.resolveBlockMap($,Z,X,z,Q):X.type==="block-seq"?zB.resolveBlockSeq($,Z,X,z,Q):JB.resolveFlowCollection($,Z,X,z,Q),W=Y.constructor;if(J==="!"||J===W.tagName)return Y.tag=W.tagName,Y;if(J)Y.tag=J;return Y}function QB($,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:H}=z,N=K&&Q?K.offset>Q.offset?K:Q:K??Q;if(N&&(!H||H.offset<N.offset))J(N,"MISSING_CHAR","Missing newline after block sequence props")}let W=X.type==="block-map"?"map":X.type==="block-seq"?"seq":X.start.source==="{"?"map":"seq";if(!Q||!Y||Y==="!"||Y===$B.YAMLMap.tagName&&W==="map"||Y===ZB.YAMLSeq.tagName&&W==="seq")return u3($,Z,X,J,Y);let U=Z.schema.tags.find((K)=>K.tag===Y&&K.collection===W);if(!U){let K=Z.schema.knownTags[Y];if(K?.collection===W)Z.schema.tags.push(Object.assign({},K,{default:!1})),U=K;else{if(K)J(Q,"BAD_COLLECTION_TYPE",`${K.tag} used for ${W} collection, but expects ${K.collection??"scalar"}`,!0);else J(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return u3($,Z,X,J,Y)}}let q=u3($,Z,X,J,Y,U),G=U.resolve?.(q,(K)=>J(Q,"TAG_RESOLVE_FAILED",K),Z.options)??q,V=tH.isNode(G)?G:new eH.Scalar(G);if(V.range=q.range,V.tag=Y,U?.format)V.format=U.format;return V}YB.composeCollection=QB});var c3=C((VB)=>{var m3=X0();function UB($,Z,X){let z=Z.offset,J=qB(Z,$.options.strict,X);if(!J)return{value:"",type:null,comment:"",range:[z,z,z]};let Q=J.mode===">"?m3.Scalar.BLOCK_FOLDED:m3.Scalar.BLOCK_LITERAL,Y=Z.source?GB(Z.source):[],W=Y.length;for(let B=Y.length-1;B>=0;--B){let O=Y[B][1];if(O===""||O==="\r")W=B;else break}if(W===0){let B=J.chomp==="+"&&Y.length>0?`
|
|
96
96
|
`.repeat(Math.max(1,Y.length-1)):"",O=z+J.length;if(Z.source)O+=Z.source.length;return{value:B,type:Q,comment:J.comment,range:[z,O,O]}}let U=Z.indent+J.indent,q=Z.offset+J.length,G=0;for(let B=0;B<W;++B){let[O,T]=Y[B];if(T===""||T==="\r"){if(J.indent===0&&O.length>U)U=O.length}else{if(O.length<U)X(q+O.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(J.indent===0)U=O.length;if(G=B,U===0&&!$.atRoot)X(q,"BAD_INDENT","Block scalar values in collections must be indented");break}q+=O.length+T.length+1}for(let B=Y.length-1;B>=W;--B)if(Y[B][0].length>U)W=B+1;let V="",K="",H=!1;for(let B=0;B<G;++B)V+=Y[B][0].slice(U)+`
|
|
97
|
-
`;for(let B=G;B<W;++B){let[O,T]=Y[B];q+=O.length+T.length+1;let
|
|
97
|
+
`;for(let B=G;B<W;++B){let[O,T]=Y[B];q+=O.length+T.length+1;let F=T[T.length-1]==="\r";if(F)T=T.slice(0,-1);if(T&&O.length<U){let S=`Block scalar lines must not be less indented than their ${J.indent?"explicit indentation indicator":"first line"}`;X(q-T.length-(F?2:1),"BAD_INDENT",S),O=""}if(Q===m3.Scalar.BLOCK_LITERAL)V+=K+O.slice(U)+T,K=`
|
|
98
98
|
`;else if(O.length>U||T[0]==="\t"){if(K===" ")K=`
|
|
99
99
|
`;else if(!H&&K===`
|
|
100
100
|
`)K=`
|
|
@@ -107,7 +107,7 @@ ${q}
|
|
|
107
107
|
`+Y[B][0].slice(U);if(V[V.length-1]!==`
|
|
108
108
|
`)V+=`
|
|
109
109
|
`;break;default:V+=`
|
|
110
|
-
`}let N=z+J.length+Z.source.length;return{value:V,type:Q,comment:J.comment,range:[z,N,N]}}function qB({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,W="",U=-1;for(let K=1;K<J.length;++K){let H=J[K];if(!W&&(H==="-"||H==="+"))W=H;else{let N=Number(H);if(!Y&&N)Y=N;else if(U===-1)U=$+K}}if(U!==-1)z(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${J}`);let q=!1,G="",V=J.length;for(let K=1;K<Z.length;++K){let H=Z[K];switch(H.type){case"space":q=!0;case"newline":V+=H.source.length;break;case"comment":if(X&&!q)z(H,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");V+=H.source.length,G=H.source.substring(1);break;case"error":z(H,"UNEXPECTED_TOKEN",H.message),V+=H.source.length;break;default:{let N=`Unexpected token in block scalar header: ${H.type}`;z(H,"UNEXPECTED_TOKEN",N);let B=H.source;if(B&&typeof B==="string")V+=B.length}}}return{mode:Q,indent:Y,chomp:W,comment:G,length:V}}function GB($){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}VB.resolveBlockScalar=UB});var
|
|
110
|
+
`}let N=z+J.length+Z.source.length;return{value:V,type:Q,comment:J.comment,range:[z,N,N]}}function qB({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,W="",U=-1;for(let K=1;K<J.length;++K){let H=J[K];if(!W&&(H==="-"||H==="+"))W=H;else{let N=Number(H);if(!Y&&N)Y=N;else if(U===-1)U=$+K}}if(U!==-1)z(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${J}`);let q=!1,G="",V=J.length;for(let K=1;K<Z.length;++K){let H=Z[K];switch(H.type){case"space":q=!0;case"newline":V+=H.source.length;break;case"comment":if(X&&!q)z(H,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");V+=H.source.length,G=H.source.substring(1);break;case"error":z(H,"UNEXPECTED_TOKEN",H.message),V+=H.source.length;break;default:{let N=`Unexpected token in block scalar header: ${H.type}`;z(H,"UNEXPECTED_TOKEN",N);let B=H.source;if(B&&typeof B==="string")V+=B.length}}}return{mode:Q,indent:Y,chomp:W,comment:G,length:V}}function GB($){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}VB.resolveBlockScalar=UB});var d3=C((TB)=>{var l3=X0(),HB=V$();function BB($,Z,X){let{offset:z,type:J,source:Q,end:Y}=$,W,U,q=(K,H,N)=>X(z+K,H,N);switch(J){case"scalar":W=l3.Scalar.PLAIN,U=MB(Q,q);break;case"single-quoted-scalar":W=l3.Scalar.QUOTE_SINGLE,U=OB(Q,q);break;case"double-quoted-scalar":W=l3.Scalar.QUOTE_DOUBLE,U=LB(Q,q);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 G=z+Q.length,V=HB.resolveEnd(Y,G,Z,X);return{value:U,type:W,comment:V.comment,range:[z,G,V.offset]}}function MB($,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 VX($)}function OB($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return VX($.slice(1,-1)).replace(/''/g,"'")}function VX($){let Z,X;try{Z=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
111
111
|
`,"sy"),X=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
112
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=`
|
|
@@ -122,55 +122,55 @@ ${q}
|
|
|
122
122
|
`)break;if(z===`
|
|
123
123
|
`)X+=`
|
|
124
124
|
`;Z+=1,z=$[Z+1]}if(!X)X=" ";return{fold:X,offset:Z}}var DB={"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 IB($,Z,X,z){let J=$.substr(Z,X),Y=J.length===X&&/^[0-9a-fA-F]+$/.test(J)?parseInt(J,16):NaN;try{return String.fromCodePoint(Y)}catch{let W=$.substr(Z-2,X+2);return z(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),W}}TB.resolveFlowScalar=BB});var
|
|
125
|
+
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function IB($,Z,X,z){let J=$.substr(Z,X),Y=J.length===X&&/^[0-9a-fA-F]+$/.test(J)?parseInt(J,16):NaN;try{return String.fromCodePoint(Y)}catch{let W=$.substr(Z-2,X+2);return z(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),W}}TB.resolveFlowScalar=BB});var HX=C((EB)=>{var h1=i(),KX=X0(),RB=c3(),_B=d3();function FB($,Z,X,z){let{value:J,type:Q,comment:Y,range:W}=Z.type==="block-scalar"?RB.resolveBlockScalar($,Z,z):_B.resolveFlowScalar(Z,$.options.strict,z),U=X?$.directives.tagName(X.source,(V)=>z(X,"TAG_RESOLVE_FAILED",V)):null,q;if($.options.stringKeys&&$.atKey)q=$.schema[h1.SCALAR];else if(U)q=CB($.schema,J,U,X,z);else if(Z.type==="scalar")q=PB($,J,Z,z);else q=$.schema[h1.SCALAR];let G;try{let V=q.resolve(J,(K)=>z(X??Z,"TAG_RESOLVE_FAILED",K),$.options);G=h1.isScalar(V)?V:new KX.Scalar(V)}catch(V){let K=V instanceof Error?V.message:String(V);z(X??Z,"TAG_RESOLVE_FAILED",K),G=new KX.Scalar(J)}if(G.range=W,G.source=J,Q)G.type=Q;if(U)G.tag=U;if(q.format)G.format=q.format;if(Y)G.comment=Y;return G}function CB($,Z,X,z,J){if(X==="!")return $[h1.SCALAR];let Q=[];for(let W of $.tags)if(!W.collection&&W.tag===X)if(W.default&&W.test)Q.push(W);else return W;for(let W of Q)if(W.test?.test(Z))return W;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"),$[h1.SCALAR]}function PB({atKey:$,directives:Z,schema:X},z,J,Q){let Y=X.tags.find((W)=>(W.default===!0||$&&W.default==="key")&&W.test?.test(z))||X[h1.SCALAR];if(X.compat){let W=X.compat.find((U)=>U.default&&U.test?.test(z))??X[h1.SCALAR];if(Y.tag!==W.tag){let U=Z.tagString(Y.tag),q=Z.tagString(W.tag),G=`Value may be parsed as either ${U} or ${q}`;Q(J,"TAG_RESOLVE_FAILED",G,!0)}}return Y}EB.composeScalar=FB});var BX=C((jB)=>{function SB($,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 $}jB.emptyScalarPosition=SB});var LX=C((uB)=>{var bB=$2(),kB=i(),yB=GX(),MX=HX(),vB=V$(),fB=BX(),gB={composeNode:OX,composeEmptyNode:p3};function OX($,Z,X,z){let J=$.atKey,{spaceBefore:Q,comment:Y,anchor:W,tag:U}=X,q,G=!0;switch(Z.type){case"alias":if(q=hB($,Z,z),W||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(q=MX.composeScalar($,Z,U,z),W)q.anchor=W.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(q=yB.composeCollection(gB,$,Z,X,z),W)q.anchor=W.source.substring(1)}catch(V){let K=V instanceof Error?V.message:String(V);z(Z,"RESOURCE_EXHAUSTION",K)}break;default:{let V=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;z(Z,"UNEXPECTED_TOKEN",V),G=!1}}if(q??(q=p3($,Z.offset,void 0,null,X,z)),W&&q.anchor==="")z(W,"BAD_ALIAS","Anchor cannot be an empty string");if(J&&$.options.stringKeys&&(!kB.isScalar(q)||typeof q.value!=="string"||q.tag&&q.tag!=="tag:yaml.org,2002:str"))z(U??Z,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(Q)q.spaceBefore=!0;if(Y)if(Z.type==="scalar"&&Z.source==="")q.comment=Y;else q.commentBefore=Y;if($.options.keepSourceTokens&&G)q.srcToken=Z;return q}function p3($,Z,X,z,{spaceBefore:J,comment:Q,anchor:Y,tag:W,end:U},q){let G={type:"scalar",offset:fB.emptyScalarPosition(Z,X,z),indent:-1,source:""},V=MX.composeScalar($,G,W,q);if(Y){if(V.anchor=Y.source.substring(1),V.anchor==="")q(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 hB({options:$},{offset:Z,source:X,end:z},J){let Q=new bB.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,W=vB.resolveEnd(z,Y,$.strict,J);if(Q.range=[Z,Y,W.offset],W.comment)Q.comment=W.comment;return Q}uB.composeEmptyNode=p3;uB.composeNode=OX});var DX=C((nB)=>{var lB=B2(),NX=LX(),dB=V$(),pB=O2();function iB($,Z,{offset:X,start:z,value:J,end:Q},Y){let W=Object.assign({_directives:Z},$),U=new lB.Document(void 0,W),q={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},G=pB.resolveProps(z,{indicator:"doc-start",next:J??Q?.[0],offset:X,onError:Y,parentIndent:0,startOnNewline:!0});if(G.found){if(U.directives.docStart=!0,J&&(J.type==="block-map"||J.type==="block-seq")&&!G.hasNewline)Y(G.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}U.contents=J?NX.composeNode(q,J,G,Y):NX.composeEmptyNode(q,G.end,z,null,G,Y);let V=U.contents.range[2],K=dB.resolveEnd(Q,V,!1,Y);if(K.comment)U.comment=K.comment;return U.range=[X,V,K.offset],U}nB.composeDoc=iB});var i3=C(($M)=>{var sB=F0("process"),aB=a4(),oB=B2(),L2=M2(),IX=i(),tB=DX(),eB=V$();function N2($){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 TX($){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)||" "),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
|
|
129
|
-
${X}`:X;else if(z||$.directives.docStart||!J)$.commentBefore=X;else if(
|
|
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 AX{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,X,z,J)=>{let Q=N2(Z);if(J)this.warnings.push(new L2.YAMLWarning(Q,X,z));else this.errors.push(new L2.YAMLParseError(Q,X,z))},this.directives=new aB.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:X,afterEmptyLine:z}=TX(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(IX.isCollection(J)&&!J.flow&&J.items.length>0){let Q=J.items[0];if(IX.isPair(Q))Q=Q.key;let Y=Q.commentBefore;Q.commentBefore=Y?`${X}
|
|
130
130
|
${Y}`:X}else{let Q=J.commentBefore;J.commentBefore=Q?`${X}
|
|
131
|
-
${Q}`:X}}if(Z){for(let J=0;J<this.errors.length;++J)$.errors.push(this.errors[J]);for(let J=0;J<this.warnings.length;++J)$.warnings.push(this.warnings[J])}else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
132
|
-
${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.push(new
|
|
131
|
+
${Q}`:X}}if(Z){for(let J=0;J<this.errors.length;++J)$.errors.push(this.errors[J]);for(let J=0;J<this.warnings.length;++J)$.warnings.push(this.warnings[J])}else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:TX(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(sB.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,X,z)=>{let J=N2($);J[0]+=Z,this.onError(J,"BAD_DIRECTIVE",X,z)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=tB.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 L2.YAMLParseError(N2($),"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 L2.YAMLParseError(N2($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=eB.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 L2.YAMLParseError(N2($),"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 oB.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}}}$M.Composer=AX});var FX=C((qM)=>{var XM=c3(),zM=d3(),JM=M2(),RX=J2();function QM($,Z=!0,X){if($){let z=(J,Q,Y)=>{let W=typeof J==="number"?J:Array.isArray(J)?J[0]:J.offset;if(X)X(W,Q,Y);else throw new JM.YAMLParseError([W,W+1],Q,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return zM.resolveFlowScalar($,Z,z);case"block-scalar":return XM.resolveBlockScalar({options:{strict:Z}},$,z)}}return null}function YM($,Z){let{implicitKey:X=!1,indent:z,inFlow:J=!1,offset:Q=-1,type:Y="PLAIN"}=Z,W=RX.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
133
|
`}];switch(W[0]){case"|":case">":{let q=W.indexOf(`
|
|
134
134
|
`),G=W.substring(0,q),V=W.substring(q+1)+`
|
|
135
|
-
`,K=[{type:"block-scalar-header",offset:Q,indent:z,source:G}];if(!
|
|
136
|
-
`});return{type:"block-scalar",offset:Q,indent:z,props:K,source:V}}case'"':return{type:"double-quoted-scalar",offset:Q,indent:z,source:W,end:U};case"'":return{type:"single-quoted-scalar",offset:Q,indent:z,source:W,end:U};default:return{type:"scalar",offset:Q,indent:z,source:W,end:U}}}function WM($,Z,X={}){let{afterKey:z=!1,implicitKey:J=!1,inFlow:Q=!1,type:Y}=X,W="indent"in $?$.indent:null;if(z&&typeof W==="number")W+=2;if(!Y)switch($.type){case"single-quoted-scalar":Y="QUOTE_SINGLE";break;case"double-quoted-scalar":Y="QUOTE_DOUBLE";break;case"block-scalar":{let q=$.props[0];if(q.type!=="block-scalar-header")throw Error("Invalid block scalar header");Y=q.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:Y="PLAIN"}let U=
|
|
135
|
+
`,K=[{type:"block-scalar-header",offset:Q,indent:z,source:G}];if(!_X(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:W,end:U};case"'":return{type:"single-quoted-scalar",offset:Q,indent:z,source:W,end:U};default:return{type:"scalar",offset:Q,indent:z,source:W,end:U}}}function WM($,Z,X={}){let{afterKey:z=!1,implicitKey:J=!1,inFlow:Q=!1,type:Y}=X,W="indent"in $?$.indent:null;if(z&&typeof W==="number")W+=2;if(!Y)switch($.type){case"single-quoted-scalar":Y="QUOTE_SINGLE";break;case"double-quoted-scalar":Y="QUOTE_DOUBLE";break;case"block-scalar":{let q=$.props[0];if(q.type!=="block-scalar-header")throw Error("Invalid block scalar header");Y=q.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:Y="PLAIN"}let U=RX.stringifyString({type:Y,value:Z},{implicitKey:J||W===null,indent:W!==null&&W>0?" ".repeat(W):"",inFlow:Q,options:{blockQuote:!0,lineWidth:-1}});switch(U[0]){case"|":case">":UM($,U);break;case'"':n3($,U,"double-quoted-scalar");break;case"'":n3($,U,"single-quoted-scalar");break;default:n3($,U,"scalar")}}function UM($,Z){let X=Z.indexOf(`
|
|
137
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,W=[{type:"block-scalar-header",offset:Q,indent:Y,source:z}];if(!
|
|
139
|
-
`});for(let U of Object.keys($))if(U!=="type"&&U!=="offset")delete $[U];Object.assign($,{type:"block-scalar",indent:Y,props:W,source:J})}}function
|
|
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})}}}qM.createScalarToken=YM;qM.resolveAsScalar=QM;qM.setScalarValue=WM});var
|
|
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,W=[{type:"block-scalar-header",offset:Q,indent:Y,source:z}];if(!_X(W,"end"in $?$.end:void 0))W.push({type:"newline",offset:-1,indent:Y,source:`
|
|
139
|
+
`});for(let U of Object.keys($))if(U!=="type"&&U!=="offset")delete $[U];Object.assign($,{type:"block-scalar",indent:Y,props:W,source:J})}}function _X($,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 n3($,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})}}}qM.createScalarToken=YM;qM.resolveAsScalar=QM;qM.setScalarValue=WM});var CX=C((BM)=>{var HM=($)=>("type"in $)?T8($):I8($);function T8($){switch($.type){case"block-scalar":{let Z="";for(let X of $.props)Z+=T8(X);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let X of $.items)Z+=I8(X);return Z}case"flow-collection":{let Z=$.start.source;for(let X of $.items)Z+=I8(X);for(let X of $.end)Z+=X.source;return Z}case"document":{let Z=I8($);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 I8({start:$,key:Z,sep:X,value:z}){let J="";for(let Q of $)J+=Q.source;if(Z)J+=T8(Z);if(X)for(let Q of X)J+=Q.source;if(z)J+=T8(z);return J}BM.stringify=HM});var wX=C((LM)=>{var r3=Symbol("break visit"),OM=Symbol("skip children"),PX=Symbol("remove item");function u1($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};EX(Object.freeze([]),$,Z)}u1.BREAK=r3;u1.SKIP=OM;u1.REMOVE=PX;u1.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};u1.parentCollection=($,Z)=>{let X=u1.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 EX($,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 W=EX(Object.freeze($.concat([[J,Y]])),Q.items[Y],X);if(typeof W==="number")Y=W-1;else if(W===r3)return r3;else if(W===PX)Q.items.splice(Y,1),Y-=1}if(typeof z==="function"&&J==="key")z=z(Z,$)}}return typeof z==="function"?z(Z,$):z}LM.visit=u1});var A8=C((FM)=>{var s3=FX(),DM=CX(),IM=wX(),a3="\uFEFF",o3="\x02",t3="\x18",e3="\x1F",TM=($)=>!!$&&("items"in $),AM=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function RM($){switch($){case a3:return"<BOM>";case o3:return"<DOC>";case t3:return"<FLOW_END>";case e3:return"<SCALAR>";default:return JSON.stringify($)}}function _M($){switch($){case a3:return"byte-order-mark";case o3:return"doc-mode";case t3:return"flow-error-end";case e3: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}FM.createScalarToken=
|
|
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}FM.createScalarToken=s3.createScalarToken;FM.resolveAsScalar=s3.resolveAsScalar;FM.setScalarValue=s3.setScalarValue;FM.stringify=DM.stringify;FM.visit=IM.visit;FM.BOM=a3;FM.DOCUMENT=o3;FM.FLOW_END=t3;FM.SCALAR=e3;FM.isCollection=TM;FM.isScalar=AM;FM.prettyToken=RM;FM.tokenType=_M});var ZZ=C((mM)=>{var D2=A8();function m0($){switch($){case void 0:case" ":case`
|
|
143
|
+
`:case"\r":case"\t":return!0;default:return!1}}var SX=new Set("0123456789ABCDEFabcdef"),hM=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),R8=new Set(",[]{}"),uM=new Set(` ,[]{}
|
|
144
|
+
\r `),$Z=($)=>!$||uM.has($);class jX{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
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
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==="...")&&
|
|
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]===
|
|
148
|
+
`||X>=this.indentNext||!Z&&!this.atEnd?$+X:-1}if(Z==="-"||Z==="."){let X=this.buffer.substr($,3);if((X==="---"||X==="...")&&m0(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]===D2.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 D2.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==="...")&&m0(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&&!m0(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(($==="-"||$==="?"||$===":")&&m0(Z)){let X=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=X,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let $=this.getLine();if($===null)return this.setNext("doc");let Z=yield*this.pushIndicators();switch($[Z]){case"#":yield*this.pushCount($.length-Z);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil($Z),"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("..."))&&m0(z[3])){if(!(X===this.indentNext-1&&this.flowLevel===1&&(z[0]==="]"||z[0]==="}")))return this.flowLevel=0,yield D2.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($Z),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let Q=this.charAt(1);if(this.flowKey||m0(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
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)=>
|
|
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)=>m0(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
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
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
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
|
|
156
|
+
`&&J>=this.pos&&J+1+Z>Y)$=J;else break}while(!0);return yield D2.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(m0(J)||$&&R8.has(J))break;Z=X}else if(m0(z)){let J=this.buffer[X+1];if(z==="\r")if(J===`
|
|
157
157
|
`)X+=1,z=`
|
|
158
|
-
`,J=this.buffer[X+1];else Z=X;if(J==="#"||$&&
|
|
159
|
-
`){let Q=this.continueScalar(X+1);if(Q===-1)break;X=Math.max(X,Q-2)}}else{if($&&
|
|
158
|
+
`,J=this.buffer[X+1];else Z=X;if(J==="#"||$&&R8.has(J))break;if(z===`
|
|
159
|
+
`){let Q=this.continueScalar(X+1);if(Q===-1)break;X=Math.max(X,Q-2)}}else{if($&&R8.has(z))break;Z=X}if(!z&&!this.atEnd)return this.setNext("plain-scalar");return yield D2.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(){let $=0;$:while(!0){switch(this.charAt(0)){case"!":$+=yield*this.pushTag(),$+=yield*this.pushSpaces(!0);continue $;case"&":$+=yield*this.pushUntil($Z),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let Z=this.flowLevel>0,X=this.charAt(1);if(m0(X)||Z&&R8.has(X)){if(!Z)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;$+=yield*this.pushCount(1),$+=yield*this.pushSpaces(!0);continue $}}}break $}return $}*pushTag(){if(this.charAt(1)==="<"){let $=this.pos+2,Z=this.buffer[$];while(!m0(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(hM.has(Z))Z=this.buffer[++$];else if(Z==="%"&&SX.has(this.buffer[$+1])&&SX.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,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)}}mM.Lexer=
|
|
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)}}mM.Lexer=jX});var XZ=C((lM)=>{class xX{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}}}}lM.LineCounter=xX});var zZ=C((nM)=>{var pM=F0("process"),bX=A8(),iM=ZZ();function I1($,Z){for(let X=0;X<$.length;++X)if($[X].type===Z)return!0;return!1}function kX($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function vX($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function _8($){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 K$($){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 F8($,Z){if(Z.length<1e5)Array.prototype.push.apply($,Z);else for(let X=0;X<Z.length;++X)$.push(Z[X])}function yX($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!I1(Z.start,"explicit-key-ind")&&!I1(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,vX(Z.value))if(Z.value.end)F8(Z.value.end,Z.sep);else Z.value.end=Z.sep;else F8(Z.start,Z.sep);delete Z.sep}}}class fX{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 iM.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=$,pM.env.LOG_TOKENS)console.log("|",bX.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=bX.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")yX(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&&kX(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(kX($.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=_8(this.peek(2)),X=K$(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 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)){
|
|
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)){F8(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 W=Z.sep[Y];switch(W.type){case"newline":Q.push(Y);break;case"space":break;case"comment":if(W.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(I1(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let Q=K$(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(I1(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(vX(Z.key)&&!I1(Z.sep,"newline")){let Q=K$(Z.start),Y=Z.key,W=Z.sep;W.push(this.sourceToken),delete Z.key,delete Z.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:Y,sep:W}]})}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(I1(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&&!I1(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)){F8(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||I1(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=_8(X),J=K$(z);yX($);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=R8($),X=G$(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=R8($),X=G$(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()}}}nM.Parser=vX});var mX=C((XO)=>{var fX=p3(),sM=H2(),D2=B2(),aM=Z3(),oM=i(),tM=ZZ(),gX=XZ();function hX($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new tM.LineCounter||null,prettyErrors:Z}}function eM($,Z={}){let{lineCounter:X,prettyErrors:z}=hX(Z),J=new gX.Parser(X?.addNewLine),Q=new fX.Composer(Z),Y=Array.from(Q.compose(J.parse($)));if(z&&X)for(let W of Y)W.errors.forEach(D2.prettifyError($,X)),W.warnings.forEach(D2.prettifyError($,X));if(Y.length>0)return Y;return Object.assign([],{empty:!0},Q.streamInfo())}function uX($,Z={}){let{lineCounter:X,prettyErrors:z}=hX(Z),J=new gX.Parser(X?.addNewLine),Q=new fX.Composer(Z),Y=null;for(let W of Q.compose(J.parse($),!0,$.length))if(!Y)Y=W;else if(Y.options.logLevel!=="silent"){Y.errors.push(new D2.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&X)Y.errors.forEach(D2.prettifyError($,X)),Y.warnings.forEach(D2.prettifyError($,X));return Y}function $O($,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=uX($,X);if(!J)return null;if(J.warnings.forEach((Q)=>aM.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 ZO($,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(oM.isDocument($)&&!z)return $.toString(X);return new sM.Document($,z,X).toString(X)}XO.parse=$O;XO.parseAllDocuments=eM;XO.parseDocument=uX;XO.stringify=ZO});var rX={};M9(rX,{orange:()=>K0,italic:()=>nO,fafCyanDeep:()=>C8,fafCyan:()=>I,dim:()=>M,bold:()=>A,FAF_HEX:()=>T2});var QZ=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,A,M,nO,T2,I=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,C8=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,K0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var l=v(()=>{A=QZ("1"),M=QZ("2"),nO=QZ("3"),T2={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var hZ=C((oj,ZA)=>{ZA.exports={name:"faf-cli",version:"7.8.0",description:"Persistent AI context + memory — .faf and .fafm, IANA-registered. Anthropic-merged.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",types:"./dist/index.d.ts",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",clean:"rm -rf dist",build:"bun run clean && bun build src/cli.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/index.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && 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","agents-md","context-engineering","codex","windsurf","fafm","ai-memory","agents"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.3","faf-scoring-kernel":"^2.0.3",open:"^11.0.0",yaml:"^2.9.0"},optionalDependencies:{"@anthropic-ai/sdk":"^0.91.1"},devDependencies:{"@faf/specification":"github:Wolfe-Jam/faf","@types/bun":"^1.3.14","@types/node":"^22.20.1","@typescript-eslint/eslint-plugin":"^8.66.0","@typescript-eslint/parser":"^8.66.0",ajv:"^8.20.0",eslint:"^9.39.5",prettier:"^3.9.6",typescript:"^5.9.3","typescript-eslint":"^8.66.0"},overrides:{"brace-expansion":"^1.1.18","fast-uri":"^3.1.5",picomatch:"^4.0.5"},engines:{node:">=18.0.0"},publishConfig:{access:"public"}}});function P($,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 L($,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 Q1=()=>{};var cZ=function(){let{crypto:$}=globalThis;if($?.randomUUID)return cZ=$.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 Y1($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var l2=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var k,Y0,M0,R1,C$,P$,E$,w$,S$,j$,x$,b$,k$;var A0=v(()=>{k=class k extends Error{};Y0=class Y0 extends k{constructor($,Z,X,z,J){super(`${Y0.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 R1({message:X,cause:l2(Z)});let J=Z,Q=J?.error?.type;if($===400)return new P$($,J,X,z,Q);if($===401)return new E$($,J,X,z,Q);if($===403)return new w$($,J,X,z,Q);if($===404)return new S$($,J,X,z,Q);if($===409)return new j$($,J,X,z,Q);if($===422)return new x$($,J,X,z,Q);if($===429)return new b$($,J,X,z,Q);if($>=500)return new k$($,J,X,z,Q);return new Y0($,J,X,z,Q)}};M0=class M0 extends Y0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};R1=class R1 extends Y0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};C$=class C$ extends R1{constructor({message:$}={}){super({message:$??"Request timed out."})}};P$=class P$ extends Y0{};E$=class E$ extends Y0{};w$=class w$ extends Y0{};S$=class S$ extends Y0{};j$=class j$ extends Y0{};x$=class x$ extends Y0{};b$=class b$ extends Y0{};k$=class k$ extends Y0{}});function U4($){if(typeof $!=="object")return{};return $??{}}function pZ($){if(!$)return!0;for(let Z in $)return!1;return!0}function CQ($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var kA,FQ=($)=>{return kA.test($)},lZ=($)=>(lZ=Array.isArray,lZ($)),dZ,PQ=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new k(`${$} must be an integer`);if(Z<0)throw new k(`${$} must be a positive integer`);return Z},q4=($)=>{try{return JSON.parse($)}catch(Z){return}};var p1=v(()=>{A0();kA=/^[a-z][a-z0-9+.-]*:/i,dZ=lZ});var EQ=($)=>new Promise((Z)=>setTimeout(Z,$));var _1="0.91.1";function yA(){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 fA(){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 xQ=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},vA=()=>{let $=yA();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_1,"X-Stainless-OS":SQ(Deno.build.os),"X-Stainless-Arch":wQ(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":_1,"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":_1,"X-Stainless-OS":SQ(globalThis.process.platform??"unknown"),"X-Stainless-Arch":wQ(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=fA();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_1,"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":_1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},wQ=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},SQ=($)=>{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"},jQ,bQ=()=>{return jQ??(jQ=vA())};var iZ=()=>{};function kQ(){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 nZ(...$){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 G4($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return nZ({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 d2($){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 yQ($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),X=Z.cancel();Z.releaseLock(),await X}var vQ=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function fQ($){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 k(`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 gQ=v(()=>{A0()});function mQ($){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 p2($){let Z;return(hQ??(Z=new globalThis.TextEncoder,hQ=Z.encode.bind(Z)))($)}function rZ($){let Z;return(uQ??(Z=new globalThis.TextDecoder,uQ=Z.decode.bind(Z)))($)}var hQ,uQ;class F1{constructor(){E0.set(this,void 0),w0.set(this,void 0),P(this,E0,new Uint8Array,"f"),P(this,w0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?p2($):$;P(this,E0,mQ([L(this,E0,"f"),Z]),"f");let X=[],z;while((z=uA(L(this,E0,"f"),L(this,w0,"f")))!=null){if(z.carriage&&L(this,w0,"f")==null){P(this,w0,z.index,"f");continue}if(L(this,w0,"f")!=null&&(z.index!==L(this,w0,"f")+1||z.carriage)){X.push(rZ(L(this,E0,"f").subarray(0,L(this,w0,"f")-1))),P(this,E0,L(this,E0,"f").subarray(L(this,w0,"f")),"f"),P(this,w0,null,"f");continue}let J=L(this,w0,"f")!==null?z.preceding-1:z.preceding,Q=rZ(L(this,E0,"f").subarray(0,J));X.push(Q),P(this,E0,L(this,E0,"f").subarray(z.index),"f"),P(this,w0,null,"f")}return X}flush(){if(!L(this,E0,"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,X,z]=
|
|
169
|
-
`);X.enqueue(Q)}catch(z){X.error(z)}},async cancel(){await Z.return?.()}})}}});async function
|
|
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=_8($),X=K$(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=_8($),X=K$(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()}}}nM.Parser=fX});var cX=C((XO)=>{var gX=i3(),sM=B2(),I2=M2(),aM=X3(),oM=i(),tM=XZ(),hX=zZ();function uX($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new tM.LineCounter||null,prettyErrors:Z}}function eM($,Z={}){let{lineCounter:X,prettyErrors:z}=uX(Z),J=new hX.Parser(X?.addNewLine),Q=new gX.Composer(Z),Y=Array.from(Q.compose(J.parse($)));if(z&&X)for(let W of Y)W.errors.forEach(I2.prettifyError($,X)),W.warnings.forEach(I2.prettifyError($,X));if(Y.length>0)return Y;return Object.assign([],{empty:!0},Q.streamInfo())}function mX($,Z={}){let{lineCounter:X,prettyErrors:z}=uX(Z),J=new hX.Parser(X?.addNewLine),Q=new gX.Composer(Z),Y=null;for(let W of Q.compose(J.parse($),!0,$.length))if(!Y)Y=W;else if(Y.options.logLevel!=="silent"){Y.errors.push(new I2.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&X)Y.errors.forEach(I2.prettifyError($,X)),Y.warnings.forEach(I2.prettifyError($,X));return Y}function $O($,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=mX($,X);if(!J)return null;if(J.warnings.forEach((Q)=>aM.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 ZO($,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(oM.isDocument($)&&!z)return $.toString(X);return new sM.Document($,z,X).toString(X)}XO.parse=$O;XO.parseAllDocuments=eM;XO.parseDocument=mX;XO.stringify=ZO});var sX={};O9(sX,{orange:()=>K0,italic:()=>nO,fafCyanDeep:()=>P8,fafCyan:()=>I,dim:()=>M,bold:()=>A,FAF_HEX:()=>A2});var YZ=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,A,M,nO,A2,I=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,P8=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,K0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var d=v(()=>{A=YZ("1"),M=YZ("2"),nO=YZ("3"),A2={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var mZ=C((zx,QA)=>{QA.exports={name:"faf-cli",version:"7.9.0",description:"Persistent AI context + memory — .faf and .fafm, IANA-registered. Anthropic-merged.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",types:"./dist/index.d.ts",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",clean:"rm -rf dist",build:"bun run clean && bun build src/cli.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/index.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && 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","agents-md","context-engineering","codex","windsurf","fafm","ai-memory","agents"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.3","faf-scoring-kernel":"^2.0.3",open:"^11.0.0",yaml:"^2.9.0"},optionalDependencies:{"@anthropic-ai/sdk":"^0.91.1"},devDependencies:{"@faf/specification":"github:Wolfe-Jam/faf","@types/bun":"^1.3.14","@types/node":"^22.20.1","@typescript-eslint/eslint-plugin":"^8.66.0","@typescript-eslint/parser":"^8.66.0",ajv:"^8.20.0",eslint:"^9.39.5",prettier:"^3.9.6",typescript:"^5.9.3","typescript-eslint":"^8.66.0"},overrides:{"brace-expansion":"^1.1.18","fast-uri":"^3.1.5",picomatch:"^4.0.5"},engines:{node:">=18.0.0"},publishConfig:{access:"public"}}});function P($,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 L($,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 W1=()=>{};var dZ=function(){let{crypto:$}=globalThis;if($?.randomUUID)return dZ=$.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 U1($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var d2=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var k,Q0,M0,F1,E$,w$,S$,j$,x$,b$,k$,y$,v$;var A0=v(()=>{k=class k extends Error{};Q0=class Q0 extends k{constructor($,Z,X,z,J){super(`${Q0.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 F1({message:X,cause:d2(Z)});let J=Z,Q=J?.error?.type;if($===400)return new w$($,J,X,z,Q);if($===401)return new S$($,J,X,z,Q);if($===403)return new j$($,J,X,z,Q);if($===404)return new x$($,J,X,z,Q);if($===409)return new b$($,J,X,z,Q);if($===422)return new k$($,J,X,z,Q);if($===429)return new y$($,J,X,z,Q);if($>=500)return new v$($,J,X,z,Q);return new Q0($,J,X,z,Q)}};M0=class M0 extends Q0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};F1=class F1 extends Q0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};E$=class E$ extends F1{constructor({message:$}={}){super({message:$??"Request timed out."})}};w$=class w$ extends Q0{};S$=class S$ extends Q0{};j$=class j$ extends Q0{};x$=class x$ extends Q0{};b$=class b$ extends Q0{};k$=class k$ extends Q0{};y$=class y$ extends Q0{};v$=class v$ extends Q0{}});function q4($){if(typeof $!=="object")return{};return $??{}}function nZ($){if(!$)return!0;for(let Z in $)return!1;return!0}function CQ($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var gA,FQ=($)=>{return gA.test($)},pZ=($)=>(pZ=Array.isArray,pZ($)),iZ,PQ=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new k(`${$} must be an integer`);if(Z<0)throw new k(`${$} must be a positive integer`);return Z},G4=($)=>{try{return JSON.parse($)}catch(Z){return}};var n1=v(()=>{A0();gA=/^[a-z][a-z0-9+.-]*:/i,iZ=pZ});var EQ=($)=>new Promise((Z)=>setTimeout(Z,$));var C1="0.91.1";function hA(){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 mA(){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 xQ=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},uA=()=>{let $=hA();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":C1,"X-Stainless-OS":SQ(Deno.build.os),"X-Stainless-Arch":wQ(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":C1,"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":C1,"X-Stainless-OS":SQ(globalThis.process.platform??"unknown"),"X-Stainless-Arch":wQ(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=mA();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":C1,"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":C1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},wQ=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},SQ=($)=>{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"},jQ,bQ=()=>{return jQ??(jQ=uA())};var rZ=()=>{};function kQ(){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 sZ(...$){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 V4($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return sZ({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 p2($){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 yQ($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),X=Z.cancel();Z.releaseLock(),await X}var vQ=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function fQ($){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 k(`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 gQ=v(()=>{A0()});function mQ($){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 i2($){let Z;return(hQ??(Z=new globalThis.TextEncoder,hQ=Z.encode.bind(Z)))($)}function aZ($){let Z;return(uQ??(Z=new globalThis.TextDecoder,uQ=Z.decode.bind(Z)))($)}var hQ,uQ;class P1{constructor(){S0.set(this,void 0),j0.set(this,void 0),P(this,S0,new Uint8Array,"f"),P(this,j0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?i2($):$;P(this,S0,mQ([L(this,S0,"f"),Z]),"f");let X=[],z;while((z=dA(L(this,S0,"f"),L(this,j0,"f")))!=null){if(z.carriage&&L(this,j0,"f")==null){P(this,j0,z.index,"f");continue}if(L(this,j0,"f")!=null&&(z.index!==L(this,j0,"f")+1||z.carriage)){X.push(aZ(L(this,S0,"f").subarray(0,L(this,j0,"f")-1))),P(this,S0,L(this,S0,"f").subarray(L(this,j0,"f")),"f"),P(this,j0,null,"f");continue}let J=L(this,j0,"f")!==null?z.preceding-1:z.preceding,Q=aZ(L(this,S0,"f").subarray(0,J));X.push(Q),P(this,S0,L(this,S0,"f").subarray(z.index),"f"),P(this,j0,null,"f")}return X}flush(){if(!L(this,S0,"f").length)return[];return this.decode(`
|
|
166
|
+
`)}}function dA($,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 cQ($){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 S0,j0;var oZ=v(()=>{W1();S0=new WeakMap,j0=new WeakMap;P1.NEWLINE_CHARS=new Set([`
|
|
167
|
+
`,"\r"]);P1.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function n2(){}function K4($,Z,X){if(!Z||H4[$]>H4[X])return n2;else return Z[$].bind(Z)}function B0($){let Z=$.logger,X=$.logLevel??"off";if(!Z)return pA;let z=lQ.get(Z);if(z&&z[0]===X)return z[1];let J={error:K4("error",Z,X),warn:K4("warn",Z,X),info:K4("info",Z,X),debug:K4("debug",Z,X)};return lQ.set(Z,[X,J]),J}var H4,tZ=($,Z,X)=>{if(!$)return;if(CQ(H4,$))return $;B0(X).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(H4))}`);return},pA,lQ,q1=($)=>{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 B4=v(()=>{n1();H4={off:0,error:200,warn:300,info:400,debug:500};pA={error:n2,warn:n2,info:n2,debug:n2},lQ=new WeakMap});async function*iA($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new k("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new k("Attempted to iterate over a response with no body")}let X=new dQ,z=new P1,J=p2($.body);for await(let Q of nA(J))for(let Y of z.decode(Q)){let W=X.decode(Y);if(W)yield W}for(let Q of z.flush()){let Y=X.decode(Q);if(Y)yield Y}}async function*nA($){let Z=new Uint8Array;for await(let X of $){if(X==null)continue;let z=X instanceof ArrayBuffer?new Uint8Array(X):typeof X==="string"?i2(X):X,J=new Uint8Array(Z.length+z.length);J.set(Z),J.set(z,Z.length),Z=J;let Q;while((Q=cQ(Z))!==-1)yield Z.slice(0,Q),Z=Z.slice(Q)}if(Z.length>0)yield Z}class dQ{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]=rA($,":");if(z.startsWith(" "))z=z.substring(1);if(Z==="event")this.event=z;else if(Z==="data")this.data.push(z);return null}}function rA($,Z){let X=$.indexOf(Z);if(X!==-1)return[$.substring(0,X),Z,$.substring(X+Z.length)];return[$,"",""]}var r2,x0;var eZ=v(()=>{W1();A0();oZ();n1();B4();A0();x0=class x0{constructor($,Z,X){this.iterator=$,r2.set(this,void 0),this.controller=Z,P(this,r2,X,"f")}static fromSSEResponse($,Z,X){let z=!1,J=X?B0(X):console;async function*Q(){if(z)throw new k("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Y=!1;try{for await(let W of iA($,Z)){if(W.event==="completion")try{yield JSON.parse(W.data)}catch(U){throw J.error("Could not parse message into JSON:",W.data),J.error("From chunk:",W.raw),U}if(W.event==="message_start"||W.event==="message_delta"||W.event==="message_stop"||W.event==="content_block_start"||W.event==="content_block_delta"||W.event==="content_block_stop"||W.event==="message"||W.event==="user.message"||W.event==="user.interrupt"||W.event==="user.tool_confirmation"||W.event==="user.custom_tool_result"||W.event==="agent.message"||W.event==="agent.thinking"||W.event==="agent.tool_use"||W.event==="agent.tool_result"||W.event==="agent.mcp_tool_use"||W.event==="agent.mcp_tool_result"||W.event==="agent.custom_tool_use"||W.event==="agent.thread_context_compacted"||W.event==="session.status_running"||W.event==="session.status_idle"||W.event==="session.status_rescheduled"||W.event==="session.status_terminated"||W.event==="session.error"||W.event==="session.deleted"||W.event==="span.model_request_start"||W.event==="span.model_request_end")try{yield JSON.parse(W.data)}catch(U){throw J.error("Could not parse message into JSON:",W.data),J.error("From chunk:",W.raw),U}if(W.event==="ping")continue;if(W.event==="error"){let U=G4(W.data)??W.data,q=U?.error?.type;throw new Q0(void 0,U,void 0,$.headers,q)}}Y=!0}catch(W){if(U1(W))return;throw W}finally{if(!Y)Z.abort()}}return new x0(Q,Z,X)}static fromReadableStream($,Z,X){let z=!1;async function*J(){let Y=new P1,W=p2($);for await(let U of W)for(let q of Y.decode(U))yield q;for(let U of Y.flush())yield U}async function*Q(){if(z)throw new k("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Y=!1;try{for await(let W of J()){if(Y)continue;if(W)yield JSON.parse(W)}Y=!0}catch(W){if(U1(W))return;throw W}finally{if(!Y)Z.abort()}}return new x0(Q,Z,X)}[(r2=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 x0(()=>z($),this.controller,L(this,r2,"f")),new x0(()=>z(Z),this.controller,L(this,r2,"f"))]}toReadableStream(){let $=this,Z;return sZ({async start(){Z=$[Symbol.asyncIterator]()},async pull(X){try{let{value:z,done:J}=await Z.next();if(J)return X.close();let Q=i2(JSON.stringify(z)+`
|
|
169
|
+
`);X.enqueue(Q)}catch(z){X.error(z)}},async cancel(){await Z.return?.()}})}}});async function M4($,Z){let{response:X,requestLogID:z,retryOfRequestLogID:J,startTime:Q}=Z,Y=await(async()=>{if(Z.options.stream){if(B0($).debug("response",X.status,X.url,X.headers,X.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(X,Z.controller);return x0.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 $5(K,X)}return await X.text()})();return B0($).debug(`[${z}] response parsed`,q1({retryOfRequestLogID:J,url:X.url,status:X.status,body:Y,durationMs:Date.now()-Q})),Y}function $5($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var Z5=v(()=>{eZ();B4()});var s2,E1;var O4=v(()=>{W1();Z5();E1=class E1 extends Promise{constructor($,Z,X=M4){super((z)=>{z(null)});this.responsePromise=Z,this.parseResponse=X,s2.set(this,void 0),P(this,s2,$,"f")}_thenUnwrap($){return new E1(L(this,s2,"f"),this.responsePromise,async(Z,X)=>$5($(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(L(this,s2,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};s2=new WeakMap});var L4,X5,a2,i0,r;var Z0=v(()=>{W1();A0();Z5();O4();n1();X5=class X5{constructor($,Z,X,z){L4.set(this,void 0),P(this,L4,$,"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 k("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await L(this,L4,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(L4=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};a2=class a2 extends E1{constructor($,Z,X){super($,Z,async(z,J)=>new X(z,J.response,await M4(z,J),J.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};i0=class i0 extends X5{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:{...q4(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...q4(this.options.query),after_id:$}}}};r=class r extends X5{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:{...q4(this.options.query),page:$}}}}});function r1($,Z,X){return J5(),new File($,Z??"unknown_file",X)}function o2($,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 aA($){let Z=typeof $==="function"?$:$.fetch,X=pQ.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 pQ.set(Z,z),z}var J5=()=>{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`.":""))}},Q5=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",f$=async($,Z,X=!0)=>{return{...$,body:await oA($.body,Z,X)}},pQ,oA=async($,Z,X=!0)=>{if(!await aA(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])=>z5(z,J,Q,X))),z},tA=($)=>$ instanceof Blob&&("name"in $),z5=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,r1([await X.blob()],o2(X,z),J))}else if(Q5(X))$.append(Z,r1([await new Response(V4(X)).blob()],o2(X,z)));else if(tA(X))$.append(Z,r1([X],o2(X,z),{type:X.type}));else if(Array.isArray(X))await Promise.all(X.map((J)=>z5($,Z+"[]",J,z)));else if(typeof X==="object")await Promise.all(Object.entries(X).map(([J,Q])=>z5($,`${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 g$=v(()=>{pQ=new WeakMap});async function t2($,Z,X){if(J5(),$=await $,Z||(Z=o2($,!0)),eA($)){if($ instanceof File&&Z==null&&X==null)return $;return r1([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...X})}if($R($)){let J=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),r1(await Y5(J),Z,X)}let z=await Y5($);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 r1(z,Z,X)}async function Y5($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(iQ($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(Q5($))for await(let X of $)Z.push(...await Y5(X));else{let X=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${X?`; constructor: ${X}`:""}${ZR($)}`)}return Z}function ZR($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((X)=>`"${X}"`).join(", ")}]`}var iQ=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",eA=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&iQ($),$R=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var nQ=v(()=>{g$();g$()});var W5=v(()=>{nQ()});var rQ=()=>{};class m{constructor($){this._client=$}}function*zR($){if(!$)return;if(sQ 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(iZ($))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=iZ(z[1])?z[1]:[z[1]],Y=!1;for(let W of Q){if(W===void 0)continue;if(Z&&!Y)Y=!0,yield[J,null];yield[J,W]}}}var sQ,D=($)=>{let Z=new Headers,X=new Set;for(let z of $){let J=new Set;for(let[Q,Y]of zR(z)){let W=Q.toLowerCase();if(!J.has(W))Z.delete(Q),J.add(W);if(Y===null)Z.delete(Q),X.add(W);else Z.append(Q,Y),X.delete(W)}}return{[sQ]:!0,values:Z,nulls:X}};var a=v(()=>{n1();sQ=Symbol.for("brand.privateNullableHeaders")});function oQ($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var aQ,JR=($=oQ)=>function(X,...z){if(X.length===1)return X[0];let J=!1,Q=[],Y=X.reduce((G,V,K)=>{if(/[?#]/.test(V))J=!0;let H=z[K],N=(J?encodeURIComponent:$)(""+H);if(K!==z.length&&(H==null||typeof H==="object"&&H.toString===Object.getPrototypeOf(Object.getPrototypeOf(H.hasOwnProperty??aQ)??aQ)?.toString))N=H+"",Q.push({start:G.length+V.length,length:N.length,error:`Value of type ${Object.prototype.toString.call(H).slice(8,-1)} is not a valid path parameter`});return G+V+(K===z.length?"":N)},""),W=Y.split(/[?#]/,1)[0],U=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,q;while((q=U.exec(W))!==null)Q.push({start:q.index,length:q[0].length,error:`Value "${q[0]}" can't be safely passed as a path parameter`});if(Q.sort((G,V)=>G.start-V.start),Q.length>0){let G=0,V=Q.reduce((K,H)=>{let N=" ".repeat(H.start-G),B="^".repeat(H.length);return G=H.start+H.length,K+N+B},"");throw new k(`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},F;var W0=v(()=>{A0();aQ=Object.freeze(Object.create(null)),F=$R(oQ)});var t2;var Y5=v(()=>{X0();o();W0();t2=class t2 extends u{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/environments?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(F`/v1/environments/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(F`/v1/environments/${$}?beta=true`,{body:J,...X,headers:D([{"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",s,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(F`/v1/environments/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(F`/v1/environments/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});function L4($){return typeof $==="object"&&$!==null&&e2 in $}function W5($,Z){let X=new Set;if($){for(let z of $)if(L4(z))X.add(z[e2])}if(Z)for(let z of Z){if(L4(z))X.add(z[e2]);if(Array.isArray(z.content)){for(let J of z.content)if(L4(J))X.add(J[e2])}}return Array.from(X)}function N4($,Z){let X=W5($,Z);if(X.length===0)return{};return{"x-stainless-helper":X.join(", ")}}function tQ($){if(L4($))return{"x-stainless-helper":$[e2]};return{}}var e2;var $6=v(()=>{e2=Symbol("anthropic.sdk.stainlessHelper")});var Z6;var U5=v(()=>{X0();o();$6();v$();W0();Z6=class Z6 extends u{list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/files?beta=true",p0,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(F`/v1/files/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}download($,Z={},X){let{betas:z}=Z??{};return this._client.get(F`/v1/files/${$}/content?beta=true`,{...X,headers:D([{"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(F`/v1/files/${$}?beta=true`,{...X,headers:D([{"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",y$({body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},tQ(z.file),Z?.headers])},this._client))}}});var X6;var q5=v(()=>{X0();o();W0();X6=class X6 extends u{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(F`/v1/models/${$}?beta=true`,{...X,headers:D([{...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",p0,{query:z,...Z,headers:D([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var z6;var G5=v(()=>{X0();o();W0();z6=class z6 extends u{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/user_profiles?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(F`/v1/user_profiles/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(F`/v1/user_profiles/${$}?beta=true`,{body:J,...X,headers:D([{"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",s,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},X){let{betas:z}=Z??{};return this._client.post(F`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}}});var J6;var V5=v(()=>{X0();o();W0();J6=class J6 extends u{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(F`/v1/agents/${$}/versions?beta=true`,s,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var f$;var K5=v(()=>{V5();V5();X0();o();W0();f$=class f$ extends u{constructor(){super(...arguments);this.versions=new J6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/agents?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z,...J}=Z??{};return this._client.get(F`/v1/agents/${$}?beta=true`,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(F`/v1/agents/${$}?beta=true`,{body:J,...X,headers:D([{"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",s,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(F`/v1/agents/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};f$.Versions=J6});var Q6;var H5=v(()=>{X0();o();W0();Q6=class Q6 extends u{create($,Z,X){let{view:z,betas:J,...Q}=Z;return this._client.post(F`/v1/memory_stores/${$}/memories?beta=true`,{query:{view:z},body:Q,...X,headers:D([{"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(F`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:Q,...X,headers:D([{"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(F`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:{view:J},body:Y,...X,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(F`/v1/memory_stores/${$}/memories?beta=true`,s,{query:J,...X,headers:D([{"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(F`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:{expected_content_sha256:J},...X,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var Y6;var B5=v(()=>{X0();o();W0();Y6=class Y6 extends u{retrieve($,Z,X){let{memory_store_id:z,betas:J,...Q}=Z;return this._client.get(F`/v1/memory_stores/${z}/memory_versions/${$}?beta=true`,{query:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(F`/v1/memory_stores/${$}/memory_versions?beta=true`,s,{query:J,...X,headers:D([{"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(F`/v1/memory_stores/${z}/memory_versions/${$}/redact?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var n1;var M5=v(()=>{H5();H5();B5();B5();X0();o();W0();n1=class n1 extends u{constructor(){super(...arguments);this.memories=new Q6(this._client),this.memoryVersions=new Y6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/memory_stores?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(F`/v1/memory_stores/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(F`/v1/memory_stores/${$}?beta=true`,{body:J,...X,headers:D([{"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",s,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(F`/v1/memory_stores/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(F`/v1/memory_stores/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};n1.Memories=Q6;n1.MemoryVersions=Y6});var g$=v(()=>{A0()});var D4;var O5=v(()=>{D4={"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 eQ($){return $?.output_format??$?.output_config?.format}function L5($,Z,X){let z=eQ(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 N5($,Z,X)}function N5($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=GR(Z,Q.text);if(z===null)z=Y;let W=Object.defineProperty({...Q},"parsed_output",{value:Y,enumerable:!1});return Object.defineProperty(W,"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 GR($,Z){let X=eQ($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new k(`Failed to parse structured output: ${z}`)}}var D5=v(()=>{A0()});var VR=($)=>{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 W="",U=!1;z=$[++Z];while(z!=='"'){if(Z===$.length){U=!0;break}if(z==="\\"){if(Z++,Z===$.length){U=!0;break}W+=z+$[Z],z=$[++Z]}else W+=z,z=$[++Z]}if(z=$[++Z],!U)X.push({type:"string",value:W});continue}if(z&&/\s/.test(z)){Z++;continue}let Q=/[0-9]/;if(z&&Q.test(z)||z==="-"||z==="."){let W="";if(z==="-")W+=z,z=$[++Z];while(z&&Q.test(z)||z===".")W+=z,z=$[++Z];X.push({type:"number",value:W});continue}let Y=/[a-z]/i;if(z&&Y.test(z)){let W="";while(z&&Y.test(z)){if(Z===$.length)break;W+=z,z=$[++Z]}if(W=="true"||W=="false"||W==="null")X.push({type:"name",value:W});else{Z++;continue}continue}Z++}return X},h$=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),h$($);break;case"number":let X=Z.value[Z.value.length-1];if(X==="."||X==="-")return $=$.slice(0,$.length-1),h$($);case"string":let z=$[$.length-2];if(z?.type==="delimiter")return $=$.slice(0,$.length-1),h$($);else if(z?.type==="brace"&&z.value==="{")return $=$.slice(0,$.length-1),h$($);break;case"delimiter":return $=$.slice(0,$.length-1),h$($);break}return $},KR=($)=>{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 $},HR=($)=>{let Z="";return $.map((X)=>{switch(X.type){case"string":Z+='"'+X.value+'"';break;default:Z+=X.value;break}}),Z},I4=($)=>JSON.parse(HR(KR(h$(VR($)))));var I5=()=>{};var T5=v(()=>{oZ()});function zY($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function JY($){}var f0,P1,u$,W6,T4,U6,q6,A4,G6,U1,V6,R4,_4,r1,F4,C4,K6,A5,$Y,P4,R5,_5,F5,ZY,XY="__json_buf",H6;var QY=v(()=>{Q1();I5();g$();T5();D5();H6=class H6{constructor($,Z){f0.add(this),this.messages=[],this.receivedMessages=[],P1.set(this,void 0),u$.set(this,null),this.controller=new AbortController,W6.set(this,void 0),T4.set(this,()=>{}),U6.set(this,()=>{}),q6.set(this,void 0),A4.set(this,()=>{}),G6.set(this,()=>{}),U1.set(this,{}),V6.set(this,!1),R4.set(this,!1),_4.set(this,!1),r1.set(this,!1),F4.set(this,void 0),C4.set(this,void 0),K6.set(this,void 0),P4.set(this,(X)=>{if(P(this,R4,!0,"f"),Y1(X))X=new M0;if(X instanceof M0)return P(this,_4,!0,"f"),this._emit("abort",X);if(X instanceof k)return this._emit("error",X);if(X instanceof Error){let z=new k(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new k(String(X)))}),P(this,W6,new Promise((X,z)=>{P(this,T4,X,"f"),P(this,U6,z,"f")}),"f"),P(this,q6,new Promise((X,z)=>{P(this,A4,X,"f"),P(this,G6,z,"f")}),"f"),L(this,W6,"f").catch(()=>{}),L(this,q6,"f").catch(()=>{}),P(this,u$,$,"f"),P(this,K6,Z?.logger??console,"f")}get response(){return L(this,F4,"f")}get request_id(){return L(this,C4,"f")}async withResponse(){P(this,r1,!0,"f");let $=await L(this,W6,"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 H6(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new H6(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return P(J,u$,{...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")},L(this,P4,"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{L(this,f0,"m",R5).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let W of Y)L(this,f0,"m",_5).call(this,W);if(Y.controller.signal?.aborted)throw new M0;L(this,f0,"m",F5).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;P(this,F4,$,"f"),P(this,C4,$?.headers.get("request-id"),"f"),L(this,T4,"f").call(this,$),this._emit("connect")}get ended(){return L(this,V6,"f")}get errored(){return L(this,R4,"f")}get aborted(){return L(this,_4,"f")}abort(){this.controller.abort()}on($,Z){return(L(this,U1,"f")[$]||(L(this,U1,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=L(this,U1,"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(L(this,U1,"f")[$]||(L(this,U1,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(P(this,r1,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){P(this,r1,!0,"f"),await L(this,q6,"f")}get currentMessage(){return L(this,P1,"f")}async finalMessage(){return await this.done(),L(this,f0,"m",A5).call(this)}async finalText(){return await this.done(),L(this,f0,"m",$Y).call(this)}_emit($,...Z){if(L(this,V6,"f"))return;if($==="end")P(this,V6,!0,"f"),L(this,A4,"f").call(this);let X=L(this,U1,"f")[$];if(X)L(this,U1,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!L(this,r1,"f")&&!X?.length)Promise.reject(z);L(this,U6,"f").call(this,z),L(this,G6,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!L(this,r1,"f")&&!X?.length)Promise.reject(z);L(this,U6,"f").call(this,z),L(this,G6,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",L(this,f0,"m",A5).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{L(this,f0,"m",R5).call(this),this._connected(null);let J=S0.fromReadableStream($,this.controller);for await(let Q of J)L(this,f0,"m",_5).call(this,Q);if(J.controller.signal?.aborted)throw new M0;L(this,f0,"m",F5).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(P1=new WeakMap,u$=new WeakMap,W6=new WeakMap,T4=new WeakMap,U6=new WeakMap,q6=new WeakMap,A4=new WeakMap,G6=new WeakMap,U1=new WeakMap,V6=new WeakMap,R4=new WeakMap,_4=new WeakMap,r1=new WeakMap,F4=new WeakMap,C4=new WeakMap,K6=new WeakMap,P4=new WeakMap,f0=new WeakSet,A5=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},$Y=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},R5=function(){if(this.ended)return;P(this,P1,void 0,"f")},_5=function(Z){if(this.ended)return;let X=L(this,f0,"m",ZY).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(zY(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:JY(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(L5(X,L(this,u$,"f"),{logger:L(this,K6,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{P(this,P1,X,"f");break}case"content_block_start":case"message_delta":break}},F5=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=L(this,P1,"f");if(!Z)throw new k("request ended without sending any chunks");return P(this,P1,void 0,"f"),L5(Z,L(this,u$,"f"),{logger:L(this,K6,"f")})},ZY=function(Z){let X=L(this,P1,"f");if(Z.type==="message_start"){if(X)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new k(`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&&zY(z)){let J=z[XY]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,XY,{value:J,enumerable:!1,writable:!0}),J)try{Q.input=I4(J)}catch(Y){let W=new k(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${J}`);L(this,P4,"f").call(this,W)}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:JY(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 S0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var m$;var E4=v(()=>{m$=class m$ 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 YY=1e5,WY=`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},R;var Y0=v(()=>{A0();aQ=Object.freeze(Object.create(null)),R=JR(oQ)});var e2;var U5=v(()=>{Z0();a();Y0();e2=class e2 extends m{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/environments?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(R`/v1/environments/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(R`/v1/environments/${$}?beta=true`,{body:J,...X,headers:D([{"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",r,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(R`/v1/environments/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(R`/v1/environments/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});function N4($){return typeof $==="object"&&$!==null&&$6 in $}function q5($,Z){let X=new Set;if($){for(let z of $)if(N4(z))X.add(z[$6])}if(Z)for(let z of Z){if(N4(z))X.add(z[$6]);if(Array.isArray(z.content)){for(let J of z.content)if(N4(J))X.add(J[$6])}}return Array.from(X)}function D4($,Z){let X=q5($,Z);if(X.length===0)return{};return{"x-stainless-helper":X.join(", ")}}function tQ($){if(N4($))return{"x-stainless-helper":$[$6]};return{}}var $6;var Z6=v(()=>{$6=Symbol("anthropic.sdk.stainlessHelper")});var X6;var G5=v(()=>{Z0();a();Z6();g$();Y0();X6=class X6 extends m{list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/files?beta=true",i0,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(R`/v1/files/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}download($,Z={},X){let{betas:z}=Z??{};return this._client.get(R`/v1/files/${$}/content?beta=true`,{...X,headers:D([{"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(R`/v1/files/${$}?beta=true`,{...X,headers:D([{"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",f$({body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},tQ(z.file),Z?.headers])},this._client))}}});var z6;var V5=v(()=>{Z0();a();Y0();z6=class z6 extends m{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(R`/v1/models/${$}?beta=true`,{...X,headers:D([{...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",i0,{query:z,...Z,headers:D([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var J6;var K5=v(()=>{Z0();a();Y0();J6=class J6 extends m{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/user_profiles?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(R`/v1/user_profiles/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(R`/v1/user_profiles/${$}?beta=true`,{body:J,...X,headers:D([{"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",r,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},X){let{betas:z}=Z??{};return this._client.post(R`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}}});var Q6;var H5=v(()=>{Z0();a();Y0();Q6=class Q6 extends m{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(R`/v1/agents/${$}/versions?beta=true`,r,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var h$;var B5=v(()=>{H5();H5();Z0();a();Y0();h$=class h$ extends m{constructor(){super(...arguments);this.versions=new Q6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/agents?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z,...J}=Z??{};return this._client.get(R`/v1/agents/${$}?beta=true`,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(R`/v1/agents/${$}?beta=true`,{body:J,...X,headers:D([{"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",r,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(R`/v1/agents/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};h$.Versions=Q6});var Y6;var M5=v(()=>{Z0();a();Y0();Y6=class Y6 extends m{create($,Z,X){let{view:z,betas:J,...Q}=Z;return this._client.post(R`/v1/memory_stores/${$}/memories?beta=true`,{query:{view:z},body:Q,...X,headers:D([{"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(R`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:Q,...X,headers:D([{"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(R`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:{view:J},body:Y,...X,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(R`/v1/memory_stores/${$}/memories?beta=true`,r,{query:J,...X,headers:D([{"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(R`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:{expected_content_sha256:J},...X,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var W6;var O5=v(()=>{Z0();a();Y0();W6=class W6 extends m{retrieve($,Z,X){let{memory_store_id:z,betas:J,...Q}=Z;return this._client.get(R`/v1/memory_stores/${z}/memory_versions/${$}?beta=true`,{query:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(R`/v1/memory_stores/${$}/memory_versions?beta=true`,r,{query:J,...X,headers:D([{"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(R`/v1/memory_stores/${z}/memory_versions/${$}/redact?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var s1;var L5=v(()=>{M5();M5();O5();O5();Z0();a();Y0();s1=class s1 extends m{constructor(){super(...arguments);this.memories=new Y6(this._client),this.memoryVersions=new W6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/memory_stores?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(R`/v1/memory_stores/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(R`/v1/memory_stores/${$}?beta=true`,{body:J,...X,headers:D([{"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",r,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(R`/v1/memory_stores/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(R`/v1/memory_stores/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};s1.Memories=Y6;s1.MemoryVersions=W6});var u$=v(()=>{A0()});var I4;var N5=v(()=>{I4={"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 eQ($){return $?.output_format??$?.output_config?.format}function D5($,Z,X){let z=eQ(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 I5($,Z,X)}function I5($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=BR(Z,Q.text);if(z===null)z=Y;let W=Object.defineProperty({...Q},"parsed_output",{value:Y,enumerable:!1});return Object.defineProperty(W,"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 BR($,Z){let X=eQ($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new k(`Failed to parse structured output: ${z}`)}}var T5=v(()=>{A0()});var MR=($)=>{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 W="",U=!1;z=$[++Z];while(z!=='"'){if(Z===$.length){U=!0;break}if(z==="\\"){if(Z++,Z===$.length){U=!0;break}W+=z+$[Z],z=$[++Z]}else W+=z,z=$[++Z]}if(z=$[++Z],!U)X.push({type:"string",value:W});continue}if(z&&/\s/.test(z)){Z++;continue}let Q=/[0-9]/;if(z&&Q.test(z)||z==="-"||z==="."){let W="";if(z==="-")W+=z,z=$[++Z];while(z&&Q.test(z)||z===".")W+=z,z=$[++Z];X.push({type:"number",value:W});continue}let Y=/[a-z]/i;if(z&&Y.test(z)){let W="";while(z&&Y.test(z)){if(Z===$.length)break;W+=z,z=$[++Z]}if(W=="true"||W=="false"||W==="null")X.push({type:"name",value:W});else{Z++;continue}continue}Z++}return X},m$=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),m$($);break;case"number":let X=Z.value[Z.value.length-1];if(X==="."||X==="-")return $=$.slice(0,$.length-1),m$($);case"string":let z=$[$.length-2];if(z?.type==="delimiter")return $=$.slice(0,$.length-1),m$($);else if(z?.type==="brace"&&z.value==="{")return $=$.slice(0,$.length-1),m$($);break;case"delimiter":return $=$.slice(0,$.length-1),m$($);break}return $},OR=($)=>{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 $},LR=($)=>{let Z="";return $.map((X)=>{switch(X.type){case"string":Z+='"'+X.value+'"';break;default:Z+=X.value;break}}),Z},T4=($)=>JSON.parse(LR(OR(m$(MR($)))));var A5=()=>{};var R5=v(()=>{eZ()});function zY($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function JY($){}var g0,w1,c$,U6,A4,q6,G6,R4,V6,G1,K6,_4,F4,a1,C4,P4,H6,_5,$Y,E4,F5,C5,P5,ZY,XY="__json_buf",B6;var QY=v(()=>{W1();A5();u$();R5();T5();B6=class B6{constructor($,Z){g0.add(this),this.messages=[],this.receivedMessages=[],w1.set(this,void 0),c$.set(this,null),this.controller=new AbortController,U6.set(this,void 0),A4.set(this,()=>{}),q6.set(this,()=>{}),G6.set(this,void 0),R4.set(this,()=>{}),V6.set(this,()=>{}),G1.set(this,{}),K6.set(this,!1),_4.set(this,!1),F4.set(this,!1),a1.set(this,!1),C4.set(this,void 0),P4.set(this,void 0),H6.set(this,void 0),E4.set(this,(X)=>{if(P(this,_4,!0,"f"),U1(X))X=new M0;if(X instanceof M0)return P(this,F4,!0,"f"),this._emit("abort",X);if(X instanceof k)return this._emit("error",X);if(X instanceof Error){let z=new k(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new k(String(X)))}),P(this,U6,new Promise((X,z)=>{P(this,A4,X,"f"),P(this,q6,z,"f")}),"f"),P(this,G6,new Promise((X,z)=>{P(this,R4,X,"f"),P(this,V6,z,"f")}),"f"),L(this,U6,"f").catch(()=>{}),L(this,G6,"f").catch(()=>{}),P(this,c$,$,"f"),P(this,H6,Z?.logger??console,"f")}get response(){return L(this,C4,"f")}get request_id(){return L(this,P4,"f")}async withResponse(){P(this,a1,!0,"f");let $=await L(this,U6,"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 B6(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new B6(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return P(J,c$,{...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")},L(this,E4,"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{L(this,g0,"m",F5).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let W of Y)L(this,g0,"m",C5).call(this,W);if(Y.controller.signal?.aborted)throw new M0;L(this,g0,"m",P5).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;P(this,C4,$,"f"),P(this,P4,$?.headers.get("request-id"),"f"),L(this,A4,"f").call(this,$),this._emit("connect")}get ended(){return L(this,K6,"f")}get errored(){return L(this,_4,"f")}get aborted(){return L(this,F4,"f")}abort(){this.controller.abort()}on($,Z){return(L(this,G1,"f")[$]||(L(this,G1,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=L(this,G1,"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(L(this,G1,"f")[$]||(L(this,G1,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(P(this,a1,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){P(this,a1,!0,"f"),await L(this,G6,"f")}get currentMessage(){return L(this,w1,"f")}async finalMessage(){return await this.done(),L(this,g0,"m",_5).call(this)}async finalText(){return await this.done(),L(this,g0,"m",$Y).call(this)}_emit($,...Z){if(L(this,K6,"f"))return;if($==="end")P(this,K6,!0,"f"),L(this,R4,"f").call(this);let X=L(this,G1,"f")[$];if(X)L(this,G1,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!L(this,a1,"f")&&!X?.length)Promise.reject(z);L(this,q6,"f").call(this,z),L(this,V6,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!L(this,a1,"f")&&!X?.length)Promise.reject(z);L(this,q6,"f").call(this,z),L(this,V6,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",L(this,g0,"m",_5).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{L(this,g0,"m",F5).call(this),this._connected(null);let J=x0.fromReadableStream($,this.controller);for await(let Q of J)L(this,g0,"m",C5).call(this,Q);if(J.controller.signal?.aborted)throw new M0;L(this,g0,"m",P5).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(w1=new WeakMap,c$=new WeakMap,U6=new WeakMap,A4=new WeakMap,q6=new WeakMap,G6=new WeakMap,R4=new WeakMap,V6=new WeakMap,G1=new WeakMap,K6=new WeakMap,_4=new WeakMap,F4=new WeakMap,a1=new WeakMap,C4=new WeakMap,P4=new WeakMap,H6=new WeakMap,E4=new WeakMap,g0=new WeakSet,_5=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},$Y=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},F5=function(){if(this.ended)return;P(this,w1,void 0,"f")},C5=function(Z){if(this.ended)return;let X=L(this,g0,"m",ZY).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(zY(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:JY(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(D5(X,L(this,c$,"f"),{logger:L(this,H6,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{P(this,w1,X,"f");break}case"content_block_start":case"message_delta":break}},P5=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=L(this,w1,"f");if(!Z)throw new k("request ended without sending any chunks");return P(this,w1,void 0,"f"),D5(Z,L(this,c$,"f"),{logger:L(this,H6,"f")})},ZY=function(Z){let X=L(this,w1,"f");if(Z.type==="message_start"){if(X)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new k(`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&&zY(z)){let J=z[XY]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,XY,{value:J,enumerable:!1,writable:!0}),J)try{Q.input=T4(J)}catch(Y){let W=new k(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${J}`);L(this,E4,"f").call(this,W)}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:JY(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 x0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var l$;var w4=v(()=>{l$=class l$ 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 YY=1e5,WY=`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,72 +192,72 @@ 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 qY(){let $,Z;return{promise:new Promise((z,J)=>{$=z,Z=J}),resolve:$,reject:Z}}async function
|
|
196
|
-
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(OR.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 W=D4[J.model]??void 0;Q=this._client.calculateNonstreamingTimeout(J.max_tokens,W)}let Y=N4(J.tools,J.messages);return this._client.post("/v1/messages?beta=true",{body:J,timeout:Q??600000,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Y,Z?.headers]),stream:X.stream??!1})}parse($,Z){return Z={...Z,headers:D([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((X)=>N5(X,$,{logger:this._client.logger??console}))}stream($,Z){return H6.createMessage(this,$,Z)}countTokens($,Z){let X=VY($),{betas:z,...J}=X;return this._client.post("/v1/messages/count_tokens?beta=true",{body:J,...Z,headers:D([{"anthropic-beta":[...z??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new O6(this._client,$,Z)}};w1.Batches=L6;w1.BetaToolRunner=O6;w1.ToolError=m$});var N6;var j5=v(()=>{X0();o();W0();N6=class N6 extends u{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(F`/v1/sessions/${$}/events?beta=true`,s,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}send($,Z,X){let{betas:z,...J}=Z;return this._client.post(F`/v1/sessions/${$}/events?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}stream($,Z={},X){let{betas:z}=Z??{};return this._client.get(F`/v1/sessions/${$}/events/stream?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers]),stream:!0})}}});var D6;var x5=v(()=>{X0();o();W0();D6=class D6 extends u{retrieve($,Z,X){let{session_id:z,betas:J}=Z;return this._client.get(F`/v1/sessions/${z}/resources/${$}?beta=true`,{...X,headers:D([{"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(F`/v1/sessions/${z}/resources/${$}?beta=true`,{body:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(F`/v1/sessions/${$}/resources?beta=true`,s,{query:J,...X,headers:D([{"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(F`/v1/sessions/${z}/resources/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}add($,Z,X){let{betas:z,...J}=Z;return this._client.post(F`/v1/sessions/${$}/resources?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var a1;var b5=v(()=>{j5();j5();x5();x5();X0();o();W0();a1=class a1 extends u{constructor(){super(...arguments);this.events=new N6(this._client),this.resources=new D6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/sessions?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(F`/v1/sessions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(F`/v1/sessions/${$}?beta=true`,{body:J,...X,headers:D([{"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",s,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(F`/v1/sessions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(F`/v1/sessions/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};a1.Events=N6;a1.Resources=D6});var I6;var k5=v(()=>{X0();o();v$();W0();I6=class I6 extends u{create($,Z={},X){let{betas:z,...J}=Z??{};return this._client.post(F`/v1/skills/${$}/versions?beta=true`,y$({body:J,...X,headers:D([{"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(F`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(F`/v1/skills/${$}/versions?beta=true`,s,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}delete($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.delete(F`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}}});var d$;var y5=v(()=>{k5();k5();X0();o();v$();W0();d$=class d$ extends u{constructor(){super(...arguments);this.versions=new I6(this._client)}create($={},Z){let{betas:X,...z}=$??{};return this._client.post("/v1/skills?beta=true",y$({body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(F`/v1/skills/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/skills?beta=true",s,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(F`/v1/skills/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}};d$.Versions=I6});var T6;var v5=v(()=>{X0();o();W0();T6=class T6 extends u{create($,Z,X){let{betas:z,...J}=Z;return this._client.post(F`/v1/vaults/${$}/credentials?beta=true`,{body:J,...X,headers:D([{"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(F`/v1/vaults/${z}/credentials/${$}?beta=true`,{...X,headers:D([{"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(F`/v1/vaults/${z}/credentials/${$}?beta=true`,{body:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(F`/v1/vaults/${$}/credentials?beta=true`,s,{query:J,...X,headers:D([{"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(F`/v1/vaults/${z}/credentials/${$}?beta=true`,{...X,headers:D([{"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(F`/v1/vaults/${z}/credentials/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var p$;var f5=v(()=>{v5();v5();X0();o();W0();p$=class p$ extends u{constructor(){super(...arguments);this.credentials=new T6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/vaults?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(F`/v1/vaults/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(F`/v1/vaults/${$}?beta=true`,{body:J,...X,headers:D([{"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",s,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(F`/v1/vaults/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(F`/v1/vaults/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};p$.Credentials=T6});var N0;var g5=v(()=>{Y5();Y5();U5();U5();q5();q5();G5();G5();K5();K5();M5();M5();S5();S5();b5();b5();y5();y5();f5();f5();N0=class N0 extends u{constructor(){super(...arguments);this.models=new X6(this._client),this.messages=new w1(this._client),this.agents=new f$(this._client),this.environments=new t2(this._client),this.sessions=new a1(this._client),this.vaults=new p$(this._client),this.memoryStores=new n1(this._client),this.files=new Z6(this._client),this.skills=new d$(this._client),this.userProfiles=new z6(this._client)}};N0.Models=X6;N0.Messages=w1;N0.Agents=f$;N0.Environments=t2;N0.Sessions=a1;N0.Vaults=p$;N0.MemoryStores=n1;N0.Files=Z6;N0.Skills=d$;N0.UserProfiles=z6});var i$;var h5=v(()=>{o();i$=class i$ extends u{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/complete",{body:z,timeout:this._client._options.timeout??600000,...Z,headers:D([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function KY($){return $?.output_config?.format}function u5($,Z,X){let z=KY(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 m5($,Z,X)}function m5($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=FR(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 FR($,Z){let X=KY($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new k(`Failed to parse structured output: ${z}`)}}var c5=v(()=>{A0()});function OY($){return $.type==="tool_use"||$.type==="server_tool_use"}function LY($){}var g0,S1,n$,A6,w4,R6,_6,S4,F6,G1,C6,j4,x4,o1,b4,k4,P6,l5,HY,d5,p5,i5,n5,BY,MY="__json_buf",E6;var NY=v(()=>{Q1();g$();T5();I5();c5();E6=class E6{constructor($,Z){g0.add(this),this.messages=[],this.receivedMessages=[],S1.set(this,void 0),n$.set(this,null),this.controller=new AbortController,A6.set(this,void 0),w4.set(this,()=>{}),R6.set(this,()=>{}),_6.set(this,void 0),S4.set(this,()=>{}),F6.set(this,()=>{}),G1.set(this,{}),C6.set(this,!1),j4.set(this,!1),x4.set(this,!1),o1.set(this,!1),b4.set(this,void 0),k4.set(this,void 0),P6.set(this,void 0),d5.set(this,(X)=>{if(P(this,j4,!0,"f"),Y1(X))X=new M0;if(X instanceof M0)return P(this,x4,!0,"f"),this._emit("abort",X);if(X instanceof k)return this._emit("error",X);if(X instanceof Error){let z=new k(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new k(String(X)))}),P(this,A6,new Promise((X,z)=>{P(this,w4,X,"f"),P(this,R6,z,"f")}),"f"),P(this,_6,new Promise((X,z)=>{P(this,S4,X,"f"),P(this,F6,z,"f")}),"f"),L(this,A6,"f").catch(()=>{}),L(this,_6,"f").catch(()=>{}),P(this,n$,$,"f"),P(this,P6,Z?.logger??console,"f")}get response(){return L(this,b4,"f")}get request_id(){return L(this,k4,"f")}async withResponse(){P(this,o1,!0,"f");let $=await L(this,A6,"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 E6(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new E6(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return P(J,n$,{...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")},L(this,d5,"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{L(this,g0,"m",p5).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let W of Y)L(this,g0,"m",i5).call(this,W);if(Y.controller.signal?.aborted)throw new M0;L(this,g0,"m",n5).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;P(this,b4,$,"f"),P(this,k4,$?.headers.get("request-id"),"f"),L(this,w4,"f").call(this,$),this._emit("connect")}get ended(){return L(this,C6,"f")}get errored(){return L(this,j4,"f")}get aborted(){return L(this,x4,"f")}abort(){this.controller.abort()}on($,Z){return(L(this,G1,"f")[$]||(L(this,G1,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=L(this,G1,"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(L(this,G1,"f")[$]||(L(this,G1,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(P(this,o1,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){P(this,o1,!0,"f"),await L(this,_6,"f")}get currentMessage(){return L(this,S1,"f")}async finalMessage(){return await this.done(),L(this,g0,"m",l5).call(this)}async finalText(){return await this.done(),L(this,g0,"m",HY).call(this)}_emit($,...Z){if(L(this,C6,"f"))return;if($==="end")P(this,C6,!0,"f"),L(this,S4,"f").call(this);let X=L(this,G1,"f")[$];if(X)L(this,G1,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!L(this,o1,"f")&&!X?.length)Promise.reject(z);L(this,R6,"f").call(this,z),L(this,F6,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!L(this,o1,"f")&&!X?.length)Promise.reject(z);L(this,R6,"f").call(this,z),L(this,F6,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",L(this,g0,"m",l5).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{L(this,g0,"m",p5).call(this),this._connected(null);let J=S0.fromReadableStream($,this.controller);for await(let Q of J)L(this,g0,"m",i5).call(this,Q);if(J.controller.signal?.aborted)throw new M0;L(this,g0,"m",n5).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(S1=new WeakMap,n$=new WeakMap,A6=new WeakMap,w4=new WeakMap,R6=new WeakMap,_6=new WeakMap,S4=new WeakMap,F6=new WeakMap,G1=new WeakMap,C6=new WeakMap,j4=new WeakMap,x4=new WeakMap,o1=new WeakMap,b4=new WeakMap,k4=new WeakMap,P6=new WeakMap,d5=new WeakMap,g0=new WeakSet,l5=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},HY=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},p5=function(){if(this.ended)return;P(this,S1,void 0,"f")},i5=function(Z){if(this.ended)return;let X=L(this,g0,"m",BY).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(OY(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:LY(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(u5(X,L(this,n$,"f"),{logger:L(this,P6,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{P(this,S1,X,"f");break}case"content_block_start":case"message_delta":break}},n5=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=L(this,S1,"f");if(!Z)throw new k("request ended without sending any chunks");return P(this,S1,void 0,"f"),u5(Z,L(this,n$,"f"),{logger:L(this,P6,"f")})},BY=function(Z){let X=L(this,S1,"f");if(Z.type==="message_start"){if(X)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new k(`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&&OY(z)){let J=z[MY]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,MY,{value:J,enumerable:!1,writable:!0}),J)Q.input=I4(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:LY(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 S0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var w6;var r5=v(()=>{X0();o();E5();g$();W0();w6=class w6 extends u{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(F`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",p0,{query:$,...Z})}delete($,Z){return this._client.delete(F`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(F`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let X=await this.retrieve($);if(!X.results_url)throw new k(`No batch \`results_url\`; Has it finished processing? ${X.processing_status} - ${X.id}`);return this._client.get(X.results_url,{...Z,headers:D([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((z,J)=>l$.fromResponse(J.response,J.controller))}}});var t1,DY,PR;var s5=v(()=>{o();$6();NY();c5();r5();r5();O5();t1=class t1 extends u{constructor(){super(...arguments);this.batches=new w6(this._client)}create($,Z){if($.model in DY)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${DY[$.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 qY(){let $,Z;return{promise:new Promise((z,J)=>{$=z,Z=J}),resolve:$,reject:Z}}async function NR($,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((W)=>("name"in W?W.name:W.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 W=Q.input;if("parse"in Y&&Y.parse)W=Y.parse(W);let U=await Y.run(W,{toolUseBlock:Q,signal:X?.signal});return{type:"tool_result",tool_use_id:Q.id,content:U}}catch(W){return{type:"tool_result",tool_use_id:Q.id,content:W instanceof l$?W.content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}var M6,d$,o1,G0,R0,b0,V1,S1,O6,UY,E5,L6;var w5=v(()=>{W1();w4();A0();a();Z6();L6=class L6{constructor($,Z,X){M6.add(this),this.client=$,d$.set(this,!1),o1.set(this,!1),G0.set(this,void 0),R0.set(this,void 0),b0.set(this,void 0),V1.set(this,void 0),S1.set(this,void 0),O6.set(this,0),P(this,G0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let J=["BetaToolRunner",...q5(Z.tools,Z.messages)].join(", ");if(P(this,R0,{...X,headers:D([{"x-stainless-helper":J},X?.headers])},"f"),P(this,S1,qY(),"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*[(d$=new WeakMap,o1=new WeakMap,G0=new WeakMap,R0=new WeakMap,b0=new WeakMap,V1=new WeakMap,S1=new WeakMap,O6=new WeakMap,M6=new WeakSet,UY=async function(){let Z=L(this,G0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let X=0;if(L(this,b0,"f")!==void 0)try{let U=await L(this,b0,"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??YY;if(X<z)return!1;let J=Z.model??L(this,G0,"f").params.model,Q=Z.summaryPrompt??WY,Y=L(this,G0,"f").params.messages;if(Y[Y.length-1].role==="assistant"){let U=Y[Y.length-1];if(Array.isArray(U.content)){let q=U.content.filter((G)=>G.type!=="tool_use");if(q.length===0)Y.pop();else U.content=q}}let W=await this.client.beta.messages.create({model:J,messages:[...Y,{role:"user",content:[{type:"text",text:Q}]}],max_tokens:L(this,G0,"f").params.max_tokens},{signal:L(this,R0,"f").signal,headers:D([L(this,R0,"f").headers,{"x-stainless-helper":"compaction"}])});if(W.content[0]?.type!=="text")throw new k("Expected text response for compaction");return L(this,G0,"f").params.messages=[{role:"user",content:W.content}],!0},Symbol.asyncIterator)](){var $;if(L(this,d$,"f"))throw new k("Cannot iterate over a consumed stream");P(this,d$,!0,"f"),P(this,o1,!0,"f"),P(this,V1,void 0,"f");try{while(!0){let Z;try{if(L(this,G0,"f").params.max_iterations&&L(this,O6,"f")>=L(this,G0,"f").params.max_iterations)break;P(this,o1,!1,"f"),P(this,V1,void 0,"f"),P(this,O6,($=L(this,O6,"f"),$++,$),"f"),P(this,b0,void 0,"f");let{max_iterations:X,compactionControl:z,...J}=L(this,G0,"f").params;if(J.stream)Z=this.client.beta.messages.stream({...J},L(this,R0,"f")),P(this,b0,Z.finalMessage(),"f"),L(this,b0,"f").catch(()=>{}),yield Z;else P(this,b0,this.client.beta.messages.create({...J,stream:!1},L(this,R0,"f")),"f"),yield L(this,b0,"f");if(!await L(this,M6,"m",UY).call(this)){if(!L(this,o1,"f")){let{role:W,content:U}=await L(this,b0,"f");L(this,G0,"f").params.messages.push({role:W,content:U})}let Y=await L(this,M6,"m",E5).call(this,L(this,G0,"f").params.messages.at(-1));if(Y)L(this,G0,"f").params.messages.push(Y);else if(!L(this,o1,"f"))break}}finally{if(Z)Z.abort()}}if(!L(this,b0,"f"))throw new k("ToolRunner concluded without a message from the server");L(this,S1,"f").resolve(await L(this,b0,"f"))}catch(Z){throw P(this,d$,!1,"f"),L(this,S1,"f").promise.catch(()=>{}),L(this,S1,"f").reject(Z),P(this,S1,qY(),"f"),Z}}setMessagesParams($){if(typeof $==="function")L(this,G0,"f").params=$(L(this,G0,"f").params);else L(this,G0,"f").params=$;P(this,o1,!0,"f"),P(this,V1,void 0,"f")}setRequestOptions($){if(typeof $==="function")P(this,R0,$(L(this,R0,"f")),"f");else P(this,R0,{...L(this,R0,"f"),...$},"f")}async generateToolResponse($=L(this,R0,"f").signal){let Z=await L(this,b0,"f")??this.params.messages.at(-1);if(!Z)return null;return L(this,M6,"m",E5).call(this,Z,$)}done(){return L(this,S1,"f").promise}async runUntilDone(){if(!L(this,d$,"f"))for await(let $ of this);return this.done()}get params(){return L(this,G0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};E5=async function(Z,X=L(this,R0,"f").signal){if(L(this,V1,"f")!==void 0)return L(this,V1,"f");return P(this,V1,NR(L(this,G0,"f").params,Z,{...L(this,R0,"f"),signal:X}),"f"),L(this,V1,"f")}});var p$;var S5=v(()=>{A0();oZ();p$=class p${constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new P1;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 k("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new k("Attempted to iterate over a response with no body")}return new p$(p2($.body),Z)}}});var N6;var j5=v(()=>{Z0();a();S5();u$();Y0();N6=class N6 extends m{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/messages/batches?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(R`/v1/messages/batches/${$}?beta=true`,{...X,headers:D([{"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",i0,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(R`/v1/messages/batches/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}cancel($,Z={},X){let{betas:z}=Z??{};return this._client.post(R`/v1/messages/batches/${$}/cancel?beta=true`,{...X,headers:D([{"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 k(`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:D([{"anthropic-beta":[...J??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},X?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,Y)=>p$.fromResponse(Y.response,Y.controller))}}});function VY($){if(!$.output_format)return $;if($.output_config?.format)throw new k("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...X}=$;return{...X,output_config:{...$.output_config,format:Z}}}var GY,IR,j1;var x5=v(()=>{u$();N5();a();Z6();T5();QY();w5();w4();j5();j5();w5();w4();GY={"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"},IR=["claude-mythos-preview","claude-opus-4-6"];j1=class j1 extends m{constructor(){super(...arguments);this.batches=new N6(this._client)}create($,Z){let X=VY($),{betas:z,...J}=X;if(J.model in GY)console.warn(`The model '${J.model}' is deprecated and will reach end-of-life on ${GY[J.model]}
|
|
196
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(IR.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 W=I4[J.model]??void 0;Q=this._client.calculateNonstreamingTimeout(J.max_tokens,W)}let Y=D4(J.tools,J.messages);return this._client.post("/v1/messages?beta=true",{body:J,timeout:Q??600000,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Y,Z?.headers]),stream:X.stream??!1})}parse($,Z){return Z={...Z,headers:D([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((X)=>I5(X,$,{logger:this._client.logger??console}))}stream($,Z){return B6.createMessage(this,$,Z)}countTokens($,Z){let X=VY($),{betas:z,...J}=X;return this._client.post("/v1/messages/count_tokens?beta=true",{body:J,...Z,headers:D([{"anthropic-beta":[...z??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new L6(this._client,$,Z)}};j1.Batches=N6;j1.BetaToolRunner=L6;j1.ToolError=l$});var D6;var b5=v(()=>{Z0();a();Y0();D6=class D6 extends m{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(R`/v1/sessions/${$}/events?beta=true`,r,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}send($,Z,X){let{betas:z,...J}=Z;return this._client.post(R`/v1/sessions/${$}/events?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}stream($,Z={},X){let{betas:z}=Z??{};return this._client.get(R`/v1/sessions/${$}/events/stream?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers]),stream:!0})}}});var I6;var k5=v(()=>{Z0();a();Y0();I6=class I6 extends m{retrieve($,Z,X){let{session_id:z,betas:J}=Z;return this._client.get(R`/v1/sessions/${z}/resources/${$}?beta=true`,{...X,headers:D([{"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(R`/v1/sessions/${z}/resources/${$}?beta=true`,{body:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(R`/v1/sessions/${$}/resources?beta=true`,r,{query:J,...X,headers:D([{"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(R`/v1/sessions/${z}/resources/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}add($,Z,X){let{betas:z,...J}=Z;return this._client.post(R`/v1/sessions/${$}/resources?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var t1;var y5=v(()=>{b5();b5();k5();k5();Z0();a();Y0();t1=class t1 extends m{constructor(){super(...arguments);this.events=new D6(this._client),this.resources=new I6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/sessions?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(R`/v1/sessions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(R`/v1/sessions/${$}?beta=true`,{body:J,...X,headers:D([{"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",r,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(R`/v1/sessions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(R`/v1/sessions/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};t1.Events=D6;t1.Resources=I6});var T6;var v5=v(()=>{Z0();a();g$();Y0();T6=class T6 extends m{create($,Z={},X){let{betas:z,...J}=Z??{};return this._client.post(R`/v1/skills/${$}/versions?beta=true`,f$({body:J,...X,headers:D([{"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(R`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(R`/v1/skills/${$}/versions?beta=true`,r,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}delete($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.delete(R`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}}});var i$;var f5=v(()=>{v5();v5();Z0();a();g$();Y0();i$=class i$ extends m{constructor(){super(...arguments);this.versions=new T6(this._client)}create($={},Z){let{betas:X,...z}=$??{};return this._client.post("/v1/skills?beta=true",f$({body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(R`/v1/skills/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/skills?beta=true",r,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(R`/v1/skills/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}};i$.Versions=T6});var A6;var g5=v(()=>{Z0();a();Y0();A6=class A6 extends m{create($,Z,X){let{betas:z,...J}=Z;return this._client.post(R`/v1/vaults/${$}/credentials?beta=true`,{body:J,...X,headers:D([{"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(R`/v1/vaults/${z}/credentials/${$}?beta=true`,{...X,headers:D([{"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(R`/v1/vaults/${z}/credentials/${$}?beta=true`,{body:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(R`/v1/vaults/${$}/credentials?beta=true`,r,{query:J,...X,headers:D([{"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(R`/v1/vaults/${z}/credentials/${$}?beta=true`,{...X,headers:D([{"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(R`/v1/vaults/${z}/credentials/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var n$;var h5=v(()=>{g5();g5();Z0();a();Y0();n$=class n$ extends m{constructor(){super(...arguments);this.credentials=new A6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/vaults?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(R`/v1/vaults/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(R`/v1/vaults/${$}?beta=true`,{body:J,...X,headers:D([{"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",r,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(R`/v1/vaults/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(R`/v1/vaults/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};n$.Credentials=A6});var N0;var u5=v(()=>{U5();U5();G5();G5();V5();V5();K5();K5();B5();B5();L5();L5();x5();x5();y5();y5();f5();f5();h5();h5();N0=class N0 extends m{constructor(){super(...arguments);this.models=new z6(this._client),this.messages=new j1(this._client),this.agents=new h$(this._client),this.environments=new e2(this._client),this.sessions=new t1(this._client),this.vaults=new n$(this._client),this.memoryStores=new s1(this._client),this.files=new X6(this._client),this.skills=new i$(this._client),this.userProfiles=new J6(this._client)}};N0.Models=z6;N0.Messages=j1;N0.Agents=h$;N0.Environments=e2;N0.Sessions=t1;N0.Vaults=n$;N0.MemoryStores=s1;N0.Files=X6;N0.Skills=i$;N0.UserProfiles=J6});var r$;var m5=v(()=>{a();r$=class r$ extends m{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/complete",{body:z,timeout:this._client._options.timeout??600000,...Z,headers:D([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function KY($){return $?.output_config?.format}function c5($,Z,X){let z=KY(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 l5($,Z,X)}function l5($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=wR(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 wR($,Z){let X=KY($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new k(`Failed to parse structured output: ${z}`)}}var d5=v(()=>{A0()});function OY($){return $.type==="tool_use"||$.type==="server_tool_use"}function LY($){}var h0,x1,s$,R6,S4,_6,F6,j4,C6,K1,P6,x4,b4,e1,k4,y4,E6,p5,HY,i5,n5,r5,s5,BY,MY="__json_buf",w6;var NY=v(()=>{W1();u$();R5();A5();d5();w6=class w6{constructor($,Z){h0.add(this),this.messages=[],this.receivedMessages=[],x1.set(this,void 0),s$.set(this,null),this.controller=new AbortController,R6.set(this,void 0),S4.set(this,()=>{}),_6.set(this,()=>{}),F6.set(this,void 0),j4.set(this,()=>{}),C6.set(this,()=>{}),K1.set(this,{}),P6.set(this,!1),x4.set(this,!1),b4.set(this,!1),e1.set(this,!1),k4.set(this,void 0),y4.set(this,void 0),E6.set(this,void 0),i5.set(this,(X)=>{if(P(this,x4,!0,"f"),U1(X))X=new M0;if(X instanceof M0)return P(this,b4,!0,"f"),this._emit("abort",X);if(X instanceof k)return this._emit("error",X);if(X instanceof Error){let z=new k(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new k(String(X)))}),P(this,R6,new Promise((X,z)=>{P(this,S4,X,"f"),P(this,_6,z,"f")}),"f"),P(this,F6,new Promise((X,z)=>{P(this,j4,X,"f"),P(this,C6,z,"f")}),"f"),L(this,R6,"f").catch(()=>{}),L(this,F6,"f").catch(()=>{}),P(this,s$,$,"f"),P(this,E6,Z?.logger??console,"f")}get response(){return L(this,k4,"f")}get request_id(){return L(this,y4,"f")}async withResponse(){P(this,e1,!0,"f");let $=await L(this,R6,"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 w6(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new w6(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return P(J,s$,{...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")},L(this,i5,"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{L(this,h0,"m",n5).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let W of Y)L(this,h0,"m",r5).call(this,W);if(Y.controller.signal?.aborted)throw new M0;L(this,h0,"m",s5).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;P(this,k4,$,"f"),P(this,y4,$?.headers.get("request-id"),"f"),L(this,S4,"f").call(this,$),this._emit("connect")}get ended(){return L(this,P6,"f")}get errored(){return L(this,x4,"f")}get aborted(){return L(this,b4,"f")}abort(){this.controller.abort()}on($,Z){return(L(this,K1,"f")[$]||(L(this,K1,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=L(this,K1,"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(L(this,K1,"f")[$]||(L(this,K1,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(P(this,e1,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){P(this,e1,!0,"f"),await L(this,F6,"f")}get currentMessage(){return L(this,x1,"f")}async finalMessage(){return await this.done(),L(this,h0,"m",p5).call(this)}async finalText(){return await this.done(),L(this,h0,"m",HY).call(this)}_emit($,...Z){if(L(this,P6,"f"))return;if($==="end")P(this,P6,!0,"f"),L(this,j4,"f").call(this);let X=L(this,K1,"f")[$];if(X)L(this,K1,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!L(this,e1,"f")&&!X?.length)Promise.reject(z);L(this,_6,"f").call(this,z),L(this,C6,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!L(this,e1,"f")&&!X?.length)Promise.reject(z);L(this,_6,"f").call(this,z),L(this,C6,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",L(this,h0,"m",p5).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{L(this,h0,"m",n5).call(this),this._connected(null);let J=x0.fromReadableStream($,this.controller);for await(let Q of J)L(this,h0,"m",r5).call(this,Q);if(J.controller.signal?.aborted)throw new M0;L(this,h0,"m",s5).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(x1=new WeakMap,s$=new WeakMap,R6=new WeakMap,S4=new WeakMap,_6=new WeakMap,F6=new WeakMap,j4=new WeakMap,C6=new WeakMap,K1=new WeakMap,P6=new WeakMap,x4=new WeakMap,b4=new WeakMap,e1=new WeakMap,k4=new WeakMap,y4=new WeakMap,E6=new WeakMap,i5=new WeakMap,h0=new WeakSet,p5=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},HY=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},n5=function(){if(this.ended)return;P(this,x1,void 0,"f")},r5=function(Z){if(this.ended)return;let X=L(this,h0,"m",BY).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(OY(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:LY(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(c5(X,L(this,s$,"f"),{logger:L(this,E6,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{P(this,x1,X,"f");break}case"content_block_start":case"message_delta":break}},s5=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=L(this,x1,"f");if(!Z)throw new k("request ended without sending any chunks");return P(this,x1,void 0,"f"),c5(Z,L(this,s$,"f"),{logger:L(this,E6,"f")})},BY=function(Z){let X=L(this,x1,"f");if(Z.type==="message_start"){if(X)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new k(`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&&OY(z)){let J=z[MY]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,MY,{value:J,enumerable:!1,writable:!0}),J)Q.input=T4(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:LY(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 x0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var S6;var a5=v(()=>{Z0();a();S5();u$();Y0();S6=class S6 extends m{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(R`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",i0,{query:$,...Z})}delete($,Z){return this._client.delete(R`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(R`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let X=await this.retrieve($);if(!X.results_url)throw new k(`No batch \`results_url\`; Has it finished processing? ${X.processing_status} - ${X.id}`);return this._client.get(X.results_url,{...Z,headers:D([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((z,J)=>p$.fromResponse(J.response,J.controller))}}});var $$,DY,jR;var o5=v(()=>{a();Z6();NY();d5();a5();a5();N5();$$=class $$ extends m{constructor(){super(...arguments);this.batches=new S6(this._client)}create($,Z){if($.model in DY)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${DY[$.model]}
|
|
197
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(jR.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=I4[$.model]??void 0;X=this._client.calculateNonstreamingTimeout($.max_tokens,J)}let z=D4($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:X??600000,...Z,headers:D([z,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((X)=>l5(X,$,{logger:this._client.logger??console}))}stream($,Z){return w6.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};DY={"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"},jR=["claude-mythos-preview","claude-opus-4-6"];$$.Batches=S6});var a$;var t5=v(()=>{Z0();a();Y0();a$=class a$ extends m{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(R`/v1/models/${$}`,{...X,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/models",i0,{query:z,...Z,headers:D([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var IY=v(()=>{u5();m5();o5();t5();rQ()});var j6=($)=>{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 e{constructor({baseURL:$=j6("ANTHROPIC_BASE_URL"),apiKey:Z=j6("ANTHROPIC_API_KEY")??null,authToken:X=j6("ANTHROPIC_AUTH_TOKEN")??null,...z}={}){e5.add(this),v4.set(this,void 0);let J={apiKey:Z,authToken:X,...z,baseURL:$||"https://api.anthropic.com"};if(!J.dangerouslyAllowBrowser&&xQ())throw new k(`It looks like you're running in a browser-like environment.
|
|
198
198
|
|
|
199
199
|
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
200
200
|
If you understand the risks and have appropriate mitigations in place,
|
|
201
201
|
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
202
202
|
|
|
203
203
|
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
204
|
-
`);this.baseURL=J.baseURL,this.timeout=J.timeout??t5.DEFAULT_TIMEOUT,this.logger=J.logger??console;let Q="warn";this.logLevel=Q,this.logLevel=aZ(J.logLevel,"ClientOptions.logLevel",this)??aZ(S6("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??Q,this.fetchOptions=J.fetchOptions,this.maxRetries=J.maxRetries??2,this.fetch=J.fetch??kQ(),P(this,y4,vQ,"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 D([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return D([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return D([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return fQ($)}getUserAgent(){return`${this.constructor.name}/JS ${_1}`}defaultIdempotencyKey(){return`stainless-node-retry-${cZ()}`}makeStatusError($,Z,X,z){return Y0.generate($,Z,X,z)}buildURL($,Z,X){let z=!L(this,o5,"m",TY).call(this)&&X||this.baseURL,J=FQ($)?new URL($):new URL(z+(z.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),Q=this.defaultQuery(),Y=Object.fromEntries(J.searchParams);if(!pZ(Q)||!pZ(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 k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options: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 C1(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:W}=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"),q=X===void 0?"":`, retryOf: ${X}`,G=Date.now();if(B0(this).debug(`[${U}] sending request`,W1({retryOfRequestLogID:X,method:z.method,url:Y,options:z,headers:Q.headers})),z.signal?.aborted)throw new M0;let V=new AbortController,K=await this.fetchWithTimeout(Y,Q,W,V).catch(l2),H=Date.now();if(K instanceof globalThis.Error){let O=`retrying, ${Z} attempts remaining`;if(z.signal?.aborted)throw new M0;let T=Y1(K)||/timed? ?out/i.test(String(K)+("cause"in K?String(K.cause):""));if(Z)return B0(this).info(`[${U}] connection ${T?"timed out":"failed"} - ${O}`),B0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (${O})`,W1({retryOfRequestLogID:X,url:Y,durationMs:H-G,message:K.message})),this.retryRequest(z,Z,X??U);if(B0(this).info(`[${U}] connection ${T?"timed out":"failed"} - error; no more retries left`),B0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (error; no more retries left)`,W1({retryOfRequestLogID:X,url:Y,durationMs:H-G,message:K.message})),T)throw new C$;throw new R1({cause:K})}let N=[...K.headers.entries()].filter(([O])=>O==="request-id").map(([O,T])=>", "+O+": "+JSON.stringify(T)).join(""),B=`[${U}${q}${N}] ${Q.method} ${Y} ${K.ok?"succeeded":"failed"} with status ${K.status} in ${H-G}ms`;if(!K.ok){let O=await this.shouldRetry(K);if(Z&&O){let x=`retrying, ${Z} attempts remaining`;return await yQ(K.body),B0(this).info(`${B} - ${x}`),B0(this).debug(`[${U}] response error (${x})`,W1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,durationMs:H-G})),this.retryRequest(z,Z,X??U,K.headers)}let T=O?"error; no more retries left":"error; not retryable";B0(this).info(`${B} - ${T}`);let R=await K.text().catch((x)=>l2(x).message),E=q4(R),w=E?void 0:R;throw B0(this).debug(`[${U}] response error (${T})`,W1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,message:w,durationMs:Date.now()-G})),this.makeStatusError(K.status,E,w,K.headers)}return B0(this).info(B),B0(this).debug(`[${U}] response start`,W1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,durationMs:H-G})),{response:K,options:z,controller:V,requestLogID:U,retryOfRequestLogID:X,startTime:G}}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 s2(this,X,$)}async fetchWithTimeout($,Z,X,z){let{signal:J,method:Q,...Y}=Z||{},W=this._makeAbort(z);if(J)J.addEventListener("abort",W,{once:!0});let U=setTimeout(W,X),q=globalThis.ReadableStream&&Y.body instanceof globalThis.ReadableStream||typeof Y.body==="object"&&Y.body!==null&&Symbol.asyncIterator in Y.body,G={signal:z.signal,...q?{duplex:"half"}:{},method:"GET",...Y};if(Q)G.method=Q.toUpperCase();try{return await this.fetch.call(void 0,$,G)}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 W=parseFloat(Q);if(!Number.isNaN(W))J=W}let Y=z?.get("retry-after");if(Y&&!J){let W=parseFloat(Y);if(!Number.isNaN(W))J=W*1000;else J=Date.parse(Y)-Date.now()}if(J===void 0){let W=$.maxRetries??this.maxRetries;J=this.calculateDefaultRetryTimeoutMillis(Z,W)}return await EQ(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 k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let X={...$},{method:z,path:J,query:Q,defaultBaseURL:Y}=X,W=this.buildURL(J,Q,Y);if("timeout"in X)PQ("timeout",X.timeout);X.timeout=X.timeout??this.timeout;let{bodyHeaders:U,body:q}=this.buildBody({options:X}),G=await this.buildHeaders({options:$,method:z,bodyHeaders:U,retryCount:Z});return{req:{method:z,headers:G,...X.signal&&{signal:X.signal},...globalThis.ReadableStream&&q instanceof globalThis.ReadableStream&&{duplex:"half"},...q&&{body:q},...this.fetchOptions??{},...X.fetchOptions??{}},url:W,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=D([J,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(z),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...bQ(),...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=D([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:G4($)};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 L(this,y4,"f").call(this,{body:$,headers:X})}}var o5,t5,y4,TY,e5="\\n\\nHuman:",$9="\\n\\nAssistant:",j1;var Z9=v(()=>{Q1();p1();iZ();gQ();A0();X0();Q5();IY();M4();h5();a5();g5();s5();iZ();o();H4();p1();t5=$0,y4=new WeakMap,o5=new WeakSet,TY=function(){return this.baseURL!=="https://api.anthropic.com"};$0.Anthropic=t5;$0.HUMAN_PROMPT=e5;$0.AI_PROMPT=$9;$0.DEFAULT_TIMEOUT=600000;$0.AnthropicError=k;$0.APIError=Y0;$0.APIConnectionError=R1;$0.APIConnectionTimeoutError=C$;$0.APIUserAbortError=M0;$0.NotFoundError=S$;$0.ConflictError=j$;$0.RateLimitError=b$;$0.BadRequestError=P$;$0.AuthenticationError=E$;$0.InternalServerError=k$;$0.PermissionDeniedError=w$;$0.UnprocessableEntityError=x$;$0.toFile=o2;j1=class j1 extends $0{constructor(){super(...arguments);this.completions=new i$(this),this.messages=new t1(this),this.models=new r$(this),this.beta=new N0(this)}};j1.Completions=i$;j1.Messages=t1;j1.Models=r$;j1.Beta=N0});var AY={};M9(AY,{toFile:()=>o2,default:()=>j1,UnprocessableEntityError:()=>x$,RateLimitError:()=>b$,PermissionDeniedError:()=>w$,PagePromise:()=>s2,NotFoundError:()=>S$,InternalServerError:()=>k$,HUMAN_PROMPT:()=>e5,ConflictError:()=>j$,BaseAnthropic:()=>$0,BadRequestError:()=>P$,AuthenticationError:()=>E$,AnthropicError:()=>k,Anthropic:()=>j1,APIUserAbortError:()=>M0,APIPromise:()=>C1,APIError:()=>Y0,APIConnectionTimeoutError:()=>C$,APIConnectionError:()=>R1,AI_PROMPT:()=>$9});var RY=v(()=>{Z9();Q5();M4();Z9();X0();A0()});var x9=XW(j9(),1),{program:m_,createCommand:c_,createArgument:l_,createOption:d_,CommanderError:p_,InvalidArgumentError:i_,InvalidOptionArgumentError:n_,Command:b9,Argument:r_,Option:s_,Help:a_}=x9.default;import{readFileSync as pX,writeFileSync as dO,existsSync as lX}from"fs";import{join as dX,dirname as iX,basename as pO}from"path";import{execFileSync as iO}from"child_process";var WO=p3(),UO=H2(),qO=w3(),zZ=B2(),GO=e$(),D1=i(),VO=B1(),KO=z0(),HO=O1(),BO=L1(),MC=T8(),MO=$Z(),OO=ZZ(),LO=XZ(),F8=mX(),cX=o$();var NO=WO.Composer,DO=UO.Document,IO=qO.Schema,TO=zZ.YAMLError,AO=zZ.YAMLParseError,RO=zZ.YAMLWarning,_O=GO.Alias,FO=D1.isAlias,CO=D1.isCollection,PO=D1.isDocument,EO=D1.isMap,wO=D1.isNode,SO=D1.isPair,jO=D1.isScalar,xO=D1.isSeq,bO=VO.Pair,kO=KO.Scalar,yO=HO.YAMLMap,vO=BO.YAMLSeq;var fO=MO.Lexer,gO=OO.LineCounter,hO=LO.Parser,D0=F8.parse,uO=F8.parseAllDocuments,mO=F8.parseDocument,I2=F8.stringify,cO=cX.visit,lO=cX.visitAsync;function p($){let Z=pX($,"utf-8");return D0(Z)}function JZ($){let Z=$._meta,X={...$};delete X._meta;let z=I2(X,{lineWidth:0});if(Z?.found&&Z.found.length>0){let J=Z.found.join(" + ");z=z.replace(/^(\s+type:\s+\S+)(\s*)$/m,(Q,Y,W)=>{if(W.includes("#"))return Q;return`${Y} # found: ${J}`})}return z}function t($,Z){dO($,JZ(Z),"utf-8")}function c($){return pX($,"utf-8")}function nX($){return D0($)}function g($=process.cwd()){let Z=["project.faf",".faf"];for(let z of Z){let J=dX($,z);if(lX(J))return J}let X=iX($);if(X!==$)for(let z of Z){let J=dX(X,z);if(lX(J))return J}return null}function V$($,Z=process.cwd()){return iO("git",["-C",iX($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+pO($)}l();var K$=[{name:"TROPHY",indicator:`${K0("✪")} ${K0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${K0(A("★"))} ${K0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${I("◆")} ${I("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${C8("◇")} ${C8("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${A("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${M("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${M("○")} RED`,threshold:1},{name:"WHITE",indicator:`${M("♡")}`,threshold:0}];function m0($){return $.indicator}function I1($){for(let Z of K$)if($>=Z.threshold)return Z;return K$[K$.length-1]}var YZ=null;function A2(){if(YZ)return YZ;try{let $=_0("faf-scoring-kernel");return YZ=$,$}catch{throw Error(`faf-scoring-kernel not installed.
|
|
204
|
+
`);this.baseURL=J.baseURL,this.timeout=J.timeout??$9.DEFAULT_TIMEOUT,this.logger=J.logger??console;let Q="warn";this.logLevel=Q,this.logLevel=tZ(J.logLevel,"ClientOptions.logLevel",this)??tZ(j6("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??Q,this.fetchOptions=J.fetchOptions,this.maxRetries=J.maxRetries??2,this.fetch=J.fetch??kQ(),P(this,v4,vQ,"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 D([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return D([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return D([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return fQ($)}getUserAgent(){return`${this.constructor.name}/JS ${C1}`}defaultIdempotencyKey(){return`stainless-node-retry-${dZ()}`}makeStatusError($,Z,X,z){return Q0.generate($,Z,X,z)}buildURL($,Z,X){let z=!L(this,e5,"m",TY).call(this)&&X||this.baseURL,J=FQ($)?new URL($):new URL(z+(z.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),Q=this.defaultQuery(),Y=Object.fromEntries(J.searchParams);if(!nZ(Q)||!nZ(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 k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options: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 E1(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:W}=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"),q=X===void 0?"":`, retryOf: ${X}`,G=Date.now();if(B0(this).debug(`[${U}] sending request`,q1({retryOfRequestLogID:X,method:z.method,url:Y,options:z,headers:Q.headers})),z.signal?.aborted)throw new M0;let V=new AbortController,K=await this.fetchWithTimeout(Y,Q,W,V).catch(d2),H=Date.now();if(K instanceof globalThis.Error){let O=`retrying, ${Z} attempts remaining`;if(z.signal?.aborted)throw new M0;let T=U1(K)||/timed? ?out/i.test(String(K)+("cause"in K?String(K.cause):""));if(Z)return B0(this).info(`[${U}] connection ${T?"timed out":"failed"} - ${O}`),B0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (${O})`,q1({retryOfRequestLogID:X,url:Y,durationMs:H-G,message:K.message})),this.retryRequest(z,Z,X??U);if(B0(this).info(`[${U}] connection ${T?"timed out":"failed"} - error; no more retries left`),B0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (error; no more retries left)`,q1({retryOfRequestLogID:X,url:Y,durationMs:H-G,message:K.message})),T)throw new E$;throw new F1({cause:K})}let N=[...K.headers.entries()].filter(([O])=>O==="request-id").map(([O,T])=>", "+O+": "+JSON.stringify(T)).join(""),B=`[${U}${q}${N}] ${Q.method} ${Y} ${K.ok?"succeeded":"failed"} with status ${K.status} in ${H-G}ms`;if(!K.ok){let O=await this.shouldRetry(K);if(Z&&O){let b=`retrying, ${Z} attempts remaining`;return await yQ(K.body),B0(this).info(`${B} - ${b}`),B0(this).debug(`[${U}] response error (${b})`,q1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,durationMs:H-G})),this.retryRequest(z,Z,X??U,K.headers)}let T=O?"error; no more retries left":"error; not retryable";B0(this).info(`${B} - ${T}`);let F=await K.text().catch((b)=>d2(b).message),w=G4(F),S=w?void 0:F;throw B0(this).debug(`[${U}] response error (${T})`,q1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,message:S,durationMs:Date.now()-G})),this.makeStatusError(K.status,w,S,K.headers)}return B0(this).info(B),B0(this).debug(`[${U}] response start`,q1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,durationMs:H-G})),{response:K,options:z,controller:V,requestLogID:U,retryOfRequestLogID:X,startTime:G}}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 a2(this,X,$)}async fetchWithTimeout($,Z,X,z){let{signal:J,method:Q,...Y}=Z||{},W=this._makeAbort(z);if(J)J.addEventListener("abort",W,{once:!0});let U=setTimeout(W,X),q=globalThis.ReadableStream&&Y.body instanceof globalThis.ReadableStream||typeof Y.body==="object"&&Y.body!==null&&Symbol.asyncIterator in Y.body,G={signal:z.signal,...q?{duplex:"half"}:{},method:"GET",...Y};if(Q)G.method=Q.toUpperCase();try{return await this.fetch.call(void 0,$,G)}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 W=parseFloat(Q);if(!Number.isNaN(W))J=W}let Y=z?.get("retry-after");if(Y&&!J){let W=parseFloat(Y);if(!Number.isNaN(W))J=W*1000;else J=Date.parse(Y)-Date.now()}if(J===void 0){let W=$.maxRetries??this.maxRetries;J=this.calculateDefaultRetryTimeoutMillis(Z,W)}return await EQ(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 k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let X={...$},{method:z,path:J,query:Q,defaultBaseURL:Y}=X,W=this.buildURL(J,Q,Y);if("timeout"in X)PQ("timeout",X.timeout);X.timeout=X.timeout??this.timeout;let{bodyHeaders:U,body:q}=this.buildBody({options:X}),G=await this.buildHeaders({options:$,method:z,bodyHeaders:U,retryCount:Z});return{req:{method:z,headers:G,...X.signal&&{signal:X.signal},...globalThis.ReadableStream&&q instanceof globalThis.ReadableStream&&{duplex:"half"},...q&&{body:q},...this.fetchOptions??{},...X.fetchOptions??{}},url:W,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=D([J,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(z),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...bQ(),...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=D([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:V4($)};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 L(this,v4,"f").call(this,{body:$,headers:X})}}var e5,$9,v4,TY,Z9="\\n\\nHuman:",X9="\\n\\nAssistant:",b1;var z9=v(()=>{W1();n1();rZ();gQ();A0();Z0();W5();IY();O4();m5();t5();u5();o5();rZ();a();B4();n1();$9=e,v4=new WeakMap,e5=new WeakSet,TY=function(){return this.baseURL!=="https://api.anthropic.com"};e.Anthropic=$9;e.HUMAN_PROMPT=Z9;e.AI_PROMPT=X9;e.DEFAULT_TIMEOUT=600000;e.AnthropicError=k;e.APIError=Q0;e.APIConnectionError=F1;e.APIConnectionTimeoutError=E$;e.APIUserAbortError=M0;e.NotFoundError=x$;e.ConflictError=b$;e.RateLimitError=y$;e.BadRequestError=w$;e.AuthenticationError=S$;e.InternalServerError=v$;e.PermissionDeniedError=j$;e.UnprocessableEntityError=k$;e.toFile=t2;b1=class b1 extends e{constructor(){super(...arguments);this.completions=new r$(this),this.messages=new $$(this),this.models=new a$(this),this.beta=new N0(this)}};b1.Completions=r$;b1.Messages=$$;b1.Models=a$;b1.Beta=N0});var AY={};O9(AY,{toFile:()=>t2,default:()=>b1,UnprocessableEntityError:()=>k$,RateLimitError:()=>y$,PermissionDeniedError:()=>j$,PagePromise:()=>a2,NotFoundError:()=>x$,InternalServerError:()=>v$,HUMAN_PROMPT:()=>Z9,ConflictError:()=>b$,BaseAnthropic:()=>e,BadRequestError:()=>w$,AuthenticationError:()=>S$,AnthropicError:()=>k,Anthropic:()=>b1,APIUserAbortError:()=>M0,APIPromise:()=>E1,APIError:()=>Q0,APIConnectionTimeoutError:()=>E$,APIConnectionError:()=>F1,AI_PROMPT:()=>X9});var RY=v(()=>{z9();W5();O4();z9();Z0();A0()});var b9=XW(x9(),1),{program:p_,createCommand:i_,createArgument:n_,createOption:r_,CommanderError:s_,InvalidArgumentError:a_,InvalidOptionArgumentError:o_,Command:k9,Argument:t_,Option:e_,Help:$F}=b9.default;import{readFileSync as iX,writeFileSync as dO,existsSync as dX}from"fs";import{join as pX,dirname as nX,basename as pO}from"path";import{execFileSync as iO}from"child_process";var WO=i3(),UO=B2(),qO=S3(),JZ=M2(),GO=$2(),T1=i(),VO=O1(),KO=X0(),HO=N1(),BO=D1(),DC=A8(),MO=ZZ(),OO=XZ(),LO=zZ(),C8=cX(),lX=t$();var NO=WO.Composer,DO=UO.Document,IO=qO.Schema,TO=JZ.YAMLError,AO=JZ.YAMLParseError,RO=JZ.YAMLWarning,_O=GO.Alias,FO=T1.isAlias,CO=T1.isCollection,PO=T1.isDocument,EO=T1.isMap,wO=T1.isNode,SO=T1.isPair,jO=T1.isScalar,xO=T1.isSeq,bO=VO.Pair,kO=KO.Scalar,yO=HO.YAMLMap,vO=BO.YAMLSeq;var fO=MO.Lexer,gO=OO.LineCounter,hO=LO.Parser,D0=C8.parse,uO=C8.parseAllDocuments,mO=C8.parseDocument,T2=C8.stringify,cO=lX.visit,lO=lX.visitAsync;function p($){let Z=iX($,"utf-8");return D0(Z)}function QZ($){let Z=$._meta,X={...$};delete X._meta;let z=T2(X,{lineWidth:0});if(Z?.found&&Z.found.length>0){let J=Z.found.join(" + ");z=z.replace(/^(\s+type:\s+\S+)(\s*)$/m,(Q,Y,W)=>{if(W.includes("#"))return Q;return`${Y} # found: ${J}`})}return z}function o($,Z){dO($,QZ(Z),"utf-8")}function c($){return iX($,"utf-8")}function rX($){return D0($)}function h($=process.cwd()){let Z=["project.faf",".faf"];for(let z of Z){let J=pX($,z);if(dX(J))return J}let X=nX($);if(X!==$)for(let z of Z){let J=pX(X,z);if(dX(J))return J}return null}function H$($,Z=process.cwd()){return iO("git",["-C",nX($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+pO($)}d();var B$=[{name:"TROPHY",indicator:`${K0("✪")} ${K0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${K0(A("★"))} ${K0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${I("◆")} ${I("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${P8("◇")} ${P8("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${A("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${M("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${M("○")} RED`,threshold:1},{name:"WHITE",indicator:`${M("♡")}`,threshold:0}];function c0($){return $.indicator}function A1($){for(let Z of B$)if($>=Z.threshold)return Z;return B$[B$.length-1]}var WZ=null;function R2(){if(WZ)return WZ;try{let $=F0("faf-scoring-kernel");return WZ=$,$}catch{throw Error(`faf-scoring-kernel not installed.
|
|
205
205
|
|
|
206
206
|
Run: npm install faf-scoring-kernel
|
|
207
|
-
`)}}function
|
|
207
|
+
`)}}function U0($){return JSON.parse(R2().score_faf($))}function aX($){return R2().validate_faf($)}function E8($){return R2().compile_fafb($)}function oX($){return JSON.parse(R2().decompile_fafb($))}function tX(){return R2().sdk_version()}var eX=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function $z($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function Zz($){let Z=$.match(/^about:\s*\n((?:[ \t]+.*\n?)*)/m);if(!Z)return null;let X=Z[1]??"",z=X.match(/^[ \t]+represents:\s*(\S+)\s*$/m);if(!z)return null;let J=z[1],Q=X.match(/^[ \t]+source_score:\s*(\d+)\s*$/m),Y=-1;if(Q){let W=parseInt(Q[1],10);if(W>=0&&W<=100)Y=W}return{represents:J,sourceScore:Y}}function H0($){return{score:$.score,tier:A1($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function z0($){let Z=Zz($);if(Z){let X=Z.sourceScore;return{score:X,tier:X>=0?A1(X):B$[B$.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Z.represents}}return H0(U0($))}d();d();import{existsSync as rO,readFileSync as sO,writeFileSync as aO,mkdirSync as oO}from"fs";import{join as Xz}from"path";import{homedir as tO}from"os";var eO=95,$L=30,ZL=3,zz=Xz(tO(),".config","faf"),UZ=Xz(zz,"star-nudge"),XL="github.com/Wolfe-Jam/faf-cli";function zL($){if($.score<eO)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??ZL))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??$L)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function JL(){try{if(!rO(UZ))return{shown:0,lastShownMs:null};let $=sO(UZ,"utf-8").trim();if($.startsWith("{")){let X=JSON.parse($),z=X.last?Date.parse(X.last):NaN;return{shown:Number.isFinite(X.shown)?Number(X.shown):0,lastShownMs:Number.isFinite(z)?z:null}}let Z=Date.parse($);return{shown:1,lastShownMs:Number.isFinite(Z)?Z:null}}catch{return{shown:0,lastShownMs:null}}}function QL($,Z){try{oO(zz,{recursive:!0}),aO(UZ,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}))}catch{}}function Jz($){let Z=Date.now(),X=JL();if(!zL({score:$,isTTY:Boolean(process.stdout.isTTY),isCI:Boolean(process.env.CI),optedOut:Boolean(process.env.FAF_NO_NUDGE),shownCount:X.shown,lastShownMs:X.lastShownMs,nowMs:Z}))return;console.log(""),console.log(` ${K0("★")} ${M("Enjoying faf-cli? A star helps others find it:")} ${XL}`),QL(X.shown,Z)}function J0($,Z,X=!1){let z=c0($.tier),J=A(`${$.score}%`);if(console.log(`${z} ${J} ${M(`${$.populated}/${$.active} slots`)} ${M("—")} ${Z}`),$.tier.name==="TROPHY")console.log(M(" Trophy. AI never has to guess."));else if($.empty>0){let Q=Object.entries($.slots).filter(([,q])=>q==="empty").map(([q])=>q),Y=Q.slice(0,3).join(", "),W=Q.length>3?`, +${Q.length-3} more`:"",U=$.empty===1?"slot":"slots";console.log(M(` ${$.empty} ${U} from Trophy: ${Y}${W}`))}if(X)console.log(""),YL($);Jz($.score)}function YL($){for(let[Z,X]of Object.entries($.slots)){let z=X==="populated"?I("●"):X==="slotignored"?M("—"):M("○");console.log(` ${z} ${X==="slotignored"?M(`${Z}: N/A`):Z}`)}}d();function w8($,Z={}){let X=$??h();if(!X)console.error(`Error: project.faf not found
|
|
208
208
|
|
|
209
|
-
Run 'faf init' to create one.`),process.exit(2);let z=c(X),J=J0(z);if(Z.json){let Q=p(X),Y={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",source:X,...J};console.log(JSON.stringify(Y,null,2));return}if(Z.status){console.log(`${m0(J.tier)} ${A(`${J.score}%`)}`);return}Q0(J,X,Z.verbose)}import{existsSync as oD}from"fs";import{join as uz}from"path";var e=[{index:1,path:"project.name",label:"Name",description:"Project name",category:"project"},{index:2,path:"project.goal",label:"Goal",description:"Goal (use case)",category:"project"},{index:3,path:"project.main_language",label:"Language",description:"Primary language",category:"project"},{index:4,path:"human_context.who",label:"Who",description:"Who is this for?",category:"human"},{index:5,path:"human_context.what",label:"What",description:"What are they building",category:"human"},{index:6,path:"human_context.why",label:"Why",description:"Why does it exist",category:"human"},{index:7,path:"human_context.where",label:"Where",description:"Where does it run",category:"human"},{index:8,path:"human_context.when",label:"When",description:"When was it started / timeline",category:"human"},{index:9,path:"human_context.how",label:"How",description:"How is it built",category:"human"},{index:10,path:"stack.frontend",canonical:"stack.framework",label:"Framework",description:"Framework (React, Svelte, etc.)",category:"frontend"},{index:11,path:"stack.css_framework",canonical:"stack.css",label:"CSS",description:"CSS framework",category:"frontend"},{index:12,path:"stack.ui_library",label:"UI Library",description:"UI component library",category:"frontend"},{index:13,path:"stack.state_management",canonical:"stack.state",label:"State",description:"State management",category:"frontend"},{index:14,path:"stack.backend",label:"Backend",description:"Backend framework",category:"backend"},{index:15,path:"stack.api_type",canonical:"stack.api",label:"API",description:"API style (REST, GraphQL, etc.)",category:"backend"},{index:16,path:"stack.runtime",label:"Runtime",description:"Runtime (Node, Bun, Python, etc.)",category:"backend"},{index:17,path:"stack.database",canonical:"stack.db",label:"Database",description:"Database",category:"backend"},{index:18,path:"stack.connection",label:"Connection",description:"Connection method (Prisma, etc.)",category:"backend"},{index:19,path:"stack.hosting",label:"Hosting",description:"Hosting platform",category:"universal"},{index:20,path:"stack.build",label:"Build",description:"Build tool",category:"universal"},{index:21,path:"stack.cicd",label:"CI/CD",description:"CI/CD",category:"universal"},{index:22,path:"stack.monorepo_tool",label:"Monorepo",description:"Monorepo tool",category:"enterprise_infra"},{index:23,path:"stack.package_manager",canonical:"stack.pkg_manager",label:"Package Manager",description:"Package manager",category:"enterprise_infra"},{index:24,path:"stack.workspaces",label:"Workspaces",description:"Workspace configuration",category:"enterprise_infra"},{index:25,path:"monorepo.packages_count",label:"Packages",description:"Number of packages",category:"enterprise_infra"},{index:26,path:"monorepo.build_orchestrator",label:"Build Orchestrator",description:"Build orchestration tool",category:"enterprise_infra"},{index:27,path:"stack.admin",label:"Admin",description:"Admin panel",category:"enterprise_app"},{index:28,path:"stack.cache",label:"Cache",description:"Caching layer",category:"enterprise_app"},{index:29,path:"stack.search",label:"Search",description:"Search engine",category:"enterprise_app"},{index:30,path:"stack.storage",label:"Storage",description:"Object storage",category:"enterprise_app"},{index:31,path:"monorepo.versioning_strategy",label:"Versioning",description:"Version strategy",category:"enterprise_ops"},{index:32,path:"monorepo.shared_configs",label:"Shared Configs",description:"Shared configs",category:"enterprise_ops"},{index:33,path:"monorepo.remote_cache",label:"Remote Cache",description:"Remote build cache",category:"enterprise_ops"}],H$=new Map(e.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),dC=new Map(e.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),pC=new Map(e.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function R2($,Z){let X=(J)=>{let Q=J.split("."),Y=$;for(let W of Q)if(Y&&typeof Y==="object"&&W in Y)Y=Y[W];else return;return Y},z=X(Z.path);if(z!==void 0)return z;if(Z.canonical)return X(Z.canonical);return}var iC=e.filter(($)=>$.index<=21);var UZ=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","n/a","not applicable"]);function C0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return UZ.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var B$={documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],cli:["project","human","universal"],library:["project","human","universal"],sdk:["project","human","universal"],wasm:["project","human","universal"],html:["project","human","universal"],"server-card":["project","human","universal"],frontend:["project","frontend","human","universal"],website:["project","frontend","human","universal"],mobile:["project","frontend","human","universal"],app:["project","frontend","human","universal"],extension:["project","frontend","human","universal"],mcp:["project","backend","human","universal"],backend:["project","backend","universal","human"],"data-science":["project","backend","human","universal"],fullstack:["project","frontend","backend","universal","human"],svelte:["project","frontend","backend","universal","human"],framework:["project","frontend","backend","universal","human"],"monorepo-root":["project","human","enterprise_infra","enterprise_app","enterprise_ops"],mcpaas:["project","backend","universal","human","enterprise_app","enterprise_ops"],saas:["project","frontend","backend","universal","human","enterprise_app"],enterprise:["project","frontend","backend","universal","human","enterprise_infra","enterprise_app","enterprise_ops"]};var T1="3.0";import{existsSync as j,readFileSync as s0,readdirSync as Tz}from"fs";import{join as S}from"path";var Jz=[{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:"content",pattern:"Gemfile",key:"rails"},{type:"content",pattern:"Gemfile.lock",key:"rails ("},{type:"file",pattern:"config/application.rb"},{type:"file",pattern:"config/routes.rb"}]},{name:"Spring Boot",slug:"spring",category:"backend",signals:[{type:"content",pattern:"pom.xml",key:"spring-boot"},{type:"content",pattern:"build.gradle",key:"springframework.boot"},{type:"content",pattern:"build.gradle.kts",key:"springframework.boot"},{type:"content",pattern:"gradle/libs.versions.toml",key:"springframework.boot"}]},{name:"Vapor",slug:"vapor",category:"backend",signals:[{type:"content",pattern:"Package.swift",key:"vapor/vapor"},{type:"content",pattern:"Package.swift",key:'product(name: "Vapor"'},{type:"content",pattern:"Package.swift",key:"product(name: 'Vapor'"},{type:"file",pattern:"Sources/App/configure.swift"}]},{name:"Hummingbird",slug:"hummingbird",category:"backend",signals:[{type:"content",pattern:"Package.swift",key:"hummingbird-project/hummingbird"},{type:"content",pattern:"Package.swift",key:'product(name: "Hummingbird"'},{type:"content",pattern:"Package.swift",key:"product(name: 'Hummingbird'"}]},{name:"Prisma",slug:"prisma",category:"database",signals:[{type:"dependency",key:"prisma"},{type:"devDependency",key:"prisma"},{type:"file",pattern:"prisma/schema.prisma"}]},{name:"Drizzle",slug:"drizzle",category:"database",signals:[{type:"dependency",key:"drizzle-orm"},{type:"file",pattern:"drizzle.config.*"}]},{name:"TypeORM",slug:"typeorm",category:"database",signals:[{type:"dependency",key:"typeorm"}]},{name:"Mongoose",slug:"mongoose",category:"database",signals:[{type:"dependency",key:"mongoose"}]},{name:"Vite",slug:"vite",category:"build",signals:[{type:"dependency",key:"vite"},{type:"devDependency",key:"vite"},{type:"file",pattern:"vite.config.*"}]},{name:"webpack",slug:"webpack",category:"build",signals:[{type:"dependency",key:"webpack"},{type:"devDependency",key:"webpack"},{type:"file",pattern:"webpack.config.*"}]},{name:"esbuild",slug:"esbuild",category:"build",signals:[{type:"dependency",key:"esbuild"},{type:"devDependency",key:"esbuild"}]},{name:"Turbopack",slug:"turbopack",category:"build",signals:[{type:"file",pattern:"turbo.json"}]},{name:"Jest",slug:"jest",category:"testing",signals:[{type:"devDependency",key:"jest"},{type:"file",pattern:"jest.config.*"}]},{name:"Vitest",slug:"vitest",category:"testing",signals:[{type:"devDependency",key:"vitest"}]},{name:"Playwright",slug:"playwright",category:"testing",signals:[{type:"devDependency",key:"@playwright/test"},{type:"file",pattern:"playwright.config.*"}]},{name:"Cypress",slug:"cypress",category:"testing",signals:[{type:"devDependency",key:"cypress"},{type:"file",pattern:"cypress.config.*"}]},{name:"Turborepo",slug:"turborepo",category:"monorepo",signals:[{type:"devDependency",key:"turbo"},{type:"file",pattern:"turbo.json"}]},{name:"Nx",slug:"nx",category:"monorepo",signals:[{type:"devDependency",key:"nx"},{type:"file",pattern:"nx.json"}]},{name:"Lerna",slug:"lerna",category:"monorepo",signals:[{type:"devDependency",key:"lerna"},{type:"file",pattern:"lerna.json"}]},{name:"MCP SDK",slug:"mcp",category:"ai",signals:[{type:"dependency",key:"@modelcontextprotocol/sdk"}]},{name:"Anthropic SDK",slug:"anthropic",category:"ai",signals:[{type:"dependency",key:"@anthropic-ai/sdk"}]},{name:"OpenAI SDK",slug:"openai",category:"ai",signals:[{type:"dependency",key:"openai"}]},{name:"LangChain",slug:"langchain",category:"ai",signals:[{type:"dependency",key:"langchain"}]},{name:"Vercel",slug:"vercel",category:"hosting",signals:[{type:"file",pattern:"vercel.json"}]},{name:"Netlify",slug:"netlify",category:"hosting",signals:[{type:"file",pattern:"netlify.toml"}]},{name:"Docker",slug:"docker",category:"hosting",signals:[{type:"file",pattern:"Dockerfile"},{type:"file",pattern:"docker-compose.yml"}]},{name:"Cloudflare Workers",slug:"cloudflare",category:"hosting",signals:[{type:"file",pattern:"wrangler.toml"},{type:"dependency",key:"wrangler"}]},{name:"GitHub Actions",slug:"github-actions",category:"cicd",signals:[{type:"file",pattern:".github/workflows/*.yml"}]},{name:"Commander.js",slug:"commander",category:"cli",signals:[{type:"dependency",key:"commander"}]}];import{existsSync as Qz,readFileSync as UL,readdirSync as qL}from"fs";import{join as qZ}from"path";var M$={version:2,_doc:"SINGLE SOURCE of Dart/Flutter detection KNOWLEDGE (A+B hybrid, the Truth-is-faf-cli spec). faf-cli imports this directly; faf-python-sdk vendors a synced copy (phase 2); MCPs compose it. Bolster Dart/Flutter by editing THIS file. Logic stays in dart.ts. Refreshed 2026-08-01 (knowledge v2) — community receipt on top of 6.13.0 Dart Edition.",flutterDeps:["flutter"],mcpDeps:["dart_mcp","mcp_server","mcp_dart","dart_mcp_server","mcp","dart_mcpserver"],serverFrameworks:[["serverpod","Serverpod"],["dart_frog","Dart Frog"],["conduit","Conduit"],["angel3_framework","Angel3"],["alfred","Alfred"],["shelf","Shelf"],["jaspr","Jaspr"],["relic","Relic"]],stateManagement:[["flutter_riverpod","Riverpod"],["hooks_riverpod","Riverpod"],["riverpod_annotation","Riverpod"],["riverpod","Riverpod"],["flutter_bloc","Bloc"],["bloc","Bloc"],["provider","Provider"],["get","GetX"],["flutter_mobx","MobX"],["mobx","MobX"],["signals","Signals"],["flutter_hooks","Hooks"]],routing:[["go_router","go_router"],["auto_route","auto_route"],["beamer","Beamer"],["routemaster","Routemaster"]]};var GL=M$.flutterDeps,VL=M$.mcpDeps,KL=M$.serverFrameworks,HL=M$.stateManagement,BL=M$.routing;function ML($){let Z=new Set,X=!1;for(let z of $.split(`
|
|
210
|
-
`)){if(/^(dependencies|dev_dependencies|dependency_overrides):\s*$/.test(z)){X=!0;continue}if(/^\S/.test(z))X=!1;if(X){let J=z.match(/^\s{2}([a-zA-Z0-9_]+):/);if(J)Z.add(J[1].toLowerCase())}}return Z}function
|
|
211
|
-
`)){let J=z.replace(/\/\/.*$/,"").trim();if(!J)continue;if(/^require\s*\(\s*$/.test(J)){X=!0;continue}if(X){if(J===")"){X=!1;continue}let Y=J.match(/^(\S+)/);if(Y)Z.add(Y[1].toLowerCase());continue}let Q=J.match(/^require\s+(\S+)/);if(Q&&Q[1]!=="(")Z.add(Q[1].toLowerCase())}return Z}function qz($,Z){let X=Z.toLowerCase();for(let z of $)if(z===X||z.startsWith(`${X}/`))return!0;return!1}function Wz($,Z){let X;for(let z of Z){if(!qz($,z[0]))continue;if(!X||z[0].length>X[0].length)X=z}return X}function AL($,Z){let X;for(let z of Z){if(!qz($,z))continue;if(!X||z.length>X.length)X=z}return X}function RL($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function _L($){let Z=j8($,"cmd");if(!GZ(Z))return!1;try{for(let X of Yz(Z)){let z=j8(Z,X);try{if(LL(z).isDirectory()){if(Yz(z).some((Q)=>Q.endsWith(".go")))return!0}else if(X.endsWith(".go"))return!0}catch{}}}catch{}return!1}function FL($){let Z=j8($,"main.go");if(!GZ(Z))return!1;try{let X=Uz(Z,"utf-8");return/^package\s+main\b/m.test(X)}catch{return!1}}function x8($){let Z=j8($,"go.mod");if(!GZ(Z))return null;let X;try{X=Uz(Z,"utf-8")}catch{return null}let z=RL(X),J=TL(X),Q=AL(J,NL),Y=Wz(J,DL),W=Wz(J,IL),U=_L($),q=FL($),G,V="",K;if(Q)G="mcp",K=`go.mod + ${Q} (Go MCP server)`;else if(Y)G="backend",V=Y[1],K=`go.mod + ${Y[0]} (Go backend)`;else if(W)G="cli",V=W[1],K=`go.mod + ${W[0]} (Go CLI)`;else if(U)G="cli",K="go.mod + cmd/ (Go CLI layout)";else if(q&&!Y)G="cli",K="go.mod + main.go package main (Go CLI)";else G="library",K="go.mod (Go module)";return{appType:G,modulePath:z,framework:V,found:K}}import{existsSync as PL,readFileSync as EL,readdirSync as wL}from"fs";import{join as SL}from"path";var h1={version:1,_doc:"SINGLE SOURCE of C# /.NET detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Bolster C# by editing THIS file. Logic stays in csharp.ts. Content-aware: .csproj alone ≠ type — Sdk first, then props/packages. Kill line: .csproj alone ≠ type. 2026-08-01 initial.",mcpPackages:["ModelContextProtocol","ModelContextProtocol.AspNetCore","ModelContextProtocol.Core","ModelContextProtocol.Extensions.Tasks","ModelContextProtocol.Extensions.Apps"],cliPackages:[["System.CommandLine","System.CommandLine"],["Spectre.Console.Cli","Spectre.Console"],["Spectre.Console","Spectre.Console"],["McMaster.Extensions.CommandLineUtils","McMaster"]],testPackages:[["Microsoft.NET.Test.Sdk","VSTest"],["xunit.v3","xUnit"],["xunit","xUnit"],["NUnit","NUnit"],["MSTest.TestFramework","MSTest"],["MSTest","MSTest"]],grpcServerPackages:["Grpc.AspNetCore"],specializedSdks:[["Microsoft.NET.Sdk.Web","web","ASP.NET Core"],["Microsoft.NET.Sdk.Worker","worker","Worker"],["Microsoft.NET.Sdk.BlazorWebAssembly","blazor-wasm","Blazor WebAssembly"],["Microsoft.NET.Sdk.Razor","razor-lib","Razor Class Library"],["MSTest.Sdk","test","MSTest"],["Aspire.AppHost.Sdk","aspire","Aspire AppHost"]],baseSdk:"Microsoft.NET.Sdk"};var jL=h1.mcpPackages.map(($)=>$.toLowerCase()),xL=h1.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),bL=h1.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),kL=h1.grpcServerPackages.map(($)=>$.toLowerCase()),yL=h1.specializedSdks,Gz=h1.baseSdk.toLowerCase();function vL($){let Z=$.match(/<Project\b[^>]*\bSdk\s*=\s*"([^"/]+)(?:\/[^"]*)?"/i),X=$.match(/<Sdk\b[^>]*\bName\s*=\s*"([^"]+)"/i),z=(Z?.[1]||X?.[1]||"").trim(),J=($.match(/<OutputType>\s*([^<]+?)\s*<\/OutputType>/i)?.[1]||"").trim(),Q=$.match(/<TargetFramework>\s*([^<]+?)\s*<\/TargetFramework>/i)?.[1],W=($.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i)?.[1]||Q||"").trim(),U=/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test($),q=/<UseMaui>\s*true\s*<\/UseMaui>/i.test($),G=/<UseWPF>\s*true\s*<\/UseWPF>/i.test($),V=/<UseWindowsForms>\s*true\s*<\/UseWindowsForms>/i.test($),K=new Set;for(let N of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))K.add(N[1].toLowerCase());for(let N of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))K.add(N[1].toLowerCase());let H=new Set;for(let N of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))H.add(N[1].toLowerCase());return{sdk:z,outputType:J,targetFramework:W,isTestProject:U,useMaui:q,useWpf:G,useWindowsForms:V,packages:K,frameworkRefs:H}}function VZ($,Z){let X=Z.toLowerCase();if($.has(X))return!0;for(let z of $)if(z===X||z.startsWith(`${X}.`))return!0;return!1}function Vz($,Z){let X;for(let[z,J]of Z){if(!VZ($,z))continue;if(!X||z.length>X[0].length)X=[z,J]}return X}function fL($){let Z;for(let X of jL){if(!VZ($,X))continue;if(!Z||X.length>Z.length)Z=X}for(let X of $)if(X==="modelcontextprotocol"||X.startsWith("modelcontextprotocol.")){if(!Z||X.length>Z.length)Z=X}return Z}function gL($){let Z=$.toLowerCase();if(!Z)return;let X;for(let z of yL){let J=z[0].toLowerCase();if(Z===J||Z.startsWith(`${J}/`)){if(!X||J.length>X[0].length)X=z}}return X}function b8($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function hL($,Z){if($==="mcp")return 0;if($==="mobile")return 1;if($==="backend")return 2;if($==="cli")return 3;if(Z&&Z!=="")return 4;return 5}function uL($,Z){let X=Z.replace(/\.csproj$/i,""),{sdk:z,packages:J,frameworkRefs:Q,outputType:Y}=$,W,U="",q,G=fL(J),V=gL(z),K=Vz(J,bL),H=Vz(J,xL),N=kL.some((O)=>VZ(J,O)),B=Q.has("microsoft.aspnetcore.app");if(G)W="mcp",U="MCP",q=`${Z} + ${G} (C# MCP server)`;else if($.isTestProject||V?.[1]==="test"||K)W="library",U=K?.[1]||(V?.[1]==="test"?V[2]:"Test"),q=`${Z} + test (${U})`;else if($.useMaui)W="mobile",U="MAUI",q=`${Z} + UseMaui (MAUI)`;else if($.useWpf||$.useWindowsForms)W="backend",U=$.useWpf&&$.useWindowsForms?"WPF+WinForms":$.useWpf?"WPF":"Windows Forms",q=`${Z} + ${U}`;else if(V?.[1]==="web")W="backend",U=N?"gRPC":V[2],q=`${Z} + Sdk=${V[0]}${N?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(V?.[1]==="worker")W="backend",U=V[2],q=`${Z} + Sdk=${V[0]} (Worker)`;else if(V?.[1]==="blazor-wasm")W="backend",U=V[2],q=`${Z} + Sdk=${V[0]} (Blazor WASM)`;else if(V?.[1]==="aspire")W="backend",U=V[2],q=`${Z} + Sdk=${V[0]} (Aspire)`;else if(V?.[1]==="razor-lib")W="library",U=V[2],q=`${Z} + Sdk=${V[0]} (Razor class library)`;else if(B&&b8(Y))W="backend",U="ASP.NET Core",q=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(B&&!b8(Y))W="library",U="ASP.NET Core",q=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(H&&(b8(Y)||!Y))W="cli",U=H[1],q=`${Z} + ${H[0]} (C# CLI)`;else if(b8(Y))W="cli",q=`${Z} + OutputType=Exe (C# console)`;else{W="library";let O=z?` Sdk=${z}`:"";if(q=`${Z}${O} (C# class library)`.replace(" Sdk=Microsoft.NET.Sdk",""),!z||z.toLowerCase()===Gz||z.toLowerCase().startsWith(`${Gz}/`))q=`${Z} (C# class library)`}return{appType:W,projectName:X,targetFramework:$.targetFramework,sdk:z||"Microsoft.NET.Sdk",framework:U,found:q}}function _2($){if(!PL($))return[];try{return wL($).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}catch{return[]}}function k8($){let Z=_2($);if(Z.length===0)return null;let X=null,z=999;for(let J of Z){let Q=SL($,J),Y;try{Y=EL(Q,"utf-8")}catch{continue}let W=vL(Y),U=uL(W,J),q=hL(U.appType,U.framework);if(!X||q<z)X=U,z=q}return X}import{existsSync as u1,readFileSync as cL,readdirSync as lL,statSync as dL}from"fs";import{join as k0}from"path";var c0={version:1,_doc:"SINGLE SOURCE of JVM (Java/Kotlin) detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Bolster JVM by editing THIS file. Logic stays in jvm.ts. Kill line: pom / gradle alone ≠ type. Content-aware: plugins · parents · packaging · deps · version catalogs. One brand JVM — Android/KMP are facets, not a second Kotlin Edition. 2026-08-03 initial (post-intel).",mcpArtifacts:["io.modelcontextprotocol.sdk:mcp","io.modelcontextprotocol.sdk:mcp-core","io.modelcontextprotocol.sdk:mcp-spring-webflux","io.modelcontextprotocol.sdk:mcp-spring-webmvc","org.springframework.ai:spring-ai-starter-mcp-server","org.springframework.ai:spring-ai-starter-mcp-server-webmvc","org.springframework.ai:spring-ai-starter-mcp-server-webflux","org.springframework.ai:spring-ai-starter-mcp-client","org.springframework.ai:spring-ai-mcp-server-spring-boot-starter","org.springframework.ai:spring-ai-mcp-client-spring-boot-starter","io.modelcontextprotocol:kotlin-sdk","io.modelcontextprotocol.kotlin:mcp"],webPlugins:[["org.springframework.boot","Spring Boot"],["io.quarkus","Quarkus"],["io.quarkus.gradle.plugin","Quarkus"],["io.micronaut.application","Micronaut"],["io.micronaut.library","Micronaut"]],webParents:[["org.springframework.boot:spring-boot-starter-parent","Spring Boot"],["io.quarkus.platform:quarkus-bom","Quarkus"],["io.micronaut.platform:micronaut-parent","Micronaut"]],webArtifacts:[["org.springframework.boot:spring-boot-starter-web","Spring Boot"],["org.springframework.boot:spring-boot-starter-webflux","Spring Boot"],["org.springframework.boot:spring-boot-starter","Spring Boot"],["io.quarkus:quarkus-core","Quarkus"],["io.micronaut:micronaut-http-server-netty","Micronaut"],["io.ktor:ktor-server-core","Ktor"],["io.ktor:ktor-server-netty","Ktor"],["io.ktor:ktor-server-cio","Ktor"]],androidPlugins:["com.android.application","com.android.library","com.android.kotlin.multiplatform.library"],kmpPlugins:["org.jetbrains.kotlin.multiplatform","kotlin-multiplatform"],jvmKotlinPlugins:["org.jetbrains.kotlin.jvm","kotlin-jvm","org.jetbrains.kotlin.android","kotlin-android"],cliPlugins:[["org.gradle.application","application"],["application","application"]],cliArtifacts:[["info.picocli:picocli","Picocli"],["com.github.ajalt.clikt:clikt","Clikt"],["com.github.ajalt.clikt:clikt-jvm","Clikt"]],libraryPlugins:["java-library","org.gradle.java-library"]};var pL=c0.mcpArtifacts.map(($)=>$.toLowerCase()),iL=c0.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),nL=c0.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),rL=c0.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),MP=c0.androidPlugins.map(($)=>$.toLowerCase()),sL=c0.kmpPlugins.map(($)=>$.toLowerCase()),aL=c0.jvmKotlinPlugins.map(($)=>$.toLowerCase()),oL=c0.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),tL=c0.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),eL=c0.libraryPlugins.map(($)=>$.toLowerCase()),$N=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function KZ($){return $N.some((Z)=>u1(k0($,Z)))}function C2($){try{return cL($,"utf-8")}catch{return null}}function ZN($){let Z=new Map,X=new Map,z="";for(let J of $.split(`
|
|
212
|
-
`)){let Q=J.replace(/#.*$/,"").trim();if(!Q)continue;let Y=Q.match(/^\[([^\]]+)\]$/);if(Y){z=Y[1].trim().toLowerCase();continue}let W=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bid\s*=\s*"([^"]+)"/);if(W&&(z==="plugins"||z.endsWith(".plugins"))){Z.set(W[1].replace(/-/g,".").toLowerCase(),W[2].toLowerCase()),Z.set(W[1].toLowerCase(),W[2].toLowerCase());continue}let U=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bmodule\s*=\s*"([^"]+)"/);if(U&&(z==="libraries"||z.endsWith(".libraries"))){let V=U[1].toLowerCase();X.set(V,U[2].toLowerCase()),X.set(V.replace(/-/g,"."),U[2].toLowerCase());continue}let q=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bgroup\s*=\s*"([^"]+)"[^}]*\bname\s*=\s*"([^"]+)"/);if(q&&(z==="libraries"||z.endsWith(".libraries"))){let V=`${q[2]}:${q[3]}`.toLowerCase(),K=q[1].toLowerCase();X.set(K,V),X.set(K.replace(/-/g,"."),V);continue}let G=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(G){let V=G[1].toLowerCase(),K=G[2];if(z==="plugins"||z.endsWith(".plugins")){let H=K.split(":")[0].toLowerCase();Z.set(V,H),Z.set(V.replace(/-/g,"."),H)}else if(z==="libraries"||z.endsWith(".libraries")){let H=K.split(":");if(H.length>=2){let N=`${H[0]}:${H[1]}`.toLowerCase();X.set(V,N),X.set(V.replace(/-/g,"."),N)}}}}return{plugins:Z,libraries:X}}function XN($){let Z=k0($,"gradle","libs.versions.toml");if(!u1(Z))return{plugins:new Map,libraries:new Map};let X=C2(Z);if(!X)return{plugins:new Map,libraries:new Map};return ZN(X)}function zN($){let Z=[];for(let X of $.matchAll(/include\s*\(\s*([^)]+)\)/g))for(let z of X[1].split(",")){let J=z.replace(/['":\s]/g,"").replace(/^:/,"");if(J)Z.push(J.replace(/:/g,"/"))}for(let X of $.matchAll(/include\s+((?:['"][^'"]+['"]\s*,?\s*)+)/g))for(let z of X[1].split(",")){let J=z.replace(/['":\s]/g,"").replace(/^:/,"");if(J)Z.push(J.replace(/:/g,"/"))}for(let X of $.matchAll(/project\s*\(\s*["']:([^"']+)["']\s*\)\s*\.projectDir\s*=\s*file\s*\(\s*["']([^"']+)["']\s*\)/g))Z.push(X[2].replace(/^\.\//,""));return[...new Set(Z)]}function JN($,Z){let X=new Set;for(let z of $.matchAll(/\bid\s*\(\s*["']([^"']+)["']\s*\)/g))X.add(z[1].toLowerCase());for(let z of $.matchAll(/\bid\s+['"]([^'"]+)['"]/g))X.add(z[1].toLowerCase());for(let z of $.matchAll(/plugins\s*\{([\s\S]*?)\}/g))for(let J of z[1].split(/[\n;]/)){let Q=J.replace(/\/\/.*$/,"").trim();if(!Q||Q.startsWith("id")||Q.startsWith("kotlin")||Q.startsWith("alias"))continue;let Y=Q.match(/^`([a-zA-Z0-9.-]+)`$/)||Q.match(/^([a-zA-Z][a-zA-Z0-9.-]*)$/);if(Y)X.add(Y[1].toLowerCase())}for(let z of $.matchAll(/\bkotlin\s*\(\s*["']([^"']+)["']\s*\)/g)){let J=z[1].toLowerCase();if(J==="jvm")X.add("org.jetbrains.kotlin.jvm");else if(J==="multiplatform")X.add("org.jetbrains.kotlin.multiplatform");else if(J==="android")X.add("org.jetbrains.kotlin.android");else X.add(`org.jetbrains.kotlin.${J}`)}for(let z of $.matchAll(/libs\.plugins\.([A-Za-z0-9_.]+)/g)){let J=z[1].toLowerCase(),Q=Z.plugins.get(J)||Z.plugins.get(J.replace(/\./g,"-"))||Z.plugins.get(J.replace(/-/g,"."));if(Q)X.add(Q);else if(J.includes("spring")&&J.includes("boot"))X.add("org.springframework.boot")}for(let z of $.matchAll(/apply\s+plugin\s*:\s*['"]([^'"]+)['"]/g))X.add(z[1].toLowerCase());return X}function QN($,Z){let X=new Set;for(let z of $.matchAll(/["']([A-Za-z0-9_.-]+:[A-Za-z0-9_.-]+)(?::[^"']+)?["']/g))X.add(z[1].toLowerCase());for(let z of $.matchAll(/libs\.([A-Za-z0-9_.]+)/g)){let J=z[1].toLowerCase();if(J.startsWith("plugins."))continue;let Q=[J,J.replace(/\./g,"-"),J.replace(/-/g,".")];for(let Y of Q){let W=Z.libraries.get(Y);if(W){X.add(W.includes(":")?W.split(":").slice(0,2).join(":"):W);break}}}return X}function Bz($){let Z=($.match(/<packaging>\s*([^<]+?)\s*<\/packaging>/i)?.[1]||"jar").trim().toLowerCase(),X=new Set,z=$.match(/<parent>([\s\S]*?)<\/parent>/i);if(z){let Y=z[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),W=z[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(Y&&W)X.add(`${Y}:${W}`.toLowerCase())}let J=new Set;for(let Y of $.matchAll(/<dependency>([\s\S]*?)<\/dependency>/gi)){let W=Y[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),U=Y[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(W&&U)J.add(`${W}:${U}`.toLowerCase())}let Q=[];for(let Y of $.matchAll(/<module>\s*([^<]+?)\s*<\/module>/gi))Q.push(Y[1].trim());return{packaging:Z,parents:X,artifacts:J,modules:Q}}function Z1($,Z){let X=Z.toLowerCase();if($.has(X))return!0;for(let z of $)if(z===X||z.endsWith(`.${X}`)||z===X.replace(/^org\.gradle\./,""))return!0;return!1}function F2($,Z,X){let z;for(let[J,Q]of Z){let Y=!1;if(X==="plugin")Y=Z1($,J);else if(Y=$.has(J)||[...$].some((W)=>W===J||W.startsWith(`${J}:`)||W.startsWith(`${J}.`)),!Y&&X==="artifact")Y=[...$].some((W)=>W===J||W.startsWith(`${J}`));if(!Y)continue;if(!z||J.length>z[0].length)z=[J,Q]}return z}function YN($){let Z;for(let X of pL)for(let z of $){if(z===X||z.startsWith(`${X}:`)||z.startsWith(X.replace(/:mcp$/,":"))){if(!Z||X.length>Z.length)Z=X}if(z.startsWith("io.modelcontextprotocol")||z.includes("spring-ai-starter-mcp")||z.includes("spring-ai-mcp")){if(!Z||z.length>Z.length)Z=z}}return Z}function Mz($){let Z=new Set,X=!1,z=!1,J=[k0($,"src"),k0($,"src","main")],Q=(Y,W)=>{if(W>4||!u1(Y))return;let U;try{U=lL(Y)}catch{return}for(let q of U){if(q==="androidMain"||q==="commonMain"||q==="jvmMain"||q==="iosMain")Z.add(q);let G=k0(Y,q);try{if(dL(G).isDirectory())Q(G,W+1);else if(q.endsWith(".kt")||q.endsWith(".kts"))X=!0;else if(q.endsWith(".java"))z=!0}catch{}}};for(let Y of J)Q(Y,0);return{kotlin:X,java:z,hints:Z}}function WN($){let Z=[],X=$.plugins,z=$.artifacts,J=sL.some((w)=>Z1(X,w))||$.sourceHints.has("commonMain"),Q=Z1(X,"com.android.application"),Y=Z1(X,"com.android.library")||Z1(X,"com.android.kotlin.multiplatform.library");if(Q||Y)Z.push("android");if(J)Z.push("multiplatform");let W=YN(z),U=F2(X,iL,"plugin"),q=F2($.parents,nL,"parent"),G=F2(z,rL,"artifact"),V=F2(X,oL,"plugin"),K=F2(z,tL,"artifact"),H=eL.some((w)=>Z1(X,w)),N=$.packaging==="pom",B,O="",T;if(Q)B="mobile",O=J?"Android+KMP":"Android",T=`${$.path||"root"} + com.android.application (${O})`;else if(W)B="mcp",O="MCP",Z.push("mcp"),T=`${$.path||"root"} + ${W} (JVM MCP server)`;else if(U||q||G){B="backend",O=U?.[1]||q?.[1]||G?.[1]||"JVM";let w=U?.[0]||q?.[0]||G?.[0]||"web";T=`${$.path||"root"} + ${w} (JVM backend)`}else if(J&&!Y)B="library",O="Kotlin Multiplatform",T=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(Y)B="library",O=J?"Android+KMP":"Android",T=`${$.path||"root"} + android library (${O})`;else if(K||$.hasApplicationPlugin&&($.hasMainClass||V)||V&&$.hasMainClass)B="cli",O=K?.[1]||"application",T=K?`${$.path||"root"} + ${K[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!H)B="cli",O="application",T=`${$.path||"root"} + application plugin (JVM CLI)`;else if(N)B="library",T=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{B="library";let w=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(T=`${$.path||"root"} (${w} library)`,H)T=`${$.path||"root"} + java-library (JVM library)`}let R="Java";if($.kotlinSources&&$.javaSources)R="Java/Kotlin";else if($.kotlinSources||aL.some((w)=>Z1(X,w))||J)R="Kotlin";let E=[...new Set(Z)];return{appType:B,framework:O,facets:E,found:T,buildTool:$.buildTool,mainLanguage:R}}function UN($,Z){if($==="mcp")return 0;if($==="mobile")return 1;if(Z.includes("multiplatform")&&$==="backend")return 2;if($==="backend")return 3;if($==="cli")return 4;if(Z.includes("multiplatform"))return 5;if(Z.includes("android"))return 6;return 7}function Kz($,Z,X){let z=Z?k0($,Z):$,J=k0(z,"build.gradle.kts"),Q=k0(z,"build.gradle"),Y=u1(J)?J:u1(Q)?Q:null;if(!Y)return null;let W=C2(Y);if(!W)return null;let U=JN(W,X),q=QN(W,X),G=Mz(z),V=/mainClass\s*[.=]/.test(W)||/mainClassName\s*=/.test(W)||/Main-Class/.test(W),K=Z1(U,"application")||Z1(U,"org.gradle.application");return{path:Z||"build.gradle",plugins:U,artifacts:q,packaging:"jar",parents:new Set,hasMainClass:V,hasApplicationPlugin:K,sourceHints:G.hints,kotlinSources:G.kotlin||Y.endsWith(".kts"),javaSources:G.java,buildTool:"gradle"}}function Hz($,Z){let X=Z?k0($,Z):$,z=k0(X,"pom.xml");if(!u1(z))return null;let J=C2(z);if(!J)return null;let{packaging:Q,parents:Y,artifacts:W}=Bz(J),U=Mz(X);return{path:Z?`${Z}/pom.xml`:"pom.xml",plugins:new Set,artifacts:W,packaging:Q,parents:Y,hasMainClass:/<mainClass>/.test(J),hasApplicationPlugin:!1,sourceHints:U.hints,kotlinSources:U.kotlin,javaSources:U.java,buildTool:"maven"}}function P2($){if(!KZ($))return null;let Z=XN($),X=[],z=null;for(let q of["settings.gradle.kts","settings.gradle"]){let G=k0($,q);if(u1(G)){z=C2(G);break}}let J=z?zN(z):[],Q=Kz($,"",Z);if(Q)X.push(Q);for(let q of J){let G=Kz($,q,Z);if(G)X.push(G)}let Y=Hz($,"");if(Y){X.push(Y);let q=C2(k0($,"pom.xml"));if(q){let{modules:G}=Bz(q);for(let V of G){let K=Hz($,V);if(K)X.push(K)}}}if(X.length===0&&z)return{appType:"library",framework:"",buildTool:"gradle",mainLanguage:"Java/Kotlin",facets:[],found:"settings.gradle (Gradle multi-project root)"};if(X.length===0)return null;let W=null,U=999;for(let q of X){let G=WN(q),V=UN(G.appType,G.facets);if(!W||V<U)W={appType:G.appType,framework:G.framework,buildTool:G.buildTool,mainLanguage:G.mainLanguage,facets:G.facets,found:G.found},U=V}if(W&&J.length>0&&!W.found.includes("multi-project"));return W}import{existsSync as S2,readFileSync as GN,readdirSync as y8,statSync as VN}from"fs";import{join as l0}from"path";var E2={version:1,_doc:"SINGLE SOURCE of Ruby detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Kill line: Gemfile alone ≠ Rails. Content-aware: gem names + light layout. 2026-08-03 initial (post-intel ruby-edition).",mcpGems:["mcp","fast-mcp","fast_mcp","rails-mcp-server","rails_mcp_server","ruby-mcp-client","ruby_mcp_client","ruby_llm-mcp","ruby_llm_mcp"],webGems:[["rails","Rails"],["railties","Rails"],["sinatra","Sinatra"],["sinatra-contrib","Sinatra"],["roda","Roda"],["grape","Grape"],["hanami","Hanami"],["hanami-controller","Hanami"],["rack","Rack"]],cliGems:[["thor","Thor"],["gli","GLI"],["commander","Commander"],["slop","Slop"]],railsLayoutFiles:["config/application.rb","config/routes.rb","bin/rails","config/environment.rb"]};var KN=E2.mcpGems.map(($)=>$.toLowerCase()),HN=E2.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),Oz=E2.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),BN=E2.railsLayoutFiles;function MN($){return S2(l0($,"Gemfile"))||S2(l0($,"gems.rb"))||ON($)}function ON($){try{return y8($).some((Z)=>Z.endsWith(".gemspec"))}catch{return!1}}function w2($){try{return GN($,"utf-8")}catch{return null}}function LN($){let Z=new Set;for(let X of $.split(`
|
|
209
|
+
Run 'faf init' to create one.`),process.exit(2);let z=c(X),J=z0(z);if(Z.json){let Q=p(X),Y={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",source:X,...J};console.log(JSON.stringify(Y,null,2));return}if(Z.status){console.log(`${c0(J.tier)} ${A(`${J.score}%`)}`);return}J0(J,X,Z.verbose)}import{existsSync as oD}from"fs";import{join as mz}from"path";var t=[{index:1,path:"project.name",label:"Name",description:"Project name",category:"project"},{index:2,path:"project.goal",label:"Goal",description:"Goal (use case)",category:"project"},{index:3,path:"project.main_language",label:"Language",description:"Primary language",category:"project"},{index:4,path:"human_context.who",label:"Who",description:"Who is this for?",category:"human"},{index:5,path:"human_context.what",label:"What",description:"What are they building",category:"human"},{index:6,path:"human_context.why",label:"Why",description:"Why does it exist",category:"human"},{index:7,path:"human_context.where",label:"Where",description:"Where does it run",category:"human"},{index:8,path:"human_context.when",label:"When",description:"When was it started / timeline",category:"human"},{index:9,path:"human_context.how",label:"How",description:"How is it built",category:"human"},{index:10,path:"stack.frontend",canonical:"stack.framework",label:"Framework",description:"Framework (React, Svelte, etc.)",category:"frontend"},{index:11,path:"stack.css_framework",canonical:"stack.css",label:"CSS",description:"CSS framework",category:"frontend"},{index:12,path:"stack.ui_library",label:"UI Library",description:"UI component library",category:"frontend"},{index:13,path:"stack.state_management",canonical:"stack.state",label:"State",description:"State management",category:"frontend"},{index:14,path:"stack.backend",label:"Backend",description:"Backend framework",category:"backend"},{index:15,path:"stack.api_type",canonical:"stack.api",label:"API",description:"API style (REST, GraphQL, etc.)",category:"backend"},{index:16,path:"stack.runtime",label:"Runtime",description:"Runtime (Node, Bun, Python, etc.)",category:"backend"},{index:17,path:"stack.database",canonical:"stack.db",label:"Database",description:"Database",category:"backend"},{index:18,path:"stack.connection",label:"Connection",description:"Connection method (Prisma, etc.)",category:"backend"},{index:19,path:"stack.hosting",label:"Hosting",description:"Hosting platform",category:"universal"},{index:20,path:"stack.build",label:"Build",description:"Build tool",category:"universal"},{index:21,path:"stack.cicd",label:"CI/CD",description:"CI/CD",category:"universal"},{index:22,path:"stack.monorepo_tool",label:"Monorepo",description:"Monorepo tool",category:"enterprise_infra"},{index:23,path:"stack.package_manager",canonical:"stack.pkg_manager",label:"Package Manager",description:"Package manager",category:"enterprise_infra"},{index:24,path:"stack.workspaces",label:"Workspaces",description:"Workspace configuration",category:"enterprise_infra"},{index:25,path:"monorepo.packages_count",label:"Packages",description:"Number of packages",category:"enterprise_infra"},{index:26,path:"monorepo.build_orchestrator",label:"Build Orchestrator",description:"Build orchestration tool",category:"enterprise_infra"},{index:27,path:"stack.admin",label:"Admin",description:"Admin panel",category:"enterprise_app"},{index:28,path:"stack.cache",label:"Cache",description:"Caching layer",category:"enterprise_app"},{index:29,path:"stack.search",label:"Search",description:"Search engine",category:"enterprise_app"},{index:30,path:"stack.storage",label:"Storage",description:"Object storage",category:"enterprise_app"},{index:31,path:"monorepo.versioning_strategy",label:"Versioning",description:"Version strategy",category:"enterprise_ops"},{index:32,path:"monorepo.shared_configs",label:"Shared Configs",description:"Shared configs",category:"enterprise_ops"},{index:33,path:"monorepo.remote_cache",label:"Remote Cache",description:"Remote build cache",category:"enterprise_ops"}],M$=new Map(t.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),rC=new Map(t.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),sC=new Map(t.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function _2($,Z){let X=(J)=>{let Q=J.split("."),Y=$;for(let W of Q)if(Y&&typeof Y==="object"&&W in Y)Y=Y[W];else return;return Y},z=X(Z.path);if(z!==void 0)return z;if(Z.canonical)return X(Z.canonical);return}var aC=t.filter(($)=>$.index<=21);var qZ=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","n/a","not applicable"]);function P0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return qZ.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var O$={documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],cli:["project","human","universal"],library:["project","human","universal"],sdk:["project","human","universal"],wasm:["project","human","universal"],html:["project","human","universal"],"server-card":["project","human","universal"],frontend:["project","frontend","human","universal"],website:["project","frontend","human","universal"],mobile:["project","frontend","human","universal"],app:["project","frontend","human","universal"],extension:["project","frontend","human","universal"],mcp:["project","backend","human","universal"],backend:["project","backend","universal","human"],"data-science":["project","backend","human","universal"],fullstack:["project","frontend","backend","universal","human"],svelte:["project","frontend","backend","universal","human"],framework:["project","frontend","backend","universal","human"],"monorepo-root":["project","human","enterprise_infra","enterprise_app","enterprise_ops"],mcpaas:["project","backend","universal","human","enterprise_app","enterprise_ops"],saas:["project","frontend","backend","universal","human","enterprise_app"],enterprise:["project","frontend","backend","universal","human","enterprise_infra","enterprise_app","enterprise_ops"]};var R1="3.0";import{existsSync as x,readFileSync as a0,readdirSync as Az}from"fs";import{join as j}from"path";var Qz=[{name:"Next.js",slug:"nextjs",category:"frontend",signals:[{type:"dependency",key:"next"},{type:"file",pattern:"next.config.*"}]},{name:"React",slug:"react",category:"frontend",signals:[{type:"dependency",key:"react"}]},{name:"SvelteKit",slug:"sveltekit",category:"frontend",signals:[{type:"dependency",key:"@sveltejs/kit"},{type:"file",pattern:"svelte.config.*"}]},{name:"Svelte",slug:"svelte",category:"frontend",signals:[{type:"dependency",key:"svelte"},{type:"devDependency",key:"svelte"}]},{name:"Vue.js",slug:"vue",category:"frontend",signals:[{type:"dependency",key:"vue"}]},{name:"Nuxt",slug:"nuxt",category:"frontend",signals:[{type:"dependency",key:"nuxt"},{type:"file",pattern:"nuxt.config.*"}]},{name:"Angular",slug:"angular",category:"frontend",signals:[{type:"dependency",key:"@angular/core"},{type:"file",pattern:"angular.json"}]},{name:"Astro",slug:"astro",category:"frontend",signals:[{type:"dependency",key:"astro"},{type:"file",pattern:"astro.config.*"}]},{name:"Solid",slug:"solid",category:"frontend",signals:[{type:"dependency",key:"solid-js"}]},{name:"Remix",slug:"remix",category:"frontend",signals:[{type:"dependency",key:"@remix-run/react"}]},{name:"Gatsby",slug:"gatsby",category:"frontend",signals:[{type:"dependency",key:"gatsby"},{type:"file",pattern:"gatsby-config.*"}]},{name:"Qwik",slug:"qwik",category:"frontend",signals:[{type:"dependency",key:"@builder.io/qwik"}]},{name:"Vercel (SvelteKit)",slug:"adapter-vercel",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-vercel"},{type:"devDependency",key:"@sveltejs/adapter-vercel"}]},{name:"Node (SvelteKit)",slug:"adapter-node",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-node"},{type:"devDependency",key:"@sveltejs/adapter-node"}]},{name:"Static (SvelteKit)",slug:"adapter-static",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-static"},{type:"devDependency",key:"@sveltejs/adapter-static"}]},{name:"Cloudflare (SvelteKit)",slug:"adapter-cloudflare",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-cloudflare"},{type:"devDependency",key:"@sveltejs/adapter-cloudflare"}]},{name:"Netlify (SvelteKit)",slug:"adapter-netlify",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-netlify"},{type:"devDependency",key:"@sveltejs/adapter-netlify"}]},{name:"Tailwind CSS",slug:"tailwind",category:"css",signals:[{type:"dependency",key:"tailwindcss"},{type:"devDependency",key:"tailwindcss"},{type:"file",pattern:"tailwind.config.*"}]},{name:"Bootstrap",slug:"bootstrap",category:"css",signals:[{type:"dependency",key:"bootstrap"}]},{name:"Styled Components",slug:"styled-components",category:"css",signals:[{type:"dependency",key:"styled-components"}]},{name:"shadcn/ui",slug:"shadcn",category:"ui",signals:[{type:"file",pattern:"components.json"},{type:"dependency",key:"@radix-ui/react-dialog"}]},{name:"Material UI",slug:"mui",category:"ui",signals:[{type:"dependency",key:"@mui/material"}]},{name:"Chakra UI",slug:"chakra",category:"ui",signals:[{type:"dependency",key:"@chakra-ui/react"}]},{name:"Ant Design",slug:"antd",category:"ui",signals:[{type:"dependency",key:"antd"}]},{name:"Redux",slug:"redux",category:"state",signals:[{type:"dependency",key:"@reduxjs/toolkit"}]},{name:"Zustand",slug:"zustand",category:"state",signals:[{type:"dependency",key:"zustand"}]},{name:"Jotai",slug:"jotai",category:"state",signals:[{type:"dependency",key:"jotai"}]},{name:"Pinia",slug:"pinia",category:"state",signals:[{type:"dependency",key:"pinia"}]},{name:"Express",slug:"express",category:"backend",signals:[{type:"dependency",key:"express"}]},{name:"Fastify",slug:"fastify",category:"backend",signals:[{type:"dependency",key:"fastify"}]},{name:"Hono",slug:"hono",category:"backend",signals:[{type:"dependency",key:"hono"}]},{name:"Elysia",slug:"elysia",category:"backend",signals:[{type:"dependency",key:"elysia"}]},{name:"NestJS",slug:"nestjs",category:"backend",signals:[{type:"dependency",key:"@nestjs/core"}]},{name:"Koa",slug:"koa",category:"backend",signals:[{type:"dependency",key:"koa"}]},{name:"Django",slug:"django",category:"backend",signals:[{type:"file",pattern:"manage.py"},{type:"file",pattern:"settings.py"}]},{name:"Flask",slug:"flask",category:"backend",signals:[{type:"content",pattern:"app.py",key:"flask"}]},{name:"FastAPI",slug:"fastapi",category:"backend",signals:[{type:"content",pattern:"main.py",key:"fastapi"}]},{name:"Rails",slug:"rails",category:"backend",signals:[{type:"content",pattern:"Gemfile",key:"rails"},{type:"content",pattern:"Gemfile.lock",key:"rails ("},{type:"file",pattern:"config/application.rb"},{type:"file",pattern:"config/routes.rb"}]},{name:"Spring Boot",slug:"spring",category:"backend",signals:[{type:"content",pattern:"pom.xml",key:"spring-boot"},{type:"content",pattern:"build.gradle",key:"springframework.boot"},{type:"content",pattern:"build.gradle.kts",key:"springframework.boot"},{type:"content",pattern:"gradle/libs.versions.toml",key:"springframework.boot"}]},{name:"Vapor",slug:"vapor",category:"backend",signals:[{type:"content",pattern:"Package.swift",key:"vapor/vapor"},{type:"content",pattern:"Package.swift",key:'product(name: "Vapor"'},{type:"content",pattern:"Package.swift",key:"product(name: 'Vapor'"},{type:"file",pattern:"Sources/App/configure.swift"}]},{name:"Hummingbird",slug:"hummingbird",category:"backend",signals:[{type:"content",pattern:"Package.swift",key:"hummingbird-project/hummingbird"},{type:"content",pattern:"Package.swift",key:'product(name: "Hummingbird"'},{type:"content",pattern:"Package.swift",key:"product(name: 'Hummingbird'"}]},{name:"Prisma",slug:"prisma",category:"database",signals:[{type:"dependency",key:"prisma"},{type:"devDependency",key:"prisma"},{type:"file",pattern:"prisma/schema.prisma"}]},{name:"Drizzle",slug:"drizzle",category:"database",signals:[{type:"dependency",key:"drizzle-orm"},{type:"file",pattern:"drizzle.config.*"}]},{name:"TypeORM",slug:"typeorm",category:"database",signals:[{type:"dependency",key:"typeorm"}]},{name:"Mongoose",slug:"mongoose",category:"database",signals:[{type:"dependency",key:"mongoose"}]},{name:"Vite",slug:"vite",category:"build",signals:[{type:"dependency",key:"vite"},{type:"devDependency",key:"vite"},{type:"file",pattern:"vite.config.*"}]},{name:"webpack",slug:"webpack",category:"build",signals:[{type:"dependency",key:"webpack"},{type:"devDependency",key:"webpack"},{type:"file",pattern:"webpack.config.*"}]},{name:"esbuild",slug:"esbuild",category:"build",signals:[{type:"dependency",key:"esbuild"},{type:"devDependency",key:"esbuild"}]},{name:"Turbopack",slug:"turbopack",category:"build",signals:[{type:"file",pattern:"turbo.json"}]},{name:"Jest",slug:"jest",category:"testing",signals:[{type:"devDependency",key:"jest"},{type:"file",pattern:"jest.config.*"}]},{name:"Vitest",slug:"vitest",category:"testing",signals:[{type:"devDependency",key:"vitest"}]},{name:"Playwright",slug:"playwright",category:"testing",signals:[{type:"devDependency",key:"@playwright/test"},{type:"file",pattern:"playwright.config.*"}]},{name:"Cypress",slug:"cypress",category:"testing",signals:[{type:"devDependency",key:"cypress"},{type:"file",pattern:"cypress.config.*"}]},{name:"Turborepo",slug:"turborepo",category:"monorepo",signals:[{type:"devDependency",key:"turbo"},{type:"file",pattern:"turbo.json"}]},{name:"Nx",slug:"nx",category:"monorepo",signals:[{type:"devDependency",key:"nx"},{type:"file",pattern:"nx.json"}]},{name:"Lerna",slug:"lerna",category:"monorepo",signals:[{type:"devDependency",key:"lerna"},{type:"file",pattern:"lerna.json"}]},{name:"MCP SDK",slug:"mcp",category:"ai",signals:[{type:"dependency",key:"@modelcontextprotocol/sdk"}]},{name:"Anthropic SDK",slug:"anthropic",category:"ai",signals:[{type:"dependency",key:"@anthropic-ai/sdk"}]},{name:"OpenAI SDK",slug:"openai",category:"ai",signals:[{type:"dependency",key:"openai"}]},{name:"LangChain",slug:"langchain",category:"ai",signals:[{type:"dependency",key:"langchain"}]},{name:"Vercel",slug:"vercel",category:"hosting",signals:[{type:"file",pattern:"vercel.json"}]},{name:"Netlify",slug:"netlify",category:"hosting",signals:[{type:"file",pattern:"netlify.toml"}]},{name:"Docker",slug:"docker",category:"hosting",signals:[{type:"file",pattern:"Dockerfile"},{type:"file",pattern:"docker-compose.yml"}]},{name:"Cloudflare Workers",slug:"cloudflare",category:"hosting",signals:[{type:"file",pattern:"wrangler.toml"},{type:"dependency",key:"wrangler"}]},{name:"GitHub Actions",slug:"github-actions",category:"cicd",signals:[{type:"file",pattern:".github/workflows/*.yml"}]},{name:"Commander.js",slug:"commander",category:"cli",signals:[{type:"dependency",key:"commander"}]}];import{existsSync as Yz,readFileSync as UL,readdirSync as qL}from"fs";import{join as GZ}from"path";var L$={version:2,_doc:"SINGLE SOURCE of Dart/Flutter detection KNOWLEDGE (A+B hybrid, the Truth-is-faf-cli spec). faf-cli imports this directly; faf-python-sdk vendors a synced copy (phase 2); MCPs compose it. Bolster Dart/Flutter by editing THIS file. Logic stays in dart.ts. Refreshed 2026-08-01 (knowledge v2) — community receipt on top of 6.13.0 Dart Edition.",flutterDeps:["flutter"],mcpDeps:["dart_mcp","mcp_server","mcp_dart","dart_mcp_server","mcp","dart_mcpserver"],serverFrameworks:[["serverpod","Serverpod"],["dart_frog","Dart Frog"],["conduit","Conduit"],["angel3_framework","Angel3"],["alfred","Alfred"],["shelf","Shelf"],["jaspr","Jaspr"],["relic","Relic"]],stateManagement:[["flutter_riverpod","Riverpod"],["hooks_riverpod","Riverpod"],["riverpod_annotation","Riverpod"],["riverpod","Riverpod"],["flutter_bloc","Bloc"],["bloc","Bloc"],["provider","Provider"],["get","GetX"],["flutter_mobx","MobX"],["mobx","MobX"],["signals","Signals"],["flutter_hooks","Hooks"]],routing:[["go_router","go_router"],["auto_route","auto_route"],["beamer","Beamer"],["routemaster","Routemaster"]]};var GL=L$.flutterDeps,VL=L$.mcpDeps,KL=L$.serverFrameworks,HL=L$.stateManagement,BL=L$.routing;function ML($){let Z=new Set,X=!1;for(let z of $.split(`
|
|
210
|
+
`)){if(/^(dependencies|dev_dependencies|dependency_overrides):\s*$/.test(z)){X=!0;continue}if(/^\S/.test(z))X=!1;if(X){let J=z.match(/^\s{2}([a-zA-Z0-9_]+):/);if(J)Z.add(J[1].toLowerCase())}}return Z}function S8($){let Z=GZ($,"pubspec.yaml");if(!Yz(Z))return null;let X;try{X=UL(Z,"utf-8")}catch{return null}let z=ML(X),J=(w)=>z.has(w.toLowerCase()),Q=GL.some(J)||/^flutter:\s*$/m.test(X)||/\bsdk:\s*flutter\b/.test(X),Y=VL.find(J),W=KL.find(([w])=>J(w)),U=HL.find(([w])=>J(w)),q=U?U[1]:"",G=BL.find(([w])=>J(w)),V=G?G[1]:"",K=J("flutter_test")?"flutter_test":J("test")?"test":"",H=/^executables:\s*$/m.test(X),N=!1;try{N=qL(GZ($,"bin")).some((w)=>w.endsWith(".dart"))}catch{}let B=H||N,O,T="",F;if(Q)if(T="Flutter",Yz(GZ($,"lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(X))O="mobile",F="pubspec.yaml (Flutter app)";else O="library",F="pubspec.yaml (Flutter package)";else if(Y)O="mcp",F=`pubspec.yaml + ${Y} (Dart MCP server)`;else if(W)O="backend",T=W[1],F=`pubspec.yaml + ${W[0]} (Dart backend)`;else if(B)O="cli",F=H?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else O="library",F="pubspec.yaml (Dart package)";return{appType:O,isFlutter:Q,framework:T,stateManagement:q,routing:V,testing:K,found:F}}import{existsSync as VZ,readFileSync as qz,readdirSync as Wz,statSync as LL}from"fs";import{join as x8}from"path";var j8={version:1,_doc:"SINGLE SOURCE of Go detection KNOWLEDGE (A+B hybrid, Truth-is-faf-cli). faf-cli imports this directly; SDKs/MCPs compose it. Bolster Go by editing THIS file. Logic stays in go.ts. Content-aware: go.mod ≠ one bucket — backend · CLI · MCP · library. 2026-08-01 initial (Dart composition pattern).",mcpModules:["github.com/mark3labs/mcp-go","github.com/modelcontextprotocol/go-sdk","github.com/metoro-io/mcp-golang","github.com/ThinkInAIXYZ/go-mcp"],serverFrameworks:[["github.com/gin-gonic/gin","Gin"],["github.com/labstack/echo","Echo"],["github.com/labstack/echo/v4","Echo"],["github.com/gofiber/fiber","Fiber"],["github.com/gofiber/fiber/v2","Fiber"],["github.com/go-chi/chi","Chi"],["github.com/go-chi/chi/v5","Chi"],["github.com/gorilla/mux","Gorilla Mux"],["github.com/gofiber/fiber/v3","Fiber"],["google.golang.org/grpc","gRPC"],["connectrpc.com/connect","Connect"],["github.com/go-kratos/kratos","Kratos"],["github.com/go-kratos/kratos/v2","Kratos"],["github.com/zeromicro/go-zero","go-zero"],["github.com/cloudwego/hertz","Hertz"]],cliFrameworks:[["github.com/spf13/cobra","Cobra"],["github.com/urfave/cli","urfave/cli"],["github.com/urfave/cli/v2","urfave/cli"],["github.com/alecthomas/kingpin","Kingpin"],["github.com/alecthomas/kong","Kong"]]};var NL=j8.mcpModules,DL=j8.serverFrameworks,IL=j8.cliFrameworks;function TL($){let Z=new Set,X=!1;for(let z of $.split(`
|
|
211
|
+
`)){let J=z.replace(/\/\/.*$/,"").trim();if(!J)continue;if(/^require\s*\(\s*$/.test(J)){X=!0;continue}if(X){if(J===")"){X=!1;continue}let Y=J.match(/^(\S+)/);if(Y)Z.add(Y[1].toLowerCase());continue}let Q=J.match(/^require\s+(\S+)/);if(Q&&Q[1]!=="(")Z.add(Q[1].toLowerCase())}return Z}function Gz($,Z){let X=Z.toLowerCase();for(let z of $)if(z===X||z.startsWith(`${X}/`))return!0;return!1}function Uz($,Z){let X;for(let z of Z){if(!Gz($,z[0]))continue;if(!X||z[0].length>X[0].length)X=z}return X}function AL($,Z){let X;for(let z of Z){if(!Gz($,z))continue;if(!X||z.length>X.length)X=z}return X}function RL($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function _L($){let Z=x8($,"cmd");if(!VZ(Z))return!1;try{for(let X of Wz(Z)){let z=x8(Z,X);try{if(LL(z).isDirectory()){if(Wz(z).some((Q)=>Q.endsWith(".go")))return!0}else if(X.endsWith(".go"))return!0}catch{}}}catch{}return!1}function FL($){let Z=x8($,"main.go");if(!VZ(Z))return!1;try{let X=qz(Z,"utf-8");return/^package\s+main\b/m.test(X)}catch{return!1}}function b8($){let Z=x8($,"go.mod");if(!VZ(Z))return null;let X;try{X=qz(Z,"utf-8")}catch{return null}let z=RL(X),J=TL(X),Q=AL(J,NL),Y=Uz(J,DL),W=Uz(J,IL),U=_L($),q=FL($),G,V="",K;if(Q)G="mcp",K=`go.mod + ${Q} (Go MCP server)`;else if(Y)G="backend",V=Y[1],K=`go.mod + ${Y[0]} (Go backend)`;else if(W)G="cli",V=W[1],K=`go.mod + ${W[0]} (Go CLI)`;else if(U)G="cli",K="go.mod + cmd/ (Go CLI layout)";else if(q&&!Y)G="cli",K="go.mod + main.go package main (Go CLI)";else G="library",K="go.mod (Go module)";return{appType:G,modulePath:z,framework:V,found:K}}import{existsSync as PL,readFileSync as EL,readdirSync as wL}from"fs";import{join as SL}from"path";var m1={version:1,_doc:"SINGLE SOURCE of C# /.NET detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Bolster C# by editing THIS file. Logic stays in csharp.ts. Content-aware: .csproj alone ≠ type — Sdk first, then props/packages. Kill line: .csproj alone ≠ type. 2026-08-01 initial.",mcpPackages:["ModelContextProtocol","ModelContextProtocol.AspNetCore","ModelContextProtocol.Core","ModelContextProtocol.Extensions.Tasks","ModelContextProtocol.Extensions.Apps"],cliPackages:[["System.CommandLine","System.CommandLine"],["Spectre.Console.Cli","Spectre.Console"],["Spectre.Console","Spectre.Console"],["McMaster.Extensions.CommandLineUtils","McMaster"]],testPackages:[["Microsoft.NET.Test.Sdk","VSTest"],["xunit.v3","xUnit"],["xunit","xUnit"],["NUnit","NUnit"],["MSTest.TestFramework","MSTest"],["MSTest","MSTest"]],grpcServerPackages:["Grpc.AspNetCore"],specializedSdks:[["Microsoft.NET.Sdk.Web","web","ASP.NET Core"],["Microsoft.NET.Sdk.Worker","worker","Worker"],["Microsoft.NET.Sdk.BlazorWebAssembly","blazor-wasm","Blazor WebAssembly"],["Microsoft.NET.Sdk.Razor","razor-lib","Razor Class Library"],["MSTest.Sdk","test","MSTest"],["Aspire.AppHost.Sdk","aspire","Aspire AppHost"]],baseSdk:"Microsoft.NET.Sdk"};var jL=m1.mcpPackages.map(($)=>$.toLowerCase()),xL=m1.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),bL=m1.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),kL=m1.grpcServerPackages.map(($)=>$.toLowerCase()),yL=m1.specializedSdks,Vz=m1.baseSdk.toLowerCase();function vL($){let Z=$.match(/<Project\b[^>]*\bSdk\s*=\s*"([^"/]+)(?:\/[^"]*)?"/i),X=$.match(/<Sdk\b[^>]*\bName\s*=\s*"([^"]+)"/i),z=(Z?.[1]||X?.[1]||"").trim(),J=($.match(/<OutputType>\s*([^<]+?)\s*<\/OutputType>/i)?.[1]||"").trim(),Q=$.match(/<TargetFramework>\s*([^<]+?)\s*<\/TargetFramework>/i)?.[1],W=($.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i)?.[1]||Q||"").trim(),U=/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test($),q=/<UseMaui>\s*true\s*<\/UseMaui>/i.test($),G=/<UseWPF>\s*true\s*<\/UseWPF>/i.test($),V=/<UseWindowsForms>\s*true\s*<\/UseWindowsForms>/i.test($),K=new Set;for(let N of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))K.add(N[1].toLowerCase());for(let N of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))K.add(N[1].toLowerCase());let H=new Set;for(let N of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))H.add(N[1].toLowerCase());return{sdk:z,outputType:J,targetFramework:W,isTestProject:U,useMaui:q,useWpf:G,useWindowsForms:V,packages:K,frameworkRefs:H}}function KZ($,Z){let X=Z.toLowerCase();if($.has(X))return!0;for(let z of $)if(z===X||z.startsWith(`${X}.`))return!0;return!1}function Kz($,Z){let X;for(let[z,J]of Z){if(!KZ($,z))continue;if(!X||z.length>X[0].length)X=[z,J]}return X}function fL($){let Z;for(let X of jL){if(!KZ($,X))continue;if(!Z||X.length>Z.length)Z=X}for(let X of $)if(X==="modelcontextprotocol"||X.startsWith("modelcontextprotocol.")){if(!Z||X.length>Z.length)Z=X}return Z}function gL($){let Z=$.toLowerCase();if(!Z)return;let X;for(let z of yL){let J=z[0].toLowerCase();if(Z===J||Z.startsWith(`${J}/`)){if(!X||J.length>X[0].length)X=z}}return X}function k8($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function hL($,Z){if($==="mcp")return 0;if($==="mobile")return 1;if($==="backend")return 2;if($==="cli")return 3;if(Z&&Z!=="")return 4;return 5}function uL($,Z){let X=Z.replace(/\.csproj$/i,""),{sdk:z,packages:J,frameworkRefs:Q,outputType:Y}=$,W,U="",q,G=fL(J),V=gL(z),K=Kz(J,bL),H=Kz(J,xL),N=kL.some((O)=>KZ(J,O)),B=Q.has("microsoft.aspnetcore.app");if(G)W="mcp",U="MCP",q=`${Z} + ${G} (C# MCP server)`;else if($.isTestProject||V?.[1]==="test"||K)W="library",U=K?.[1]||(V?.[1]==="test"?V[2]:"Test"),q=`${Z} + test (${U})`;else if($.useMaui)W="mobile",U="MAUI",q=`${Z} + UseMaui (MAUI)`;else if($.useWpf||$.useWindowsForms)W="backend",U=$.useWpf&&$.useWindowsForms?"WPF+WinForms":$.useWpf?"WPF":"Windows Forms",q=`${Z} + ${U}`;else if(V?.[1]==="web")W="backend",U=N?"gRPC":V[2],q=`${Z} + Sdk=${V[0]}${N?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(V?.[1]==="worker")W="backend",U=V[2],q=`${Z} + Sdk=${V[0]} (Worker)`;else if(V?.[1]==="blazor-wasm")W="backend",U=V[2],q=`${Z} + Sdk=${V[0]} (Blazor WASM)`;else if(V?.[1]==="aspire")W="backend",U=V[2],q=`${Z} + Sdk=${V[0]} (Aspire)`;else if(V?.[1]==="razor-lib")W="library",U=V[2],q=`${Z} + Sdk=${V[0]} (Razor class library)`;else if(B&&k8(Y))W="backend",U="ASP.NET Core",q=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(B&&!k8(Y))W="library",U="ASP.NET Core",q=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(H&&(k8(Y)||!Y))W="cli",U=H[1],q=`${Z} + ${H[0]} (C# CLI)`;else if(k8(Y))W="cli",q=`${Z} + OutputType=Exe (C# console)`;else{W="library";let O=z?` Sdk=${z}`:"";if(q=`${Z}${O} (C# class library)`.replace(" Sdk=Microsoft.NET.Sdk",""),!z||z.toLowerCase()===Vz||z.toLowerCase().startsWith(`${Vz}/`))q=`${Z} (C# class library)`}return{appType:W,projectName:X,targetFramework:$.targetFramework,sdk:z||"Microsoft.NET.Sdk",framework:U,found:q}}function F2($){if(!PL($))return[];try{return wL($).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}catch{return[]}}function y8($){let Z=F2($);if(Z.length===0)return null;let X=null,z=999;for(let J of Z){let Q=SL($,J),Y;try{Y=EL(Q,"utf-8")}catch{continue}let W=vL(Y),U=uL(W,J),q=hL(U.appType,U.framework);if(!X||q<z)X=U,z=q}return X}import{existsSync as c1,readFileSync as cL,readdirSync as lL,statSync as dL}from"fs";import{join as v0}from"path";var l0={version:1,_doc:"SINGLE SOURCE of JVM (Java/Kotlin) detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Bolster JVM by editing THIS file. Logic stays in jvm.ts. Kill line: pom / gradle alone ≠ type. Content-aware: plugins · parents · packaging · deps · version catalogs. One brand JVM — Android/KMP are facets, not a second Kotlin Edition. 2026-08-03 initial (post-intel).",mcpArtifacts:["io.modelcontextprotocol.sdk:mcp","io.modelcontextprotocol.sdk:mcp-core","io.modelcontextprotocol.sdk:mcp-spring-webflux","io.modelcontextprotocol.sdk:mcp-spring-webmvc","org.springframework.ai:spring-ai-starter-mcp-server","org.springframework.ai:spring-ai-starter-mcp-server-webmvc","org.springframework.ai:spring-ai-starter-mcp-server-webflux","org.springframework.ai:spring-ai-starter-mcp-client","org.springframework.ai:spring-ai-mcp-server-spring-boot-starter","org.springframework.ai:spring-ai-mcp-client-spring-boot-starter","io.modelcontextprotocol:kotlin-sdk","io.modelcontextprotocol.kotlin:mcp"],webPlugins:[["org.springframework.boot","Spring Boot"],["io.quarkus","Quarkus"],["io.quarkus.gradle.plugin","Quarkus"],["io.micronaut.application","Micronaut"],["io.micronaut.library","Micronaut"]],webParents:[["org.springframework.boot:spring-boot-starter-parent","Spring Boot"],["io.quarkus.platform:quarkus-bom","Quarkus"],["io.micronaut.platform:micronaut-parent","Micronaut"]],webArtifacts:[["org.springframework.boot:spring-boot-starter-web","Spring Boot"],["org.springframework.boot:spring-boot-starter-webflux","Spring Boot"],["org.springframework.boot:spring-boot-starter","Spring Boot"],["io.quarkus:quarkus-core","Quarkus"],["io.micronaut:micronaut-http-server-netty","Micronaut"],["io.ktor:ktor-server-core","Ktor"],["io.ktor:ktor-server-netty","Ktor"],["io.ktor:ktor-server-cio","Ktor"]],androidPlugins:["com.android.application","com.android.library","com.android.kotlin.multiplatform.library"],kmpPlugins:["org.jetbrains.kotlin.multiplatform","kotlin-multiplatform"],jvmKotlinPlugins:["org.jetbrains.kotlin.jvm","kotlin-jvm","org.jetbrains.kotlin.android","kotlin-android"],cliPlugins:[["org.gradle.application","application"],["application","application"]],cliArtifacts:[["info.picocli:picocli","Picocli"],["com.github.ajalt.clikt:clikt","Clikt"],["com.github.ajalt.clikt:clikt-jvm","Clikt"]],libraryPlugins:["java-library","org.gradle.java-library"]};var pL=l0.mcpArtifacts.map(($)=>$.toLowerCase()),iL=l0.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),nL=l0.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),rL=l0.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),DP=l0.androidPlugins.map(($)=>$.toLowerCase()),sL=l0.kmpPlugins.map(($)=>$.toLowerCase()),aL=l0.jvmKotlinPlugins.map(($)=>$.toLowerCase()),oL=l0.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),tL=l0.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),eL=l0.libraryPlugins.map(($)=>$.toLowerCase()),$N=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function HZ($){return $N.some((Z)=>c1(v0($,Z)))}function P2($){try{return cL($,"utf-8")}catch{return null}}function ZN($){let Z=new Map,X=new Map,z="";for(let J of $.split(`
|
|
212
|
+
`)){let Q=J.replace(/#.*$/,"").trim();if(!Q)continue;let Y=Q.match(/^\[([^\]]+)\]$/);if(Y){z=Y[1].trim().toLowerCase();continue}let W=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bid\s*=\s*"([^"]+)"/);if(W&&(z==="plugins"||z.endsWith(".plugins"))){Z.set(W[1].replace(/-/g,".").toLowerCase(),W[2].toLowerCase()),Z.set(W[1].toLowerCase(),W[2].toLowerCase());continue}let U=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bmodule\s*=\s*"([^"]+)"/);if(U&&(z==="libraries"||z.endsWith(".libraries"))){let V=U[1].toLowerCase();X.set(V,U[2].toLowerCase()),X.set(V.replace(/-/g,"."),U[2].toLowerCase());continue}let q=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bgroup\s*=\s*"([^"]+)"[^}]*\bname\s*=\s*"([^"]+)"/);if(q&&(z==="libraries"||z.endsWith(".libraries"))){let V=`${q[2]}:${q[3]}`.toLowerCase(),K=q[1].toLowerCase();X.set(K,V),X.set(K.replace(/-/g,"."),V);continue}let G=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(G){let V=G[1].toLowerCase(),K=G[2];if(z==="plugins"||z.endsWith(".plugins")){let H=K.split(":")[0].toLowerCase();Z.set(V,H),Z.set(V.replace(/-/g,"."),H)}else if(z==="libraries"||z.endsWith(".libraries")){let H=K.split(":");if(H.length>=2){let N=`${H[0]}:${H[1]}`.toLowerCase();X.set(V,N),X.set(V.replace(/-/g,"."),N)}}}}return{plugins:Z,libraries:X}}function XN($){let Z=v0($,"gradle","libs.versions.toml");if(!c1(Z))return{plugins:new Map,libraries:new Map};let X=P2(Z);if(!X)return{plugins:new Map,libraries:new Map};return ZN(X)}function zN($){let Z=[];for(let X of $.matchAll(/include\s*\(\s*([^)]+)\)/g))for(let z of X[1].split(",")){let J=z.replace(/['":\s]/g,"").replace(/^:/,"");if(J)Z.push(J.replace(/:/g,"/"))}for(let X of $.matchAll(/include\s+((?:['"][^'"]+['"]\s*,?\s*)+)/g))for(let z of X[1].split(",")){let J=z.replace(/['":\s]/g,"").replace(/^:/,"");if(J)Z.push(J.replace(/:/g,"/"))}for(let X of $.matchAll(/project\s*\(\s*["']:([^"']+)["']\s*\)\s*\.projectDir\s*=\s*file\s*\(\s*["']([^"']+)["']\s*\)/g))Z.push(X[2].replace(/^\.\//,""));return[...new Set(Z)]}function JN($,Z){let X=new Set;for(let z of $.matchAll(/\bid\s*\(\s*["']([^"']+)["']\s*\)/g))X.add(z[1].toLowerCase());for(let z of $.matchAll(/\bid\s+['"]([^'"]+)['"]/g))X.add(z[1].toLowerCase());for(let z of $.matchAll(/plugins\s*\{([\s\S]*?)\}/g))for(let J of z[1].split(/[\n;]/)){let Q=J.replace(/\/\/.*$/,"").trim();if(!Q||Q.startsWith("id")||Q.startsWith("kotlin")||Q.startsWith("alias"))continue;let Y=Q.match(/^`([a-zA-Z0-9.-]+)`$/)||Q.match(/^([a-zA-Z][a-zA-Z0-9.-]*)$/);if(Y)X.add(Y[1].toLowerCase())}for(let z of $.matchAll(/\bkotlin\s*\(\s*["']([^"']+)["']\s*\)/g)){let J=z[1].toLowerCase();if(J==="jvm")X.add("org.jetbrains.kotlin.jvm");else if(J==="multiplatform")X.add("org.jetbrains.kotlin.multiplatform");else if(J==="android")X.add("org.jetbrains.kotlin.android");else X.add(`org.jetbrains.kotlin.${J}`)}for(let z of $.matchAll(/libs\.plugins\.([A-Za-z0-9_.]+)/g)){let J=z[1].toLowerCase(),Q=Z.plugins.get(J)||Z.plugins.get(J.replace(/\./g,"-"))||Z.plugins.get(J.replace(/-/g,"."));if(Q)X.add(Q);else if(J.includes("spring")&&J.includes("boot"))X.add("org.springframework.boot")}for(let z of $.matchAll(/apply\s+plugin\s*:\s*['"]([^'"]+)['"]/g))X.add(z[1].toLowerCase());return X}function QN($,Z){let X=new Set;for(let z of $.matchAll(/["']([A-Za-z0-9_.-]+:[A-Za-z0-9_.-]+)(?::[^"']+)?["']/g))X.add(z[1].toLowerCase());for(let z of $.matchAll(/libs\.([A-Za-z0-9_.]+)/g)){let J=z[1].toLowerCase();if(J.startsWith("plugins."))continue;let Q=[J,J.replace(/\./g,"-"),J.replace(/-/g,".")];for(let Y of Q){let W=Z.libraries.get(Y);if(W){X.add(W.includes(":")?W.split(":").slice(0,2).join(":"):W);break}}}return X}function Mz($){let Z=($.match(/<packaging>\s*([^<]+?)\s*<\/packaging>/i)?.[1]||"jar").trim().toLowerCase(),X=new Set,z=$.match(/<parent>([\s\S]*?)<\/parent>/i);if(z){let Y=z[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),W=z[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(Y&&W)X.add(`${Y}:${W}`.toLowerCase())}let J=new Set;for(let Y of $.matchAll(/<dependency>([\s\S]*?)<\/dependency>/gi)){let W=Y[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),U=Y[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(W&&U)J.add(`${W}:${U}`.toLowerCase())}let Q=[];for(let Y of $.matchAll(/<module>\s*([^<]+?)\s*<\/module>/gi))Q.push(Y[1].trim());return{packaging:Z,parents:X,artifacts:J,modules:Q}}function z1($,Z){let X=Z.toLowerCase();if($.has(X))return!0;for(let z of $)if(z===X||z.endsWith(`.${X}`)||z===X.replace(/^org\.gradle\./,""))return!0;return!1}function C2($,Z,X){let z;for(let[J,Q]of Z){let Y=!1;if(X==="plugin")Y=z1($,J);else if(Y=$.has(J)||[...$].some((W)=>W===J||W.startsWith(`${J}:`)||W.startsWith(`${J}.`)),!Y&&X==="artifact")Y=[...$].some((W)=>W===J||W.startsWith(`${J}`));if(!Y)continue;if(!z||J.length>z[0].length)z=[J,Q]}return z}function YN($){let Z;for(let X of pL)for(let z of $){if(z===X||z.startsWith(`${X}:`)||z.startsWith(X.replace(/:mcp$/,":"))){if(!Z||X.length>Z.length)Z=X}if(z.startsWith("io.modelcontextprotocol")||z.includes("spring-ai-starter-mcp")||z.includes("spring-ai-mcp")){if(!Z||z.length>Z.length)Z=z}}return Z}function Oz($){let Z=new Set,X=!1,z=!1,J=[v0($,"src"),v0($,"src","main")],Q=(Y,W)=>{if(W>4||!c1(Y))return;let U;try{U=lL(Y)}catch{return}for(let q of U){if(q==="androidMain"||q==="commonMain"||q==="jvmMain"||q==="iosMain")Z.add(q);let G=v0(Y,q);try{if(dL(G).isDirectory())Q(G,W+1);else if(q.endsWith(".kt")||q.endsWith(".kts"))X=!0;else if(q.endsWith(".java"))z=!0}catch{}}};for(let Y of J)Q(Y,0);return{kotlin:X,java:z,hints:Z}}function WN($){let Z=[],X=$.plugins,z=$.artifacts,J=sL.some((S)=>z1(X,S))||$.sourceHints.has("commonMain"),Q=z1(X,"com.android.application"),Y=z1(X,"com.android.library")||z1(X,"com.android.kotlin.multiplatform.library");if(Q||Y)Z.push("android");if(J)Z.push("multiplatform");let W=YN(z),U=C2(X,iL,"plugin"),q=C2($.parents,nL,"parent"),G=C2(z,rL,"artifact"),V=C2(X,oL,"plugin"),K=C2(z,tL,"artifact"),H=eL.some((S)=>z1(X,S)),N=$.packaging==="pom",B,O="",T;if(Q)B="mobile",O=J?"Android+KMP":"Android",T=`${$.path||"root"} + com.android.application (${O})`;else if(W)B="mcp",O="MCP",Z.push("mcp"),T=`${$.path||"root"} + ${W} (JVM MCP server)`;else if(U||q||G){B="backend",O=U?.[1]||q?.[1]||G?.[1]||"JVM";let S=U?.[0]||q?.[0]||G?.[0]||"web";T=`${$.path||"root"} + ${S} (JVM backend)`}else if(J&&!Y)B="library",O="Kotlin Multiplatform",T=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(Y)B="library",O=J?"Android+KMP":"Android",T=`${$.path||"root"} + android library (${O})`;else if(K||$.hasApplicationPlugin&&($.hasMainClass||V)||V&&$.hasMainClass)B="cli",O=K?.[1]||"application",T=K?`${$.path||"root"} + ${K[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!H)B="cli",O="application",T=`${$.path||"root"} + application plugin (JVM CLI)`;else if(N)B="library",T=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{B="library";let S=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(T=`${$.path||"root"} (${S} library)`,H)T=`${$.path||"root"} + java-library (JVM library)`}let F="Java";if($.kotlinSources&&$.javaSources)F="Java/Kotlin";else if($.kotlinSources||aL.some((S)=>z1(X,S))||J)F="Kotlin";let w=[...new Set(Z)];return{appType:B,framework:O,facets:w,found:T,buildTool:$.buildTool,mainLanguage:F}}function UN($,Z){if($==="mcp")return 0;if($==="mobile")return 1;if(Z.includes("multiplatform")&&$==="backend")return 2;if($==="backend")return 3;if($==="cli")return 4;if(Z.includes("multiplatform"))return 5;if(Z.includes("android"))return 6;return 7}function Hz($,Z,X){let z=Z?v0($,Z):$,J=v0(z,"build.gradle.kts"),Q=v0(z,"build.gradle"),Y=c1(J)?J:c1(Q)?Q:null;if(!Y)return null;let W=P2(Y);if(!W)return null;let U=JN(W,X),q=QN(W,X),G=Oz(z),V=/mainClass\s*[.=]/.test(W)||/mainClassName\s*=/.test(W)||/Main-Class/.test(W),K=z1(U,"application")||z1(U,"org.gradle.application");return{path:Z||"build.gradle",plugins:U,artifacts:q,packaging:"jar",parents:new Set,hasMainClass:V,hasApplicationPlugin:K,sourceHints:G.hints,kotlinSources:G.kotlin||Y.endsWith(".kts"),javaSources:G.java,buildTool:"gradle"}}function Bz($,Z){let X=Z?v0($,Z):$,z=v0(X,"pom.xml");if(!c1(z))return null;let J=P2(z);if(!J)return null;let{packaging:Q,parents:Y,artifacts:W}=Mz(J),U=Oz(X);return{path:Z?`${Z}/pom.xml`:"pom.xml",plugins:new Set,artifacts:W,packaging:Q,parents:Y,hasMainClass:/<mainClass>/.test(J),hasApplicationPlugin:!1,sourceHints:U.hints,kotlinSources:U.kotlin,javaSources:U.java,buildTool:"maven"}}function E2($){if(!HZ($))return null;let Z=XN($),X=[],z=null;for(let q of["settings.gradle.kts","settings.gradle"]){let G=v0($,q);if(c1(G)){z=P2(G);break}}let J=z?zN(z):[],Q=Hz($,"",Z);if(Q)X.push(Q);for(let q of J){let G=Hz($,q,Z);if(G)X.push(G)}let Y=Bz($,"");if(Y){X.push(Y);let q=P2(v0($,"pom.xml"));if(q){let{modules:G}=Mz(q);for(let V of G){let K=Bz($,V);if(K)X.push(K)}}}if(X.length===0&&z)return{appType:"library",framework:"",buildTool:"gradle",mainLanguage:"Java/Kotlin",facets:[],found:"settings.gradle (Gradle multi-project root)"};if(X.length===0)return null;let W=null,U=999;for(let q of X){let G=WN(q),V=UN(G.appType,G.facets);if(!W||V<U)W={appType:G.appType,framework:G.framework,buildTool:G.buildTool,mainLanguage:G.mainLanguage,facets:G.facets,found:G.found},U=V}if(W&&J.length>0&&!W.found.includes("multi-project"));return W}import{existsSync as j2,readFileSync as GN,readdirSync as v8,statSync as VN}from"fs";import{join as d0}from"path";var w2={version:1,_doc:"SINGLE SOURCE of Ruby detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Kill line: Gemfile alone ≠ Rails. Content-aware: gem names + light layout. 2026-08-03 initial (post-intel ruby-edition).",mcpGems:["mcp","fast-mcp","fast_mcp","rails-mcp-server","rails_mcp_server","ruby-mcp-client","ruby_mcp_client","ruby_llm-mcp","ruby_llm_mcp"],webGems:[["rails","Rails"],["railties","Rails"],["sinatra","Sinatra"],["sinatra-contrib","Sinatra"],["roda","Roda"],["grape","Grape"],["hanami","Hanami"],["hanami-controller","Hanami"],["rack","Rack"]],cliGems:[["thor","Thor"],["gli","GLI"],["commander","Commander"],["slop","Slop"]],railsLayoutFiles:["config/application.rb","config/routes.rb","bin/rails","config/environment.rb"]};var KN=w2.mcpGems.map(($)=>$.toLowerCase()),HN=w2.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),Lz=w2.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),BN=w2.railsLayoutFiles;function MN($){return j2(d0($,"Gemfile"))||j2(d0($,"gems.rb"))||ON($)}function ON($){try{return v8($).some((Z)=>Z.endsWith(".gemspec"))}catch{return!1}}function S2($){try{return GN($,"utf-8")}catch{return null}}function LN($){let Z=new Set;for(let X of $.split(`
|
|
213
213
|
`)){let z=X.replace(/#.*$/,"").trim();if(!z)continue;let J=z.match(/^\s*gem\s+['"]([^'"]+)['"]/i)||z.match(/^\s*gem\s+:([A-Za-z0-9_.-]+)/i);if(J)Z.add(J[1].toLowerCase())}return Z}function NN($){let Z=new Set,X=!1;for(let z of $.split(`
|
|
214
214
|
`)){let J=z.replace(/\r$/,"");if(/^\s*specs:\s*$/.test(J)){X=!0;continue}if(X){if(/^[A-Z]/.test(J)||J.startsWith("PLATFORMS")||J.startsWith("DEPENDENCIES")||J.startsWith("BUNDLED")||J.startsWith("RUBY VERSION")||J.startsWith("CHECKSUMS")){X=!1;continue}let Q=J.match(/^\s{2,}([a-zA-Z0-9_.-]+)\s*\(/);if(Q)Z.add(Q[1].toLowerCase())}}return Z}function DN($){let Z=new Set;for(let X of $.split(`
|
|
215
|
-
`)){let J=X.replace(/#.*$/,"").match(/add_(?:runtime_|development_)?dependency\s*\(?\s*['"]([^'"]+)['"]/i);if(J)Z.add(J[1].toLowerCase())}return Z}function IN($){let Z=new Set,X=[];for(let J of["Gemfile","gems.rb"]){let Q=
|
|
216
|
-
`)X++;continue}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<$.length&&!($[X]==="*"&&$[X+1]==="/"))X++;X+=2;continue}Z+=$[X],X++}return Z}function hN($,Z){let X=$.map((J)=>J.toLowerCase()),z;for(let J of Z)for(let Q of X)if(Q.includes(J)&&(!z||J.length>z.length))z=J;return z}function Nz($,Z){let X=$.map((J)=>J.toLowerCase()),z;for(let[J,Q]of Z)for(let Y of X)if(Y.includes(J)&&(!z||J.length>z[0].length))z=[J,Q];return z}function Dz($,Z){let X=$.map((J)=>J.toLowerCase()),z;for(let[J,Q]of Z)if(X.includes(J)&&(!z||J.length>z[0].length))z=[J,Q];return z}function uN($){let Z=$.map((X)=>X.toLowerCase());return EN.some((X)=>Z.includes(X))}function mN($){let Z=!1,X=!1,z;for(let J of MZ($)){let Q=x2($,J,"project.pbxproj"),Y=Iz(Q);if(!Y)continue;for(let W of bN)if(Y.includes(W))Z=!0,z=W;for(let W of kN)if(Y.includes(W)){if(X=!0,!z)z=W}}return{hasApplication:Z,hasTool:X,hit:z}}function cN($){for(let Z of yN)if(BZ(x2($,Z)))return Z;return}function b2($){if(!vN($))return null;let Z=x2($,"Package.swift"),X=BZ(Z),z=MZ($),J=z.length>0,Q=null;if(X){let h=Iz(Z);if(h)Q=fN(h)}let Y=J?mN($):{hasApplication:!1,hasTool:!1},W=cN($),U=Q?.packageUrls??[],q=Q?.productNames??[],G=hN(U,PN),V=uN(q),K=Nz(U,wN),H=Dz(q,SN),N=Nz(U,jN),B=Dz(q,xN),O=!!(G||V),T=!!(K||H||W),R=!!(Q?.hasExecutableProduct||Q?.hasExecutableTarget),E=!!(N||B),w=Y.hasApplication,y=X&&J?"spm+xcode":X?"spm":"xcode",x,d="",_;if(O)if(x="mcp",d="MCP",V)_="Package.swift + product MCP (Swift MCP)";else _=`Package.swift + ${G} (Swift MCP)`;else if(T)if(x="backend",d=H?.[1]||K?.[1]||(W?"Vapor":""),H)_=`Package.swift + product ${H[1]} (Swift backend)`;else if(K)_=`Package.swift + ${K[1]} (Swift backend)`;else _=`${W} (Swift backend layout)`;else if(w)x="app",d="",_=`${z[0]} + ${Y.hit||"application"} (Swift app)`;else if(E||R&&!T&&!O)if(x="cli",d=B?.[1]||N?.[1]||"",B)_=`Package.swift + product ${B[1]} (Swift CLI)`;else if(N)_=`Package.swift + ${N[1]} (Swift CLI)`;else if(Q?.hasExecutableProduct)_="Package.swift + .executable product (Swift CLI)";else _="Package.swift + .executableTarget (Swift CLI)";else if(Y.hasTool&&!X)x="cli",_=`${z[0]} + tool productType (Swift CLI)`;else if(X)if(x="library",Q?.hasLibraryProduct)_="Package.swift + .library product (Swift library)";else _="Package.swift (Swift library)";else x="library",_=`${z[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:x,framework:d,packageManager:y,found:_}}function lN($){let Z=S($,"Cargo.toml");if(!j(Z))return null;try{let z=s0(Z,"utf-8").match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return z?z[1]:null}catch{return null}}function dN($){let Z=S($,"Cargo.toml");if(!j(Z))return!1;try{let X=s0(Z,"utf-8");return/^\s*\[\[bin\]\]/m.test(X)}catch{return!1}}function pN($,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=lN($);if(X&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(X))return`Cargo.toml name "${X}" → sdk`;return null}function iN($){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=S($,X);if(!j(z))continue;try{let J=JSON.parse(s0(z,"utf-8"));if(typeof J.manifest_version==="number")return`${X} manifest_version ${J.manifest_version} (browser extension)`}catch{}}return null}function nN($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,X=S($,"pyproject.toml");if(j(X))try{let Q=s0(X,"utf-8").match(Z);if(Q)return`pyproject.toml depends on ${Q[1]}`}catch{}let z=S($,"requirements.txt");if(j(z))try{let Q=s0(z,"utf-8").match(Z);if(Q)return`requirements.txt contains ${Q[1]}`}catch{}return null}function rN($,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(j(S($,"ios"))&&j(S($,"android")))return"ios/ + android/ dirs";return null}function sN($,Z){let X=S($,"Cargo.toml");if(j(X))try{let J=s0(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=S($,"build.zig");if(j(z))try{let J=s0(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 aN($,Z){if(!j(S($,"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 oN($,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?.bin)return null;if(Z?.files&&Z.files.length>0){let X=/^(dist|src|lib|build|bin)(\/|$)|\/(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)||Q==="README.md"||Q==="docs"||Q==="docs/");if(!z&&J)return"package.json files = docs/examples only (no source)"}return null}function tN($,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 eN($,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((W)=>X[W]),Y=J.some((W)=>X[W]);if(Q&&Y)return"auth + payment dependencies";return null}function $D($,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 ZD($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||j(S($,"pnpm-workspace.yaml"))))return null;return"private workspace + multi-package"}function m1($){let Z=S($,"package.json");if(!j(Z))return null;try{return JSON.parse(s0(Z,"utf-8"))}catch{return null}}function Az($,Z){if(!Z.includes("*"))return j(S($,Z));let X=Z.split("/");if(X.length===1){let W=Z.split("*")[0];try{return Tz($).some((U)=>U.startsWith(W))}catch{return!1}}let z=S($,...X.slice(0,-1)),J=X[X.length-1],Q=J.split("*")[0],Y=J.split("*")[1]||"";try{return Tz(z).some((W)=>W.startsWith(Q)&&W.endsWith(Y))}catch{return!1}}function XD($,Z,X){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return Az(X,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!Az(X,$.pattern))return!1;try{let z=S(X,$.pattern);if(!j(z))return!1;return s0(z,"utf-8").toLowerCase().includes($.key.toLowerCase())}catch{return!1}}default:return!1}}function OZ($){let Z=m1($);return Jz.map((X)=>{let J=X.signals.filter((Q)=>XD(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 Rz($){let Z=m1($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(j(S($,"tsconfig.json")))return"TypeScript";if(j(S($,"Cargo.toml")))return"Rust";if(j(S($,"go.mod")))return"Go";if(_2($).length>0)return"C#";if(j(S($,"pyproject.toml"))||j(S($,"setup.py")))return"Python";if(j(S($,"Gemfile")))return"Ruby";if(KZ($)){let X=P2($);if(X)return X.mainLanguage==="Java/Kotlin"?"Kotlin":X.mainLanguage;return"Java"}if(j(S($,"Package.swift")))return"Swift";if(j(S($,"build.zig")))return"Zig";if(j(S($,"pubspec.yaml")))return"Dart";if(Z)return"JavaScript";return"Unknown"}function _z($){let Z=m1($),X=OZ($),z=[],J=oN($,Z);if(J)return z.push(J),{type:"documentation",found:z};let Q=pN($,Z);if(Q)return z.push(Q),{type:"sdk",found:z};let Y=iN($);if(Y)return z.push(Y),{type:"extension",found:z};let W=$D($,Z,X);if(W)return z.push(W),{type:"mcpaas",found:z};let U=eN($,Z);if(U)return z.push(U),{type:"saas",found:z};let q=sN($,Z);if(q)return z.push(q),{type:"wasm",found:z};let G=w8($);if(G)return z.push(G.found),{type:G.appType,found:z};let V=x8($);if(V)return z.push(V.found),{type:V.appType,found:z};let K=k8($);if(K)return z.push(K.found),{type:K.appType,found:z};let H=P2($);if(H)return z.push(H.found),{type:H.appType,found:z};let N=v8($);if(N)return z.push(N.found),{type:N.appType,found:z};let B=b2($);if(B)return z.push(B.found),{type:B.appType,found:z};let O=rN($,Z);if(O)return z.push(O),{type:"mobile",found:z};if(X.some((r)=>r.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(dN($))return z.push("Cargo.toml [[bin]]"),{type:"cli",found:z};if(j(S($,"build.zig"))){if(z.push("build.zig"),j(S($,"src/main.zig")))return z.push("src/main.zig"),{type:"cli",found:z};if(j(S($,"src/root.zig")))return z.push("src/root.zig"),{type:"library",found:z}}let R=X.some((r)=>r.slug==="svelte"||r.slug==="sveltekit");if(Z?.private===!0&&(j(S($,"pnpm-workspace.yaml"))||Z?.workspaces!==void 0)&&R)return z.push("private workspace","Svelte"),{type:"framework",found:z};if(R)return z.push("Svelte/SvelteKit"),{type:"svelte",found:z};let w=X.some((r)=>r.category==="frontend"),y=X.some((r)=>r.category==="backend");if(Z?.private&&(Z.workspaces||j(S($,"pnpm-workspace.yaml")))&&w&&y)return z.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:z};let x=ZD($,Z);if(x)return z.push(x),{type:"monorepo-root",found:z};let d=tN($,Z,X);if(d)return z.push(d),{type:"website",found:z};if(X.some((r)=>r.slug==="nextjs"||r.slug==="nuxt"))return z.push(X.find((r)=>r.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:z};let h=X.some((r)=>r.category==="frontend"),O0=X.some((r)=>r.category==="backend");if(h&&O0)return z.push("frontend framework","backend framework"),{type:"fullstack",found:z};if(h)return z.push("frontend framework"),{type:"frontend",found:z};if(O0)return z.push("backend framework"),{type:"backend",found:z};let b=nN($);if(b)return z.push(b),{type:"data-science",found:z};let m=aN($,Z);if(m)return z.push(m),{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 Fz($){if(j(S($,"bunfig.toml")))return"Bun";if(j(S($,"deno.json"))||j(S($,"deno.jsonc")))return"Deno";if(m1($))return"Node.js";if(j(S($,"Cargo.toml")))return"Rust";if(j(S($,"go.mod")))return"Go";if(_2($).length>0)return".NET";if(j(S($,"pubspec.yaml")))return"Dart";return"Unknown"}function Cz($){if(j(S($,"pubspec.yaml")))return"pub";if(j(S($,"go.mod")))return"go modules";if(_2($).length>0)return"NuGet";if(j(S($,"pom.xml")))return"maven";if(j(S($,"build.gradle"))||j(S($,"build.gradle.kts"))||j(S($,"settings.gradle"))||j(S($,"settings.gradle.kts")))return"gradle";if(j(S($,"bun.lockb"))||j(S($,"bun.lock")))return"bun";if(j(S($,"pnpm-lock.yaml")))return"pnpm";if(j(S($,"yarn.lock")))return"yarn";if(j(S($,"package-lock.json")))return"npm";return"npm"}function Pz($){if(j(S($,".github/workflows")))return"GitHub Actions";if(j(S($,".gitlab-ci.yml")))return"GitLab CI";if(j(S($,".circleci")))return"CircleCI";if(j(S($,"Jenkinsfile")))return"Jenkins";return null}function Ez($){if(j(S($,"vercel.json")))return"Vercel";if(j(S($,"netlify.toml")))return"Netlify";if(j(S($,"wrangler.toml")))return"Cloudflare";if(j(S($,"Dockerfile")))return"Docker";if(j(S($,"fly.toml")))return"Fly.io";if(j(S($,"render.yaml")))return"Render";return null}function wz($){let Z=S($,"svelte.config.js");if(!j(Z))return null;try{let z=s0(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 Sz($){let Z=m1($);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(S($,"tsconfig.json"))&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function f8($){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)=>j(S($,X)))}function g8($,Z){let X={};if(Z?.scripts){for(let z of["build","test","lint","dev","start"])if(Z.scripts[z]){let J=j(S($,"bun.lock"))||j(S($,"bun.lockb"))?"bun run":"npm run";X[z]=`${J} ${z}`}}if(j(S($,"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(j(S($,"build.zig"))){if(!X.build)X.build="zig build";if(!X.test)X.test="zig build test"}if(j(S($,"go.mod"))){if(!X.build)X.build="go build ./...";if(!X.test)X.test="go test ./..."}if(j(S($,"pyproject.toml"))||j(S($,"pytest.ini"))){if(!X.test)X.test="pytest"}return X}function jz($,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(j(S($,"bunfig.toml")))J.push("Bun");else if(j(S($,"deno.json"))||j(S($,"deno.jsonc")))J.push("Deno");if(J.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let W of Y)if(!J.some((U)=>U.toLowerCase().includes(W.toLowerCase())))J.push(W)}return J}function h8($){let Z=m1($),X=OZ($),z=Rz($),J=_z($),Q=J.type,Y=Fz($),W=Cz($),U=Pz($),q=Ez($),G=Sz($),V=X.find((a)=>a.category==="frontend"),K=X.find((a)=>a.category==="css"),H=X.find((a)=>a.category==="ui"),N=X.find((a)=>a.category==="state"),B=X.find((a)=>a.category==="backend"),O=X.find((a)=>a.category==="database"),T=B$[Q]||B$.library,R=Q==="framework",E=X.some((a)=>a.slug==="svelte"||a.slug==="sveltekit"),w=R&&E?"svelte":R?null:null,y=Q==="svelte"||w==="svelte",x=y?wz($):null,d=y&&X.some((a)=>a.slug==="sveltekit"),_=new Set(["css_framework","ui_library","database","connection","hosting"]),h={},O0=e.filter((a)=>a.path.startsWith("stack."));for(let a of O0){let Z0=a.path.replace("stack.","");if(!T.includes(a.category)){h[Z0]="slotignored";continue}if(R&&_.has(Z0)){h[Z0]="slotignored";continue}switch(Z0){case"frontend":h[Z0]=V?.name??(Q==="cli"?"CLI":"");break;case"css_framework":h[Z0]=K?.name??"";break;case"ui_library":h[Z0]=H?.name??"";break;case"state_management":h[Z0]=y?N?.name??"Runes":N?.name??"";break;case"backend":h[Z0]=y?d?"SvelteKit":B?.name??"":B?.name??"";break;case"api_type":h[Z0]=d?"Server Routes":"";break;case"runtime":h[Z0]=Y!=="Unknown"?Y:"";break;case"database":h[Z0]=O?.name??"";break;case"connection":h[Z0]=O?.name??"";break;case"hosting":if(y&&x)h[Z0]=x;else h[Z0]=q??"";break;case"build":h[Z0]=y?"Vite":G??"";break;case"cicd":h[Z0]=U??"";break;case"package_manager":h[Z0]=W;break;default:h[Z0]="";break}}let b={},m=e.filter((a)=>a.path.startsWith("monorepo."));for(let a of m){let Z0=a.path.replace("monorepo.","");if(!T.includes(a.category))b[Z0]="slotignored";else b[Z0]=""}let r={name:Z?.name??$.split("/").pop()??"project",goal:Z?.description??"",main_language:z,type:Q};if(R&&w)r.framework=w;let s$=jz($,Z,X,z),H9=f8($),B9=g8($,Z),k6={faf_version:T1,project:r,stack:h,human_context:{who:"",what:Z?.description??"",why:"",where:"",when:"",how:""},monorepo:b,_meta:{found:J.found}};if(s$.length>0)k6.tech_stack=s$;if(H9.length>0)k6.key_files=H9;if(Object.keys(B9).length>0)k6.commands=B9;return k6}import{existsSync as JD,readFileSync as QD}from"fs";import{join as YD}from"path";var xz={MIN_LENGTH:8,MAX_LENGTH:280},zD=[/^(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 d0($){let Z=$.trim();if(Z.length<xz.MIN_LENGTH)return!1;if(Z.length>xz.MAX_LENGTH)return!1;if(zD.some((X)=>X.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
|
|
215
|
+
`)){let J=X.replace(/#.*$/,"").match(/add_(?:runtime_|development_)?dependency\s*\(?\s*['"]([^'"]+)['"]/i);if(J)Z.add(J[1].toLowerCase())}return Z}function IN($){let Z=new Set,X=[];for(let J of["Gemfile","gems.rb"]){let Q=d0($,J),Y=S2(Q);if(Y){for(let W of LN(Y))Z.add(W);X.push(J)}}let z=S2(d0($,"Gemfile.lock"))||S2(d0($,"gems.locked"));if(z){for(let J of NN(z))Z.add(J);X.push("Gemfile.lock")}try{for(let J of v8($)){if(!J.endsWith(".gemspec"))continue;let Q=S2(d0($,J));if(Q){for(let Y of DN(Q))Z.add(Y);X.push(J)}}}catch{}return{gems:Z,sources:X}}function x2($,Z){let X=Z.toLowerCase();if($.has(X))return!0;return!1}function BZ($,Z){let X;for(let[z,J]of Z){if(!x2($,z))continue;if(!X||z.length>X[0].length)X=[z,J]}return X}function TN($){let Z;for(let X of KN)if(x2($,X)&&(!Z||X.length>Z.length))Z=X;return Z}function Nz($){for(let Z of BN)if(j2(d0($,Z)))return Z;return}function AN($,Z){let X=BZ(Z,Lz);if(X)return{hit:!0,why:X[0]};try{for(let J of v8($)){if(!J.endsWith(".gemspec"))continue;let Q=S2(d0($,J));if(Q&&/executables\s*=/.test(Q)&&!/executables\s*=\s*\[\s*\]/.test(Q))return{hit:!0,why:`${J} executables`}}}catch{}let z=d0($,"bin");if(j2(z))try{let Q=v8(z).filter((Y)=>{if(Y==="setup"||Y==="console"||Y==="rake")return!1;try{return VN(d0(z,Y)).isFile()}catch{return!1}}).filter((Y)=>Y!=="rails");if(Q.length>0&&!x2(Z,"rails")&&!Nz($))return{hit:!0,why:`bin/${Q[0]}`}}catch{}return{hit:!1,why:""}}function f8($){if(!MN($))return null;let{gems:Z,sources:X}=IN($),z=X[0]||"Gemfile",J=X.some((O)=>O==="Gemfile"||O==="gems.rb"||O.includes("lock"))?"bundler":"rubygems",Q=TN(Z),Y=BZ(Z,HN),W=Nz($),U=x2(Z,"rails")||x2(Z,"railties"),q=AN($,Z),G=j2(d0($,"config.ru")),V=U||!!W,K=Y&&Y[1]!=="Rails"&&!(Y[0]==="rack"&&!G)?Y:void 0,H,N="",B;if(Q)H="mcp",N="MCP",B=`${z} + gem ${Q} (Ruby MCP)`;else if(V)if(H="backend",N="Rails",U&&W)B=`${z} + rails + ${W} (Rails)`;else if(U)B=`${z} + gem rails (Rails)`;else B=`${W} (Rails layout)`;else if(K)H="backend",N=K[1],B=`${z} + gem ${K[0]} (Ruby backend)`;else if(q.hit)H="cli",N=BZ(Z,Lz)?.[1]||"",B=`${z} + ${q.why} (Ruby CLI)`;else H="library",B=`${z} (Ruby library)`;return{appType:H,framework:N,packageManager:J,found:B}}import{existsSync as MZ,readFileSync as _N,readdirSync as FN,statSync as CN}from"fs";import{join as b2}from"path";var s0={version:1,_doc:"SINGLE SOURCE of Swift detection KNOWLEDGE (Truth-is-faf-cli). Kill line: Package.swift alone ≠ app. Static parse of products + package URLs + product names + light xcodeproj productType. Never execute Package.swift / swift build. 2026-08-03 post-intel swift-edition.",mcpPackageUrls:["modelcontextprotocol/swift-sdk","github.com/modelcontextprotocol/swift-sdk"],mcpProducts:["MCP"],serverPackageUrls:[["vapor/vapor","Vapor"],["github.com/vapor/vapor","Vapor"],["hummingbird-project/hummingbird","Hummingbird"],["github.com/hummingbird-project/hummingbird","Hummingbird"]],serverProducts:[["Vapor","Vapor"],["Hummingbird","Hummingbird"]],cliPackageUrls:[["apple/swift-argument-parser","ArgumentParser"],["github.com/apple/swift-argument-parser","ArgumentParser"]],cliProducts:[["ArgumentParser","ArgumentParser"]],appProductTypes:["com.apple.product-type.application"],cliProductTypes:["com.apple.product-type.tool"],vaporLayoutFiles:["Sources/App/configure.swift","Sources/App/routes.swift","Sources/App/entrypoint.swift"]};var PN=s0.mcpPackageUrls.map(($)=>$.toLowerCase()),EN=s0.mcpProducts.map(($)=>$.toLowerCase()),wN=s0.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),SN=s0.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),jN=s0.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),xN=s0.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),bN=s0.appProductTypes,kN=s0.cliProductTypes,yN=s0.vaporLayoutFiles;function vN($){return MZ(b2($,"Package.swift"))||OZ($).length>0}function OZ($){try{return FN($).filter((Z)=>{if(!Z.endsWith(".xcodeproj"))return!1;try{return CN(b2($,Z)).isDirectory()}catch{return!1}})}catch{return[]}}function Tz($){try{return _N($,"utf-8")}catch{return null}}function fN($){let Z=gN($),X=Z.toLowerCase(),z=[],J=/\.package\s*\(\s*url\s*:\s*"([^"]+)"/gi,Q;while((Q=J.exec(Z))!==null)z.push(Q[1]);let Y=/\.package\s*\(\s*url\s*:\s*'([^']+)'/gi;while((Q=Y.exec(Z))!==null)z.push(Q[1]);let W=[],U=/\.product\s*\(\s*name\s*:\s*"([^"]+)"/gi;while((Q=U.exec(Z))!==null)W.push(Q[1]);let q=/\.product\s*\(\s*name\s*:\s*'([^']+)'/gi;while((Q=q.exec(Z))!==null)W.push(Q[1]);let G=/\.library\s*\(/.test(X),V=/\.executable\s*\(/.test(X),K=/\.plugin\s*\(/.test(X)&&!G&&!V?!0:/\bproducts\s*:\s*\[[\s\S]*?\.plugin\s*\(/.test(X),H=/\.executabletarget\s*\(/.test(X),N=/\.target\s*\(/.test(X)&&!H?!0:(X.match(/\.target\s*\(/g)||[]).length>(X.match(/\.executabletarget\s*\(/g)||[]).length+(X.match(/\.testtarget\s*\(/g)||[]).length;return{packageUrls:z,productNames:W,hasLibraryProduct:G,hasExecutableProduct:V,hasPluginProduct:!!K,hasExecutableTarget:H,hasLibraryTarget:N}}function gN($){let Z="",X=0;while(X<$.length){if($[X]==='"'||$[X]==="'"){let z=$[X];Z+=z,X++;while(X<$.length){if($[X]==="\\"&&X+1<$.length){Z+=$[X]+$[X+1],X+=2;continue}if(Z+=$[X],$[X]===z){X++;break}X++}continue}if($[X]==="/"&&$[X+1]==="/"){X+=2;while(X<$.length&&$[X]!==`
|
|
216
|
+
`)X++;continue}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<$.length&&!($[X]==="*"&&$[X+1]==="/"))X++;X+=2;continue}Z+=$[X],X++}return Z}function hN($,Z){let X=$.map((J)=>J.toLowerCase()),z;for(let J of Z)for(let Q of X)if(Q.includes(J)&&(!z||J.length>z.length))z=J;return z}function Dz($,Z){let X=$.map((J)=>J.toLowerCase()),z;for(let[J,Q]of Z)for(let Y of X)if(Y.includes(J)&&(!z||J.length>z[0].length))z=[J,Q];return z}function Iz($,Z){let X=$.map((J)=>J.toLowerCase()),z;for(let[J,Q]of Z)if(X.includes(J)&&(!z||J.length>z[0].length))z=[J,Q];return z}function uN($){let Z=$.map((X)=>X.toLowerCase());return EN.some((X)=>Z.includes(X))}function mN($){let Z=!1,X=!1,z;for(let J of OZ($)){let Q=b2($,J,"project.pbxproj"),Y=Tz(Q);if(!Y)continue;for(let W of bN)if(Y.includes(W))Z=!0,z=W;for(let W of kN)if(Y.includes(W)){if(X=!0,!z)z=W}}return{hasApplication:Z,hasTool:X,hit:z}}function cN($){for(let Z of yN)if(MZ(b2($,Z)))return Z;return}function k2($){if(!vN($))return null;let Z=b2($,"Package.swift"),X=MZ(Z),z=OZ($),J=z.length>0,Q=null;if(X){let u=Tz(Z);if(u)Q=fN(u)}let Y=J?mN($):{hasApplication:!1,hasTool:!1},W=cN($),U=Q?.packageUrls??[],q=Q?.productNames??[],G=hN(U,PN),V=uN(q),K=Dz(U,wN),H=Iz(q,SN),N=Dz(U,jN),B=Iz(q,xN),O=!!(G||V),T=!!(K||H||W),F=!!(Q?.hasExecutableProduct||Q?.hasExecutableTarget),w=!!(N||B),S=Y.hasApplication,y=X&&J?"spm+xcode":X?"spm":"xcode",b,l="",_;if(O)if(b="mcp",l="MCP",V)_="Package.swift + product MCP (Swift MCP)";else _=`Package.swift + ${G} (Swift MCP)`;else if(T)if(b="backend",l=H?.[1]||K?.[1]||(W?"Vapor":""),H)_=`Package.swift + product ${H[1]} (Swift backend)`;else if(K)_=`Package.swift + ${K[1]} (Swift backend)`;else _=`${W} (Swift backend layout)`;else if(S)b="app",l="",_=`${z[0]} + ${Y.hit||"application"} (Swift app)`;else if(w||F&&!T&&!O)if(b="cli",l=B?.[1]||N?.[1]||"",B)_=`Package.swift + product ${B[1]} (Swift CLI)`;else if(N)_=`Package.swift + ${N[1]} (Swift CLI)`;else if(Q?.hasExecutableProduct)_="Package.swift + .executable product (Swift CLI)";else _="Package.swift + .executableTarget (Swift CLI)";else if(Y.hasTool&&!X)b="cli",_=`${z[0]} + tool productType (Swift CLI)`;else if(X)if(b="library",Q?.hasLibraryProduct)_="Package.swift + .library product (Swift library)";else _="Package.swift (Swift library)";else b="library",_=`${z[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:b,framework:l,packageManager:y,found:_}}function lN($){let Z=j($,"Cargo.toml");if(!x(Z))return null;try{let z=a0(Z,"utf-8").match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return z?z[1]:null}catch{return null}}function dN($){let Z=j($,"Cargo.toml");if(!x(Z))return!1;try{let X=a0(Z,"utf-8");return/^\s*\[\[bin\]\]/m.test(X)}catch{return!1}}function pN($,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=lN($);if(X&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(X))return`Cargo.toml name "${X}" → sdk`;return null}function iN($){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=j($,X);if(!x(z))continue;try{let J=JSON.parse(a0(z,"utf-8"));if(typeof J.manifest_version==="number")return`${X} manifest_version ${J.manifest_version} (browser extension)`}catch{}}return null}function nN($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,X=j($,"pyproject.toml");if(x(X))try{let Q=a0(X,"utf-8").match(Z);if(Q)return`pyproject.toml depends on ${Q[1]}`}catch{}let z=j($,"requirements.txt");if(x(z))try{let Q=a0(z,"utf-8").match(Z);if(Q)return`requirements.txt contains ${Q[1]}`}catch{}return null}function rN($,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(x(j($,"ios"))&&x(j($,"android")))return"ios/ + android/ dirs";return null}function sN($,Z){let X=j($,"Cargo.toml");if(x(X))try{let J=a0(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=j($,"build.zig");if(x(z))try{let J=a0(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 aN($,Z){if(!x(j($,"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 oN($,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?.bin)return null;if(Z?.files&&Z.files.length>0){let X=/^(dist|src|lib|build|bin)(\/|$)|\/(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)||Q==="README.md"||Q==="docs"||Q==="docs/");if(!z&&J)return"package.json files = docs/examples only (no source)"}return null}function tN($,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 eN($,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((W)=>X[W]),Y=J.some((W)=>X[W]);if(Q&&Y)return"auth + payment dependencies";return null}function $D($,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 ZD($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||x(j($,"pnpm-workspace.yaml"))))return null;return"private workspace + multi-package"}function l1($){let Z=j($,"package.json");if(!x(Z))return null;try{return JSON.parse(a0(Z,"utf-8"))}catch{return null}}function Rz($,Z){if(!Z.includes("*"))return x(j($,Z));let X=Z.split("/");if(X.length===1){let W=Z.split("*")[0];try{return Az($).some((U)=>U.startsWith(W))}catch{return!1}}let z=j($,...X.slice(0,-1)),J=X[X.length-1],Q=J.split("*")[0],Y=J.split("*")[1]||"";try{return Az(z).some((W)=>W.startsWith(Q)&&W.endsWith(Y))}catch{return!1}}function XD($,Z,X){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return Rz(X,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!Rz(X,$.pattern))return!1;try{let z=j(X,$.pattern);if(!x(z))return!1;return a0(z,"utf-8").toLowerCase().includes($.key.toLowerCase())}catch{return!1}}default:return!1}}function LZ($){let Z=l1($);return Qz.map((X)=>{let J=X.signals.filter((Q)=>XD(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 _z($){let Z=l1($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(x(j($,"tsconfig.json")))return"TypeScript";if(x(j($,"Cargo.toml")))return"Rust";if(x(j($,"go.mod")))return"Go";if(F2($).length>0)return"C#";if(x(j($,"pyproject.toml"))||x(j($,"setup.py")))return"Python";if(x(j($,"Gemfile")))return"Ruby";if(HZ($)){let X=E2($);if(X)return X.mainLanguage==="Java/Kotlin"?"Kotlin":X.mainLanguage;return"Java"}if(x(j($,"Package.swift")))return"Swift";if(x(j($,"build.zig")))return"Zig";if(x(j($,"pubspec.yaml")))return"Dart";if(Z)return"JavaScript";return"Unknown"}function Fz($){let Z=l1($),X=LZ($),z=[],J=oN($,Z);if(J)return z.push(J),{type:"documentation",found:z};let Q=pN($,Z);if(Q)return z.push(Q),{type:"sdk",found:z};let Y=iN($);if(Y)return z.push(Y),{type:"extension",found:z};let W=$D($,Z,X);if(W)return z.push(W),{type:"mcpaas",found:z};let U=eN($,Z);if(U)return z.push(U),{type:"saas",found:z};let q=sN($,Z);if(q)return z.push(q),{type:"wasm",found:z};let G=S8($);if(G)return z.push(G.found),{type:G.appType,found:z};let V=b8($);if(V)return z.push(V.found),{type:V.appType,found:z};let K=y8($);if(K)return z.push(K.found),{type:K.appType,found:z};let H=E2($);if(H)return z.push(H.found),{type:H.appType,found:z};let N=f8($);if(N)return z.push(N.found),{type:N.appType,found:z};let B=k2($);if(B)return z.push(B.found),{type:B.appType,found:z};let O=rN($,Z);if(O)return z.push(O),{type:"mobile",found:z};if(X.some((f)=>f.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(dN($))return z.push("Cargo.toml [[bin]]"),{type:"cli",found:z};if(x(j($,"build.zig"))){if(z.push("build.zig"),x(j($,"src/main.zig")))return z.push("src/main.zig"),{type:"cli",found:z};if(x(j($,"src/root.zig")))return z.push("src/root.zig"),{type:"library",found:z}}let F=X.some((f)=>f.slug==="svelte"||f.slug==="sveltekit");if(Z?.private===!0&&(x(j($,"pnpm-workspace.yaml"))||Z?.workspaces!==void 0)&&F)return z.push("private workspace","Svelte"),{type:"framework",found:z};if(F)return z.push("Svelte/SvelteKit"),{type:"svelte",found:z};let S=X.some((f)=>f.category==="frontend"),y=X.some((f)=>f.category==="backend");if(Z?.private&&(Z.workspaces||x(j($,"pnpm-workspace.yaml")))&&S&&y)return z.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:z};let b=ZD($,Z);if(b)return z.push(b),{type:"monorepo-root",found:z};let l=tN($,Z,X);if(l)return z.push(l),{type:"website",found:z};if(X.some((f)=>f.slug==="nextjs"||f.slug==="nuxt"))return z.push(X.find((f)=>f.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:z};let u=X.some((f)=>f.category==="frontend"),V0=X.some((f)=>f.category==="backend");if(u&&V0)return z.push("frontend framework","backend framework"),{type:"fullstack",found:z};if(u)return z.push("frontend framework"),{type:"frontend",found:z};if(V0)return z.push("backend framework"),{type:"backend",found:z};let O0=nN($);if(O0)return z.push(O0),{type:"data-science",found:z};let E=aN($,Z);if(E)return z.push(E),{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 Cz($){if(x(j($,"bunfig.toml")))return"Bun";if(x(j($,"deno.json"))||x(j($,"deno.jsonc")))return"Deno";if(l1($))return"Node.js";if(x(j($,"Cargo.toml")))return"Rust";if(x(j($,"go.mod")))return"Go";if(F2($).length>0)return".NET";if(x(j($,"pubspec.yaml")))return"Dart";return"Unknown"}function Pz($){if(x(j($,"pubspec.yaml")))return"pub";if(x(j($,"go.mod")))return"go modules";if(F2($).length>0)return"NuGet";if(x(j($,"pom.xml")))return"maven";if(x(j($,"build.gradle"))||x(j($,"build.gradle.kts"))||x(j($,"settings.gradle"))||x(j($,"settings.gradle.kts")))return"gradle";if(x(j($,"bun.lockb"))||x(j($,"bun.lock")))return"bun";if(x(j($,"pnpm-lock.yaml")))return"pnpm";if(x(j($,"yarn.lock")))return"yarn";if(x(j($,"package-lock.json")))return"npm";return"npm"}function Ez($){if(x(j($,".github/workflows")))return"GitHub Actions";if(x(j($,".gitlab-ci.yml")))return"GitLab CI";if(x(j($,".circleci")))return"CircleCI";if(x(j($,"Jenkinsfile")))return"Jenkins";return null}function wz($){if(x(j($,"vercel.json")))return"Vercel";if(x(j($,"netlify.toml")))return"Netlify";if(x(j($,"wrangler.toml")))return"Cloudflare";if(x(j($,"Dockerfile")))return"Docker";if(x(j($,"fly.toml")))return"Fly.io";if(x(j($,"render.yaml")))return"Render";return null}function Sz($){let Z=j($,"svelte.config.js");if(!x(Z))return null;try{let z=a0(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 jz($){let Z=l1($);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(x(j($,"tsconfig.json"))&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function g8($){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)=>x(j($,X)))}function h8($,Z){let X={};if(Z?.scripts){for(let z of["build","test","lint","dev","start"])if(Z.scripts[z]){let J=x(j($,"bun.lock"))||x(j($,"bun.lockb"))?"bun run":"npm run";X[z]=`${J} ${z}`}}if(x(j($,"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(x(j($,"build.zig"))){if(!X.build)X.build="zig build";if(!X.test)X.test="zig build test"}if(x(j($,"go.mod"))){if(!X.build)X.build="go build ./...";if(!X.test)X.test="go test ./..."}if(x(j($,"pyproject.toml"))||x(j($,"pytest.ini"))){if(!X.test)X.test="pytest"}return X}function xz($,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(x(j($,"bunfig.toml")))J.push("Bun");else if(x(j($,"deno.json"))||x(j($,"deno.jsonc")))J.push("Deno");if(J.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let W of Y)if(!J.some((U)=>U.toLowerCase().includes(W.toLowerCase())))J.push(W)}return J}function u8($){let Z=l1($),X=LZ($),z=_z($),J=Fz($),Q=J.type,Y=Cz($),W=Pz($),U=Ez($),q=wz($),G=jz($),V=X.find((s)=>s.category==="frontend"),K=X.find((s)=>s.category==="css"),H=X.find((s)=>s.category==="ui"),N=X.find((s)=>s.category==="state"),B=X.find((s)=>s.category==="backend"),O=X.find((s)=>s.category==="database"),T=O$[Q]||O$.library,F=Q==="framework",w=X.some((s)=>s.slug==="svelte"||s.slug==="sveltekit"),S=F&&w?"svelte":F?null:null,y=Q==="svelte"||S==="svelte",b=y?Sz($):null,l=y&&X.some((s)=>s.slug==="sveltekit"),_=new Set(["css_framework","ui_library","database","connection","hosting"]),u={},V0=t.filter((s)=>s.path.startsWith("stack."));for(let s of V0){let $0=s.path.replace("stack.","");if(!T.includes(s.category)){u[$0]="slotignored";continue}if(F&&_.has($0)){u[$0]="slotignored";continue}switch($0){case"frontend":u[$0]=V?.name??(Q==="cli"?"CLI":"");break;case"css_framework":u[$0]=K?.name??"";break;case"ui_library":u[$0]=H?.name??"";break;case"state_management":u[$0]=y?N?.name??"Runes":N?.name??"";break;case"backend":u[$0]=y?l?"SvelteKit":B?.name??"":B?.name??"";break;case"api_type":u[$0]=l?"Server Routes":"";break;case"runtime":u[$0]=Y!=="Unknown"?Y:"";break;case"database":u[$0]=O?.name??"";break;case"connection":u[$0]=O?.name??"";break;case"hosting":if(y&&b)u[$0]=b;else u[$0]=q??"";break;case"build":u[$0]=y?"Vite":G??"";break;case"cicd":u[$0]=U??"";break;case"package_manager":u[$0]=W;break;default:u[$0]="";break}}let O0={},E=t.filter((s)=>s.path.startsWith("monorepo."));for(let s of E){let $0=s.path.replace("monorepo.","");if(!T.includes(s.category))O0[$0]="slotignored";else O0[$0]=""}let f={name:Z?.name??$.split("/").pop()??"project",goal:Z?.description??"",main_language:z,type:Q};if(F&&S)f.framework=S;let _0=xz($,Z,X,z),e0=g8($),M9=h8($,Z),y6={faf_version:R1,project:f,stack:u,human_context:{who:"",what:Z?.description??"",why:"",where:"",when:"",how:""},monorepo:O0,_meta:{found:J.found}};if(_0.length>0)y6.tech_stack=_0;if(e0.length>0)y6.key_files=e0;if(Object.keys(M9).length>0)y6.commands=M9;return y6}import{existsSync as JD,readFileSync as QD}from"fs";import{join as YD}from"path";var bz={MIN_LENGTH:8,MAX_LENGTH:280},zD=[/^(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 p0($){let Z=$.trim();if(Z.length<bz.MIN_LENGTH)return!1;if(Z.length>bz.MAX_LENGTH)return!1;if(zD.some((X)=>X.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
|
|
217
217
|
`).length>4)return!1;return!0}function WD($){let Z=$.split(`
|
|
218
218
|
`),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(`
|
|
219
219
|
`)}function UD($){let X=WD($).split(`
|
|
220
|
-
`),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
|
|
221
|
-
`),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,W=[];z++;while(z<X.length){let U=X[z].trim(),q=U.match(/^(#{1,6})\s+/);if(q&&q[1].length<=Y)break;if(U===""){if(W.length>0)break;z++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(U))break;W.push(U),z++}if(W.length===0)return null;return W.join(" ").trim()}z++}return null}function qD($){let Z=
|
|
222
|
-
`),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 W=Y[1].trim();W=W.replace(/\s*#.*$/,"").trim();let U=W.match(/^"((?:[^"\\]|\\.)*)"$/)||W.match(/^'((?:[^'\\]|\\.)*)'$/);if(U)return U[1];return W}}return null}function NZ($){let Z=ND($,"Cargo.toml");if(!OD(Z))return{};let X;try{X=LD(Z,"utf-8")}catch{return{}}let z=DD(X,"description");if(z&&d0(z))return{project:{goal:z}};return{}}function ID($,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 u8($){return ID(LZ($),NZ($))}import{existsSync as TD,readdirSync as bz,readFileSync as AD}from"fs";import{join as IZ,dirname as RD,extname as _D,resolve as FD}from"path";var DZ={"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"],slots:{packageManager:"bundler",mainLanguage:"Ruby"},priority:35,intelligence:"ultra-high"},"Gemfile.lock":{frameworks:["Ruby"],slots:{packageManager:"bundler",mainLanguage:"Ruby"},priority:34,intelligence:"high"},"composer.json":{frameworks:["PHP","Laravel","Symfony"],slots:{packageManager:"composer",mainLanguage:"PHP"},priority:35,intelligence:"ultra-high"},"Cargo.toml":{frameworks:["Rust"],slots:{packageManager:"cargo",mainLanguage:"Rust",buildTool:"cargo"},priority:36,intelligence:"ultra-high"},"go.mod":{frameworks:["Go"],slots:{packageManager:"go modules",mainLanguage:"Go",buildTool:"go build"},priority:36,intelligence:"ultra-high"},"Package.swift":{frameworks:["Swift"],slots:{packageManager:"spm",mainLanguage:"Swift",buildTool:"swift build"},priority:36,intelligence:"ultra-high"},"*.csproj":{frameworks:["C#",".NET"],slots:{packageManager:"NuGet",mainLanguage:"C#",buildTool:"dotnet"},priority:36,intelligence:"ultra-high"},"pubspec.yaml":{frameworks:["Dart"],slots:{packageManager:"pub",mainLanguage:"Dart"},priority:35,intelligence:"ultra-high"},"pom.xml":{frameworks:["Java"],slots:{packageManager:"maven",mainLanguage:"Java",buildTool:"maven"},priority:35,intelligence:"ultra-high"},"build.gradle":{frameworks:["Java","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Java",buildTool:"gradle"},priority:35,intelligence:"ultra-high"},"settings.gradle":{frameworks:["Java","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Java",buildTool:"gradle"},priority:34,intelligence:"high"},"settings.gradle.kts":{frameworks:["Kotlin","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Kotlin",buildTool:"gradle"},priority:34,intelligence:"high"},"next.config.js":{frameworks:["Next.js"],slots:{framework:"Next.js",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","Swift"],slots:{packageManager:"CocoaPods",mainLanguage:"Swift/Objective-C"},priority:30,intelligence:"high"},"build.gradle.kts":{frameworks:["Kotlin","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Kotlin",buildTool:"gradle"},priority:35,intelligence:"ultra-high"},"*.ipynb":{frameworks:["Jupyter","Python"],slots:{mainLanguage:"Python",framework:"Jupyter Notebook"},priority:30,intelligence:"high"},MLproject:{frameworks:["MLflow"],slots:{mainLanguage:"Python",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 CD=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),PD=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),ED={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"]},wD=[["packageManager","package-manager"],["pkg_manager","package-manager"],["mainLanguage","language"],["main_language","language"],["framework","framework"],["backend","backend"],["database","database"],["db","database"],["cicd","ci-cd"],["hosting","hosting"],["buildTool","build"],["build_tool","build"],["build","build"],["runtime","runtime"],["cssFramework","css"],["css","css"],["uiLibrary","ui-library"],["stateManagement","state-management"],["apiType","api"],["api","api"]];function SD($,Z){for(let[X,z]of wD)if(X in $)return z;return Z.length>0?"framework":"config"}function jD($){try{let Z=JSON.parse(AD($,"utf-8")),X=["background","content_scripts","action","browser_action","permissions"].some((z)=>(z in Z));if(typeof Z.manifest_version==="number"&&X)return"chrome";return"other"}catch{return"other"}}function xD($){let Z=[],X=FD($),z=TD(IZ($,".git")),J=new Set;for(let Q=0;Q<10;Q++){let Y;try{Y=bz(X)}catch{break}for(let U of Y){if(U.toLowerCase().endsWith(".csproj")){let G=k8(X);if(G){let V={mainLanguage:"C#",packageManager:"NuGet",buildTool:"dotnet"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="mobile"&&G.framework)V.framework=G.framework;if(G.targetFramework)V.runtime=G.targetFramework;let K=G.framework?[G.framework,"C#",".NET"]:["C#",".NET"];Z.push({slots:V,priority:36,frameworks:K,fileName:U})}continue}if(U.endsWith(".xcodeproj")){let G=b2(X);if(G){let V={mainLanguage:"Swift",packageManager:G.packageManager==="spm"?"spm":"Xcode",buildTool:G.packageManager.includes("spm")?"swift build":"xcodebuild"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="app")V.framework=G.framework||"Swift App";let K=G.framework?[G.framework,"Swift"]:["Swift"];Z.push({slots:V,priority:36,frameworks:K,fileName:U})}continue}let q=DZ[U];if(!q)continue;if(U==="manifest.json"&&jD(IZ(X,U))!=="chrome")continue;if(U==="pubspec.yaml"){let G=w8(X);if(G){let V={mainLanguage:"Dart",packageManager:"pub"};if(G.isFlutter){if(V.framework="Flutter",G.stateManagement)V.stateManagement=G.stateManagement}else if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="mcp")V.apiType="MCP";Z.push({slots:V,priority:q.priority,frameworks:G.isFlutter?["Flutter","Dart"]:["Dart"],fileName:U});continue}}if(U==="go.mod"){let G=x8(X);if(G){let V={mainLanguage:"Go",packageManager:"go modules",buildTool:"go build"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";let K=G.framework?[G.framework,"Go"]:["Go"];Z.push({slots:V,priority:q.priority,frameworks:K,fileName:U});continue}}if(U==="Gemfile"||U==="Gemfile.lock"||U==="gems.rb"){let G=v8(X);if(G){let V={mainLanguage:"Ruby",packageManager:G.packageManager};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";let K=G.framework?[G.framework,"Ruby"]:["Ruby"];Z.push({slots:V,priority:q.priority??35,frameworks:K,fileName:U});continue}}if(U==="Package.swift"){let G=b2(X);if(G){let V={mainLanguage:"Swift",packageManager:G.packageManager==="xcode"?"Xcode":"spm",buildTool:"swift build"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="app")V.framework=G.framework||"SwiftUI/App";let K=G.framework?[G.framework,"Swift"]:["Swift"];Z.push({slots:V,priority:q.priority??36,frameworks:K,fileName:U});continue}}if(U==="pom.xml"||U==="build.gradle"||U==="build.gradle.kts"||U==="settings.gradle"||U==="settings.gradle.kts"){if(J.has(X))continue;J.add(X);let G=P2(X);if(G){let V={mainLanguage:G.mainLanguage==="Java/Kotlin"?"Kotlin":G.mainLanguage,packageManager:G.buildTool==="maven"?"maven":"gradle",buildTool:G.buildTool};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="mobile")V.framework=G.framework||"Android";if(G.facets.includes("multiplatform"))V.framework=G.framework||"Kotlin Multiplatform";let K=G.framework?[G.framework,"JVM",G.mainLanguage==="Kotlin"?"Kotlin":"Java"]:["JVM",G.mainLanguage==="Kotlin"?"Kotlin":"Java"];Z.push({slots:V,priority:q.priority??35,frameworks:K,fileName:U});continue}}Z.push({slots:q.slots||{},priority:q.priority,frameworks:q.frameworks,fileName:U})}if(z&&Q===0)break;let W=RD(X);if(W===X)break;X=W}return Z}function bD($){let Z=[];for(let X of kz($,2,{count:0})){let z=DZ[`*${X}`],J=z?.slots?.mainLanguage;if(J)Z.push({slots:{mainLanguage:J},priority:z.priority,frameworks:z.frameworks})}return Z}function kD($){let Z=[...xD($),...bD($)],X={},z={},J=new Set;for(let q of Z){q.frameworks.forEach((G)=>J.add(G));for(let[G,V]of Object.entries(q.slots))if(V&&!V.includes("/")&&(!(G in X)||q.priority>z[G]))X[G]=V,z[G]=q.priority}let Q=new Map;for(let q of Z){if(!q.fileName)continue;if(!Q.has(q.fileName))Q.set(q.fileName,{fileName:q.fileName,category:SD(q.slots,q.frameworks),priority:q.priority})}let Y=[...Q.values()].sort((q,G)=>G.priority-q.priority||q.fileName.localeCompare(G.fileName)),W=[];if(X.mainLanguage)W.push(X.mainLanguage.toLowerCase());if(X.framework)W.push(X.framework.toLowerCase());let U=W.length>0?W.join("-"):"unknown-stack";return{slotFills:X,frameworks:[...J],confirmedCount:Z.length,discoveredFormats:Y,stackSignature:U}}function m8($){let{slotFills:Z}=kD($),X={};for(let[z,J]of Object.entries(Z)){let Q=ED[z];if(!Q||!J)continue;let[Y,W]=Q;if(Y==="project")(X.project??={})[W]=J;else(X.stack??={})[W]=J}return X}function kz($,Z,X){let z=new Set;if(Z<0||X.count>400)return z;let J;try{J=bz($,{withFileTypes:!0})}catch{return z}for(let Q of J){if(X.count++>400)break;if(!Q.isDirectory()){let Y=_D(Q.name);if(PD.has(Y))z.add(Y);continue}if(CD.has(Q.name)||Q.name.startsWith("."))continue;for(let Y of kz(IZ($,Q.name),Z-1,X))z.add(Y)}return z}import{existsSync as yz,readFileSync as vz}from"fs";import{join as fz}from"path";var L0=($,Z,X)=>({value:$,source:Z,confidence:X});function yD($){let Z=vD($),X=fD($),z={},J=(Q,Y)=>{if(Y)z[Q]=Y};return J("what",gD(Z,X)),J("who",hD(X)),J("why",uD(X)),J("where",mD(Z,X)),J("when",cD(X)),J("how",lD(Z,X)),z}function c8($){let Z=yD($),X={};return Object.keys(Z).forEach((z)=>{let J=Z[z];if(J)X[z]=J.value}),X}function vD($){let Z=fz($,"package.json");if(!yz(Z))return null;try{return JSON.parse(vz(Z,"utf-8"))}catch{return null}}function fD($){let Z=fz($,"README.md");if(!yz(Z))return"";let X;try{X=vz(Z,"utf-8")}catch{return""}return X.split(`
|
|
220
|
+
`),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 d1($,Z){let X=$.split(`
|
|
221
|
+
`),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,W=[];z++;while(z<X.length){let U=X[z].trim(),q=U.match(/^(#{1,6})\s+/);if(q&&q[1].length<=Y)break;if(U===""){if(W.length>0)break;z++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(U))break;W.push(U),z++}if(W.length===0)return null;return W.join(" ").trim()}z++}return null}function qD($){let Z=d1($,/^(use\s+cases?|goal)\b/i);if(Z&&p0(Z))return Z;let X=UD($);if(X&&p0(X))return X;return}function GD($){let Z=d1($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&p0(Z))return Z;return}function VD($){let Z=d1($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&p0(Z))return Z;return}function KD($){let Z=d1($,/^(why|motivation|problem|rationale)\b/i);if(Z&&p0(Z))return Z;return}function HD($){let Z=d1($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&p0(Z))return Z;return}function BD($){let Z=d1($,/^(status|history|timeline|since|launched)\b/i);if(Z&&p0(Z))return Z;return}function MD($){let Z=d1($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&p0(Z))return Z;return}function NZ($){let Z=["README.md","README.MD","Readme.md","readme.md"],X=null;for(let H of Z){let N=YD($,H);if(JD(N)){X=N;break}}if(!X)return{};let z;try{z=QD(X,"utf-8")}catch{return{}}let J={},Q=qD(z);if(Q)J.project={goal:Q};let Y={},W=GD(z);if(W)Y.what=W;let U=VD(z);if(U)Y.who=U;let q=KD(z);if(q)Y.why=q;let G=HD(z);if(G)Y.where=G;let V=BD(z);if(V)Y.when=V;let K=MD(z);if(K)Y.how=K;if(Object.keys(Y).length>0)J.human_context=Y;return J}import{existsSync as OD,readFileSync as LD}from"fs";import{join as ND}from"path";function DD($,Z){let X=$.split(`
|
|
222
|
+
`),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 W=Y[1].trim();W=W.replace(/\s*#.*$/,"").trim();let U=W.match(/^"((?:[^"\\]|\\.)*)"$/)||W.match(/^'((?:[^'\\]|\\.)*)'$/);if(U)return U[1];return W}}return null}function DZ($){let Z=ND($,"Cargo.toml");if(!OD(Z))return{};let X;try{X=LD(Z,"utf-8")}catch{return{}}let z=DD(X,"description");if(z&&p0(z))return{project:{goal:z}};return{}}function ID($,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 m8($){return ID(NZ($),DZ($))}import{existsSync as TD,readdirSync as kz,readFileSync as AD}from"fs";import{join as TZ,dirname as RD,extname as _D,resolve as FD}from"path";var IZ={"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"],slots:{packageManager:"bundler",mainLanguage:"Ruby"},priority:35,intelligence:"ultra-high"},"Gemfile.lock":{frameworks:["Ruby"],slots:{packageManager:"bundler",mainLanguage:"Ruby"},priority:34,intelligence:"high"},"composer.json":{frameworks:["PHP","Laravel","Symfony"],slots:{packageManager:"composer",mainLanguage:"PHP"},priority:35,intelligence:"ultra-high"},"Cargo.toml":{frameworks:["Rust"],slots:{packageManager:"cargo",mainLanguage:"Rust",buildTool:"cargo"},priority:36,intelligence:"ultra-high"},"go.mod":{frameworks:["Go"],slots:{packageManager:"go modules",mainLanguage:"Go",buildTool:"go build"},priority:36,intelligence:"ultra-high"},"Package.swift":{frameworks:["Swift"],slots:{packageManager:"spm",mainLanguage:"Swift",buildTool:"swift build"},priority:36,intelligence:"ultra-high"},"*.csproj":{frameworks:["C#",".NET"],slots:{packageManager:"NuGet",mainLanguage:"C#",buildTool:"dotnet"},priority:36,intelligence:"ultra-high"},"pubspec.yaml":{frameworks:["Dart"],slots:{packageManager:"pub",mainLanguage:"Dart"},priority:35,intelligence:"ultra-high"},"pom.xml":{frameworks:["Java"],slots:{packageManager:"maven",mainLanguage:"Java",buildTool:"maven"},priority:35,intelligence:"ultra-high"},"build.gradle":{frameworks:["Java","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Java",buildTool:"gradle"},priority:35,intelligence:"ultra-high"},"settings.gradle":{frameworks:["Java","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Java",buildTool:"gradle"},priority:34,intelligence:"high"},"settings.gradle.kts":{frameworks:["Kotlin","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Kotlin",buildTool:"gradle"},priority:34,intelligence:"high"},"next.config.js":{frameworks:["Next.js"],slots:{framework:"Next.js",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","Swift"],slots:{packageManager:"CocoaPods",mainLanguage:"Swift/Objective-C"},priority:30,intelligence:"high"},"build.gradle.kts":{frameworks:["Kotlin","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Kotlin",buildTool:"gradle"},priority:35,intelligence:"ultra-high"},"*.ipynb":{frameworks:["Jupyter","Python"],slots:{mainLanguage:"Python",framework:"Jupyter Notebook"},priority:30,intelligence:"high"},MLproject:{frameworks:["MLflow"],slots:{mainLanguage:"Python",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 CD=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),PD=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),ED={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"]},wD=[["packageManager","package-manager"],["pkg_manager","package-manager"],["mainLanguage","language"],["main_language","language"],["framework","framework"],["backend","backend"],["database","database"],["db","database"],["cicd","ci-cd"],["hosting","hosting"],["buildTool","build"],["build_tool","build"],["build","build"],["runtime","runtime"],["cssFramework","css"],["css","css"],["uiLibrary","ui-library"],["stateManagement","state-management"],["apiType","api"],["api","api"]];function SD($,Z){for(let[X,z]of wD)if(X in $)return z;return Z.length>0?"framework":"config"}function jD($){try{let Z=JSON.parse(AD($,"utf-8")),X=["background","content_scripts","action","browser_action","permissions"].some((z)=>(z in Z));if(typeof Z.manifest_version==="number"&&X)return"chrome";return"other"}catch{return"other"}}function xD($){let Z=[],X=FD($),z=TD(TZ($,".git")),J=new Set;for(let Q=0;Q<10;Q++){let Y;try{Y=kz(X)}catch{break}for(let U of Y){if(U.toLowerCase().endsWith(".csproj")){let G=y8(X);if(G){let V={mainLanguage:"C#",packageManager:"NuGet",buildTool:"dotnet"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="mobile"&&G.framework)V.framework=G.framework;if(G.targetFramework)V.runtime=G.targetFramework;let K=G.framework?[G.framework,"C#",".NET"]:["C#",".NET"];Z.push({slots:V,priority:36,frameworks:K,fileName:U})}continue}if(U.endsWith(".xcodeproj")){let G=k2(X);if(G){let V={mainLanguage:"Swift",packageManager:G.packageManager==="spm"?"spm":"Xcode",buildTool:G.packageManager.includes("spm")?"swift build":"xcodebuild"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="app")V.framework=G.framework||"Swift App";let K=G.framework?[G.framework,"Swift"]:["Swift"];Z.push({slots:V,priority:36,frameworks:K,fileName:U})}continue}let q=IZ[U];if(!q)continue;if(U==="manifest.json"&&jD(TZ(X,U))!=="chrome")continue;if(U==="pubspec.yaml"){let G=S8(X);if(G){let V={mainLanguage:"Dart",packageManager:"pub"};if(G.isFlutter){if(V.framework="Flutter",G.stateManagement)V.stateManagement=G.stateManagement}else if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="mcp")V.apiType="MCP";Z.push({slots:V,priority:q.priority,frameworks:G.isFlutter?["Flutter","Dart"]:["Dart"],fileName:U});continue}}if(U==="go.mod"){let G=b8(X);if(G){let V={mainLanguage:"Go",packageManager:"go modules",buildTool:"go build"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";let K=G.framework?[G.framework,"Go"]:["Go"];Z.push({slots:V,priority:q.priority,frameworks:K,fileName:U});continue}}if(U==="Gemfile"||U==="Gemfile.lock"||U==="gems.rb"){let G=f8(X);if(G){let V={mainLanguage:"Ruby",packageManager:G.packageManager};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";let K=G.framework?[G.framework,"Ruby"]:["Ruby"];Z.push({slots:V,priority:q.priority??35,frameworks:K,fileName:U});continue}}if(U==="Package.swift"){let G=k2(X);if(G){let V={mainLanguage:"Swift",packageManager:G.packageManager==="xcode"?"Xcode":"spm",buildTool:"swift build"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="app")V.framework=G.framework||"SwiftUI/App";let K=G.framework?[G.framework,"Swift"]:["Swift"];Z.push({slots:V,priority:q.priority??36,frameworks:K,fileName:U});continue}}if(U==="pom.xml"||U==="build.gradle"||U==="build.gradle.kts"||U==="settings.gradle"||U==="settings.gradle.kts"){if(J.has(X))continue;J.add(X);let G=E2(X);if(G){let V={mainLanguage:G.mainLanguage==="Java/Kotlin"?"Kotlin":G.mainLanguage,packageManager:G.buildTool==="maven"?"maven":"gradle",buildTool:G.buildTool};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="mobile")V.framework=G.framework||"Android";if(G.facets.includes("multiplatform"))V.framework=G.framework||"Kotlin Multiplatform";let K=G.framework?[G.framework,"JVM",G.mainLanguage==="Kotlin"?"Kotlin":"Java"]:["JVM",G.mainLanguage==="Kotlin"?"Kotlin":"Java"];Z.push({slots:V,priority:q.priority??35,frameworks:K,fileName:U});continue}}Z.push({slots:q.slots||{},priority:q.priority,frameworks:q.frameworks,fileName:U})}if(z&&Q===0)break;let W=RD(X);if(W===X)break;X=W}return Z}function bD($){let Z=[];for(let X of yz($,2,{count:0})){let z=IZ[`*${X}`],J=z?.slots?.mainLanguage;if(J)Z.push({slots:{mainLanguage:J},priority:z.priority,frameworks:z.frameworks})}return Z}function kD($){let Z=[...xD($),...bD($)],X={},z={},J=new Set;for(let q of Z){q.frameworks.forEach((G)=>J.add(G));for(let[G,V]of Object.entries(q.slots))if(V&&!V.includes("/")&&(!(G in X)||q.priority>z[G]))X[G]=V,z[G]=q.priority}let Q=new Map;for(let q of Z){if(!q.fileName)continue;if(!Q.has(q.fileName))Q.set(q.fileName,{fileName:q.fileName,category:SD(q.slots,q.frameworks),priority:q.priority})}let Y=[...Q.values()].sort((q,G)=>G.priority-q.priority||q.fileName.localeCompare(G.fileName)),W=[];if(X.mainLanguage)W.push(X.mainLanguage.toLowerCase());if(X.framework)W.push(X.framework.toLowerCase());let U=W.length>0?W.join("-"):"unknown-stack";return{slotFills:X,frameworks:[...J],confirmedCount:Z.length,discoveredFormats:Y,stackSignature:U}}function c8($){let{slotFills:Z}=kD($),X={};for(let[z,J]of Object.entries(Z)){let Q=ED[z];if(!Q||!J)continue;let[Y,W]=Q;if(Y==="project")(X.project??={})[W]=J;else(X.stack??={})[W]=J}return X}function yz($,Z,X){let z=new Set;if(Z<0||X.count>400)return z;let J;try{J=kz($,{withFileTypes:!0})}catch{return z}for(let Q of J){if(X.count++>400)break;if(!Q.isDirectory()){let Y=_D(Q.name);if(PD.has(Y))z.add(Y);continue}if(CD.has(Q.name)||Q.name.startsWith("."))continue;for(let Y of yz(TZ($,Q.name),Z-1,X))z.add(Y)}return z}import{existsSync as vz,readFileSync as fz}from"fs";import{join as gz}from"path";var L0=($,Z,X)=>({value:$,source:Z,confidence:X});function yD($){let Z=vD($),X=fD($),z={},J=(Q,Y)=>{if(Y)z[Q]=Y};return J("what",gD(Z,X)),J("who",hD(X)),J("why",uD(X)),J("where",mD(Z,X)),J("when",cD(X)),J("how",lD(Z,X)),z}function l8($){let Z=yD($),X={};return Object.keys(Z).forEach((z)=>{let J=Z[z];if(J)X[z]=J.value}),X}function vD($){let Z=gz($,"package.json");if(!vz(Z))return null;try{return JSON.parse(fz(Z,"utf-8"))}catch{return null}}function fD($){let Z=gz($,"README.md");if(!vz(Z))return"";let X;try{X=fz(Z,"utf-8")}catch{return""}return X.split(`
|
|
223
223
|
`).filter((z)=>!/^\s*\[!\[/.test(z)&&!/^\s*!\[/.test(z)).join(`
|
|
224
|
-
`).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function
|
|
225
|
-
`,"utf-8")}generateProjectDNA(){return sD("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=rD(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((q)=>q.type===U),Q=(U,q,G)=>z.push({type:U,score:$,date:X,version:Z,label:q,emoji:G});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!J("doubled"))Q("doubled","Doubled","2️⃣");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 W=z.findIndex((U)=>U.type==="current");if(W>=0)z.splice(W,1);Q("current","Current","\uD83D\uDCCD")}}
|
|
226
|
-
run ${A("'faf go'")} to fill empty slots`))}
|
|
227
|
-
run ${A("'faf go'")} to reach ✪ Trophy`))}import{existsSync as WI}from"fs";import{join as UI}from"path";var
|
|
224
|
+
`).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function p1($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function N$($,Z){let X=new RegExp(`##?\\s+(${Z})\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n##?|$)`,"i"),z=$.match(X);return z&&z[2]&&z[2].trim().length>20?{body:p1(z[2]),heading:z[1].trim()}:null}function y2($,Z,X=30){for(let z of Z){let J=$.match(z);if(J&&J[1]&&J[1].trim().length>=X)return p1(J[1])}return null}function gD($,Z){if($?.description&&$.description.length>20)return L0(p1($.description),"package.json:description",0.95);let X=N$(Z,"Purpose|What|About|Overview|Description");if(X)return L0(X.body,`README:## ${X.heading}`,0.8);let z=Z.split(/\n\s*\n/).map((Q)=>Q.trim()).find((Q)=>Q.length>30&&!Q.startsWith("#"));if(z)return L0(p1(z),"README:first-paragraph",0.5);let J=y2(Z,[/(?:core|main|primary)\s+(?:problem|challenge)(?:\s+is)?\s*:?\s*([^.\n]{30,})/i,/solves?\s+(?:the\s+)?(?:problem\s+of\s+)?([^.\n]{30,})/i]);return J?L0(J,"README:problem-heuristic",0.6):null}function hD($){let Z=N$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return L0(Z.body,`README:## ${Z.heading}`,0.8);let X=y2($,[/\b(?:designed|built|made)\s+for\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i,/\bfor\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i],8);return X?L0(X,"README:audience-heuristic",0.6):null}function uD($){let Z=N$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return L0(Z.body,`README:## ${Z.heading}`,0.8);let X=y2($,[/(?:our\s+|the\s+)?(?:mission|purpose|goal)\s+is\s+([^.\n]{30,})/i,/\b(?:mission|purpose|goal)\s*:\s*([^.\n]{30,})/i,/(?:built|created|designed)\s+(?:because|to)\s+([^.\n]{30,})/i]);return X?L0(X,"README:mission-heuristic",0.6):null}function mD($,Z){let X=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(X)return L0(p1(X.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return L0(p1($.homepage),"package.json:homepage",0.9);let z=y2(Z,[/\b(?:deployed|hosted|available|published)\s+(?:on|at|via)\s+([^.\n]{3,80})/i],3);return z?L0(z,"README:deploy-heuristic",0.6):null}function cD($){let Z=N$($,"Timeline|Status|Release|Roadmap");if(Z)return L0(Z.body,`README:## ${Z.heading}`,0.8);let X=y2($,[/\b(production\s+since\s+[^.\n]{4,60})/i,/\b((?:in\s+)?(?:production|beta|alpha|development)\s+since\s+[^.\n]{4,60})/i,/\bsince\s+((?:[A-Z][a-z]+\s+)?\d{4}[^.\n]{0,40})/],4);return X?L0(X,"README:since-heuristic",0.6):null}function lD($,Z){let X=$?.scripts?Object.keys($.scripts):[],z=["start","dev","build"].filter((Y)=>X.includes(Y));if(z.length)return L0(p1(z.map((Y)=>`npm run ${Y}`).join(", ")),"package.json:scripts",0.9);let J=N$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(J)return L0(J.body,`README:## ${J.heading}`,0.8);let Q=N$(Z,"Architecture|Approach|How it works|Methodology|How");return Q?L0(Q.body,`README:## ${Q.heading}`,0.7):null}function D$($){let Z=u8($),X=m8($),z=J1(Z,X);dD(z);let J=J1(z,c8($));return J1(J,{human_context:l8($)})}function dD($){let Z=$.project?.type??"library",X=O$[Z]||O$.library;for(let z of t){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 J1($,Z){let X={...$};for(let[z,J]of Object.entries(Z)){let Q=X[z];if(P0(Q))X[z]=J;else if(typeof J==="object"&&J!==null&&!Array.isArray(J)&&typeof Q==="object"&&Q!==null&&!Array.isArray(Q))X[z]=J1(Q,J)}return X}import{existsSync as hz,readFileSync as pD,writeFileSync as iD}from"fs";import{join as nD,basename as rD}from"path";import{createHash as sD}from"crypto";class Q1{projectPath;dnaPath;dna=null;constructor($){this.projectPath=$,this.dnaPath=nD($,".faf-dna")}exists(){return hz(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(!hz(this.dnaPath))return null;try{return this.dna=JSON.parse(pD(this.dnaPath,"utf-8")),this.dna}catch{return null}}save(){if(!this.dna)return;this.dna.lastModified=new Date().toISOString(),iD(this.dnaPath,`${JSON.stringify(this.dna,null,2)}
|
|
225
|
+
`,"utf-8")}generateProjectDNA(){return sD("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=rD(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((q)=>q.type===U),Q=(U,q,G)=>z.push({type:U,score:$,date:X,version:Z,label:q,emoji:G});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!J("doubled"))Q("doubled","Doubled","2️⃣");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 W=z.findIndex((U)=>U.type==="current");if(W>=0)z.splice(W,1);Q("current","Current","\uD83D\uDCCD")}}d();d();import{homedir as uz}from"os";import{resolve as d8}from"path";function aD($=process.cwd()){let Z=d8($),X=d8(uz());if(Z===X)return!0;if(Z==="/"||/^[A-Za-z]:[\\/]?$/.test(Z))return!0;return!1}function I$($=process.cwd(),Z="faf"){if(!aD($))return;let X=d8($)===d8(uz())?"your home directory (~)":"the filesystem root";console.error(`${I("faf")}: ${X} is not a project.`),console.error(""),console.error(` ${A("cd")} into a real repo (or any folder you mean to own), then run again:`),console.error(M(" cd /path/to/your-project")),console.error(M(` ${Z}`)),console.error(""),console.error(M(" Home will never be a git repo for this. project.faf belongs with the code.")),process.exit(1)}function AZ($={}){I$(process.cwd(),"faf init");let Z=process.cwd(),X=$.output?$.output.endsWith(".faf")?$.output:mz(Z,$.output):mz(Z,"project.faf");if(oD(X)&&!$.force)console.error(`project.faf already exists. Use ${A("--force")} to overwrite.`),process.exit(1);let z=D$(Z);o(X,z);let J=c(X),Q=z0(J),Y=new Q1(Z);if(!Y.exists()||$.force)Y.birth(Q.score);if(console.log(`${I("created")} ${X}`),J0(Q,X),console.log(M(` \uD83E\uDDEC Birth DNA ${Q.score}% — your journey starts here (faf dna)`)),Q.score<100)console.log(M(`
|
|
226
|
+
run ${A("'faf go'")} to fill empty slots`))}d();function cz(){let $=new Q1(process.cwd());if(!$.load())console.error(`${A("×")} No FAF DNA found. Run ${A("'faf init'")} to start your journey.`),process.exit(1);let Z=$.getJourney(),X=$.getBirthDNADisplay(),z=X.born.split("T")[0];console.log(),console.log(K0(A("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${I(A(Z))}`),console.log(),console.log(M(` 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(M(" history:"));for(let Q of J)console.log(M(` ${Q}`))}console.log()}import{existsSync as tD}from"fs";import{join as eD}from"path";d();function p8(){I$(process.cwd(),"faf auto");let $=process.cwd(),Z=eD($,"project.faf");if(tD(Z)){let Q=p(Z),Y=J1(Q,m8($)),W=J1(Y,u8($)),U=J1(W,c8($)),q=J1(U,{human_context:l8($)});o(Z,q),console.log(`${I("updated")} ${Z}`)}else o(Z,D$($)),console.log(`${I("created")} ${Z}`);let X=c(Z),z=H0(U0(X)),J=new Q1($);if(J.exists())J.recordGrowth(z.score,["faf auto"]);if(J0(z,Z),z.score<100)console.log(M(`
|
|
227
|
+
run ${A("'faf go'")} to reach ✪ Trophy`))}import{existsSync as WI}from"fs";import{join as UI}from"path";var T$="(terse — 3-4 words)",$I=[{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? ${T$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${T$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${T$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${T$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${T$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${T$}`,header:"How",type:"text",required:!0}],ZI=[{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}],i8=[...$I,...ZI],XI=new Map(i8.map(($)=>[$.path,$])),Ww=Object.fromEntries(i8.map(($)=>[$.path,$]));function n8($){let Z=XI.get($);if(Z)return Z.question;let X=M$.get($)??t.find((z)=>z.canonical===$);return X?`${X.description}?`.replace(/\?\?$/,"?"):`${$}?`}function _Z($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||P0(Z)}return!1}function zI($,Z){let X=$;for(let z of Z.split("."))if(X&&typeof X==="object"&&z in X)X=X[z];else return;return X}function JI($){if($==="project.goal")return!0;return M$.get($)?.category==="human"}function QI($,Z=_Z){let X=[],z=[];for(let J of i8){let Q=zI($,J.path);if(Q==="slotignored")continue;if(!Z(Q))continue;(JI(J.path)?X:z).push(J.path)}return{human:X,sourceable:z}}function YI($,Z,X=_Z){let z=QI(Z,X),J;if($>=100||z.human.length===0&&z.sourceable.length===0)J="done";else if(z.sourceable.length>0)J="can-source";else J="needs-human";let Q=J==="needs-human"?RZ(z):[];return{status:J,score:$,gaps:z,ask:Q}}function RZ($){return $.human.map((Z)=>({path:Z,question:n8(Z)}))}function lz($,Z={}){let X=Math.max(1,Z.maxRounds??5),z=Z.isEmpty??_Z,J=[],Q=0;for(let W=0;W<=X;W++){let U=$.read();if(!U)return{status:"no-faf",score:0,rounds:Q,history:J,ask:[]};let q=$.score(U.yaml);J.push(q);let G=YI(q,U.data,z);if(G.status==="done")return{status:"done",score:q,rounds:Q,history:J,ask:[]};if(G.status==="needs-human")return{status:"needs-human",score:q,rounds:Q,history:J,ask:G.ask};if(J.length>=2&&q<=J[J.length-2])return G.gaps.human.length?{status:"needs-human",score:q,rounds:Q,history:J,ask:RZ(G.gaps)}:{status:"stuck",score:q,rounds:Q,history:J,ask:[]};if(Q>=X)return{status:"capped",score:q,rounds:Q,history:J,ask:RZ(G.gaps)};$.runAuto(),Q++}return{status:"capped",score:J[J.length-1]??0,rounds:Q,history:J,ask:[]}}d();function dz($={}){let Z=process.cwd(),X=UI(Z,"project.faf"),z=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;qI(lz({read:()=>WI(X)?{data:p(X),yaml:c(X)}:{data:{},yaml:""},score:(Q)=>Q?H0(U0(Q)).score:0,runAuto:()=>p8()},{maxRounds:z}))}function qI($){if($.history.length>1)console.log(M(`
|
|
228
228
|
climb: ${$.history.join("% → ")}%`));switch(console.log(""),$.status){case"done":console.log(`${I("done")} — ✪ 100% AI-readiness. The .faf is complete.`);break;case"needs-human":{let Z=$.ask.length;console.log(`${A("Sourced everything detection can.")} ${Z} question${Z===1?"":"s"} only you can answer:`);for(let X of $.ask)console.log(` ${M("•")} ${X.question}`);console.log(M(`
|
|
229
|
-
Answer with ${A("'faf go'")}, or fill them in project.faf directly.`));break}case"stuck":console.log(`${A(`Stopped at ${$.score}%.`)} The remaining gaps need evidence detection couldn't find, and there's nothing only you can answer. Add the missing manifests/README, then re-run.`);break;case"capped":console.log(`${A(`Stopped at ${$.score}% after ${$.rounds} rounds (the cap).`)} Re-run ${A("'faf loop'")} to continue, or raise ${M("--rounds")}.`);break;case"no-faf":console.log(`No project.faf, and none could be created here. Run ${A("'faf init'")} first.`);break}}import{existsSync as
|
|
229
|
+
Answer with ${A("'faf go'")}, or fill them in project.faf directly.`));break}case"stuck":console.log(`${A(`Stopped at ${$.score}%.`)} The remaining gaps need evidence detection couldn't find, and there's nothing only you can answer. Add the missing manifests/README, then re-run.`);break;case"capped":console.log(`${A(`Stopped at ${$.score}% after ${$.rounds} rounds (the cap).`)} Re-run ${A("'faf loop'")} to continue, or raise ${M("--rounds")}.`);break;case"no-faf":console.log(`No project.faf, and none could be created here. Run ${A("'faf init'")} first.`);break}}import{existsSync as a8,statSync as tz}from"fs";import{join as ez,dirname as TI}from"path";import{readFileSync as OI,existsSync as LI,statSync as Fw}from"fs";import{join as iz}from"path";import{readFileSync as GI,writeFileSync as r8,existsSync as VI}from"fs";var KI="<!-- faf:start -->",HI="<!-- faf:end -->",BI="<!-- faf:";function o0($,Z,X=KI,z=HI){let J=`${X}
|
|
230
230
|
${Z.trim()}
|
|
231
|
-
${z}`;if(!VI($)){
|
|
232
|
-
`,"utf-8");return}let Q=GI($,"utf-8"),Y=Q.indexOf(X),W=Q.indexOf(z);if(Y!==-1&&W!==-1&&W>Y){let U=Q.slice(0,Y),q=Q.slice(W+z.length);
|
|
233
|
-
`,"utf-8");return}
|
|
231
|
+
${z}`;if(!VI($)){r8($,`${J}
|
|
232
|
+
`,"utf-8");return}let Q=GI($,"utf-8"),Y=Q.indexOf(X),W=Q.indexOf(z);if(Y!==-1&&W!==-1&&W>Y){let U=Q.slice(0,Y),q=Q.slice(W+z.length);r8($,`${U}${J}${q}`,"utf-8");return}if(Q.trimStart().startsWith(BI)){r8($,`${J}
|
|
233
|
+
`,"utf-8");return}r8($,`${J}
|
|
234
234
|
|
|
235
|
-
${Q}`,"utf-8")}var MI=new Set(["API","CI","CD","MCP","CLI","SDK","UI","UX","AI","ML","DB","ORM","OS","HTTP","HTTPS","REST","RPC","JSON","YAML","XML","SQL","CSS","HTML","AWS","GCP","CDN","DNS","JWT","ID","IP","URL","URI","TS","JS"]);function
|
|
236
|
-
${U}`}function
|
|
237
|
-
`)}function
|
|
235
|
+
${Q}`,"utf-8")}var MI=new Set(["API","CI","CD","MCP","CLI","SDK","UI","UX","AI","ML","DB","ORM","OS","HTTP","HTTPS","REST","RPC","JSON","YAML","XML","SQL","CSS","HTML","AWS","GCP","CDN","DNS","JWT","ID","IP","URL","URI","TS","JS"]);function FZ($){return $.split("_").map((Z)=>{if(!Z)return Z;let X=Z.toUpperCase();return MI.has(X)?X:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function E0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function f0($){let Z=M$.get($);if(Z?.label)return Z.label;let X=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return FZ(X)}var nz="CLAUDE.md",NI="STATUS: BI-SYNC ACTIVE";function rz($){let Z=iz($,nz);if(!LI(Z))return null;return OI(Z,"utf-8")}function sz($,Z){o0(iz($,nz),Z)}function Y1($,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(" | ")} -->`,W=[];if(Z.doc)W.push(`doc=${Z.doc}`);else W.push(`claim=${Z.claim??"project.faf"}`);if(typeof Z.score==="number")W.push(`score=${Z.score}`);if(W.push(`family=${Z.family??"FAF"}`),Z.siblings&&Z.siblings.length>0)W.push(`siblings=${Z.siblings.join(",")}`);let U=`<!-- faf: ${W.join(" | ")} -->`;return`${Y}
|
|
236
|
+
${U}`}function az($){let Z=[],X=$.project?.name??"Project",z=$.project?.main_language??"",J=$.project?.goal??"";if(Z.push(Y1($)),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[q,G]of Object.entries(Q))if(G&&G!=="slotignored"&&String(G).trim())Y.push(`**${f0(`stack.${q}`)}:** ${G}`);if(Y.length>0){Z.push("## Stack"),Z.push("");for(let q of Y)Z.push(`- ${q}`);Z.push("")}let W=$.human_context??{},U=[["who",W.who],["what",W.what],["why",W.why],["where",W.where],["when",W.when],["how",W.how]].filter(([,q])=>q&&String(q).trim()).map(([q,G])=>`- **${f0(`human_context.${q}`)}:** ${G}`);if(U.length>0)Z.push("## Context"),Z.push(""),Z.push(...U),Z.push("");return Z.push("---"),Z.push(""),Z.push(`*${NI} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
|
|
237
|
+
`)}function pz($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function s8($){let Z={project:{}},X=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(X)Z.project.name=pz(X[1].trim());if(!Z.project.name){let Q=$.match(/\*\*Name:\*\*\s*(.+)/);if(Q)Z.project.name=pz(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 jw,writeFileSync as DI,existsSync as xw}from"fs";import{join as II}from"path";function oz($,Z){DI(II($,"MEMORY.md"),Z,"utf-8")}d();function A$(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function CZ($={}){let Z=process.cwd(),X=h(Z);if(!X)console.error(`Error: project.faf not found
|
|
238
238
|
|
|
239
|
-
Run 'faf init' to create one.`),process.exit(2);let z=
|
|
239
|
+
Run 'faf init' to create one.`),process.exit(2);let z=ez(Z,"CLAUDE.md"),J=ez(Z,"MEMORY.md"),Q=$.direction??"auto";if(Q==="auto")$J(X,z,Z);else if(Q==="push")ZJ(X,Z);else if(Q==="pull")AI(X,z);if(A$())XJ(X,J,Z);if($.watch)console.log(M("watching for changes... (Ctrl+C to stop)")),_I(X,z,J,Z)}function $J($,Z,X){ZJ($,X)}function ZJ($,Z){let X=p($),z=az(X);sz(Z,z),console.log(`${I("◆")} sync .faf → CLAUDE.md ${M("← bi-sync")}`);let J=H0(U0(c($)));J0(J,$)}function AI($,Z){let X=H0(U0(c($)));if(X.tier.name!=="TROPHY")console.error(`${A("×")} sync --pull blocked: requires ✪ Trophy (currently ${X.score}%)`),console.error(M(" MD → .faf backfill only runs at 100%. Reach Trophy with 'faf go', then retry.")),process.exit(1);let z=rz(TI(Z));if(!z){console.error("CLAUDE.md not found.");return}let J=s8(z),Q=p($);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};o($,Q),console.log(`${I("◆")} sync CLAUDE.md → .faf ${M("← bi-sync (Trophy-gated)")}`);let Y=H0(U0(c($)));J0(Y,$)}function XJ($,Z,X){let z=p($),J=tz($).mtimeMs,Q=a8(Z)?tz(Z).mtimeMs:0;if(!a8(Z)||J>Q){let Y=RI(z);oz(X,Y),console.log(`${I("◆")} sync .faf → MEMORY.md ${M("← tri-sync")}`)}else console.log(`${I("◆")} sync MEMORY.md → .faf ${M("← tri-sync")}`)}function RI($){let Z=$.project??{},X=[`# ${Z.name??"Project"} — Memory Topics`,"","> Authored 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(`
|
|
240
240
|
`)}
|
|
241
|
-
`}function _I($,Z,X,z){let{watch:J}=
|
|
241
|
+
`}function _I($,Z,X,z){let{watch:J}=F0("fs"),Q=null,Y=()=>{if(Q)clearTimeout(Q);Q=setTimeout(()=>{if(console.log(M("change detected...")),$J($,Z,z),A$())XJ($,X,z)},200)};if(J($,Y),a8(Z))J(Z,Y);if(A$()&&a8(X))J(X,Y)}import{writeFileSync as FI}from"fs";d();function zJ($,Z={}){let X=$??h();if(!X)console.error(`Error: project.faf not found
|
|
242
242
|
|
|
243
|
-
Run 'faf init' to create one.`),process.exit(2);let z=c(X),J=
|
|
243
|
+
Run 'faf init' to create one.`),process.exit(2);let z=c(X),J=E8(z),Q=Z.output??X.replace(/\.faf$/,".fafb");FI(Q,J),console.log(`${I("compiled")} ${Q} ${M(`(${J.length} bytes)`)}`)}import{readFileSync as CI}from"fs";function JJ($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let X=new Uint8Array(CI($));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=oX(X);console.log(JSON.stringify(z,null,2))}function QJ($){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")Z.push("about is not an app_type — declare about.represents (owner/repo) instead");if(X.about!==void 0){if(!$z(X)||typeof X.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!eX.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 PZ($,Z={}){let X=$??h();if(!X)console.error(`Error: project.faf not found
|
|
244
244
|
|
|
245
|
-
Run 'faf init' to create one.`),process.exit(2);let z=p(X),J=
|
|
246
|
-
--strict requires 100%`)),process.exit(1)}import{join as PI}from"path";var
|
|
247
|
-
`)}function
|
|
248
|
-
`)}function qJ($,Z){
|
|
249
|
-
`)}function GJ($,Z){
|
|
250
|
-
`)}function HJ($,Z){
|
|
251
|
-
`)}function LJ($,Z){let X=MJ($,".grok"),z=MJ(X,"config.toml"),J=
|
|
245
|
+
Run 'faf init' to create one.`),process.exit(2);let z=p(X),J=QJ(z);if(!J.valid){console.log(`${A("invalid")} ${X}`);for(let W of J.errors)console.log(` ${M("x")} ${W}`);process.exit(3)}let Q=c(X);if(!aX(Q))console.log(`${A("invalid yaml")} ${X}`),process.exit(3);console.log(`${I("valid")} ${X}`);let Y=z0(Q);if(J0(Y,X,Z.verbose),Z.strict&&Y.score<100)console.log(M(`
|
|
246
|
+
--strict requires 100%`)),process.exit(1)}import{mkdirSync as YT}from"fs";import{resolve as WT}from"path";import{join as PI}from"path";var w0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),YJ=($)=>Array.isArray($)?$.join(", "):String($),EI=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),wI=new Set(["target_user","core_problem","mission_purpose"]);function SI($){let Z=[],X=(E="")=>Z.push(E),z=$.ai_instructions,J=$.preferences,Q=$.instant_context,Y=$.security,W=$.commands,U=$.key_files??Q?.key_files,q=w0($.project?.default_branch)?String($.project?.default_branch):"main",G=W?Object.entries(W).filter(([,E])=>w0(E)):[],V=G.filter(([E])=>/test/i.test(E)),K=G.filter(([E])=>/lint|check/i.test(E)&&!/test/i.test(E)),H=G.filter(([E])=>!/test|lint|check/i.test(E)),N=(E)=>{let f=E.toLowerCase();if(/install|deps/.test(f))return 0;if(/^build$|build/.test(f)&&!/rebuild/.test(f))return 1;if(/^dev$|develop/.test(f))return 2;if(/^start$|run/.test(f))return 3;return 4},B=[...H].sort((E,f)=>N(E[0])-N(f[0])||E[0].localeCompare(f[0])),O=[...V,...K],T=V[0]?.[1],F=B.find(([E])=>/build/i.test(E))?.[1];X(Y1($)),X(),X(`# AGENTS.md — ${$.project?.name??"Project"}`),X();let w=[];if($.project?.main_language)w.push(String($.project.main_language));if(w0($.project?.type))w.push(`type: ${String($.project?.type)}`);if(w0($.project?.version))w.push(`v${String($.project?.version)}`);let S=$.project?.goal?String($.project.goal).trim():"";if(w.length)S+=(S?" — ":"")+w.join(" · ");if(S)X(S),X();if(X("> Authored by faf — do not edit the managed block; refresh with `faf export --agents`. Hand content outside `<!-- faf:start -->` … `<!-- faf:end -->` is preserved."),X(),B.length){X("## Setup & build"),X(),X("```bash");for(let[E,f]of B)X(`${f} # ${E}`);X("```"),X()}if(O.length){X("## Run the tests"),X(),X("```bash");for(let[,E]of O)X(E);X("```"),X()}if(U&&U.length){X("## Where things live"),X();let E=U.map((f)=>{let _0=String(f),e0=_0.indexOf(" — ");return e0>0?{path:_0.slice(0,e0),role:_0.slice(e0+3)}:{path:_0,role:""}});if(E.some((f)=>f.role)){X("| Path | Role |"),X("|------|------|");for(let f of E)X(`| \`${f.path}\` | ${f.role} |`)}else for(let f of E)X(`- \`${f.path}\``);X()}let y=new Map,b=(E)=>{if(!E)return;for(let[f,_0]of Object.entries(E)){if(EI.has(f)||!w0(_0))continue;let e0=FZ(f);if(!y.has(e0))y.set(e0,YJ(_0))}};b(z?.working_style),b(J);let l=$.conventions??[];if(y.size||l.length){X("## Conventions"),X();for(let[E,f]of y)X(`- **${E}:** ${f}`);for(let E of l)if(w0(E))X(`- ${E}`);X()}let _=(z?.warnings??[]).filter((E)=>w0(E)),u=["read the tree"];if(T)u.push(`run the tests (\`${T}\`)`);if(F)u.push("build the project");for(let[,E]of K.slice(0,1))u.push(`\`${E}\``);X("## Guardrails"),X();for(let E of _)X(`- ${E}`);X(`- **Always OK:** ${[...new Set(u)].join(" · ")}.`),X("- **Ask first:** dependency installs, deletions, migrations, schema changes, publish/release."),X(`- **Never:** force-push · push straight to \`${q}\` (branch and open a PR) · commit secrets.`),X();let V0=[];for(let[,E]of K)V0.push(`\`${E}\` exits 0`);for(let[,E]of V)V0.push(`\`${E}\` passes`);if(V0.push("changes committed with a conventional message"),X("## Definition of Done"),X(),X(`Done when: ${[...new Set(V0)].join(" · ")}.`),X(),X("## When stuck"),X(),X(`Ask a clarifying question, propose a short plan, or open a draft PR with notes — do not push large speculative changes to \`${q}\`.`),X(),Y&&(w0(Y.secrets)||(Y.never??[]).length)){if(X("## Security & secrets"),X(),w0(Y.secrets)){let E=w0(Y.example)?` (see \`${Y.example}\`)`:"";X(`- Secrets live in \`${Y.secrets}\`${E}. Never read or commit them.`)}for(let E of Y.never??[])if(w0(E))X(`- Never read or commit \`${E}\`.`);X()}if(X("## Commit & PR"),X(),J&&w0(J.commit_style))X(`- Commit style: ${YJ(J.commit_style)}`);else X("- Conventional Commits preferred (`feat:`, `fix:`, `chore:`, …).");if(X(`- Branch off \`${q}\` and open a PR — never commit to \`${q}\` directly.`),X("- If build/test scripts or layout change, refresh this file in the **same PR** (`faf export --agents`)."),X(),$.stack){let E=[];for(let[f,_0]of Object.entries($.stack)){if(wI.has(f))continue;if(E0(_0))E.push(`- **${f0(`stack.${f}`)}:** ${_0.trim()}`)}if(E.length){X("## Stack"),X();for(let f of E)X(f);X()}}let O0=$.generated;if(w0(O0))X(`*Context authored: ${String(O0)}*`);return Z.join(`
|
|
247
|
+
`)}function WJ($,Z){o0(PI($,"AGENTS.md"),SI(Z))}import{existsSync as o8,readFileSync as UJ}from"fs";import{join as v2}from"path";function jI($,Z){let X=[],z=(U)=>o8(v2($,U)),J=(U)=>{try{return UJ(v2($,U),"utf-8")}catch{return""}};if(z("tsconfig.json")&&/"strict"\s*:\s*true/.test(J("tsconfig.json")))X.push("TypeScript strict mode (tsconfig.json)");if(Z?.type==="module")X.push("ESM modules (`type: module`)");let Q=[],Y=Z?.devDependencies??{};if(z(".eslintrc")||z(".eslintrc.json")||z(".eslintrc.cjs")||z("eslint.config.js")||z("eslint.config.mjs")||"eslint"in Y)Q.push("ESLint");if(z(".prettierrc")||z(".prettierrc.json")||z("prettier.config.js")||"prettier"in Y)Q.push("Prettier");let W=z("pyproject.toml")?J("pyproject.toml"):"";if(/\[tool\.black\]/.test(W))Q.push("black");if(/\[tool\.ruff\]/.test(W))Q.push("ruff");if(/\[tool\.mypy\]/.test(W))Q.push("mypy");if(z("rustfmt.toml")||z(".rustfmt.toml"))Q.push("rustfmt");if(Q.length)X.push(`Style enforced by ${Q.join(" · ")} — obey the configs`);return X}function EZ($,Z){let X={...Z},z=null,J=v2($,"package.json");if(o8(J))try{z=JSON.parse(UJ(J,"utf-8"))}catch{z=null}let Q=h8($,z);if(Object.keys(Q).length)X.commands={...Q,...Z.commands??{}};let Y=Z.key_files??Z.instant_context?.key_files;if(!Y||Y.length===0){let W=g8($);if(W.length)X.key_files=W}if(!Z.security){let U=[".env",".env.local",".env.development"].find((q)=>o8(v2($,q)));if(U){let q=[".env.example",".env.sample",".env.template"].find((G)=>o8(v2($,G)));X.security={secrets:U,...q?{example:q}:{}}}}if(!Z.conventions){let W=jI($,z);if(W.length)X.conventions=W}return X}import{join as xI}from"path";function bI($){let Z=[];if(Z.push(Y1($)),Z.push(""),Z.push("# .cursorrules"),Z.push(`# Authored from project.faf — ${$.project?.name??"Project"}`),Z.push(""),$.project?.main_language)Z.push(`language: ${$.project.main_language}`);if($.stack){Z.push(""),Z.push("# Stack");for(let[X,z]of Object.entries($.stack))if(E0(z))Z.push(`# ${f0(`stack.${X}`)}: ${z.trim()}`)}return Z.push(""),Z.join(`
|
|
248
|
+
`)}function qJ($,Z){o0(xI($,".cursorrules"),bI(Z),"# faf:start","# faf:end")}import{join as kI}from"path";var yI=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),vI=new Set(["target_user","core_problem","mission_purpose"]);function fI($){let Z=[],X=$.instant_context,z=$.commands,J=$.key_files??X?.key_files,Q=z?Object.entries(z).filter(([,K])=>yI(K)):[],Y=Q.filter(([K])=>/test/i.test(K)),W=Q.filter(([K])=>/lint|check/i.test(K)&&!/test/i.test(K)),U=Q.filter(([K])=>!/test|lint|check/i.test(K)),q=(K)=>{let H=K.toLowerCase();if(/install|deps/.test(H))return 0;if(/^build$|build/.test(H)&&!/rebuild/.test(H))return 1;if(/^dev$|develop/.test(H))return 2;if(/^start$|run/.test(H))return 3;return 4},G=[...U].sort((K,H)=>q(K[0])-q(H[0])||K[0].localeCompare(H[0])),V=[...Y,...W];if(Z.push(Y1($)),Z.push(""),Z.push(`# GEMINI.md — ${$.project?.name??"Project"}`),Z.push(""),Z.push("> Authored from project.faf — refresh with `faf export --gemini`."),Z.push(""),$.project?.name)Z.push(`Project: ${$.project.name}`);if($.project?.goal)Z.push(`Goal: ${$.project.goal}`);if($.project?.main_language)Z.push(`Language: ${$.project.main_language}`);if(G.length){Z.push(""),Z.push("## Setup & build"),Z.push(""),Z.push("```bash");for(let[K,H]of G)Z.push(`${H} # ${K}`);Z.push("```")}if(V.length){Z.push(""),Z.push("## Test & verify"),Z.push(""),Z.push("```bash");for(let[,K]of V)Z.push(K);Z.push("```")}if(J&&J.length){Z.push(""),Z.push("## Where things live"),Z.push("");for(let K of J)Z.push(`- \`${K}\``)}if($.stack){let K=[];for(let[H,N]of Object.entries($.stack)){if(vI.has(H))continue;if(E0(N))K.push(`- ${f0(`stack.${H}`)}: ${N.trim()}`)}if(K.length){Z.push(""),Z.push("## Stack");for(let H of K)Z.push(H)}}return Z.push(""),Z.push("## Before changing things"),Z.push(""),Z.push("- Ask first: dependency installs, deletions, migrations, schema changes, publish/release."),Z.push("- Never: force-push · push straight to `main` · commit secrets."),Z.push(""),Z.join(`
|
|
249
|
+
`)}function GJ($,Z){o0(kI($,"GEMINI.md"),fI(Z))}import{join as VJ}from"path";import{mkdirSync as gI}from"fs";var KJ=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],hI=new Set([...KJ.map(([$])=>$),"cicd"]);function uI($){let Z=[],X=$.project?.name??"Project";if(Z.push(Y1($)),Z.push(""),Z.push(`# GitHub Copilot Instructions — ${X}`),Z.push(""),Z.push("> Authored from project.faf by FAF. Copilot reads these instructions on every request in this repository — keep them short and broadly applicable."),Z.push(""),E0($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let z=$.stack??{},J=[];if(E0($.project?.main_language))J.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[q,G]of Object.entries(z)){if(hI.has(q))continue;if(E0(G))J.push(`- **${f0(`stack.${q}`)}:** ${G.trim()}`)}if(J.length>0)Z.push("## Tech stack","",...J,"");let Q=[];for(let[q,G]of KJ){let V=z[q];if(E0(V))Q.push(`- ${G} \`${V.trim()}\`.`)}if(E0(z.cicd))Q.push(`- CI runs on ${z.cicd.trim()}.`);if(Q.length>0)Z.push("## Build & run","",...Q,"");let Y=$.human_context??{},U=[["who",Y.who],["what",Y.what],["why",Y.why],["where",Y.where],["when",Y.when],["how",Y.how]].filter(([,q])=>E0(q)).map(([q,G])=>`- **${f0(`human_context.${q}`)}:** ${G.trim()}`);if(U.length>0)Z.push("## Project context","",...U,"");return Z.join(`
|
|
250
|
+
`)}function HJ($,Z){gI(VJ($,".github"),{recursive:!0}),o0(VJ($,".github","copilot-instructions.md"),uI(Z))}import{existsSync as mI,mkdirSync as cI,readFileSync as lI,writeFileSync as BJ}from"fs";import{join as MJ}from"path";var dI="https://mcpaas.live/grok/mcp/v1",OJ="mcp_servers.grok-faf-mcp";function pI($){return[`[${OJ}]`,`url = "${dI}"`,""].join(`
|
|
251
|
+
`)}function LJ($,Z){let X=MJ($,".grok"),z=MJ(X,"config.toml"),J=pI(Z);if(!mI(z))return cI(X,{recursive:!0}),BJ(z,`# grok-faf-mcp — wired by FAF from project.faf
|
|
252
252
|
|
|
253
|
-
`+J,"utf-8"),"created";let Q=
|
|
253
|
+
`+J,"utf-8"),"created";let Q=lI(z,"utf-8");if(Q.includes(`[${OJ}]`))return"unchanged";let Y=Q.endsWith(`
|
|
254
254
|
|
|
255
255
|
`)?"":Q.endsWith(`
|
|
256
256
|
`)?`
|
|
257
257
|
`:`
|
|
258
258
|
|
|
259
|
-
`;return BJ(z,Q+Y+J,"utf-8"),"merged"}
|
|
260
|
-
`)}function
|
|
259
|
+
`;return BJ(z,Q+Y+J,"utf-8"),"merged"}d();import{writeFileSync as iI}from"fs";import{join as nI}from"path";var NJ=A2.orange,rI=A2.cyan,sI=A2.cyanDeep,aI="#FF9500",oI="#FF3B30",tI="#E6EDF3",eI="#6E7681",DJ={TROPHY:{glyph:"✪",color:NJ},GOLD:{glyph:"★",color:NJ},SILVER:{glyph:"◆",color:rI},BRONZE:{glyph:"◇",color:sI},GREEN:{glyph:"●",color:tI},YELLOW:{glyph:"●",color:aI},RED:{glyph:"○",color:oI},WHITE:{glyph:"♡",color:eI}};function R$($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var IJ=["who","what","why","where","when","how"];function t8($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,X])=>`<div class="row"><div class="k">${R$(Z)}</div><div class="v">${R$(X)}</div></div>`).join(`
|
|
260
|
+
`)}function $T($,Z,X="project.faf"){let z=R$($.project?.name??"Project"),J=Z.tier?.name??"WHITE",Q=DJ[J]??DJ.WHITE,Y=Z.inherited?Z.represents?`inherited from ${R$(Z.represents)}`:"inherited":`${Z.score}%`,W=J==="TROPHY"&&!Z.inherited,U=$.human_context??{},q=IJ.map((B)=>[B,U[B]]),G=Object.entries(U).filter(([B])=>!IJ.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??{}),H=K.filter(([,B])=>B&&B!=="slotignored"&&String(B).trim()!==""),N=K.filter(([,B])=>B==="slotignored").length;return`<!DOCTYPE html>
|
|
261
261
|
<html lang="en">
|
|
262
262
|
<head>
|
|
263
263
|
<meta charset="UTF-8">
|
|
@@ -298,7 +298,7 @@ footer strong{color:#e6edf3}
|
|
|
298
298
|
<div class="eyebrow">project.faf · visual render</div>
|
|
299
299
|
<header>
|
|
300
300
|
<h1>${z}</h1>
|
|
301
|
-
<span class="badge">${Q.glyph} ${
|
|
301
|
+
<span class="badge">${Q.glyph} ${R$(J)}</span>
|
|
302
302
|
<span class="score">${Y}</span>
|
|
303
303
|
</header>
|
|
304
304
|
<div class="meter"><span></span></div>
|
|
@@ -306,97 +306,97 @@ ${W?'<p class="award statline"><span class="awd-pre">✅ All Required slots fill
|
|
|
306
306
|
|
|
307
307
|
<section>
|
|
308
308
|
<h2>The 6 W's</h2>
|
|
309
|
-
${
|
|
310
|
-
${G.length?
|
|
309
|
+
${t8(q)||'<p class="muted">No human_context yet.</p>'}
|
|
310
|
+
${G.length?t8(G):""}
|
|
311
311
|
</section>
|
|
312
312
|
|
|
313
313
|
<section>
|
|
314
314
|
<h2>Project</h2>
|
|
315
|
-
${
|
|
315
|
+
${t8(V)||'<p class="muted">—</p>'}
|
|
316
316
|
</section>
|
|
317
317
|
|
|
318
318
|
<section>
|
|
319
319
|
<h2>Stack</h2>
|
|
320
|
-
${H.length?
|
|
320
|
+
${H.length?t8(H):'<p class="muted">No active stack slots.</p>'}
|
|
321
321
|
</section>
|
|
322
322
|
|
|
323
323
|
<footer>
|
|
324
|
-
Rendered on-demand from your current <strong>${
|
|
324
|
+
Rendered on-demand from your current <strong>${R$(X)}</strong><br>
|
|
325
325
|
<strong>Humans like visuals. <span style="color:#00D4D4">We gave them one.</span></strong>
|
|
326
326
|
</footer>
|
|
327
327
|
</div>
|
|
328
328
|
</body>
|
|
329
329
|
</html>
|
|
330
|
-
`}function
|
|
331
|
-
`,"utf-8"),J}
|
|
330
|
+
`}function e8($,Z,X,z="project.faf"){iI(nI($,"project.html"),$T(Z,X,z),"utf-8")}import{writeFileSync as ZT}from"fs";import{join as XT}from"path";var TJ="application/vnd.faf+yaml",zT="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",JT=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function RJ($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&JT.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 QT($){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 f2($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:TJ,iana:`https://www.iana.org/assignments/media-types/${TJ}`,deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function wZ($,Z={}){let X={$schema:zT,name:RJ($),version:String($.project?.version??"0.1.0"),description:QT($)},z=jZ($)??$.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":f2($,Z)},X}var SZ="io.modelcontextprotocol.registry/publisher-provided",AJ=4096;function _J($,Z={}){let X={"one.faf/context":f2($,Z)},z=new TextEncoder().encode(JSON.stringify(X)).length;if(z>AJ)throw Error(`publisher-provided _meta is ${z}B — exceeds the registry ${AJ}B cap`);return{[SZ]:X}}function FJ($){return RJ($)}function jZ($){let Z=$.project?.title;if(typeof Z==="string"){let X=Z.trim();if(X&&X.length<=100)return X}return}function CJ($,Z,X={}){let z=wZ(Z,X),J=XT($,"server-card");return ZT(J,`${JSON.stringify(z,null,2)}
|
|
331
|
+
`,"utf-8"),J}d();function _$($={}){let Z=h();if(!Z)console.error(`Error: project.faf not found
|
|
332
332
|
|
|
333
|
-
Run 'faf init' to create one.`),process.exit(2);let X
|
|
334
|
-
`,"utf-8")}function kJ($){if(!$)return;let Z=$.split(",").map((z)=>z.trim().toLowerCase()).filter(Boolean),X=Z.filter((z)=>!
|
|
333
|
+
Run 'faf init' to create one.`),process.exit(2);let X=$.output?WT(process.cwd(),$.output):process.cwd();if($.output)YT(X,{recursive:!0});let z=p(Z),J=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.conductor&&!$.html&&!$.card;if(J||$.agents)WJ(X,EZ(X,z)),console.log(" AGENTS.md");if(J||$.cursor)qJ(X,z),console.log(" .cursorrules");if(J||$.gemini)GJ(X,EZ(X,z)),console.log(" GEMINI.md");if(J||$.copilot)HJ(X,z),console.log(" .github/copilot-instructions.md");if($.grok){let Y=LJ(X,z);console.log(` .grok/config.toml (${Y})`)}if(J||$.html){let Y=z0(c(Z));e8(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=CJ(X,z);console.log(` ${Y.replace(`${X}/`,"")}`)}console.log(`${I("exported")} ${M(`from ${Z}`)}`)}import{existsSync as yJ,readFileSync as TT,writeFileSync as AT}from"fs";import{resolve as kZ}from"path";import{existsSync as PJ,mkdirSync as UT,readFileSync as qT,writeFileSync as GT}from"fs";import{dirname as wJ,join as EJ}from"path";var VT="https://faf.one/context",KT="JSONRPC",SJ="1.0",xZ=["a2a","mcp","registry","catalog"];function jJ($){return D0(qT($,"utf-8"))}function xJ($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let z of Z){let J=EJ($,z);if(PJ(J))return J}let X=wJ($);if(X!==$)for(let z of Z){let J=EJ(X,z);if(PJ(J))return J}return null}function HT($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function bZ($,Z={}){let X=HT($);if(X.length>0)return X;let z=Z.doorUrl?.trim();if(z)return[{protocol:"a2a",location:z,version:SJ}];return[]}function BT($,Z,X={}){let z=$.agent??{},J=bZ($,X);if(J.length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");let Q=String(z.displayName??$.metadata?.persona??z.name??"").trim(),Y=String(z.description??"").trim(),W=String(z.version??"").trim(),U=String(z.vendor??"").trim(),q=String(z.homepage??"").trim();if(!Q||!Y||!W||!U||!q)throw Error("A2A card needs agent.displayName|name, description, version, vendor, homepage in .fafa");let G=f2(Z,X),V=($.capabilities??[]).map((K)=>{let H=String(K.name??"").trim();if(!H)throw Error("A2A skill missing capabilities[].name");let N=Array.isArray(K.tags)?K.tags.map(String):[];return{id:H,name:H,description:String(K.description??"").trim()||H,tags:N}});return{name:Q,description:Y,supportedInterfaces:J.map((K)=>({url:String(K.location),protocolBinding:KT,protocolVersion:String(K.version??SJ)})),provider:{organization:U,url:q},version:W,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[{uri:VT,description:"FAF context provenance — the durable context block (one context, every door).",required:!1,params:G}]},defaultInputModes:["text/plain","application/json"],defaultOutputModes:["text/plain","application/json"],skills:V}}function MT($){let Z=$.agent?.homepage;if(!Z)return"local";try{return new URL(Z).hostname.replace(/^www\./,"")}catch{return"local"}}function OT($,Z){if(Z.a2aCardUrl)return Z.a2aCardUrl;let X=$.agent?.homepage;if(X)try{return new URL("/.well-known/agent-card.json",X).href}catch{}return"/.well-known/agent-card.json"}function LT($,Z,X={}){let z=MT($),J=$.agent??{},Q=String(J.name??"agent"),Y=X.now??Z.generated??new Date().toISOString(),W=[];if(bZ($,X).length>0)W.push({identifier:`urn:air:${z}:a2a:${Q}`,displayName:String(J.displayName??J.name??"A2A Agent Card"),type:"application/a2a-agent-card+json",description:"A2A v1.0 Agent Card. Projected from .fafa.",url:OT($,X),updatedAt:Y});let U=NT($,"fafa");if(U)W.push({identifier:`urn:air:${z}:agent:${Q}`,displayName:String(J.displayName??J.name??".fafa"),type:"application/vnd.fafa+yaml",description:"FAF agent passport (.fafa).",url:U,updatedAt:Y});return W}function NT($,Z){let X=$.agent?.homepage;if(!X)return;try{return new URL(`/.well-known/${Z}`,X).href}catch{return}}function DT($,Z){let X=$.findIndex((z)=>z.identifier===Z.identifier);if(X>=0)return X;if(Z.type==="application/a2a-agent-card+json"||Z.type==="application/json"||Z.identifier.includes(":a2a:"))return $.findIndex((z)=>z.identifier.includes(":a2a:")||z.type==="application/a2a-agent-card+json"||String(z.url??"").includes("agent-card.json"));if(Z.type==="application/vnd.fafa+yaml")return $.findIndex((z)=>z.type==="application/vnd.fafa+yaml");return-1}function bJ($,Z){let X=$?{...$,entries:[...$.entries??[]]}:{specVersion:"1.0",entries:[]};for(let z of Z){let J=DT(X.entries,z);if(J>=0)X.entries[J]={...X.entries[J],url:z.url,type:z.type,...z.updatedAt?{updatedAt:z.updatedAt}:{}};else X.entries.push(z)}return X}function $4($){let Z=$.opts??{},X=new Set($.targets?.length?$.targets:xZ),J={block:f2($.faf,Z)};if(X.has("mcp"))J.mcp=wZ($.faf,Z);if(X.has("registry")){let Q=jZ($.faf);J.registry={name:FJ($.faf),...Q?{title:Q}:{},_meta:_J($.faf,Z)}}if(X.has("a2a")||X.has("catalog")){if(!$.fafa){if($.targets?.includes("a2a")||$.targets?.includes("catalog"))throw Error("A2A/catalog require a .fafa (agent.fafa). Will not invent an agent.")}}if(X.has("a2a")&&$.fafa)if(bZ($.fafa,Z).length===0){if($.targets?.includes("a2a"))throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.")}else J.a2a=BT($.fafa,$.faf,Z);if(X.has("catalog")&&$.fafa)J.catalog=LT($.fafa,$.faf,Z);return IT(J),J}function IT($){let Z=JSON.stringify($.block),X=[];if($.a2a)X.push(JSON.stringify($.a2a.capabilities.extensions[0].params));if($.mcp){let z=$.mcp._meta;X.push(JSON.stringify(z["one.faf/context"]))}if($.registry){let z=$.registry._meta["io.modelcontextprotocol.registry/publisher-provided"];X.push(JSON.stringify(z["one.faf/context"]))}for(let z of X)if(z!==Z)throw Error("context block drifted across card targets — one projector, one block")}function g2($,Z){UT(wJ($),{recursive:!0}),GT($,`${JSON.stringify(Z,null,2)}
|
|
334
|
+
`,"utf-8")}function kJ($){if(!$)return;let Z=$.split(",").map((z)=>z.trim().toLowerCase()).filter(Boolean),X=Z.filter((z)=>!xZ.includes(z));if(X.length)throw Error(`unknown card target: ${X.join(", ")} (use ${xZ.join(",")})`);return Z}d();var RT=["$schema","name","title","description","icons","version","repository","websiteUrl","packages","remotes","_meta"];function vJ($={}){let Z=$.faf?kZ($.faf):h();if(!Z||!yJ(Z))console.error(`Error: project.faf not found
|
|
335
335
|
|
|
336
|
-
Run 'faf init' to create one.`),process.exit(2);let X=p(Z),z=
|
|
336
|
+
Run 'faf init' to create one.`),process.exit(2);let X=p(Z),z=kZ($.in??"./server.json");if(!yJ(z))console.error(`Error: ${z} not found.
|
|
337
337
|
|
|
338
338
|
'faf server-card' patches the identity into an existing registry server.json;
|
|
339
|
-
it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=JSON.parse(
|
|
340
|
-
`;if($.check){process.stdout.write(N);return}let B=
|
|
339
|
+
it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=JSON.parse(TT(z,"utf-8")),Y=J._meta?.[SZ]?.["one.faf/context"]?.generated,W=$.generated??Y,U=$4({faf:X,targets:["registry"],opts:{fafPointer:"./project.faf",now:W}}),q=U.registry.name,G=U.registry.title,V=U.registry._meta,K={...J,name:q,...$.setVersion?{version:$.setVersion}:{},_meta:{...J._meta??{},...V}};if(G)K.title=G;else delete K.title;let H={};for(let O of RT)if(O in K&&K[O]!==void 0)H[O]=K[O];for(let O of Object.keys(K))if(!(O in H)&&K[O]!==void 0)H[O]=K[O];let N=`${JSON.stringify(H,null,2)}
|
|
340
|
+
`;if($.check){process.stdout.write(N);return}let B=kZ($.out??z);AT(B,N),console.error(`${I("✓")} ${B} — name=${q} title=${G??"(none)"} ${M("(identity emitted from faf-cli)")}`)}import{existsSync as Z4,readFileSync as fJ}from"fs";import{join as X4,resolve as yZ}from"path";d();function gJ($={}){let Z=$.dir?yZ($.dir):process.cwd(),X;try{X=kJ($.target)}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}let z=$.faf?yZ($.faf):h(Z);if(!z||!Z4(z))console.error(`Error: project.faf not found
|
|
341
341
|
|
|
342
|
-
Run 'faf init' to create one.`),process.exit(2);let J=p(z),Q=$.fafa?
|
|
343
|
-
`);return}let U=[];if(W.a2a){let q=
|
|
342
|
+
Run 'faf init' to create one.`),process.exit(2);let J=p(z),Q=$.fafa?yZ($.fafa):xJ(Z),Y=Q&&Z4(Q)?jJ(Q):void 0,W;try{W=$4({faf:J,fafa:Y,targets:X,opts:{a2aCardUrl:$.a2aUrl,doorUrl:$.doorUrl,fafPointer:$.fafPointer}})}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}if($.check){process.stdout.write(`${JSON.stringify(W,null,2)}
|
|
343
|
+
`);return}let U=[];if(W.a2a){let q=X4(Z,".well-known","agent-card.json");g2(q,W.a2a),U.push(q)}if(W.mcp){let q=X4(Z,"server-card");g2(q,W.mcp),U.push(q)}if(W.catalog){let q=X4(Z,".well-known","ai-catalog.json"),G;if(Z4(q))G=JSON.parse(fJ(q,"utf-8"));g2(q,bJ(G,W.catalog)),U.push(q)}if(W.registry){let q=X4(Z,"server.json");if(Z4(q)){let G=JSON.parse(fJ(q,"utf-8")),V={...G,name:W.registry.name,_meta:{...G._meta??{},...W.registry._meta}};if(W.registry.title)V.title=W.registry.title;g2(q,V),U.push(q)}else if(X?.includes("registry"))console.error(`Error: ${q} not found.
|
|
344
344
|
|
|
345
|
-
Registry target patches an existing server.json. Seed one first.`),process.exit(2)}if(U.length===0){console.error(`${I("faf cards")} ${M("nothing to write — need .fafa for A2A/catalog; server.json for registry")}`);return}for(let q of U)console.error(`${I("✓")} ${q}`)}import{join as
|
|
345
|
+
Registry target patches an existing server.json. Seed one first.`),process.exit(2)}if(U.length===0){console.error(`${I("faf cards")} ${M("nothing to write — need .fafa for A2A/catalog; server.json for registry")}`);return}for(let q of U)console.error(`${I("✓")} ${q}`)}import{join as _T}from"path";import FT from"open";d();function CT($){if(process.env.CI)return!1;try{return FT($).catch(()=>{return}),!0}catch{return!1}}function hJ(){let $=h();if(!$)console.error(`Error: project.faf not found
|
|
346
346
|
|
|
347
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=p($),z=
|
|
348
|
-
`+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:X}}function mJ($,Z={},X=process.cwd()){let z;try{z=
|
|
347
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=p($),z=z0(c($));e8(Z,X,z,$);let J=_T(Z,"project.html"),Q=CT(J);console.log(" project.html"),console.log(Q?`${I("opened")} ${M("in your browser")}`:`${I("rendered")} ${M(`file://${J}`)}`)}import{mkdirSync as PT,rmSync as ET,existsSync as wT}from"fs";import{join as uJ,resolve as ST}from"path";import{execFileSync as jT}from"child_process";import{tmpdir as xT}from"os";d();function bT($){let Z=($??"").trim();if(!Z)throw Error("Please provide a GitHub URL.");if(/[\s;&|`$(){}<>\\^'"!*?[\]]/.test(Z))throw Error(`Refusing unsafe URL: ${JSON.stringify($)}`);let X=Z.replace(/\/+$/,"").replace(/\.git$/i,""),z=X.match(/^(?:github\.com\/)?([A-Za-z0-9][A-Za-z0-9._-]*)\/([A-Za-z0-9][A-Za-z0-9._-]*)$/);if(z)return`https://github.com/${z[1]}/${z[2]}.git`;if(/^https?:\/\/[A-Za-z0-9._\-/:@~%]+$/.test(X))return`${X}.git`;throw Error(`Not a recognized GitHub repo URL: ${JSON.stringify($)}`)}function kT($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function yT($,Z,X){return["clone","--depth","1",...X?["--branch",X]:[],"--",$,Z]}function vT($,Z=process.cwd()){if($.stdout)return{outputPath:null};let X=$.output?ST(Z,$.output):uJ(Z,"project.faf");if(wT(X)&&!$.force)throw Error(`${X} already exists — refusing to overwrite your context.
|
|
348
|
+
`+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:X}}function mJ($,Z={},X=process.cwd()){let z;try{z=bT($)}catch(Y){console.error(`Error: ${Y.message}
|
|
349
349
|
|
|
350
|
-
Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let J;try{J=
|
|
350
|
+
Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let J;try{J=vT(Z,X)}catch(Y){console.error(`Error: ${Y.message}`),process.exit(1);return}let Q=uJ(xT(),`faf-git-${Date.now()}`);PT(Q,{recursive:!0});try{console.error(M(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{jT("git",yT(z,Q,Z.ref),{stdio:"pipe"})}catch(q){let V=(q?.stderr?.toString()??"").trim().split(`
|
|
351
351
|
`).slice(-2).join(" ").trim()||"git clone failed",K=Z.ref?`
|
|
352
352
|
|
|
353
353
|
(does the branch/tag '${Z.ref}' exist?)`:"";console.error(`Error: could not clone ${$}
|
|
354
354
|
|
|
355
|
-
${V}${K}`),process.exit(1)}let Y=
|
|
356
|
-
`)}function
|
|
357
|
-
`).some((J)=>J.trim()===
|
|
355
|
+
${V}${K}`),process.exit(1)}let Y=D$(Q);if(Y.project&&/^faf-git-\d+$/.test(String(Y.project.name??"")))Y.project.name=kT(z);if(J.outputPath===null){process.stdout.write(QZ(Y));return}o(J.outputPath,Y),console.log(`${I("created")} ${J.outputPath}`);let W=c(J.outputPath),U=H0(U0(W));J0(U,J.outputPath)}finally{ET(Q,{recursive:!0,force:!0})}}import{execFileSync as _1}from"child_process";import{readFileSync as iJ,existsSync as nJ,appendFileSync as fT}from"fs";import{join as gT}from"path";var F$=($)=>String($).trim(),hT="slotignored",cJ=($)=>P0($)||typeof $==="string"&&$.trim().toLowerCase()===hT;function uT($,Z){let X=[],z=0,J=0;for(let Q of t){let Y=_2($,Q),W=_2(Z,Q),U=!cJ(Y),q=!cJ(W);if(U)z++;if(q)J++;let G=Q.label??Q.path.split(".").pop()??Q.path,V={path:Q.path,label:G,category:String(Q.category)};if(!U&&q)X.push({...V,kind:"added",to:F$(W)});else if(U&&!q)X.push({...V,kind:"removed",from:F$(Y)});else if(U&&q&&F$(Y)!==F$(W))X.push({...V,kind:"changed",from:F$(Y),to:F$(W)})}return{changes:X,filledBase:z,filledTarget:J}}function lJ($){if(!$.trim())return 0;try{return z0($).score??0}catch{return 0}}function dJ($){if(!$.trim())return{};try{return rX($)??{}}catch{return{}}}function Q4($,Z){let{changes:X,filledBase:z,filledTarget:J}=uT(dJ($),dJ(Z)),Q=lJ($),Y=lJ(Z);return{changes:X,scoreBase:Q,scoreTarget:Y,scoreDelta:Y-Q,filledBase:z,filledTarget:J}}var mT={added:"+",removed:"-",changed:"~"},pJ=($)=>$>0?`+${$}`:`${$}`,z4=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function rJ($,Z,X){let z=[],J=c0(A1($.scoreBase)),Q=c0(A1($.scoreTarget));if(z.push(`project.faf ${Z} → ${X}`),z.push(`Score: ${$.scoreBase}% ${J} → ${$.scoreTarget}% ${Q} (${pJ($.scoreDelta)})`),z.push(""),$.changes.length===0)z.push(" (no slot changes)");else{let Y="";for(let W of $.changes){if(W.category!==Y)z.push(` ${W.category}`),Y=W.category;let U=mT[W.kind],q=W.label.padEnd(16);if(W.kind==="changed")z.push(` ${U} ${q} ${z4(W.from)} → ${z4(W.to)}`);else if(W.kind==="added")z.push(` ${U} ${q} ${z4(W.to)} (added)`);else z.push(` ${U} ${q} ${z4(W.from)} (removed)`)}}return z.push(""),z.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${pJ($.filledTarget-$.filledBase)})`),z.join(`
|
|
356
|
+
`)}function cT($,Z){try{return _1("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function h2($,Z){if(!cT($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function C$($,Z,X){try{return _1("git",["show",`${$}:${Z}`],{cwd:X,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function sJ($){let Z=$[0]??"project.faf";try{if($.length<5){console.log(`${Z} — unmerged (resolve the conflict, then \`faf diff\`)`);return}let X=(Q)=>Q&&Q!=="/dev/null"&&nJ(Q)?iJ(Q,"utf-8"):"",z=(Q,Y)=>{if(!Q||Q==="/dev/null")return"(absent)";if(!Y||/^0+$/.test(Y))return"(working tree)";return Y.slice(0,7)},J=Q4(X($[1]),X($[4]));console.log(rJ(J,z($[1],$[2]),z($[4],$[5])))}catch(X){console.log(`${Z} — faf diff unavailable (${X instanceof Error?X.message:"error"})`)}}var J4="*.faf diff=faf";function vZ($){let[Z,...X]=$.trim().split(/\s+/);try{return _1(Z,X,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function aJ($){try{return _1("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}catch{throw console.error("Error: not a git repository."),process.exit(2),Error("unreachable")}}function lT($){let Z=aJ($),X=gT(Z,".gitattributes"),z=nJ(X)?iJ(X,"utf-8"):"";if(!z.split(`
|
|
357
|
+
`).some((J)=>J.trim()===J4))fT(X,`${z&&!z.endsWith(`
|
|
358
358
|
`)?`
|
|
359
|
-
`:""}${
|
|
360
|
-
`),console.log(`✅ .gitattributes ${
|
|
359
|
+
`:""}${J4}
|
|
360
|
+
`),console.log(`✅ .gitattributes ${J4}`);else console.log(`• .gitattributes already opts in (${J4})`);if(_1("git",["config","diff.faf.command","faf diff-driver"],{cwd:$}),console.log("✅ git config diff.faf.command = faf diff-driver"),console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!vZ("faf diff-driver"))console.log("\n⚠ the `faf` on your PATH does not support `diff-driver` yet (needs faf ≥ 7.0)."),console.log(" `git diff` on .faf files falls back to the raw text diff until you upgrade.")}function dT($){aJ($);try{_1("git",["config","--unset","diff.faf.command"],{cwd:$,stdio:"pipe"})}catch{}console.log("✅ removed diff.faf.command (the .gitattributes line is left for you to keep or delete).")}function oJ($,Z={},X=process.cwd()){if(Z.installDriver)return lT(X);if(Z.uninstallDriver)return dT(X);let z=h(X);if(!z)console.error(`Error: project.faf not found
|
|
361
361
|
|
|
362
|
-
Run 'faf init' to create one.`),process.exit(2);let J;try{J=
|
|
363
|
-
`)}function
|
|
362
|
+
Run 'faf init' to create one.`),process.exit(2);let J;try{J=_1("git",["rev-parse","--show-toplevel"],{cwd:X,encoding:"utf-8"}).trim()}catch{console.error("Error: not a git repository — faf diff compares .faf versions across git history."),process.exit(2);return}let Q=H$(z,X),Y,W,U,q;if(!$)Y="HEAD",W="(working tree)",U=C$("HEAD",Q,X),q=c(z);else if($.includes("...")){let[V,K]=$.split("...");h2(V,X),h2(K,X);let H;try{H=_1("git",["merge-base",V,K],{cwd:X,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${V}' and '${K}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=H.slice(0,7),W=K,U=C$(H,Q,X),q=C$(K,Q,X)}else if($.includes("..")){let[V,K]=$.split("..");h2(V,X),h2(K,X),Y=V,W=K,U=C$(V,Q,X),q=C$(K,Q,X)}else h2($,X),Y=$,W="(working tree)",U=C$($,Q,X),q=c(z);let G=Q4(U,q);if(Z.json)console.log(JSON.stringify({base:Y,target:W,...G},null,2));else console.log(rJ(G,Y,W))}import{execFileSync as fZ}from"child_process";function pT($){if(!$.trim())return 0;try{return z0($).score??0}catch{return 0}}var iT=($)=>$>0?`+${$}`:`${$}`;function nT($){let Z=$.map((X)=>({...X,score:pT(X.raw)}));return Z.map((X,z)=>{let J=Z[z+1];return{hex:X.hex,date:X.date,subject:X.subject,score:X.score,delta:J?X.score-J.score:null,first:!J}})}function rT($,Z="project.faf"){if($.length===0)return`${Z} — no history (no commits touch it yet)`;let X=[];X.push(`${Z} — score timeline (${$.length} commit${$.length===1?"":"s"})`),X.push("");for(let z of $){let J=`${String(z.score).padStart(3)}%`,Q=z.first?" new ":z.delta===0?" ·":iT(z.delta).padStart(4);X.push(` ${J} ${Q} ${z.date} ${z.hex} ${c0(A1(z.score))} ${z.subject}`)}return X.join(`
|
|
363
|
+
`)}function sT($,Z,X){try{return fZ("git",["show",`${$}:${Z}`],{cwd:X,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function tJ($={},Z=process.cwd()){let X=h(Z);if(!X)console.error(`Error: project.faf not found
|
|
364
364
|
|
|
365
|
-
Run 'faf init' to create one.`),process.exit(2);let z;try{z=
|
|
366
|
-
`).filter(Boolean).map((H)=>{let[N,B,O]=H.split("\x1F");return{hex:N,date:B,subject:O??""}}),U=Q>0?Math.min(W.length,Q+1):W.length,q=W.slice(0,U).map((H)=>({...H,raw:
|
|
365
|
+
Run 'faf init' to create one.`),process.exit(2);let z;try{z=fZ("git",["rev-parse","--show-toplevel"],{cwd:Z,encoding:"utf-8"}).trim()}catch{console.error("Error: not a git repository — faf log reads the .faf score across git history."),process.exit(2);return}let J=H$(X,Z),Q=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=fZ("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",J],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let W=Y.split(`
|
|
366
|
+
`).filter(Boolean).map((H)=>{let[N,B,O]=H.split("\x1F");return{hex:N,date:B,subject:O??""}}),U=Q>0?Math.min(W.length,Q+1):W.length,q=W.slice(0,U).map((H)=>({...H,raw:sT(H.hex,J,Z)})),G=nT(q),V=Q>0?G.slice(0,Q):G;if($.reverse)V=[...V].reverse();let K=W.length;if($.json)console.log(JSON.stringify({file:J,total:K,count:V.length,entries:V},null,2));else{let H=rT(V,J.split("/").pop()??"project.faf");if(Q>0&&K>V.length)H+=`
|
|
367
367
|
|
|
368
|
-
… showing ${V.length} of ${K} commits — \`faf log --all\` for the full timeline.`;console.log(H)}}import{execFileSync as
|
|
369
|
-
`)}function
|
|
368
|
+
… showing ${V.length} of ${K} commits — \`faf log --all\` for the full timeline.`;console.log(H)}}import{execFileSync as Y4}from"child_process";import{existsSync as gZ,readFileSync as hZ,writeFileSync as ZQ,chmodSync as aT,mkdirSync as oT}from"fs";import{resolve as tT,dirname as eT}from"path";var W4="# >>> faf >>>",u2="# <<< faf <<<",eJ="faf hooks-run",$A=($)=>$>0?`+${$}`:`${$}`;function XQ($){return Y4("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function $Q($,Z){try{return Y4("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function zQ($,Z){try{return Y4("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function uZ($){let Z=Y4("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return tT($,Z)}function JQ($={},Z=process.cwd()){try{let X;try{X=XQ(Z)}catch{return}let z=h(Z);if(!z)return;let J=H$(z,Z),Q=$Q(`:${J}`,Z);if(Q===null)return;let Y=$Q(`HEAD:${J}`,Z)??"",W=Q4(Y,Q),U=`${W.scoreBase}% → ${W.scoreTarget}% (${$A(W.scoreDelta)})`;if(W.scoreDelta<0){if(console.error(`⚠ faf: context regressed ${U} — ${W.changes.length} slot change(s)`),$.strict)console.error(" commit blocked (--strict). Fix with `faf score` / `faf sync`, or `git commit --no-verify` to override."),process.exit(1)}else console.log(`✓ faf: context ${U}`)}catch(X){console.error(`faf hooks: skipped (${X instanceof Error?X.message:"error"})`)}}function ZA($,Z){let X=$.trim().split(/\s+/)[0],z=Z?`${$} --strict || exit 1`:`${$} || true`;return[W4,`if command -v ${X} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${z}`,"fi",u2,""].join(`
|
|
369
|
+
`)}function XA($,Z={}){let X;try{X=XQ($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let z=zQ("core.hooksPath",$);if(z){let G=Z.runnerCmd??eJ;return console.error(`Error: core.hooksPath is set (${z}) — a hook manager (husky/lefthook/pre-commit) owns hooks here.`),console.error(" faf won't touch a managed hooks directory. Add this to your pre-commit yourself:"),console.error(` ${G}${Z.strict?" --strict":""}`),!1}let J=uZ($),Q=Z.runnerCmd??eJ;if(!vZ(Q)){let G=Q.trim().split(/\s+/)[0];if(Z.strict)return console.error(`Error: \`${G}\` on PATH doesn't support \`hooks-run\` yet (needs faf ≥ 7.0).`),console.error(" A --strict hook against an older faf would BLOCK your commits. Upgrade faf, then re-install."),!1;console.log(`⚠ \`${G}\` on PATH doesn't support \`hooks-run\` yet (needs faf ≥ 7.0) — the hook no-ops until you upgrade.`)}let Y=ZA(Q,!!Z.strict),W=gZ(J)?hZ(J,"utf-8"):"",U=W.indexOf(W4),q=W.indexOf(u2);if(U!==-1&&q!==-1){let G=W.slice(q+u2.length).replace(/^\n/,"");W=W.slice(0,U)+Y+G}else if(W.trim())W=W.endsWith(`
|
|
370
370
|
`)?`${W}
|
|
371
371
|
${Y}`:`${W}
|
|
372
372
|
|
|
373
373
|
${Y}`;else W=`#!/bin/sh
|
|
374
|
-
${Y}`;return
|
|
375
|
-
`);return ZQ(Z,Q),console.log("✅ faf pre-commit block removed (other hook content preserved)."),!0}function
|
|
376
|
-
`);let $=new Map;for(let Z of
|
|
374
|
+
${Y}`;return oT(eT(J),{recursive:!0}),ZQ(J,W),aT(J,493),console.log(`✅ pre-commit context guard installed — ${Z.strict?"STRICT (blocks on score regression)":"warn (informs only)"}`),console.log(" Skips when no .faf is staged · respects `git commit --no-verify` · fails open."),!0}function zA($){let Z;try{Z=uZ($)}catch{return console.error("Error: not a git repository."),!1}if(!gZ(Z))return console.log("• no pre-commit hook to clean."),!0;let X=hZ(Z,"utf-8"),z=X.indexOf(W4),J=X.indexOf(u2);if(z===-1||J===-1)return console.log("• faf block not found in pre-commit — nothing to remove."),!0;let Q=(X.slice(0,z)+X.slice(J+u2.length).replace(/^\n/,"")).replace(/^#!\/bin\/sh\s*$/,`#!/bin/sh
|
|
375
|
+
`);return ZQ(Z,Q),console.log("✅ faf pre-commit block removed (other hook content preserved)."),!0}function JA($){let Z;try{Z=uZ($)}catch{console.error("Error: not a git repository.");return}let X=zQ("core.hooksPath",$),z=gZ(Z)?hZ(Z,"utf-8"):"",J=z.includes(W4),Q=/hooks-run --strict/.test(z);if(console.log("faf pre-commit context guard"),console.log(` installed: ${J?`yes (${Q?"strict":"warn"})`:"no"}`),X)console.log(` ⚠ core.hooksPath = ${X} (a hook manager owns hooks — faf won't install here)`);if(!J&&!X)console.log(" → `faf hooks --install` (add --strict to block on regression)")}function QQ($={}){let Z=process.cwd();if($.install){if(!XA(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!zA(Z))process.exit(2);return}JA(Z)}d();function YQ($={}){if($.version||Object.keys($).length===0)YA()}function YA(){let $=mZ();console.log(`${I(A("faf"))} v${$.version}`),console.log(M(`kernel ${tX()} IANA application/vnd.faf+yaml`))}var m2=[{name:"HTML",extensions:[".html",".htm"],category:"web"},{name:"CSS",extensions:[".css"],category:"web"},{name:"JavaScript",extensions:[".js",".mjs",".cjs"],category:"web"},{name:"TypeScript",extensions:[".ts",".tsx",".mts",".cts"],category:"web"},{name:"JSX",extensions:[".jsx"],category:"web"},{name:"Vue",extensions:[".vue"],category:"web"},{name:"Svelte",extensions:[".svelte"],category:"web"},{name:"Astro",extensions:[".astro"],category:"web"},{name:"JSON",extensions:[".json"],category:"data"},{name:"YAML",extensions:[".yml",".yaml"],category:"data"},{name:"TOML",extensions:[".toml"],category:"data"},{name:"XML",extensions:[".xml"],category:"data"},{name:"CSV",extensions:[".csv"],category:"data"},{name:"INI",extensions:[".ini",".cfg"],category:"config"},{name:"Env",extensions:[".env"],category:"config"},{name:"Dockerfile",extensions:["Dockerfile"],category:"config"},{name:"Rust",extensions:[".rs"],category:"systems"},{name:"Go",extensions:[".go"],category:"systems"},{name:"C",extensions:[".c",".h"],category:"systems"},{name:"C++",extensions:[".cpp",".cc",".hpp"],category:"systems"},{name:"Zig",extensions:[".zig"],category:"systems"},{name:"Python",extensions:[".py"],category:"scripting"},{name:"Ruby",extensions:[".rb"],category:"scripting"},{name:"Shell",extensions:[".sh",".bash",".zsh"],category:"scripting"},{name:"Lua",extensions:[".lua"],category:"scripting"},{name:"Java",extensions:[".java"],category:"jvm"},{name:"Kotlin",extensions:[".kt",".kts"],category:"jvm"},{name:"Scala",extensions:[".scala"],category:"jvm"},{name:"C#",extensions:[".cs"],category:"dotnet"},{name:"F#",extensions:[".fs"],category:"dotnet"},{name:"Swift",extensions:[".swift"],category:"systems"},{name:"Dart",extensions:[".dart"],category:"mobile"},{name:"Markdown",extensions:[".md",".mdx"],category:"docs"},{name:"LaTeX",extensions:[".tex"],category:"docs"},{name:"reStructuredText",extensions:[".rst"],category:"docs"},{name:"FAF",extensions:[".faf"],category:"faf"},{name:"FAFb",extensions:[".fafb"],category:"faf"},{name:"FAFm",extensions:[".fafm"],category:"faf"}];d();function WQ(){console.log(`${I("formats")} ${M("— supported file types")}
|
|
376
|
+
`);let $=new Map;for(let Z of m2){let X=$.get(Z.category)??[];X.push(Z),$.set(Z.category,X)}for(let[Z,X]of $){console.log(` ${A(Z)}`);for(let z of X)console.log(` ${z.name} ${M(z.extensions.join(", "))}`);console.log()}console.log(M(` ${m2.length} formats across ${$.size} categories`))}d();import{readdirSync as WA,rmSync as UA}from"fs";import{tmpdir as qA}from"os";import{join as GA}from"path";function UQ(){let $=qA(),Z=0;try{let X=WA($);for(let z of X)if(z.startsWith("faf-git-"))UA(GA($,z),{recursive:!0,force:!0}),Z++}catch{}if(Z>0)console.log(`${I("cleared")} ${Z} cached director${Z===1?"y":"ies"}`);else console.log(M("nothing to clear"))}function qQ($={}){let Z=h();if(!Z)console.error(`Error: project.faf not found
|
|
377
377
|
|
|
378
|
-
Run 'faf init' to create one.`),process.exit(2);if($.json){let X=p(Z);console.log(JSON.stringify(X,null,2))}else{let X=c(Z);console.log(X)}}
|
|
378
|
+
Run 'faf init' to create one.`),process.exit(2);if($.json){let X=p(Z);console.log(JSON.stringify(X,null,2))}else{let X=c(Z);console.log(X)}}d();function GQ(){let $=h();if(!$)console.error(`Error: project.faf not found
|
|
379
379
|
|
|
380
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=p($),X=[];for(let z of
|
|
381
|
-
`))}import{existsSync as
|
|
380
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=p($),X=[];for(let z of t){let[J,Q]=z.path.split("."),W=Z[J]?.[Q];if(P0(W)||W==="slotignored")continue;X.push(`${z.path}: ${W}`)}if(X.length===0){console.log(M("no populated slots"));return}console.log(X.join(`
|
|
381
|
+
`))}import{existsSync as VA,statSync as VQ}from"fs";import{join as KA}from"path";d();var HA=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"];function KQ(){let $=h();if(!$)console.error(`Error: project.faf not found
|
|
382
382
|
|
|
383
383
|
Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=VQ($).mtimeMs;console.log(`${I("drift")} ${M("— context file sync status")}
|
|
384
|
-
`),console.log(` ${A(".faf")} ${M(
|
|
385
|
-
run ${A("'faf sync'")} to resolve drift`))}function
|
|
384
|
+
`),console.log(` ${A(".faf")} ${M(cZ(X))}`);let z=0;for(let J of HA){let Q=KA(Z,J);if(!VA(Q)){console.log(` ${M("○")} ${J} ${M("missing")}`);continue}let Y=VQ(Q).mtimeMs,W=Y-X;if(Math.abs(W)<1000)console.log(` ${I("●")} ${J} ${M("in sync")}`);else if(W>0)console.log(` ${A("!")} ${J} ${A("newer")} ${M(cZ(Y))}`),z++;else console.log(` ${M("○")} ${J} ${M("older")} ${M(cZ(Y))}`),z++}if(z>0)console.log(M(`
|
|
385
|
+
run ${A("'faf sync'")} to resolve drift`))}function cZ($){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 HQ($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
|
|
386
386
|
|
|
387
|
-
Example: faf edit project.name "My Project"`),process.exit(1);let X=
|
|
387
|
+
Example: faf edit project.name "My Project"`),process.exit(1);let X=h();if(!X)console.error(`Error: project.faf not found
|
|
388
388
|
|
|
389
|
-
Run 'faf init' to create one.`),process.exit(2);let z=p(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,
|
|
389
|
+
Run 'faf init' to create one.`),process.exit(2);let z=p(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,o(X,z),console.log(`${I("updated")} ${$} ${M("→")} ${Z}`)}import{existsSync as U4,readFileSync as lZ}from"fs";import{join as c2}from"path";d();function BQ(){let $=process.cwd(),Z=[],X={faf_version:R1,project:{}},z=c2($,"CLAUDE.md");if(U4(z)){let U=lZ(z,"utf-8"),q=s8(U);if(q.project?.name)X.project.name=q.project.name;if(q.project?.goal)X.project.goal=q.project.goal;if(q.project?.main_language)X.project.main_language=q.project.main_language;Z.push("CLAUDE.md")}let J=c2($,"AGENTS.md");if(U4(J)){let U=lZ(J,"utf-8");if(!X.project.name){let q=U.match(/^#\s+(.+)/m);if(q)X.project.name=q[1].trim()}Z.push("AGENTS.md")}let Q=c2($,"GEMINI.md");if(U4(Q)){let U=lZ(Q,"utf-8");if(!X.project.name){let q=U.match(/^#\s+(.+)/m);if(q)X.project.name=q[1].trim()}Z.push("GEMINI.md")}let Y=c2($,".cursorrules");if(U4(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 W=h($);if(W){let U=p(W);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;o(W,U),console.log(`${I("◆")} recover merged into ${W}`)}else{let U=c2($,"project.faf");o(U,X),console.log(`${I("◆")} recover created ${U}`)}console.log(M(` sources: ${Z.join(", ")}`))}d();var l2=R1;function MQ($={}){let Z=h();if(!Z)console.error(`Error: project.faf not found
|
|
390
390
|
|
|
391
|
-
Run 'faf init' to create one.`),process.exit(2);let X=p(Z),z=X.faf_version??"unknown";if(z===
|
|
392
|
-
`),console.log(` Status: ${$?K0(A("PRO")):A("Free")}`),console.log(""),!$)console.log(M(" Upgrade: faf pro activate"))}function
|
|
393
|
-
`);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(` ${I("◆")} ${A(Z)} ${M("—")} ${X}`);console.log("")}function
|
|
394
|
-
`),console.log(" Set FAF_PRO=1 in your environment to enable Pro features."),console.log(""),console.log(M(" export FAF_PRO=1")),console.log(""),console.log(M(" Visit: https://faf.one/pro")),import("open").then(({default:$})=>$("https://faf.one/pro")).catch(()=>{})}import{gzipSync as
|
|
391
|
+
Run 'faf init' to create one.`),process.exit(2);let X=p(Z),z=X.faf_version??"unknown";if(z===l2){console.log(`${I("◆")} migrate already at v${l2}`);return}if(X.faf_version=l2,!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(`${I("◆")} migrate ${M("(dry run)")} v${z} → v${l2}`),console.log(M(` would update ${Z}`));return}o(Z,X),console.log(`${I("◆")} migrate v${z} → v${l2}`),console.log(M(` updated ${Z}`))}d();function OQ($){if($==="features")MA();else if($==="activate")OA();else BA()}function BA(){let $=A$();if(console.log(`${I("pro")} ${M("— FAF Pro status")}
|
|
392
|
+
`),console.log(` Status: ${$?K0(A("PRO")):A("Free")}`),console.log(""),!$)console.log(M(" Upgrade: faf pro activate"))}function MA(){console.log(`${I("pro")} ${M("— Pro features")}
|
|
393
|
+
`);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(` ${I("◆")} ${A(Z)} ${M("—")} ${X}`);console.log("")}function OA(){console.log(`${I("pro")} ${M("— activate")}
|
|
394
|
+
`),console.log(" Set FAF_PRO=1 in your environment to enable Pro features."),console.log(""),console.log(M(" export FAF_PRO=1")),console.log(""),console.log(M(" Visit: https://faf.one/pro")),import("open").then(({default:$})=>$("https://faf.one/pro")).catch(()=>{})}import{gzipSync as LA}from"zlib";d();function LQ($={}){let Z=h();if(!Z)console.error(`Error: project.faf not found
|
|
395
395
|
|
|
396
|
-
Run 'faf init' to create one.`),process.exit(2);let X=c(Z),J=
|
|
397
|
-
`),console.log(` ${Q}`),$.copy)try{let{execSync:Y}=
|
|
396
|
+
Run 'faf init' to create one.`),process.exit(2);let X=c(Z),J=LA(Buffer.from(X)).toString("base64url");if($.raw){console.log(J);return}let Q=`https://faf.one/share?d=${J}`;if(console.log(`${I("◆")} share ${M(Z)}
|
|
397
|
+
`),console.log(` ${Q}`),$.copy)try{let{execSync:Y}=F0("child_process"),W=process.platform;if(W==="darwin")Y("pbcopy",{input:Q});else if(W==="linux")Y("xclip -selection clipboard",{input:Q});console.log(M(`
|
|
398
398
|
copied to clipboard`))}catch{console.log(M(`
|
|
399
|
-
copy failed — install xclip or pbcopy`))}}import{mkdirSync as
|
|
399
|
+
copy failed — install xclip or pbcopy`))}}import{mkdirSync as NA,writeFileSync as DA,rmSync as IA}from"fs";import{tmpdir as TA}from"os";import{join as NQ}from"path";d();function DQ(){let $=NQ(TA(),`faf-demo-${Date.now()}`);NA($,{recursive:!0}),console.log(`${I("demo")} ${M("— FAF in action")}
|
|
400
400
|
`);let Z=`faf_version: 2.5.0
|
|
401
401
|
project:
|
|
402
402
|
name: acme-app
|
|
@@ -422,18 +422,18 @@ human_context:
|
|
|
422
422
|
where: Cloud (Vercel + AWS)
|
|
423
423
|
when: "2026"
|
|
424
424
|
how: Agile sprints with CI/CD
|
|
425
|
-
`,X=NQ($,"project.faf");
|
|
426
|
-
`)),console.log(` ${A("2.")} Scoring...`);let z=H0(
|
|
427
|
-
${M(' Demo complete. Run "faf init" in your project to get started.')}`)}
|
|
428
|
-
`);for(let Y of Q)console.log(` ${A(`#${Y.index}`)} ${Y.path} ${M("—")} ${Y.description} ${M(`[${Y.category}]`)}`);console.log(""),J+=Q.length}}if(z||Z.formats){let Q=
|
|
429
|
-
`);for(let Y of Q)console.log(` ${A(Y.name)} ${M(Y.extensions.join(", "))} ${M(`[${Y.category}]`)}`);console.log(""),J+=Q.length}}if(J===0)console.log(M(` No results for "${$}"`))}import{writeFileSync as TQ,existsSync as
|
|
425
|
+
`,X=NQ($,"project.faf");DA(X,Z),console.log(` ${A("1.")} Created sample project.faf`),console.log(M(` ${X}
|
|
426
|
+
`)),console.log(` ${A("2.")} Scoring...`);let z=H0(U0(c(X)));console.log(""),J0(z,"project.faf",!0),IA($,{recursive:!0,force:!0}),console.log(`
|
|
427
|
+
${M(' Demo complete. Run "faf init" in your project to get started.')}`)}d();function IQ($,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=t.filter((Y)=>Y.path.toLowerCase().includes(X)||Y.description.toLowerCase().includes(X)||Y.category.toLowerCase().includes(X));if(Q.length>0){console.log(`${I("slots")} ${M(`— ${Q.length} match${Q.length===1?"":"es"}`)}
|
|
428
|
+
`);for(let Y of Q)console.log(` ${A(`#${Y.index}`)} ${Y.path} ${M("—")} ${Y.description} ${M(`[${Y.category}]`)}`);console.log(""),J+=Q.length}}if(z||Z.formats){let Q=m2.filter((Y)=>Y.name.toLowerCase().includes(X)||Y.extensions.some((W)=>W.toLowerCase().includes(X))||Y.category.toLowerCase().includes(X));if(Q.length>0){console.log(`${I("formats")} ${M(`— ${Q.length} match${Q.length===1?"":"es"}`)}
|
|
429
|
+
`);for(let Y of Q)console.log(` ${A(Y.name)} ${M(Y.extensions.join(", "))} ${M(`[${Y.category}]`)}`);console.log(""),J+=Q.length}}if(J===0)console.log(M(` No results for "${$}"`))}import{writeFileSync as TQ,existsSync as P$,mkdirSync as AA}from"fs";import{join as i1}from"path";d();var RA="Wolfe-Jam/faf-taf-git@v2.2.0";function AQ($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;if($==="setup"){PA(Z);return}EA(Z)}function _A($){if(P$(i1($,"bun.lockb"))||P$(i1($,"bun.lock")))return"bun";if(P$(i1($,"pnpm-lock.yaml")))return"pnpm";if(P$(i1($,"yarn.lock")))return"yarn";return"npm"}var FA={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: pnpm/action-setup@v4
|
|
430
430
|
- uses: actions/setup-node@v4
|
|
431
431
|
with:
|
|
432
432
|
node-version: 20`,install:"pnpm install --frozen-lockfile",test:"pnpm test"},yarn:{setup:` - uses: actions/setup-node@v4
|
|
433
433
|
with:
|
|
434
434
|
node-version: 20`,install:"yarn install --frozen-lockfile",test:"yarn test"},npm:{setup:` - uses: actions/setup-node@v4
|
|
435
435
|
with:
|
|
436
|
-
node-version: 20`,install:"npm ci",test:"npm test"}};function
|
|
436
|
+
node-version: 20`,install:"npm ci",test:"npm test"}};function CA($){let Z=`name: TAF Receipts
|
|
437
437
|
`+`# Prints a Test Receipt (.taf) on every push — proof over time, cannot be gamed.
|
|
438
438
|
`+`# Generated by \`faf taf setup\`. Docs: https://github.com/Wolfe-Jam/faf-taf-git
|
|
439
439
|
on:
|
|
@@ -445,7 +445,7 @@ jobs:
|
|
|
445
445
|
runs-on: ubuntu-latest
|
|
446
446
|
steps:
|
|
447
447
|
- uses: actions/checkout@v4
|
|
448
|
-
`,X;if(
|
|
448
|
+
`,X;if(P$(i1($,"package.json"))){let J=FA[_A($)];X=`${J.setup}
|
|
449
449
|
- run: ${J.install}
|
|
450
450
|
- name: Run tests
|
|
451
451
|
run: ${J.test} 2>&1 | tee test-output.txt
|
|
@@ -456,28 +456,28 @@ jobs:
|
|
|
456
456
|
echo "TODO: your test command" 2>&1 | tee test-output.txt
|
|
457
457
|
`;let z=` - name: Print TAF receipt
|
|
458
458
|
if: github.event_name == 'push'
|
|
459
|
-
uses: ${
|
|
459
|
+
uses: ${RA}
|
|
460
460
|
with:
|
|
461
461
|
test-output-file: test-output.txt
|
|
462
462
|
auto-commit: 'true'
|
|
463
463
|
commit-message: 'chore(taf): update .taf receipt [skip ci]'
|
|
464
464
|
target-branch: taf-receipts
|
|
465
|
-
`;return Z+X+z}function
|
|
466
|
-
`),console.log(M("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(X),console.log(M("Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run."))}function
|
|
465
|
+
`;return Z+X+z}function PA($){let Z=process.cwd(),X=CA(Z),z=i1(Z,".github","workflows","taf.yml");if($.write){if(P$(z)){console.error(`${A("×")} .github/workflows/taf.yml already exists — not overwriting.`),console.error(M(" Add the faf-taf-git step to your existing workflow, or remove taf.yml and re-run."));return}AA(i1(Z,".github","workflows"),{recursive:!0}),TQ(z,X,"utf-8"),console.log(`${I("◆")} taf wrote .github/workflows/taf.yml`),console.log(M(" commit + push → your first Test Receipt prints to the taf-receipts branch."));return}console.log(`${I("TAF setup")} ${M("— Test Receipt Printer: proof over time, cannot be gamed")}
|
|
466
|
+
`),console.log(M("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(X),console.log(M("Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run."))}function EA($){console.error(M("note: `faf taf` (score snapshot) is deprecated — use `faf score --json`. (`faf taf setup` wires the Receipt Printer.)"));let Z=h();if(!Z)console.error(`Error: project.faf not found
|
|
467
467
|
|
|
468
|
-
Run 'faf init' to create one.`),process.exit(2);let X=p(Z),z=c(Z),J=
|
|
468
|
+
Run 'faf init' to create one.`),process.exit(2);let X=p(Z),z=c(Z),J=z0(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)TQ($.output,Y,"utf-8"),console.log(`${I("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as wA}from"readline";import{existsSync as RQ,readFileSync as SA,writeFileSync as jA,unlinkSync as xA}from"fs";import{join as bA}from"path";d();var kA=".faf-session.json";function yA($,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 vA($,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 _Q($={}){I$(process.cwd(),"faf go");let Z=h();if(!Z)console.error(`Error: project.faf not found
|
|
469
469
|
|
|
470
|
-
Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=
|
|
471
|
-
`));let U=
|
|
472
|
-
session saved. Resume with: faf go --resume`));break}if(B.toLowerCase()==="skip"||B.trim()==="")continue;
|
|
473
|
-
${I("◆")} go filled ${G} slot${G===1?"":"s"}`);let K=H0(
|
|
470
|
+
Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=bA(X,kA),J=0;if($.resume&&RQ(z))try{J=JSON.parse(SA(z,"utf-8")).slotIndex,console.log(M(` resuming from slot #${J+1}`))}catch{}let Q=p(Z),Y=t.filter((H)=>{let N=yA(Q,H.path);return P0(N)&&N!=="slotignored"});if(Y.length===0){console.log(`${I("◆")} go all slots populated — ✪ Trophy`);let H=H0(U0(c(Z)));J0(H,Z);return}console.log(`${I("go")} ${M("— guided interview to ✪ Trophy")}`);let W=Y.length===1?"slot":"slots";console.log(M(` ${Y.length} ${W} from Trophy. Enter a value, "skip" to skip, or "quit" to stop.
|
|
471
|
+
`));let U=wA({input:process.stdin,output:process.stdout}),q=(H)=>new Promise((N)=>U.question(H,N)),G=0,V=Y.slice(J);for(let H=0;H<V.length;H++){let N=V[H],B=await q(` ${A(`#${N.index}`)} ${n8(N.path)} ${M(`(${N.path})`)}: `);if(B.toLowerCase()==="quit"){let O={slotIndex:J+H,fafPath:Z};jA(z,JSON.stringify(O),"utf-8"),console.log(M(`
|
|
472
|
+
session saved. Resume with: faf go --resume`));break}if(B.toLowerCase()==="skip"||B.trim()==="")continue;vA(Q,N.path,B.trim()),G++}if(U.close(),G>0)o(Z,Q),console.log(`
|
|
473
|
+
${I("◆")} go filled ${G} slot${G===1?"":"s"}`);let K=H0(U0(c(Z)));if(J0(K,Z),RQ(z))try{xA(z)}catch{}}d();var bR=[/^(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 kR($){if(typeof $!=="string")return!1;let Z=$.trim();if(Z.length<4||Z.length>280)return!1;return!bR.some((X)=>X.test(Z))}function yR($,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 vR($,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 _Y($){if($==="analyze")await gR();else if($==="enhance")await fR();else console.log(`${I("ai")} ${M("— AI-powered features")}
|
|
474
474
|
`),console.log(` ${A("faf ai enhance")} ${M("— fill empty slots via Claude")}`),console.log(` ${A("faf ai analyze")} ${M("— get improvement suggestions")}`),console.log(""),console.log(M(" Requires ANTHROPIC_API_KEY environment variable."))}async function FY(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
|
|
475
475
|
|
|
476
476
|
export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (RY(),AY));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
|
|
477
477
|
|
|
478
|
-
npm install @anthropic-ai/sdk`),process.exit(2)}}async function
|
|
478
|
+
npm install @anthropic-ai/sdk`),process.exit(2)}}async function fR(){let $=h();if(!$)console.error(`Error: project.faf not found
|
|
479
479
|
|
|
480
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=p($),X=c($),z=
|
|
480
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=p($),X=c($),z=t.filter((U)=>{let q=yR(Z,U.path);return P0(q)&&q!=="slotignored"});if(z.length===0){console.log(`${I("◆")} ai enhance all slots populated`);return}console.log(`${I("ai")} enhance ${M(`extracting from ${z.length} empty slots...`)}`);let J=await FY(),Q=z.map((U)=>`- ${U.path}: ${U.description}`).join(`
|
|
481
481
|
`),Y=`You are extracting concrete content from a project's .faf file to fill empty slots. STRICT RULES:
|
|
482
482
|
|
|
483
483
|
1. Return JSON mapping dot-paths to values OR null.
|
|
@@ -493,54 +493,54 @@ ${X}
|
|
|
493
493
|
Empty slots to fill (return null if no concrete evidence):
|
|
494
494
|
${Q}
|
|
495
495
|
|
|
496
|
-
Respond with ONLY valid JSON, no markdown fences. Each value is either a short string (with concrete evidence) or null (leave empty).`,W=await J.messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:Y}]});try{let U=W.content[0].text,q=JSON.parse(U),G=0,V=0;for(let K of z){let H=q[K.path];if(H===null||H===void 0)continue;if(
|
|
497
|
-
${I("◆")} ai enhance filled ${G} slot${G===1?"":"s"}${V>0?` (${V} rejected)`:""}`);let K=H0(
|
|
496
|
+
Respond with ONLY valid JSON, no markdown fences. Each value is either a short string (with concrete evidence) or null (leave empty).`,W=await J.messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:Y}]});try{let U=W.content[0].text,q=JSON.parse(U),G=0,V=0;for(let K of z){let H=q[K.path];if(H===null||H===void 0)continue;if(kR(H))vR(Z,K.path,H),console.log(` ${I("●")} ${K.path} ${M("←")} ${H}`),G++;else console.log(` ${M("○")} ${K.path} ${M("— rejected as slop, left empty")}`),V++}if(G>0){o($,Z),console.log(`
|
|
497
|
+
${I("◆")} ai enhance filled ${G} slot${G===1?"":"s"}${V>0?` (${V} rejected)`:""}`);let K=H0(U0(c($)));J0(K,$)}else if(V>0)console.log(`
|
|
498
498
|
${M("all extractions rejected as slop. Run")} ${A("'faf go'")} ${M("for interview-fill.")}`);else console.log(`
|
|
499
|
-
${M("no concrete evidence for empty slots. Run")} ${A("'faf go'")} ${M("for interview-fill.")}`)}catch{console.error("Error: Could not parse AI response.")}}async function
|
|
499
|
+
${M("no concrete evidence for empty slots. Run")} ${A("'faf go'")} ${M("for interview-fill.")}`)}catch{console.error("Error: Could not parse AI response.")}}async function gR(){let $=h();if(!$)console.error(`Error: project.faf not found
|
|
500
500
|
|
|
501
501
|
Run 'faf init' to create one.`),process.exit(2);let Z=c($);console.log(`${I("ai")} analyze ${M("getting suggestions...")}`);let z=await(await FY()).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.
|
|
502
502
|
|
|
503
503
|
${Z}
|
|
504
504
|
|
|
505
|
-
Be concise. One line per suggestion.`}]});console.log(""),console.log(z.content[0].text)}import{existsSync as
|
|
506
|
-
`),console.log(` ${A("faf conductor import <path>")} ${M("— import conductor config into .faf")}`),console.log(` ${A("faf conductor export")} ${M("— author conductor config from .faf")}`)}function
|
|
505
|
+
Be concise. One line per suggestion.`}]});console.log(""),console.log(z.content[0].text)}import{existsSync as J9,readFileSync as Q9,readdirSync as hR}from"fs";import{join as CY}from"path";d();function PY($,Z){if($==="import")uR(Z);else if($==="export")mR();else console.log(`${I("conductor")} ${M("— conductor integration")}
|
|
506
|
+
`),console.log(` ${A("faf conductor import <path>")} ${M("— import conductor config into .faf")}`),console.log(` ${A("faf conductor export")} ${M("— author conductor config from .faf")}`)}function uR($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!J9($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:R1,project:{}};if(J9($)&&$.endsWith(".json")){let J=JSON.parse(Q9($,"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(J9($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let J=D0(Q9($,"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=hR($);for(let Q of J){let Y=CY($,Q);if(Q.endsWith(".json"))try{let W=JSON.parse(Q9(Y,"utf-8"));if(W.name&&!Z.project.name)Z.project.name=W.name;if(W.description&&!Z.project.goal)Z.project.goal=W.description}catch{}}}catch{console.error(`Error: could not read directory: ${$}`),process.exit(2)}let X=process.cwd(),z=h(X);if(z){let J=p(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;o(z,J),console.log(`${I("◆")} conductor import merged into ${z}`)}else{let J=CY(X,"project.faf");o(J,Z),console.log(`${I("◆")} conductor import created ${J}`)}}function mR(){let $=h();if(!$)console.error(`Error: project.faf not found
|
|
507
507
|
|
|
508
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=p($),X={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(X,null,2))}
|
|
509
|
-
`,"utf-8")}function
|
|
508
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=p($),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 cR,readFileSync as lR,existsSync as dR}from"fs";import{join as pR}from"path";var iR=["BRAKE","ENGINE","AERO","TYRE","PIT"],nR=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function rR($){let Z=$.match(nR);if(!Z)return null;return Z[1].toUpperCase()}function sR($){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 aR($,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=[],W=0,U=null,q=0;for(let G=0;G<$.length;G++){while(q<J.length&&J[q].idx===G){let K=J[q];if(K.type==="describe")U=K.name;else{let H=Y.map((B)=>B.name),N=H.length>0?`${H.join(" > ")} > ${K.name}`:K.name;X.push(N)}q++}let V=$[G];if(V==="{"){if(W++,U!==null)Y.push({name:U,openDepth:W}),U=null}else if(V==="}"){W--;while(Y.length>0&&W<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 oR=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function EY($,Z=[]){let X;try{X=cR($,{withFileTypes:!0})}catch{return Z}for(let z of X){if(oR.has(z.name))continue;if(z.name.startsWith(".")&&z.name!==".")continue;let J=pR($,z.name);if(z.isDirectory())EY(J,Z);else if(z.isFile())Z.push(J)}return Z}function tR($){let Z=[];if(!dR($))return Z;let X=EY($);for(let z of X){let J=z.split("/").pop()??"",Q=sR(J);if(!Q.ok||!Q.lang)continue;let Y;try{Y=lR(z,"utf-8")}catch{continue}if(Q.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(Q.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let W=aR(Y,Q.lang),U=z.replace(`${$}/`,"");for(let q of W)Z.push({file:U,language:Q.lang,testName:q,tier:rR(q)})}return Z}function eR($){let Z={BRAKE:0,ENGINE:0,AERO:0,TYRE: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 $_($){if(console.log(`${I(A("faf wjttc"))} ${M("— vendor-neutral test audit")}`),console.log(""),console.log(` Files scanned: ${A(String($.filesScanned))}`),console.log(` Tests found: ${A(String($.totalTests))}`),console.log(""),$.totalTests===0){console.log(M(" no tests found"));return}console.log(M(" Tiers:"));for(let Z of iR){let X=$.byTier[Z],z=(X/$.totalTests*100).toFixed(0),J=Z==="BRAKE"?K0("●"):Z==="ENGINE"?I("●"):Z==="AERO"?M("●"):Z==="TYRE"?I("◐"):M("○");console.log(` ${J} ${Z.padEnd(7)} ${A(String(X).padStart(4))} ${M(`(${z}%)`)}`)}if($.untiered>0){let Z=($.untiered/$.totalTests*100).toFixed(0);console.log(` ${M("○")} ${"untiered".padEnd(7)} ${A(String($.untiered).padStart(4))} ${M(`(${Z}%)`)}`)}if($.untiered>0&&$.untieredExamples.length>0){console.log(""),console.log(M(` Untiered examples (first ${$.untieredExamples.length}):`));for(let Z of $.untieredExamples)console.log(` ${M("·")} ${Z}`)}if(Object.keys($.byLanguage).length>1){console.log(""),console.log(M(" Languages:"));for(let[Z,X]of Object.entries($.byLanguage))console.log(` ${M("·")} ${Z.padEnd(12)} ${A(String(X))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(K0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function wY($={}){let Z=$.path??"tests",X=tR(Z),z=eR(X);if($.json)console.log(JSON.stringify(z,null,2));else $_(z);if($.strict&&z.untiered>0)process.exit(1)}import{createHash as xY}from"crypto";import{readFileSync as bY,writeFileSync as Z_,existsSync as kY}from"fs";import{join as yY,dirname as X_}from"path";d();var SY="faf-bench/1",z_={"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 J_($,Z){return z_[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var Q_=[["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"]],x6=new Map;Q_.forEach(($,Z)=>$.forEach((X)=>x6.set(X,Z)));var Y_=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function Y9($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function jY($){return Y9($).split(" ").filter((Z)=>Z&&!Y_.has(Z))}function W_($,Z){let X=Y9($),z=Y9(Z);if(!X||!z)return!1;if(X===z)return!0;let J=x6.get(X);if(J!==void 0&&x6.get(z)===J)return!0;let Q=jY($);if(Q.length===0)return!1;let Y=new Set(jY(Z));return Q.every((W)=>{if(Y.has(W))return!0;let U=x6.get(W);return U!==void 0&&[...Y].some((q)=>x6.get(q)===U)})}function U_($){let Z=z0($),X=D0($),z=[],J={},Q=0;for(let U of t){if(Z.slots[U.path]!=="populated")continue;let q=_2(X,U);if(typeof q!=="string")continue;let G=q.trim();if(!G||qZ.has(G.toLowerCase()))continue;Q+=1,z.push({n:Q,path:U.path,question:J_(U.path,U.description)}),J[Q]=G}let Y=JSON.stringify({v:SY,q:z.map((U)=>[U.path,U.question])}),W=xY("sha256").update(Y).digest("hex").slice(0,12);return{version:SY,qsetHash:W,questions:z,answers:J}}function q_($,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()!==""&&W_($.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 vY=".faf-bench.json";function G_($){let Z=yY($,vY);if(!kY(Z))return null;try{return JSON.parse(bY(Z,"utf-8"))}catch{return null}}function V_($,Z){Z_(yY($,vY),`${JSON.stringify(Z,null,2)}
|
|
509
|
+
`,"utf-8")}function W9($,Z){let X=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:X,hash:xY("sha256").update(X).digest("hex")}}var f4=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function K_($,Z){let{cold:X,faf:z}=$;console.log(`
|
|
510
510
|
${A(`faf bench — ${Z}`)}
|
|
511
|
-
`),console.log(` ${M("without context")} ${I("with .faf")}`),console.log(`answers ${X.score}/${X.total} ${A(`${z.score}/${z.total}`)}`),console.log(`tokens ${
|
|
512
|
-
${M(`The ${J} missing answer${J===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(M("Structured context closes the gap."));let Q=
|
|
513
|
-
${K0("✪ BENCH RECEIPT")}`),console.log(M(` qset: ${$.qsetHash} protocol: ${$.protocol} model: ${z.model??X.model??"unreported"}`)),console.log(M(` cold ${X.score}/${X.total} · faf ${z.score}/${z.total} · sha256: ${Q.hash.slice(0,16)}…`))}function
|
|
511
|
+
`),console.log(` ${M("without context")} ${I("with .faf")}`),console.log(`answers ${X.score}/${X.total} ${A(`${z.score}/${z.total}`)}`),console.log(`tokens ${f4(X.tokens)} ${f4(z.tokens)}`);let J=X.total-X.score;if(J>0)console.log(`
|
|
512
|
+
${M(`The ${J} missing answer${J===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(M("Structured context closes the gap."));let Q=W9($,Z);console.log(`
|
|
513
|
+
${K0("✪ BENCH RECEIPT")}`),console.log(M(` qset: ${$.qsetHash} protocol: ${$.protocol} model: ${z.model??X.model??"unreported"}`)),console.log(M(` cold ${X.score}/${X.total} · faf ${z.score}/${z.total} · sha256: ${Q.hash.slice(0,16)}…`))}function H_($,Z){let X=$.cold,z=X.total-X.score;if(console.log(`
|
|
514
514
|
${A(`faf bench — ${Z}`)} ${K0("Trouble ahead, expensive trouble.")}
|
|
515
|
-
`),console.log(` ${M("without context")}`),console.log(`answers ${X.score}/${X.total} ${M("— the AI is guessing at what you are building")}`),X.tokens!==void 0)console.log(`tokens ${
|
|
515
|
+
`),console.log(` ${M("without context")}`),console.log(`answers ${X.score}/${X.total} ${M("— the AI is guessing at what you are building")}`),X.tokens!==void 0)console.log(`tokens ${f4(X.tokens)} ${M("— re-derivation burn, paid again EVERY session")}`);if(z>0)console.log(`
|
|
516
516
|
${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(`
|
|
517
|
-
${I("→ faf init && faf bench")} ${M("(close the gap, get the receipt)")}`)}var
|
|
517
|
+
${I("→ faf init && faf bench")} ${M("(close the gap, get the receipt)")}`)}var B_="https://mcpaas.live/bench/submit";async function M_($,Z){try{let X=await fetch(Z,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)});console.log(M(X.ok?` ✪ submitted to ${Z}`:` submit failed (${X.status})`))}catch{console.log(M(" submit skipped (endpoint unreachable)"))}}function fY($,Z,X={}){let z=X.file??h();if(!z)console.error(`Error: project.faf not found
|
|
518
518
|
|
|
519
|
-
Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let J=c(z),Q=
|
|
519
|
+
Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let J=c(z),Q=U_(J),Y=X_(z),W=D0(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:q})=>({n:U,question:q}))},null,2));return}console.log(`
|
|
520
520
|
${A(`faf bench — ${Q.questions.length} questions`)} ${M(`qset ${Q.qsetHash}`)}
|
|
521
521
|
`);for(let U of Q.questions)console.log(` ${String(U.n).padStart(2)}. ${U.question}`);console.log(`
|
|
522
|
-
${M('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!kY(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(bY(Z,"utf-8")),q=U.answers??U,G=
|
|
523
|
-
${A(`faf bench — ${W}`)} ${I("with .faf")}: ${A(`${V.score}/${V.total}`)} ${M(`tokens ${
|
|
522
|
+
${M('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!kY(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(bY(Z,"utf-8")),q=U.answers??U,G=q_(Q,q),V={score:G.correct,total:G.total,...X.tokens?{tokens:parseInt(X.tokens,10)}:{},...X.model?{model:X.model}:{}},K=G_(Y),H=K&&K.qsetHash===Q.qsetHash?K:{version:Q.version,qsetHash:Q.qsetHash,protocol:"in-session"};if(X.cold)H.cold=V;else if(X.faf)H.faf=V;else console.error("Error: specify the run mode — --cold (no context) or --faf (after reading project.faf)."),process.exit(2);if(V_(Y,H),X.json){let N=W9(H,W);console.log(JSON.stringify({...H,receipt:N.hash,perQuestion:G.perQuestion},null,2));return}if(H.cold&&H.faf)K_(H,W);if(X.submit&&H.cold&&H.faf){let{cold:N,faf:B}=H,O=W9(H,W);M_({date:new Date().toISOString().slice(0,10),model:B.model??N.model??X.model??"unreported",repo:W,qset:H.qsetHash,cold:`${N.score}/${N.total}`,faf:`${B.score}/${B.total}`,sha256:O.hash.slice(0,16)},X.endpoint??B_)}else if(H.cold)H_(H,W);else console.log(`
|
|
523
|
+
${A(`faf bench — ${W}`)} ${I("with .faf")}: ${A(`${V.score}/${V.total}`)} ${M(`tokens ${f4(V.tokens)}`)}`),console.log(M("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
|
|
524
524
|
${A("faf bench — agent-native protocol")} ${M(`qset ${Q.qsetHash} · ${Q.questions.length} questions`)}
|
|
525
525
|
`),console.log(`${A("COLD phase")} ${M("(fresh AI session, repo access)")}`),console.log(' 1. Instruct: "Answer these questions from the repository.'),console.log(' Do NOT read project.faf, CLAUDE.md, AGENTS.md, or any *.faf file."'),console.log(` 2. ${I("faf bench questions")} — hand them over; answers terse, saved as cold.json`),console.log(` 3. ${I("faf bench grade cold.json --cold --tokens <used> --model <name>")}
|
|
526
526
|
`),console.log(`${A("FAF phase")} ${M("(same questions, context first)")}`),console.log(' 4. Instruct: "Read project.faf, then answer the same questions." → faf.json'),console.log(` 5. ${I("faf bench grade faf.json --faf --tokens <used> --model <name>")}
|
|
527
|
-
`),console.log(M("Grading is mechanical against your own project.faf — the .faf IS the answer key.")),console.log(M(`Receipts carry protocol: in-session (honor-system cold). qset ${Q.qsetHash}.`))}import{existsSync as
|
|
527
|
+
`),console.log(M("Grading is mechanical against your own project.faf — the .faf IS the answer key.")),console.log(M(`Receipts carry protocol: in-session (honor-system cold). qset ${Q.qsetHash}.`))}import{existsSync as O_,writeFileSync as L_}from"fs";d();function gY($={}){let Z=h();if(!Z)console.error(`Error: project.faf not found
|
|
528
528
|
|
|
529
|
-
Run 'faf init' to create one.`),process.exit(2);let X=c(Z),z=
|
|
530
|
-
`),U){let V=W>0?"↑":"↓";console.log(` drift: ${M(`${Y}%`)} ${V} ${A(`${z.score}%`)} ${M(`(${W>0?"+":""}${W})`)}`)}else if(Y!==null&&Y!==void 0)console.log(` no drift ${M(`— steady at ${z.score}%`)}`);else console.log(` baseline set ${M(`— ${z.score}%`)}`);if(G!==null&&G!==void 0)console.log(` .fafb re-compiled ${M(`(${G} bytes — fast tier current)`)}`);console.log(` re-grounded: ${
|
|
529
|
+
Run 'faf init' to create one.`),process.exit(2);let X=c(Z),z=z0(X),J=new Q1(process.cwd()),Q=J.load()?J.getBirthDNADisplay():null,Y=Q?Q.current:null,W=Y!==null&&Y!==void 0?z.score-Y:0,U=Y!==null&&Y!==void 0&&W!==0,q=Z.replace(/\.faf$/,".fafb"),G=null;if(O_(q)){let V=E8(X);L_(q,V),G=V.length}if($.json)console.log(JSON.stringify({reGrounded:!0,score:z.score,tier:z.tier,baseline:Y,delta:W,drifted:U,fafb:G!==null&&G!==void 0?{reCompiled:!0,bytes:G}:{reCompiled:!1},journey:J.getJourney()||null},null,2));else{if(console.log(`${I("refresh")} ${M("— re-grounding on the live .faf")}
|
|
530
|
+
`),U){let V=W>0?"↑":"↓";console.log(` drift: ${M(`${Y}%`)} ${V} ${A(`${z.score}%`)} ${M(`(${W>0?"+":""}${W})`)}`)}else if(Y!==null&&Y!==void 0)console.log(` no drift ${M(`— steady at ${z.score}%`)}`);else console.log(` baseline set ${M(`— ${z.score}%`)}`);if(G!==null&&G!==void 0)console.log(` .fafb re-compiled ${M(`(${G} bytes — fast tier current)`)}`);console.log(` re-grounded: ${c0(z.tier)} ${A(`${z.score}%`)}`)}if(J.exists())J.recordGrowth(z.score,["refresh — re-grounded"]);else J.birth(z.score)}d();import{existsSync as iY}from"fs";import{resolve as k6}from"path";var hY=["ephemeral","standard","high","critical"],Z$=Object.fromEntries(hY.map(($,Z)=>[$,Z])),U9=new Set(["user","feedback","project","reference"]),q9=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),G9=new Set(["facts","sessions","preferences","custom"]),V9={low:"ephemeral",medium:"standard"};import{readFileSync as N_,writeFileSync as D_,existsSync as I_}from"fs";function b6(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function I0($){return $===null||$===void 0}function g4($){if(I0($))return"standard";if(V9[$])return V9[$];if($ in Z$)return $;return"standard"}var T_=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function uY($){if(typeof $==="string")return{text:$,id:null,type:null,priority:"standard",tags:[],links:[],timestamp:null,source:null,extra:{}};if(!$||typeof $!=="object"||!("text"in $))throw Error(`fact must be a string or a mapping with 'text': ${JSON.stringify($)}`);let Z=$,X={};for(let[z,J]of Object.entries(Z))if(!T_.has(z))X[z]=J;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:g4(Z.priority),tags:Array.isArray(Z.tags)?Z.tags.slice():[],links:Array.isArray(Z.links)?Z.links.slice():[],timestamp:Z.timestamp??null,source:Z.source??null,extra:X}}function mY($){if(I0($.id)&&I0($.type)&&$.tags.length===0&&$.links.length===0&&I0($.timestamp)&&I0($.source)&&Object.keys($.extra).length===0&&$.priority==="standard")return $.text;let X={text:$.text};if(!I0($.id))X.id=$.id;if(!I0($.type))X.type=$.type;if(X.priority=$.priority,$.tags.length)X.tags=$.tags;if($.links.length)X.links=$.links;if(!I0($.timestamp))X.timestamp=$.timestamp;if(!I0($.source))X.source=$.source;return Object.assign(X,$.extra),X}class t0{namepoint;profile;retention;created;last_etched;_facts;_byId;_index;_sessions;_preferences;_custom;_extra;_memoryExtra;constructor($,Z={}){this.namepoint=$,this.profile=Z.profile??"knowledge",this.retention=Z.retention??"forever",this.created=Z.created??b6(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.slice():[],this._byId=new Map,this._facts.forEach((X,z)=>{if(!I0(X.id))this._byId.set(X.id,z)}),this._index=Z.index?Z.index.slice():[],this._sessions=Z.sessions?structuredClone(Z.sessions):[],this._preferences=Z.preferences?{...Z.preferences}:{},this._custom=Z.custom?{...Z.custom}:{},this._extra=Z.extra?{...Z.extra}:{},this._memoryExtra=Z.memoryExtra?{...Z.memoryExtra}:{}}get facts(){return this._facts}get index(){return this._index}get sessions(){return this._sessions}get preferences(){return this._preferences}get custom(){return this._custom}get extra(){return this._extra}get memoryExtra(){return this._memoryExtra}static load($){if(!I_($))throw Error(`soul file not found: ${$}`);let Z=N_($,"utf-8"),X=D0(Z);if(!X||typeof X!=="object")throw Error("soul is not a YAML mapping");let z=X.memory&&typeof X.memory==="object"?X.memory:{},J=Array.isArray(z.facts)?z.facts:[],Q={};for(let[U,q]of Object.entries(X))if(!q9.has(U))Q[U]=structuredClone(q);let Y={};for(let[U,q]of Object.entries(z))if(!G9.has(U))Y[U]=structuredClone(q);let W=new t0(String(X.namepoint??$.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(X.profile??"voice"),facts:J.map(uY),retention:String(X.retention??"forever"),created:X.created??null,index:Array.isArray(X.index)?X.index.slice():[],sessions:Array.isArray(z.sessions)?structuredClone(z.sessions):[],preferences:z.preferences&&typeof z.preferences==="object"?structuredClone(z.preferences):{},custom:z.custom&&typeof z.custom==="object"?structuredClone(z.custom):{},extra:Q,memoryExtra:Y});return W.last_etched=String(X.last_etched??W.created),W}static fromFile($){return t0.load($)}toDoc(){let $={facts:this._facts.map(mY),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[X,z]of Object.entries(this._memoryExtra))if(!G9.has(X))$[X]=structuredClone(z);let Z={version:"1.1",profile:this.profile,namepoint:this.namepoint,created:this.created,last_etched:this.last_etched,retention:this.retention,index:this._index.slice(),memory:$};for(let[X,z]of Object.entries(this._extra))if(!q9.has(X))Z[X]=structuredClone(z);return Z}toYaml(){return T2(this.toDoc(),{lineWidth:100})}rebuildIndex($=80){return this._index=this._facts.map((Z)=>`${Z.id??"?"} — ${Z.text.slice(0,$)}`),this._index}save($,Z={}){if(Z.reindex!==!1)this.rebuildIndex();return D_($,this.toYaml(),"utf-8"),$}toFile($,Z={}){return this.save($,Z)}add($){if(!I0($.id)&&this._byId.has($.id)){let Z=this._byId.get($.id);if(Z!==void 0)this._facts[Z]=$}else if(this._facts.push($),!I0($.id))this._byId.set($.id,this._facts.length-1);if($.timestamp&&$.timestamp>(this.last_etched||""))this.last_etched=$.timestamp;return $}etch($,Z={}){return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:g4(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:b6(),source:Z.source??null,extra:{}})}recall($,Z={}){let X=Z$[g4(Z.minPriority??"ephemeral")]??0,z=($??"").toLowerCase(),J=new Set(Z.tags??[]),Q=[];this._facts.forEach((W,U)=>{if(z&&!W.text.toLowerCase().includes(z))return;if(J.size>0&&![...J].some((q)=>W.tags.includes(q)))return;if(!I0(Z.type)&&W.type!==Z.type)return;if((Z$[W.priority]??1)<X)return;Q.push([U,W])}),Q.sort((W,U)=>{let q=Z$[W[1].priority]??1,G=Z$[U[1].priority]??1;if(G!==q)return G-q;let V=W[1].timestamp??"",K=U[1].timestamp??"";if(K!==V)return K<V?-1:K>V?1:0;return U[0]-W[0]});let Y=Q.map(([,W])=>W);if(!I0(Z.limit))return Y.slice(0,Z.limit);return Y}getFact($){let Z=this._byId.get($);return Z===void 0?null:this._facts[Z]}deleteFact($){let Z=this._byId.get($);if(Z===void 0)return!1;return this._facts.splice(Z,1),this._byId.clear(),this._facts.forEach((X,z)=>{if(!I0(X.id))this._byId.set(X.id,z)}),!0}}import{readdirSync as A_,readFileSync as R_,statSync as cY,existsSync as __}from"fs";import{join as F_,basename as lY,resolve as C_}from"path";var dY=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),P_=/\[\[([^\]]+)\]\]/g;function E_($){let Z=cY($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function w_($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let X=D0(Z[1]);if(!X||typeof X!=="object")return{fm:null,body:Z.slice(2).join("---").trim()};return{fm:X,body:Z.slice(2).join("---").trim()}}catch{return{fm:null,body:$}}}function S_($,Z,X){if(!X.name)return null;let z=X.metadata&&typeof X.metadata==="object"?X.metadata:{},J=z.type;if(typeof J!=="string"||!U9.has(J))return null;let Q=String(X.name).trim(),W=(X.description!==void 0&&X.description!==null&&String(X.description).trim()?String(X.description).trim():"")||Q,U={};if(z.originSessionId)U.provenance=[`session:${z.originSessionId}`];let q=[...new Set([...Z.matchAll(P_)].map((G)=>G[1]))].sort();return{text:W,id:Q,type:J,priority:"standard",tags:[],links:q,timestamp:E_($),source:`claude-code memory: ${lY($)}`,extra:U}}function K9($,Z={}){let X=C_($);if(!__(X))throw Error(`Claude memory directory not found: ${X}`);if(!cY(X).isDirectory())throw Error(`Claude memory path is not a directory: ${X}`);let z=Z.skip??dY,J=Z.namepoint??`@claude-code:${lY(X)}`,Q=[],Y=A_(X).filter((V)=>V.endsWith(".md")).sort();for(let V of Y){if(z.has(V))continue;let K=F_(X,V),H;try{H=R_(K,"utf-8")}catch{continue}let{fm:N,body:B}=w_(H);if(!N)continue;let O=S_(K,B,N);if(O)Q.push(O)}let W=Q.map((V)=>V.timestamp).filter(Boolean),U=W.length?W.reduce((V,K)=>V<K?V:K):b6(),q=W.length?W.reduce((V,K)=>V>K?V:K):U,G=new t0(J,{profile:"knowledge",facts:Q,created:U});return G.last_etched=q,G.rebuildIndex(),G}function H9(){return k6(process.cwd(),"soul.fafm")}function B9($){let Z=k6($??H9());if(!iY(Z))console.error(`Error: soul file not found: ${Z}
|
|
531
531
|
|
|
532
|
-
Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return
|
|
532
|
+
Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return t0.load(Z)}function j_($,Z){if(!$)console.error(`Error: directory required
|
|
533
533
|
|
|
534
|
-
faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let X=
|
|
535
|
-
`);for(let X of Z.recall()){let z=X.id?A(X.id):M("(no-id)"),J=[X.type,X.priority].filter(Boolean).join(" · ");if(console.log(` ${z} ${X.text.slice(0,80)}`),J)console.log(M(` ${J}`))}}function
|
|
536
|
-
`);for(let Y of Q)console.log(` ${Y.id?A(Y.id):M("?")} ${Y.text}`)}function
|
|
534
|
+
faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let X=k6($);try{let z=K9(X,{namepoint:Z.namepoint}),J=k6(Z.output??H9());z.toFile(J),console.log(`${I("memory convert")} ${M("—")} ${z.facts.length} facts → ${J}`),console.log(M(` namepoint ${z.namepoint} profile ${z.profile} index ${z.index.length}`))}catch(z){console.error(`Error: ${z instanceof Error?z.message:z}`),process.exit(1)}}function x_($){let Z=B9($.file);if($.json){console.log(JSON.stringify(Z.facts.map((X)=>({id:X.id,text:X.text,type:X.type,priority:X.priority,tags:X.tags})),null,2));return}console.log(`${I("memory ls")} ${M(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
|
|
535
|
+
`);for(let X of Z.recall()){let z=X.id?A(X.id):M("(no-id)"),J=[X.type,X.priority].filter(Boolean).join(" · ");if(console.log(` ${z} ${X.text.slice(0,80)}`),J)console.log(M(` ${J}`))}}function b_($,Z){let X=B9(Z.file),z=Z.tag?Z.tag.split(",").map((Y)=>Y.trim()):void 0,J=Z.limit!==void 0&&Z.limit!==null?parseInt(Z.limit,10):void 0,Q=X.recall($??null,{tags:z,type:Z.type,minPriority:Z.priority,limit:Number.isFinite(J)?J:null});if(Z.json){console.log(JSON.stringify(Q.map((Y)=>({id:Y.id,text:Y.text,priority:Y.priority})),null,2));return}console.log(`${I("memory recall")} ${M(`— ${Q.length} hit(s)`)}${$?M(` for "${$}"`):""}
|
|
536
|
+
`);for(let Y of Q)console.log(` ${Y.id?A(Y.id):M("?")} ${Y.text}`)}function k_($,Z){if(!$)console.error(`Error: text required
|
|
537
537
|
|
|
538
|
-
faf memory etch "a durable fact" [--id slug]`),process.exit(2);let X=
|
|
538
|
+
faf memory etch "a durable fact" [--id slug]`),process.exit(2);let X=k6(Z.file??H9()),z=iY(X)?t0.load(X):new t0(Z.namepoint??"@local",{profile:"knowledge"}),J=z.etch($,{id:Z.id,type:Z.type,priority:Z.priority});z.toFile(X),console.log(`${I("memory etch")} ${M("—")} ${J.id??"(no-id)"} → ${X}`)}function y_($){let Z=B9($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${I("memory show")} ${M(`— ${Z.namepoint}`)}
|
|
539
539
|
`),console.log(` profile ${Z.profile}`),console.log(` facts ${Z.facts.length}`),console.log(` index ${Z.index.length}`),console.log(` created ${Z.created}`),console.log(` last_etched ${Z.last_etched}`),Z.index.length){console.log(`
|
|
540
|
-
${A("index")}`);for(let X of Z.index.slice(0,20))console.log(M(` ${X}`));if(Z.index.length>20)console.log(M(` … +${Z.index.length-20} more`))}}function nY($,Z,X={}){if(Z&&typeof Z==="object")X=Z,Z=void 0;switch($){case"convert":
|
|
540
|
+
${A("index")}`);for(let X of Z.index.slice(0,20))console.log(M(` ${X}`));if(Z.index.length>20)console.log(M(` … +${Z.index.length-20} more`))}}function nY($,Z,X={}){if(Z&&typeof Z==="object")X=Z,Z=void 0;switch($){case"convert":j_(Z,X);break;case"ls":case"list":x_(X);break;case"recall":b_(Z,X);break;case"etch":k_(Z,X);break;case"show":y_(X);break;case void 0:case"help":pY();break;default:console.error(`Unknown memory subcommand: ${$}`),pY(),process.exit(2)}}function pY(){console.log(`${I("faf memory")} ${M("— .fafm soul ops (knowledge profile)")}
|
|
541
541
|
`),console.log(" convert <dir> Claude Code memory dir → soul.fafm"),console.log(" etch <text> Write a fact (creates soul.fafm if needed)"),console.log(" ls List facts (ranked)"),console.log(" recall [query] Deterministic recall"),console.log(` show Soul summary
|
|
542
|
-
`),console.log(M(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json")),console.log(M(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}var{version:rY}=hZ(),f=new b9;f.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(rY,"-v, --version");f.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(($)=>TZ($));f.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>mz());f.command("auto").description("Zero to 100% in one command").action(()=>d8());f.command("loop").description("Drive to 100% — source what we can, then ask only the human").option("-r, --rounds <n>","max auto rounds before stopping","5").action(($)=>lz($));f.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>_Q($));f.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>E8($,Z));f.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key)").option("--json","Output as JSON").option("--cold","Grade as the without-context run").option("--faf","Grade as the with-context run").option("--tokens <n>","Tokens used in the run (reported by the agent)").option("--model <name>","Model that answered (reported)").option("--file <path>","Path to project.faf (default: discovered)").option("--submit","Submit the full-pair receipt to the public bench ledger").option("--endpoint <url>","Override the submit endpoint").action(($,Z,X)=>fY($,Z,X));f.command("show").description("Render project.faf → project.html and open it").action(()=>hJ());f.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(($)=>FZ($));f.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").action(($,Z)=>XJ($,Z));f.command("decompile <file>").description("Decompile .fafb to JSON").option("--output <path>","Output path").action(($,Z)=>zJ($,Z));f.command("git <url>").description("Instant scored context from any GitHub repo (any branch/tag with --ref)").option("--ref <ref>","Clone at a specific branch or tag (versioned context)").option("--output <path>","Write to a custom path (default: ./project.faf)").option("--force","Overwrite an existing project.faf").option("--stdout","Print the .faf to stdout instead of writing a file").action(($,Z)=>mJ($,Z));f.command("diff [range]").description("Semantic context diff between two .faf versions (slot deltas + score). git ranges: <ref>, A..B, A...B").option("--json","Emit the delta as structured JSON").option("--install-driver","Wire faf diff into native git — `git diff` renders .faf score+slot deltas").option("--uninstall-driver","Remove the native-git diff driver").action(($,Z)=>oJ($,Z));f.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>sJ($??[]));f.command("log").description("Score timeline across git history — the .faf score at every commit that touched it").option("-n, --limit <n>","Max commits to show (default 20)").option("--all","Show every commit, no cap").option("--reverse","Oldest-first instead of newest-first").option("--json","Emit the timeline as structured JSON").action(($)=>tJ($));f.command("hooks").description("Pre-commit context guard — scores staged .faf vs HEAD, warns (or --strict blocks) on regression").option("--install","Install the pre-commit hook").option("--uninstall","Remove the faf hook block (preserves other hooks)").option("--strict","With --install: block the commit on a score regression (default: warn only)").action(($)=>QQ($));f.command("hooks-run",{hidden:!0}).description("Internal: the pre-commit context guard the git hook invokes").option("--strict","Exit non-zero on a score regression").action(($)=>JQ($));f.command("export").description("Export context files from .faf").option("--agents","Author AGENTS.md").option("--cursor","Author .cursorrules").option("--gemini","Author GEMINI.md").option("--copilot","Author .github/copilot-instructions.md (GitHub Copilot)").option("--grok","Wire grok-faf-mcp into .grok/config.toml").option("--conductor","Author conductor config").option("--html","Author project.html (visual render of project.faf)").option("--card","Author MCP Server Card (.well-known/mcp/server-card) with the FAF context-block").option("--all","Author all formats").action(($)=>A$($));f.command("server-card").description("Emit the registry server.json identity (name + title + _meta) from project.faf — the cross-language server-card emitter; patches an existing file").option("--in <path>","Existing server.json to patch (default: ./server.json)").option("--out <path>","Output path (default: same as --in)").option("--faf <path>","project.faf path (default: auto-discover)").option("--set-version <version>","Set the version field (default: preserve existing). NOTE: not --version, which is the global CLI-version flag").option("--generated <iso>","Override the _meta generated stamp (default: preserve existing)").option("--check","Print to stdout, do not write (diff/verify — the idempotency-test hook)").action(($)=>vJ($));f.command("cards").description("Project .faf + .fafa onto A2A / MCP / registry / catalog cards — one context block, every door").option("--target <list>","Comma list: a2a,mcp,registry,catalog (default: whatever inputs allow)").option("--faf <path>","project.faf path (default: auto-discover)").option("--fafa <path>","agent.fafa path (default: auto-discover)").option("--dir <path>","Working directory (default: cwd)").option("--a2a-url <url>","Public URL of the A2A card (catalog row)").option("--door-url <url>","A2A door when .fafa has no a2a endpoint").option("--faf-pointer <url>","Absolute .faf pointer for served cards (default: ./project.faf)").option("--check","Print projected cards to stdout, do not write").action(($)=>gJ($));f.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--fix","Auto-fix issues").option("--doctor","Full diagnostic").option("--trust","Verify trust chain").action(($,Z)=>CZ($,Z));f.command("info").description("Show version and system info").option("--version","Show version").option("--faq","Show FAQ").option("--index","Show command index").option("--stacks","Show supported stacks").action(($)=>YQ($));f.command("formats").description("Show supported formats").action(()=>WQ());f.command("clear").description("Clear cached data").action(()=>UQ());f.command("convert").description("Convert .faf to other formats").option("--json","Output as JSON").action(($)=>qQ($));f.command("context").description("Author context output").action(()=>GQ());f.command("refresh").description("Re-ground on the live .faf — re-score, measure drift vs the DNA baseline, keep .fafb current").option("--json","Output as JSON").action(($)=>gY($));f.command("drift").description("Check context drift").action(()=>KQ());f.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>HQ($,Z));f.command("recover").description("Recover .faf from context files").action(()=>BQ());f.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>MQ($));f.command("pro [subcommand]").description("Pro features & licensing").action(($)=>OQ($));f.command("share").description("Share .faf via URL").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>LQ($));f.command("demo").description("Demo walkthrough").action(()=>DQ());f.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>IQ($,Z));f.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` wires the CI receipt printer; bare snapshot deprecated → faf score --json").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").action(($,Z)=>AQ($,Z));f.command("ai [subcommand]").description("AI-powered features (enhance|analyze)").action(($)=>_Y($));f.command("conductor [subcommand] [path]").description("Conductor integration").action(($,Z)=>PY($,Z));f.command("wjttc").description("Audit test suite for WJTTC tier coverage (vendor-neutral)").option("--path <path>","Test directory (default: tests)").option("--strict","Exit non-zero if any tests are untiered").option("--json","Output as JSON for CI consumption").action(($)=>wY($));f.command("memory [subcommand] [arg]").description(".fafm soul ops — convert Claude memory, etch, recall, ls, show").option("-f, --file <path>","Soul file (default: ./soul.fafm)").option("-o, --output <path>","Output path (convert)").option("--namepoint <handle>","Namepoint for new/converted soul").option("--id <id>","Fact id (etch)").option("--type <type>","Fact type filter / etch type").option("--tag <tags>","Comma-separated tags (recall)").option("--priority <level>","Min priority floor (recall) or etch priority").option("--limit <n>","Max recall hits").option("--json","JSON output").action(($,Z,X)=>nY($,Z,X));f.command("bi-sync",{hidden:!0}).action(()=>FZ());f.command("status",{hidden:!0}).action(()=>E8(void 0,{status:!0}));f.command("agents",{hidden:!0}).action(()=>A$({agents:!0}));f.command("cursor",{hidden:!0}).action(()=>A$({cursor:!0}));f.command("gemini",{hidden:!0}).action(()=>A$({gemini:!0}));f.command("grok",{hidden:!0}).action(()=>A$({grok:!0}));f.command("validate",{hidden:!0}).action(($)=>CZ($));f.command("yolo",{hidden:!0}).action(()=>TZ({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:X}=await Promise.resolve().then(() => (l(),rX)),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",W="\x1B[48;2;29;29;29m",U="\x1B[0m";console.log(""),console.log(`\x1B[48;2;29;29;29m ${"\x1B[38;2;150;150;150m"}▄${"\x1B[48;2;150;150;150m"}███████${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▄${"\x1B[0m"}`),console.log(`\x1B[48;2;29;29;29m \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}█${"\x1B[38;2;29;29;29m"}█${"\x1B[38;2;150;150;150m"}███████${"\x1B[0m"} ${X($("faf"))} ${Z(`v${rY}`)}`);let q="\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(`${q}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`),console.log(`${Z(` ${z}`)}`),console.log("");try{await E8(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${X("faf --help")} ${Z("for commands")}`)})();else f.addHelpText("after",["","Git-native (The GIT Version):"," faf diff [range] semantic context diff + score delta (A..B, A...B)"," faf diff --install-driver make native `git diff` render .faf deltas"," faf log score timeline across history (Proof-Over-Time)"," faf hooks --install pre-commit guard against context regression"," faf git <url> [--ref] instant scored context from any repo, any branch/tag","",' "FAF is to Context what Git is to Versions."',""].join(`
|
|
543
|
-
`)),
|
|
542
|
+
`),console.log(M(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json")),console.log(M(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}var{version:rY}=mZ(),g=new k9;g.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(rY,"-v, --version");g.command("init").description("Create .faf from your project").option("--yolo","Quick init with sensible defaults").option("--quick","Alias for --yolo").option("--force","Overwrite existing project.faf").option("--output <path>","Output path").action(($)=>AZ($));g.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>cz());g.command("auto").description("Zero to 100% in one command").action(()=>p8());g.command("loop").description("Drive to 100% — source what we can, then ask only the human").option("-r, --rounds <n>","max auto rounds before stopping","5").action(($)=>dz($));g.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>_Q($));g.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>w8($,Z));g.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key)").option("--json","Output as JSON").option("--cold","Grade as the without-context run").option("--faf","Grade as the with-context run").option("--tokens <n>","Tokens used in the run (reported by the agent)").option("--model <name>","Model that answered (reported)").option("--file <path>","Path to project.faf (default: discovered)").option("--submit","Submit the full-pair receipt to the public bench ledger").option("--endpoint <url>","Override the submit endpoint").action(($,Z,X)=>fY($,Z,X));g.command("show").description("Render project.faf → project.html and open it").action(()=>hJ());g.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(($)=>CZ($));g.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").action(($,Z)=>zJ($,Z));g.command("decompile <file>").description("Decompile .fafb to JSON").option("--output <path>","Output path").action(($,Z)=>JJ($,Z));g.command("git <url>").description("Instant scored context from any GitHub repo (any branch/tag with --ref)").option("--ref <ref>","Clone at a specific branch or tag (versioned context)").option("--output <path>","Write to a custom path (default: ./project.faf)").option("--force","Overwrite an existing project.faf").option("--stdout","Print the .faf to stdout instead of writing a file").action(($,Z)=>mJ($,Z));g.command("diff [range]").description("Semantic context diff between two .faf versions (slot deltas + score). git ranges: <ref>, A..B, A...B").option("--json","Emit the delta as structured JSON").option("--install-driver","Wire faf diff into native git — `git diff` renders .faf score+slot deltas").option("--uninstall-driver","Remove the native-git diff driver").action(($,Z)=>oJ($,Z));g.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>sJ($??[]));g.command("log").description("Score timeline across git history — the .faf score at every commit that touched it").option("-n, --limit <n>","Max commits to show (default 20)").option("--all","Show every commit, no cap").option("--reverse","Oldest-first instead of newest-first").option("--json","Emit the timeline as structured JSON").action(($)=>tJ($));g.command("hooks").description("Pre-commit context guard — scores staged .faf vs HEAD, warns (or --strict blocks) on regression").option("--install","Install the pre-commit hook").option("--uninstall","Remove the faf hook block (preserves other hooks)").option("--strict","With --install: block the commit on a score regression (default: warn only)").action(($)=>QQ($));g.command("hooks-run",{hidden:!0}).description("Internal: the pre-commit context guard the git hook invokes").option("--strict","Exit non-zero on a score regression").action(($)=>JQ($));g.command("export").description("Export context files from .faf").option("--agents","Author AGENTS.md").option("--cursor","Author .cursorrules").option("--gemini","Author GEMINI.md").option("--copilot","Author .github/copilot-instructions.md (GitHub Copilot)").option("--grok","Wire grok-faf-mcp into .grok/config.toml").option("--conductor","Author conductor config").option("--html","Author project.html (visual render of project.faf)").option("--card","Author MCP Server Card (.well-known/mcp/server-card) with the FAF context-block").option("--all","Author all formats").option("--output <path>","Write exported files to this directory instead of the current one").action(($)=>_$($));g.command("server-card").description("Emit the registry server.json identity (name + title + _meta) from project.faf — the cross-language server-card emitter; patches an existing file").option("--in <path>","Existing server.json to patch (default: ./server.json)").option("--out <path>","Output path (default: same as --in)").option("--faf <path>","project.faf path (default: auto-discover)").option("--set-version <version>","Set the version field (default: preserve existing). NOTE: not --version, which is the global CLI-version flag").option("--generated <iso>","Override the _meta generated stamp (default: preserve existing)").option("--check","Print to stdout, do not write (diff/verify — the idempotency-test hook)").action(($)=>vJ($));g.command("cards").description("Project .faf + .fafa onto A2A / MCP / registry / catalog cards — one context block, every door").option("--target <list>","Comma list: a2a,mcp,registry,catalog (default: whatever inputs allow)").option("--faf <path>","project.faf path (default: auto-discover)").option("--fafa <path>","agent.fafa path (default: auto-discover)").option("--dir <path>","Working directory (default: cwd)").option("--a2a-url <url>","Public URL of the A2A card (catalog row)").option("--door-url <url>","A2A door when .fafa has no a2a endpoint").option("--faf-pointer <url>","Absolute .faf pointer for served cards (default: ./project.faf)").option("--check","Print projected cards to stdout, do not write").action(($)=>gJ($));g.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--fix","Auto-fix issues").option("--doctor","Full diagnostic").option("--trust","Verify trust chain").option("--verbose","Show slot breakdown").action(($,Z)=>PZ($,Z));g.command("info").description("Show version and system info").option("--version","Show version").option("--faq","Show FAQ").option("--index","Show command index").option("--stacks","Show supported stacks").action(($)=>YQ($));g.command("formats").description("Show supported formats").action(()=>WQ());g.command("clear").description("Clear cached data").action(()=>UQ());g.command("convert").description("Convert .faf to other formats").option("--json","Output as JSON").action(($)=>qQ($));g.command("context").description("Author context output").action(()=>GQ());g.command("refresh").description("Re-ground on the live .faf — re-score, measure drift vs the DNA baseline, keep .fafb current").option("--json","Output as JSON").action(($)=>gY($));g.command("drift").description("Check context drift").action(()=>KQ());g.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>HQ($,Z));g.command("recover").description("Recover .faf from context files").action(()=>BQ());g.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>MQ($));g.command("pro [subcommand]").description("Pro features & licensing").action(($)=>OQ($));g.command("share").description("Share .faf via URL").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>LQ($));g.command("demo").description("Demo walkthrough").action(()=>DQ());g.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>IQ($,Z));g.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` wires the CI receipt printer; bare snapshot deprecated → faf score --json").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").action(($,Z)=>AQ($,Z));g.command("ai [subcommand]").description("AI-powered features (enhance|analyze)").action(($)=>_Y($));g.command("conductor [subcommand] [path]").description("Conductor integration").action(($,Z)=>PY($,Z));g.command("wjttc").description("Audit test suite for WJTTC tier coverage (vendor-neutral)").option("--path <path>","Test directory (default: tests)").option("--strict","Exit non-zero if any tests are untiered").option("--json","Output as JSON for CI consumption").action(($)=>wY($));g.command("memory [subcommand] [arg]").description(".fafm soul ops — convert Claude memory, etch, recall, ls, show").option("-f, --file <path>","Soul file (default: ./soul.fafm)").option("-o, --output <path>","Output path (convert)").option("--namepoint <handle>","Namepoint for new/converted soul").option("--id <id>","Fact id (etch)").option("--type <type>","Fact type filter / etch type").option("--tag <tags>","Comma-separated tags (recall)").option("--priority <level>","Min priority floor (recall) or etch priority").option("--limit <n>","Max recall hits").option("--json","JSON output").action(($,Z,X)=>nY($,Z,X));g.command("bi-sync",{hidden:!0}).action(()=>CZ());g.command("status",{hidden:!0}).action(()=>w8(void 0,{status:!0}));g.command("agents",{hidden:!0}).action(()=>_$({agents:!0}));g.command("cursor",{hidden:!0}).action(()=>_$({cursor:!0}));g.command("gemini",{hidden:!0}).action(()=>_$({gemini:!0}));g.command("grok",{hidden:!0}).action(()=>_$({grok:!0}));g.command("validate",{hidden:!0}).action(($)=>PZ($));g.command("yolo",{hidden:!0}).action(()=>AZ({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:X}=await Promise.resolve().then(() => (d(),sX)),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",W="\x1B[48;2;29;29;29m",U="\x1B[0m";console.log(""),console.log(`\x1B[48;2;29;29;29m ${"\x1B[38;2;150;150;150m"}▄${"\x1B[48;2;150;150;150m"}███████${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▄${"\x1B[0m"}`),console.log(`\x1B[48;2;29;29;29m \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}█${"\x1B[38;2;29;29;29m"}█${"\x1B[38;2;150;150;150m"}███████${"\x1B[0m"} ${X($("faf"))} ${Z(`v${rY}`)}`);let q="\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(`${q}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`),console.log(`${Z(` ${z}`)}`),console.log("");try{await w8(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${X("faf --help")} ${Z("for commands")}`)})();else g.addHelpText("after",["","Git-native (The GIT Version):"," faf diff [range] semantic context diff + score delta (A..B, A...B)"," faf diff --install-driver make native `git diff` render .faf deltas"," faf log score timeline across history (Proof-Over-Time)"," faf hooks --install pre-commit guard against context regression"," faf git <url> [--ref] instant scored context from any repo, any branch/tag","",' "FAF is to Context what Git is to Versions."',""].join(`
|
|
543
|
+
`)),g.parse(process.argv);
|
|
544
544
|
|
|
545
|
-
//# debugId=
|
|
545
|
+
//# debugId=84F952B112D361E864756E2164756E21
|
|
546
546
|
//# sourceMappingURL=cli.js.map
|