faf-cli 7.8.0 → 7.10.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 +18 -15
- package/dist/cli.js +235 -235
- package/dist/cli.js.map +20 -17
- package/dist/core/types.d.ts +2 -0
- package/dist/detect/relentless.d.ts +8 -2
- package/dist/detect/scanner.d.ts +27 -0
- package/dist/index.js +109 -109
- package/dist/index.js.map +15 -12
- package/dist/interrogate/build-files.d.ts +10 -0
- package/dist/interrogate/compose.d.ts +11 -0
- package/dist/interrogate/env.d.ts +8 -0
- package/dist/interrogate/index.d.ts +12 -5
- package/dist/interrogate/types.d.ts +17 -0
- 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
|
|
3
|
-
`)}displayWidth($){return
|
|
2
|
+
import{createRequire as NW}from"node:module";var WW=Object.create;var{getPrototypeOf:UW,defineProperty:i4,getOwnPropertyNames:qW}=Object;var GW=Object.prototype.hasOwnProperty;function VW($){return this[$]}var KW,HW,BW=($,Z,X)=>{var z=$!=null&&typeof $==="object";if(z){var J=Z?KW??=new WeakMap:HW??=new WeakMap,Q=J.get($);if(Q)return Q}X=$!=null?WW(UW($)):{};let Y=Z||!$||!$.__esModule?i4(X,"default",{value:$,enumerable:!0}):X;for(let W of qW($))if(!GW.call(Y,W))i4(Y,W,{get:VW.bind($,W),enumerable:!0});if(z)J.set($,Y);return Y};var E=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var MW=($)=>$;function OW($,Z){this[$]=MW.bind(null,Z)}var E9=($,Z)=>{for(var X in Z)i4($,X,{get:Z[X],enumerable:!0,configurable:!0,set:OW.bind(Z,X)})};var v=($,Z)=>()=>($&&(Z=$($=0)),Z);var _0=NW(import.meta.url);var t$=E((LW)=>{class n4 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 w9 extends n4{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}LW.CommanderError=n4;LW.InvalidArgumentError=w9});var f6=E((RW)=>{var{InvalidArgumentError:TW}=t$();class S9{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 TW(`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 AW($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}RW.Argument=S9;RW.humanReadableArgName=AW});var r4=E((PW)=>{var{humanReadableArgName:CW}=f6();class j9{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)=>CW(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 x9($).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 x9($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}PW.Help=j9;PW.stripColor=x9});var s4=E((xW)=>{var{InvalidArgumentError:SW}=t$();class k9{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let X=jW($);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 SW(`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 b9(this.name().replace(/^no-/,""));return b9(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class y9{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 b9($){return $.split("-").reduce((Z,X)=>{return Z+X[0].toUpperCase()+X.slice(1)})}function jW($){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}}
|
|
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}}xW.Option=k9;xW.DualOptions=y9});var v9=E((gW)=>{function yW($,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 vW($,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=yW($,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""}
|
|
15
|
-
- specify the name in Command constructor or using .name()`);if(Z=Z||{},Z.isDefault)this._defaultCommandName=$._name;if(Z.noHelp||Z.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,Z){return new
|
|
16
|
-
Expecting one of '${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(
|
|
14
|
+
(Did you mean ${z[0]}?)`;return""}gW.suggestSimilar=vW});var u9=E((pW)=>{var hW=_0("node:events").EventEmitter,a4=_0("node:child_process"),Z1=_0("node:path"),h6=_0("node:fs"),a=_0("node:process"),{Argument:uW,humanReadableArgName:mW}=f6(),{CommanderError:o4}=t$(),{Help:cW,stripColor:lW}=r4(),{Option:g9,DualOptions:dW}=s4(),{suggestSimilar:f9}=v9();class e4 extends hW{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)=>a.stdout.write(Z),writeErr:(Z)=>a.stderr.write(Z),outputError:(Z,X)=>X(Z),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,getOutHasColors:()=>t4()??(a.stdout.isTTY&&a.stdout.hasColors?.()),getErrHasColors:()=>t4()??(a.stderr.isTTY&&a.stderr.hasColors?.()),stripColor:(Z)=>lW(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 e4($)}createHelp(){return Object.assign(new cW,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...$},this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,Z){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
|
|
15
|
+
- specify the name in Command constructor or using .name()`);if(Z=Z||{},Z.isDefault)this._defaultCommandName=$._name;if(Z.noHelp||Z.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,Z){return new uW($,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 o4($,Z,X));a.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 g9($,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 g9)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(a.versions?.electron)Z.from="electron";let z=a.execArgv??[];if(z.includes("-e")||z.includes("--eval")||z.includes("-p")||z.includes("--print"))Z.from="eval"}if($===void 0)$=a.argv;this.rawArgs=$.slice();let X;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],X=$.slice(2);break;case"electron":if(a.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(h6.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=Z1.resolve(q,G);if(h6.existsSync(V))return V;if(z.includes(Z1.extname(G)))return;let K=z.find((H)=>h6.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=h6.realpathSync(this._scriptPath)}catch{q=this._scriptPath}Y=Z1.resolve(Z1.dirname(q),Y)}if(Y){let q=J(Y,Q);if(!q&&!$._executableFile&&this._scriptPath){let G=Z1.basename(this._scriptPath,Z1.extname(this._scriptPath));if(G!==this._name)q=J(Y,`${G}-${$._name}`)}Q=q||Q}X=z.includes(Z1.extname(Q));let W;if(a.platform!=="win32")if(X)Z.unshift(Q),Z=h9(a.execArgv).concat(Z),W=a4.spawn(a.argv[0],Z,{stdio:"inherit"});else W=a4.spawn(Q,Z,{stdio:"inherit"});else this._checkForMissingExecutable(Q,Y,$._name),Z.unshift(Q),Z=h9(a.execArgv).concat(Z),W=a4.spawn(a.execPath,Z,{stdio:"inherit"});if(!W.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((G)=>{a.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)a.exit(q);else U(new o4(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)a.exit(1);else{let G=new o4(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
|
|
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
|
|
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 a.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,a.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new dW(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=f9($,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=f9($,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 mW(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=Z1.basename($,Z1.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(a.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 h9($){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 t4(){if(a.env.NO_COLOR||a.env.FORCE_COLOR==="0"||a.env.FORCE_COLOR==="false")return!1;if(a.env.FORCE_COLOR||a.env.CLICOLOR_FORCE!==void 0)return!0;return}pW.Command=e4;pW.useColor=t4});var d9=E((aW)=>{var{Argument:m9}=f6(),{Command:$3}=u9(),{CommanderError:rW,InvalidArgumentError:c9}=t$(),{Help:sW}=r4(),{Option:l9}=s4();aW.program=new $3;aW.createCommand=($)=>new $3($);aW.createOption=($,Z)=>new l9($,Z);aW.createArgument=($,Z)=>new m9($,Z);aW.Command=$3;aW.Option=l9;aW.Argument=m9;aW.Help=sW;aW.CommanderError=rW;aW.InvalidArgumentError=c9;aW.InvalidOptionArgumentError=c9});var i=E((MU)=>{var Z3=Symbol.for("yaml.alias"),n9=Symbol.for("yaml.document"),u6=Symbol.for("yaml.map"),r9=Symbol.for("yaml.pair"),X3=Symbol.for("yaml.scalar"),m6=Symbol.for("yaml.seq"),X1=Symbol.for("yaml.node.type"),UU=($)=>!!$&&typeof $==="object"&&$[X1]===Z3,qU=($)=>!!$&&typeof $==="object"&&$[X1]===n9,GU=($)=>!!$&&typeof $==="object"&&$[X1]===u6,VU=($)=>!!$&&typeof $==="object"&&$[X1]===r9,s9=($)=>!!$&&typeof $==="object"&&$[X1]===X3,KU=($)=>!!$&&typeof $==="object"&&$[X1]===m6;function a9($){if($&&typeof $==="object")switch($[X1]){case u6:case m6:return!0}return!1}function HU($){if($&&typeof $==="object")switch($[X1]){case Z3:case u6:case X3:case m6:return!0}return!1}var BU=($)=>(s9($)||a9($))&&!!$.anchor;MU.ALIAS=Z3;MU.DOC=n9;MU.MAP=u6;MU.NODE_TYPE=X1;MU.PAIR=r9;MU.SCALAR=X3;MU.SEQ=m6;MU.hasAnchor=BU;MU.isAlias=UU;MU.isCollection=a9;MU.isDocument=qU;MU.isMap=GU;MU.isNode=HU;MU.isPair=VU;MU.isScalar=s9;MU.isSeq=KU});var e$=E((xU)=>{var q0=i(),A0=Symbol("break visit"),o9=Symbol("skip children"),r0=Symbol("remove node");function c6($,Z){let X=t9(Z);if(q0.isDocument($)){if(X$(null,$.contents,X,Object.freeze([$]))===r0)$.contents=null}else X$(null,$,X,Object.freeze([]))}c6.BREAK=A0;c6.SKIP=o9;c6.REMOVE=r0;function X$($,Z,X,z){let J=e9($,Z,X,z);if(q0.isNode(J)||q0.isPair(J))return $7($,z,J),X$($,J,X,z);if(typeof J!=="symbol"){if(q0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let Q=0;Q<Z.items.length;++Q){let Y=X$(Q,Z.items[Q],X,z);if(typeof Y==="number")Q=Y-1;else if(Y===A0)return A0;else if(Y===r0)Z.items.splice(Q,1),Q-=1}}else if(q0.isPair(Z)){z=Object.freeze(z.concat(Z));let Q=X$("key",Z.key,X,z);if(Q===A0)return A0;else if(Q===r0)Z.key=null;let Y=X$("value",Z.value,X,z);if(Y===A0)return A0;else if(Y===r0)Z.value=null}}return J}async function l6($,Z){let X=t9(Z);if(q0.isDocument($)){if(await z$(null,$.contents,X,Object.freeze([$]))===r0)$.contents=null}else await z$(null,$,X,Object.freeze([]))}l6.BREAK=A0;l6.SKIP=o9;l6.REMOVE=r0;async function z$($,Z,X,z){let J=await e9($,Z,X,z);if(q0.isNode(J)||q0.isPair(J))return $7($,z,J),z$($,J,X,z);if(typeof J!=="symbol"){if(q0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let Q=0;Q<Z.items.length;++Q){let Y=await z$(Q,Z.items[Q],X,z);if(typeof Y==="number")Q=Y-1;else if(Y===A0)return A0;else if(Y===r0)Z.items.splice(Q,1),Q-=1}}else if(q0.isPair(Z)){z=Object.freeze(z.concat(Z));let Q=await z$("key",Z.key,X,z);if(Q===A0)return A0;else if(Q===r0)Z.key=null;let Y=await z$("value",Z.value,X,z);if(Y===A0)return A0;else if(Y===r0)Z.value=null}}return J}function t9($){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 e9($,Z,X,z){if(typeof X==="function")return X($,Z,z);if(q0.isMap(Z))return X.Map?.($,Z,z);if(q0.isSeq(Z))return X.Seq?.($,Z,z);if(q0.isPair(Z))return X.Pair?.($,Z,z);if(q0.isScalar(Z))return X.Scalar?.($,Z,z);if(q0.isAlias(Z))return X.Alias?.($,Z,z);return}function $7($,Z,X){let z=Z[Z.length-1];if(q0.isCollection(z))z.items[$]=X;else if(q0.isPair(z))if($==="key")z.key=X;else z.value=X;else if(q0.isDocument(z))z.contents=X;else{let J=q0.isAlias(z)?"alias":"scalar";throw Error(`Cannot replace node with ${J} parent`)}}xU.visit=c6;xU.visitAsync=l6});var z3=E((fU)=>{var Z7=i(),yU=e$(),vU={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},gU=($)=>$.replace(/[!,[\]{}]/g,(Z)=>vU[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+gU($.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&&Z7.isNode($.contents)){let J={};yU.visit($.contents,(Q,Y)=>{if(Z7.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:"};fU.Directives=k0});var d6=E((lU)=>{var X7=i(),uU=e$();function mU($){if(/[\x00-\x19\s,[\]{}]/.test($)){let X=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(X)}return!0}function z7($){let Z=new Set;return uU.visit($,{Value(X,z){if(z.anchor)Z.add(z.anchor)}}),Z}function J7($,Z){for(let X=1;;++X){let z=`${$}${X}`;if(!Z.has(z))return z}}function cU($,Z){let X=[],z=new Map,J=null;return{onAnchor:(Q)=>{X.push(Q),J??(J=z7($));let Y=J7(Z,J);return J.add(Y),Y},setAnchors:()=>{for(let Q of X){let Y=z.get(Q);if(typeof Y==="object"&&Y.anchor&&(X7.isScalar(Y.node)||X7.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}}lU.anchorIsValid=mU;lU.anchorNames=z7;lU.createNodeAnchors=cU;lU.findNewAnchor=J7});var J3=E((rU)=>{function $2($,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=$2($,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=$2($,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=$2($,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=$2($,z,J,Q);if(Y===void 0)delete z[J];else if(Y!==Q)z[J]=Y}return $.call(Z,X,z)}rU.applyReviver=$2});var H1=E((oU)=>{var aU=i();function Q7($,Z,X){if(Array.isArray($))return $.map((z,J)=>Q7(z,String(J),X));if($&&typeof $.toJSON==="function"){if(!X||!aU.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 $}oU.toJS=Q7});var p6=E((Zq)=>{var eU=J3(),Y7=i(),$q=H1();class W7{constructor($){Object.defineProperty(this,Y7.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(!Y7.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=$q.toJS(this,"",Q);if(typeof z==="function")for(let{count:W,res:U}of Q.anchors.values())z(U,W);return typeof J==="function"?eU.applyReviver(J,{"":Y},"",Y):Y}}Zq.NodeBase=W7});var Z2=E((Wq)=>{var zq=d6(),Jq=e$(),J$=i(),Qq=p6(),Yq=H1();class U7 extends Qq.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=[],Jq.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)Yq.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=i6(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(zq.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 i6($,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=i6($,J,X);if(Q>z)z=Q}return z}else if(J$.isPair(Z)){let z=i6($,Z.key,X),J=i6($,Z.value,X);return Math.max(z,J)}return 1}Wq.Alias=U7});var J0=E((Hq)=>{var qq=i(),Gq=p6(),Vq=H1(),Kq=($)=>!$||typeof $!=="function"&&typeof $!=="object";class y1 extends Gq.NodeBase{constructor($){super(qq.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:Vq.toJS(this.value,$,Z)}toString(){return String(this.value)}}y1.BLOCK_FOLDED="BLOCK_FOLDED";y1.BLOCK_LITERAL="BLOCK_LITERAL";y1.PLAIN="PLAIN";y1.QUOTE_DOUBLE="QUOTE_DOUBLE";y1.QUOTE_SINGLE="QUOTE_SINGLE";Hq.Scalar=y1;Hq.isScalarValue=Kq});var X2=E((Iq)=>{var Oq=Z2(),v1=i(),q7=J0(),Nq="tag:yaml.org,2002:";function Lq($,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 Dq($,Z,X){if(v1.isDocument($))$=$.contents;if(v1.isNode($))return $;if(v1.isPair($)){let V=X.schema[v1.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 Oq.Alias(U.anchor);else U={anchor:null,node:null},W.set($,U);if(Z?.startsWith("!!"))Z=Nq+Z.slice(2);let q=Lq($,Z,Y.tags);if(!q){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let V=new q7.Scalar($);if(U)U.node=V;return V}q=$ instanceof Map?Y[v1.MAP]:(Symbol.iterator in Object($))?Y[v1.SEQ]:Y[v1.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 q7.Scalar($);if(Z)G.tag=Z;else if(!q.default)G.tag=q.tag;if(U)U.node=G;return G}Iq.createNode=Dq});var n6=E((Fq)=>{var Aq=X2(),s0=i(),Rq=p6();function Q3($,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 Aq.createNode(z,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var G7=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class V7 extends Rq.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)=>s0.isNode(X)||s0.isPair(X)?X.clone($):X),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(G7($))this.add(Z);else{let[X,...z]=$,J=this.get(X,!0);if(s0.isCollection(J))J.addIn(z,Z);else if(J===void 0&&this.schema)this.set(X,Q3(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(s0.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&&s0.isScalar(J)?J.value:J;else return s0.isCollection(J)?J.getIn(z,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!s0.isPair(Z))return!1;let X=Z.value;return X==null||$&&s0.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 s0.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(s0.isCollection(J))J.setIn(z,Z);else if(J===void 0&&this.schema)this.set(X,Q3(this.schema,z,Z));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${z}`)}}}Fq.Collection=V7;Fq.collectionFromPath=Q3;Fq.isEmptyPath=G7});var z2=E((Sq)=>{var Eq=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function Y3($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var wq=($,Z,X)=>$.endsWith(`
|
|
29
|
+
`)?Y3(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}
|
|
38
|
-
`){if(Q-Y>z)return!0;if(Y=Q+1,J-Y<=z)return!1}return!0}function
|
|
31
|
+
`+Y3(X,Z):($.endsWith(" ")?"":" ")+X;Sq.indentComment=Y3;Sq.lineComment=wq;Sq.stringifyComment=Eq});var H7=E((yq)=>{function kq($,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,L=!1,B=-1,O=-1,T=-1;if(X==="block"){if(B=K7($,B,Z.length),B!==-1)V=B+U}for(let S;S=$[B+=1];){if(X==="quoted"&&S==="\\"){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(S===`
|
|
32
|
+
`){if(X==="block")B=K7($,B,Z.length);V=B+Z.length+U,K=void 0}else{if(S===" "&&H&&H!==" "&&H!==`
|
|
33
|
+
`&&H!=="\t"){let b=$[B+1];if(b&&b!==" "&&b!==`
|
|
34
|
+
`&&b!=="\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=S,S=$[B+=1],L=!0;let b=B>T+1?B-2:O-1;if(G[b])return $;q.push(b),G[b]=!0,V=b+U,K=void 0}else L=!0}H=S}if(L&&W)W();if(q.length===0)return $;if(Y)Y();let j=$.slice(0,q[0]);for(let S=0;S<q.length;++S){let b=q[S],y=q[S+1]||$.length;if(b===0)j=`
|
|
35
|
+
${Z}${$.slice(0,y)}`;else{if(X==="quoted"&&G[b])j+=`${$[b]}\\`;j+=`
|
|
36
|
+
${Z}${$.slice(b+1,y)}`}}return j}function K7($,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}yq.FOLD_BLOCK="block";yq.FOLD_FLOW="flow";yq.FOLD_QUOTED="quoted";yq.foldFlowLines=kq});var Q2=E((lq)=>{var m0=J0(),B1=H7(),s6=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),a6=($)=>/^(%|---|\.\.\.)/m.test($);function uq($,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 J2($,Z){let X=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return X;let{implicitKey:z}=Z,J=Z.options.doubleQuotedMinMultiLineLength,Q=Z.indent||(a6($)?" ":""),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,s6(Z,!1))}function W3($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
|
|
42
|
+
`)||/[ \t]\n|\n[ \t]/.test($))return J2($,Z);let X=Z.indent||(a6($)?" ":""),z="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
43
|
+
${X}`)+"'";return Z.implicitKey?z:B1.foldFlowLines(z,X,B1.FOLD_FLOW,s6(Z,!1))}function Q$($,Z){let{singleQuote:X}=Z.options,z;if(X===!1)z=J2;else{let J=$.includes('"'),Q=$.includes("'");if(J&&!Q)z=W3;else if(Q&&!J)z=J2;else z=X?W3:J2}return z($,Z)}var U3;try{U3=new RegExp(`(^|(?<!
|
|
44
44
|
))
|
|
45
45
|
+(?!
|
|
46
|
-
|$)`,"g")}catch{
|
|
46
|
+
|$)`,"g")}catch{U3=/\n+(?!\n|$)/g}function r6({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||a6(X)?" ":""),G=Y==="literal"?!0:Y==="folded"||Z===m0.Scalar.BLOCK_FOLDED?!1:Z===m0.Scalar.BLOCK_LITERAL?!0:!uq(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
|
-
`&&y!=="\t"&&y!==" ")break}let H=X.substring(K),
|
|
50
|
-
`);if(
|
|
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}`),x=!1,
|
|
54
|
-
${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:
|
|
60
|
-
${Z.indent}${W}`}
|
|
61
|
-
${W}:`}else if(O=`${O}:`,K)O+=
|
|
62
|
-
`:"",
|
|
63
|
-
${
|
|
64
|
-
`&&
|
|
49
|
+
`&&y!=="\t"&&y!==" ")break}let H=X.substring(K),L=H.indexOf(`
|
|
50
|
+
`);if(L===-1)V="-";else if(X===H||L!==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(U3,`$&${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 j=X.substring(0,T<O?T+1:O);if(j)X=X.substring(j.length),j=j.replace(/\n+/g,`$&${q}`);let b=(B?q?"2":"1":"")+V;if($){if(b+=" "+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}`),x=!1,m=s6(z,!0);if(Y!=="folded"&&Z!==m0.Scalar.BLOCK_FOLDED)m.onOverflow=()=>{x=!0};let F=B1.foldFlowLines(`${j}${y}${H}`,q,B1.FOLD_BLOCK,m);if(!x)return`>${b}
|
|
54
|
+
${q}${F}`}return X=X.replace(/\n+/g,`$&${q}`),`|${b}
|
|
55
|
+
${q}${j}${X}${H}`}function mq($,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):r6($,Z,X,z);if(!W&&!G&&J!==m0.Scalar.PLAIN&&Q.includes(`
|
|
58
|
+
`))return r6($,Z,X,z);if(a6(Q)){if(U==="")return Z.forceBlockIndent=!0,r6($,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:L}=Z.doc.schema;if(L.some(K)||H?.some(K))return Q$(Q,Z)}return W?V:B1.foldFlowLines(V,U,B1.FOLD_FLOW,s6(Z,!1))}function cq($,Z,X,z){let{implicitKey:J,inFlow:Q}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:W}=$;if(W!==m0.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))W=m0.Scalar.QUOTE_DOUBLE}let U=(G)=>{switch(G){case m0.Scalar.BLOCK_FOLDED:case m0.Scalar.BLOCK_LITERAL:return J||Q?Q$(Y.value,Z):r6(Y,Z,X,z);case m0.Scalar.QUOTE_DOUBLE:return J2(Y.value,Z);case m0.Scalar.QUOTE_SINGLE:return W3(Y.value,Z);case m0.Scalar.PLAIN:return mq(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}lq.stringifyString=cq});var Y2=E((tq)=>{var pq=d6(),M1=i(),iq=z2(),nq=Q2();function rq($,Z){let X=Object.assign({blockQuote:!0,commentString:iq.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 sq($,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 aq($,Z,{anchors:X,doc:z}){if(!z.directives)return"";let J=[],Q=(M1.isScalar($)||M1.isCollection($))&&$.anchor;if(Q&&pq.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 oq($,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=sq(Z.doc.schema.tags,Q));let Y=aq(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)?nq.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}`}tq.createStringifyContext=rq;tq.stringify=oq});var O7=E((XG)=>{var z1=i(),B7=J0(),M7=Y2(),W2=z2();function ZG({key:$,value:Z},X,z,J){let{allNullValues:Q,doc:Y,indent:W,indentStep:U,options:{commentString:q,indentSeq:G,simpleKeys:V}}=X,K=z1.isNode($)&&$.comment||null;if(V){if(K)throw Error("With simple keys, key nodes cannot have comments");if(z1.isCollection($)||!z1.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let H=!V&&(!$||K&&Z==null&&!X.inFlow||z1.isCollection($)||(z1.isScalar($)?$.type===B7.Scalar.BLOCK_FOLDED||$.type===B7.Scalar.BLOCK_LITERAL:typeof $==="object"));X=Object.assign({},X,{allNullValues:!1,implicitKey:!H&&(V||!Q),indent:W+U});let L=!1,B=!1,O=M7.stringify($,X,()=>L=!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(L&&z)z();return O===""?"?":H?`? ${O}`:O}}else if(Q&&!V||Z==null&&H){if(O=`? ${O}`,K&&!L)O+=W2.lineComment(O,X.indent,q(K));else if(B&&J)J();return O}if(L)K=null;if(H){if(K)O+=W2.lineComment(O,X.indent,q(K));O=`? ${O}
|
|
61
|
+
${W}:`}else if(O=`${O}:`,K)O+=W2.lineComment(O,X.indent,q(K));let T,j,S;if(z1.isNode(Z))T=!!Z.spaceBefore,j=Z.commentBefore,S=Z.comment;else if(T=!1,j=null,S=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(X.implicitKey=!1,!H&&!K&&z1.isScalar(Z))X.indentAtStart=O.length+1;if(B=!1,!G&&U.length>=2&&!X.inFlow&&!H&&z1.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)X.indent=X.indent.substring(2);let b=!1,y=M7.stringify(Z,X,()=>b=!0,()=>B=!0),x=" ";if(K||T||j){if(x=T?`
|
|
62
|
+
`:"",j){let m=q(j);x+=`
|
|
63
|
+
${W2.indentComment(m,X.indent)}`}if(y===""&&!X.inFlow){if(x===`
|
|
64
|
+
`&&S)x=`
|
|
65
65
|
|
|
66
66
|
`}else x+=`
|
|
67
|
-
${X.indent}`}else if(!H
|
|
68
|
-
`),
|
|
67
|
+
${X.indent}`}else if(!H&&z1.isCollection(Z)){let m=y[0],F=y.indexOf(`
|
|
68
|
+
`),n=F!==-1,p=X.inFlow??Z.flow??Z.items.length===0;if(n||!p){let T0=!1;if(n&&(m==="&"||m==="!")){let P=y.indexOf(" ");if(m==="&"&&P!==-1&&P<F&&y[P+1]==="!")P=y.indexOf(" ",P+1);if(P===-1||F<P)T0=!0}if(!T0)x=`
|
|
69
69
|
${X.indent}`}}else if(y===""||y[0]===`
|
|
70
|
-
`)x="";if(O+=x+y,X.inFlow){if(
|
|
70
|
+
`)x="";if(O+=x+y,X.inFlow){if(b&&z)z()}else if(S&&!b)O+=W2.lineComment(O,X.indent,q(S));else if(B&&J)J();return O}XG.stringifyPair=ZG});var q3=E((YG)=>{var N7=_0("process");function JG($,...Z){if($==="debug")console.log(...Z)}function QG($,Z){if($==="debug"||$==="warn")if(typeof N7.emitWarning==="function")N7.emitWarning(Z);else console.warn(Z)}YG.debug=JG;YG.warn=QG});var $8=E((GG)=>{var e6=i(),L7=J0(),o6="<<",t6={identify:($)=>$===o6||typeof $==="symbol"&&$.description===o6,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new L7.Scalar(Symbol(o6)),{addToJSMap:D7}),stringify:()=>o6},qG=($,Z)=>(t6.identify(Z)||e6.isScalar(Z)&&(!Z.type||Z.type===L7.Scalar.PLAIN)&&t6.identify(Z.value))&&$?.doc.schema.tags.some((X)=>X.tag===t6.tag&&X.default);function D7($,Z,X){let z=I7($,X);if(e6.isSeq(z))for(let J of z.items)G3($,Z,J);else if(Array.isArray(z))for(let J of z)G3($,Z,J);else G3($,Z,z)}function G3($,Z,X){let z=I7($,X);if(!e6.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 I7($,Z){return $&&e6.isAlias(Z)?Z.resolve($.doc,$):Z}GG.addMergeToJSMap=D7;GG.isMergeKey=qG;GG.merge=t6});var K3=E((LG)=>{var BG=q3(),T7=$8(),MG=Y2(),A7=i(),V3=H1();function OG($,Z,{key:X,value:z}){if(A7.isNode(X)&&X.addToJSMap)X.addToJSMap($,Z,z);else if(T7.isMergeKey($,X))T7.addMergeToJSMap($,Z,z);else{let J=V3.toJS(X,"",$);if(Z instanceof Map)Z.set(J,V3.toJS(z,J,$));else if(Z instanceof Set)Z.add(J);else{let Q=NG(X,J,$),Y=V3.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 NG($,Z,X){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(A7.isNode($)&&X?.doc){let z=MG.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)+'..."';BG.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)}LG.addPairToJSMap=OG});var O1=E((RG)=>{var R7=X2(),IG=O7(),TG=K3(),Z8=i();function AG($,Z,X){let z=R7.createNode($,void 0,X),J=R7.createNode(Z,void 0,X);return new X8(z,J)}class X8{constructor($,Z=null){Object.defineProperty(this,Z8.NODE_TYPE,{value:Z8.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:X}=this;if(Z8.isNode(Z))Z=Z.clone($);if(Z8.isNode(X))X=X.clone($);return new X8(Z,X)}toJSON($,Z){let X=Z?.mapAsMap?new Map:{};return TG.addPairToJSMap(Z,X,this)}toString($,Z,X){return $?.doc?IG.stringifyPair(this,$,Z,X):JSON.stringify(this)}}RG.Pair=X8;RG.createPair=AG});var H3=E((wG)=>{var g1=i(),F7=Y2(),z8=z2();function CG($,Z,X){return(Z.inFlow??$.flow?EG:PG)($,Z,X)}function PG({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 L=0;L<Z.length;++L){let B=Z[L],O=null;if(g1.isNode(B)){if(!V&&B.spaceBefore)K.push("");if(J8(X,K,B.commentBefore,V),B.comment)O=B.comment}else if(g1.isPair(B)){let j=g1.isNode(B.key)?B.key:null;if(j){if(!V&&j.spaceBefore)K.push("");J8(X,K,j.commentBefore,V)}}V=!1;let T=F7.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 L=1;L<K.length;++L){let B=K[L];H+=B?`
|
|
71
71
|
${U}${B}`:`
|
|
72
72
|
`}}if($){if(H+=`
|
|
73
|
-
|
|
74
|
-
`)),
|
|
73
|
+
`+z8.indentComment(q($),U),W)W()}else if(V&&Y)Y();return H}function EG({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 L=0;L<$.length;++L){let B=$[L],O=null;if(g1.isNode(B)){if(B.spaceBefore)V.push("");if(J8(Z,V,B.commentBefore,!1),B.comment)O=B.comment}else if(g1.isPair(B)){let j=g1.isNode(B.key)?B.key:null;if(j){if(j.spaceBefore)V.push("");if(J8(Z,V,j.commentBefore,!1),j.comment)q=!0}let S=g1.isNode(B.value)?B.value:null;if(S){if(S.comment)O=S.comment;if(S.commentBefore)q=!0}else if(B.value==null&&j?.comment)O=j.comment}if(O)q=!0;let T=F7.stringify(B,U,()=>O=null);if(q||(q=V.length>G||T.includes(`
|
|
74
|
+
`)),L<$.length-1)T+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)q||(q=V.reduce((j,S)=>j+S.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 L=V.reduce((B,O)=>B+O.length+2,2);q=Z.options.lineWidth>0&&L>Z.options.lineWidth}if(q){let L=K;for(let B of V)L+=B?`
|
|
75
75
|
${Q}${J}${B}`:`
|
|
76
|
-
`;return`${
|
|
77
|
-
${J}${H}`}else return`${K}${Y}${V.join(" ")}${Y}${H}`}}function
|
|
78
|
-
`:" ")}return
|
|
76
|
+
`;return`${L}
|
|
77
|
+
${J}${H}`}else return`${K}${Y}${V.join(" ")}${Y}${H}`}}function J8({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())}}wG.stringifyCollection=CG});var L1=E((yG)=>{var jG=H3(),xG=K3(),bG=n6(),N1=i(),Q8=O1(),kG=J0();function U2($,Z){let X=N1.isScalar(Z)?Z.value:Z;for(let z of $)if(N1.isPair(z)){if(z.key===Z||z.key===X)return z;if(N1.isScalar(z.key)&&z.key.value===X)return z}return}class _7 extends bG.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(N1.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(Q8.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(N1.isPair($))X=$;else if(!$||typeof $!=="object"||!("key"in $))X=new Q8.Pair($,$?.value);else X=new Q8.Pair($.key,$.value);let z=U2(this.items,X.key),J=this.schema?.sortMapEntries;if(z){if(!Z)throw Error(`Key ${X.key} already set`);if(N1.isScalar(z.value)&&kG.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=U2(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let z=U2(this.items,$)?.value;return(!Z&&N1.isScalar(z)?z.value:z)??void 0}has($){return!!U2(this.items,$)}set($,Z){this.add(new Q8.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)xG.addPairToJSMap(Z,z,J);return z}toString($,Z,X){if(!$)return JSON.stringify(this);for(let z of this.items)if(!N1.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 jG.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:X,onComment:Z})}}yG.YAMLMap=_7;yG.findPair=U2});var Y$=E((uG)=>{var fG=i(),C7=L1(),hG={collection:"map",default:!0,nodeClass:C7.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!fG.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,X)=>C7.YAMLMap.from($,Z,X)};uG.map=hG});var D1=E((nG)=>{var cG=X2(),lG=H3(),dG=n6(),W8=i(),pG=J0(),iG=H1();class P7 extends dG.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(W8.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=Y8($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let X=Y8($);if(typeof X!=="number")return;let z=this.items[X];return!Z&&W8.isScalar(z)?z.value:z}has($){let Z=Y8($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let X=Y8($);if(typeof X!=="number")throw Error(`Expected a valid index, not ${$}.`);let z=this.items[X];if(W8.isScalar(z)&&pG.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(iG.toJS(J,String(z++),Z));return X}toString($,Z,X){if(!$)return JSON.stringify(this);return lG.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(cG.createNode(Y,void 0,X))}}return J}}function Y8($){let Z=W8.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}nG.YAMLSeq=P7});var W$=E((oG)=>{var sG=i(),E7=D1(),aG={collection:"seq",default:!0,nodeClass:E7.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!sG.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,X)=>E7.YAMLSeq.from($,Z,X)};oG.seq=aG});var q2=E((ZV)=>{var eG=Q2(),$V={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,X,z){return Z=Object.assign({actualString:!0},Z),eG.stringifyString($,Z,X,z)}};ZV.string=$V});var U8=E((zV)=>{var w7=J0(),S7={identify:($)=>$==null,createNode:()=>new w7.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new w7.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&S7.test.test($)?$:Z.options.nullStr};zV.nullTag=S7});var B3=E((YV)=>{var QV=J0(),j7={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new QV.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},X){if($&&j7.test.test($)){let z=$[0]==="t"||$[0]==="T";if(Z===z)return $}return Z?X.options.trueStr:X.options.falseStr}};YV.boolTag=j7});var U$=E((qV)=>{function UV({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}qV.stringifyNumber=UV});var O3=E((MV)=>{var VV=J0(),M3=U$(),KV={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:M3.stringifyNumber},HV={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():M3.stringifyNumber($)}},BV={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new VV.Scalar(parseFloat($)),X=$.indexOf(".");if(X!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-X-1;return Z},stringify:M3.stringifyNumber};MV.float=BV;MV.floatExp=HV;MV.floatNaN=KV});var L3=E((AV)=>{var x7=U$(),q8=($)=>typeof $==="bigint"||Number.isInteger($),N3=($,Z,X,{intAsBigInt:z})=>z?BigInt($):parseInt($.substring(Z),X);function b7($,Z,X){let{value:z}=$;if(q8(z)&&z>=0)return X+z.toString(Z);return x7.stringifyNumber($)}var DV={identify:($)=>q8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,X)=>N3($,2,8,X),stringify:($)=>b7($,8,"0o")},IV={identify:q8,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,X)=>N3($,0,10,X),stringify:x7.stringifyNumber},TV={identify:($)=>q8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,X)=>N3($,2,16,X),stringify:($)=>b7($,16,"0x")};AV.int=IV;AV.intHex=TV;AV.intOct=DV});var k7=E((xV)=>{var CV=Y$(),PV=U8(),EV=W$(),wV=q2(),SV=B3(),D3=O3(),I3=L3(),jV=[CV.map,EV.seq,wV.string,PV.nullTag,SV.boolTag,I3.intOct,I3.int,I3.intHex,D3.floatNaN,D3.floatExp,D3.float];xV.schema=jV});var v7=E((uV)=>{var kV=J0(),yV=Y$(),vV=W$();function y7($){return typeof $==="bigint"||Number.isInteger($)}var G8=({value:$})=>JSON.stringify($),gV=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:G8},{identify:($)=>$==null,createNode:()=>new kV.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:G8},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:G8},{identify:y7,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:X})=>X?BigInt($):parseInt($,10),stringify:({value:$})=>y7($)?$.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:G8}],fV={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},hV=[yV.map,vV.seq].concat(gV,fV);uV.schema=hV});var A3=E((dV)=>{var G2=_0("buffer"),T3=J0(),cV=Q2(),lV={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof G2.Buffer==="function")return G2.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 G2.Buffer==="function")W=Y instanceof G2.Buffer?Y.toString("base64"):G2.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=T3.Scalar.BLOCK_LITERAL),Z!==T3.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===T3.Scalar.BLOCK_LITERAL?`
|
|
78
|
+
`:" ")}return cV.stringifyString({comment:$,type:Z,value:W},z,J,Q)}};dV.binary=lV});var K8=E((sV)=>{var V8=i(),R3=O1(),iV=J0(),nV=D1();function g7($,Z){if(V8.isSeq($))for(let X=0;X<$.items.length;++X){let z=$.items[X];if(V8.isPair(z))continue;else if(V8.isMap(z)){if(z.items.length>1)Z("Each pair must have its own sequence indicator");let J=z.items[0]||new R3.Pair(new iV.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]=V8.isPair(z)?z:new R3.Pair(z)}else Z("Expected a sequence for this tag");return $}function f7($,Z,X){let{replacer:z}=X,J=new nV.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(R3.createPair(W,U,X))}return J}var rV={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:g7,createNode:f7};sV.createPairs=f7;sV.pairs=rV;sV.resolvePairs=g7});var _3=E((ZK)=>{var h7=i(),F3=H1(),V2=L1(),eV=D1(),u7=K8();class f1 extends eV.YAMLSeq{constructor(){super();this.add=V2.YAMLMap.prototype.add.bind(this),this.delete=V2.YAMLMap.prototype.delete.bind(this),this.get=V2.YAMLMap.prototype.get.bind(this),this.has=V2.YAMLMap.prototype.has.bind(this),this.set=V2.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(h7.isPair(z))J=F3.toJS(z.key,"",Z),Q=F3.toJS(z.value,J,Z);else J=F3.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=u7.createPairs($,Z,X),J=new this;return J.items=z.items,J}}f1.tag="tag:yaml.org,2002:omap";var $K={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:f1,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let X=u7.resolvePairs($,Z),z=[];for(let{key:J}of X.items)if(h7.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)};ZK.YAMLOMap=f1;ZK.omap=$K});var p7=E((JK)=>{var m7=J0();function c7({value:$,source:Z},X){if(Z&&($?l7:d7).test.test(Z))return Z;return $?X.options.trueStr:X.options.falseStr}var l7={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new m7.Scalar(!0),stringify:c7},d7={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new m7.Scalar(!1),stringify:c7};JK.falseTag=d7;JK.trueTag=l7});var i7=E((VK)=>{var WK=J0(),C3=U$(),UK={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:C3.stringifyNumber},qK={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():C3.stringifyNumber($)}},GK={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new WK.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:C3.stringifyNumber};VK.float=GK;VK.floatExp=qK;VK.floatNaN=UK});var r7=E((DK)=>{var n7=U$(),K2=($)=>typeof $==="bigint"||Number.isInteger($);function H8($,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 P3($,Z,X){let{value:z}=$;if(K2(z)){let J=z.toString(Z);return z<0?"-"+X+J.substr(1):X+J}return n7.stringifyNumber($)}var MK={identify:K2,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,X)=>H8($,2,2,X),stringify:($)=>P3($,2,"0b")},OK={identify:K2,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,X)=>H8($,1,8,X),stringify:($)=>P3($,8,"0")},NK={identify:K2,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,X)=>H8($,0,10,X),stringify:n7.stringifyNumber},LK={identify:K2,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,X)=>H8($,2,16,X),stringify:($)=>P3($,16,"0x")};DK.int=NK;DK.intBin=MK;DK.intHex=LK;DK.intOct=OK});var E3=E((_K)=>{var O8=i(),B8=O1(),M8=L1();class h1 extends M8.YAMLMap{constructor($){super($);this.tag=h1.tag}add($){let Z;if(O8.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new B8.Pair($.key,null);else Z=new B8.Pair($,null);if(!M8.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let X=M8.findPair(this.items,$);return!Z&&O8.isPair(X)?O8.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=M8.findPair(this.items,$);if(X&&!Z)this.items.splice(this.items.indexOf(X),1);else if(!X&&Z)this.items.push(new B8.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(B8.createPair(Q,null,X))}return J}}h1.tag="tag:yaml.org,2002:set";var FK={collection:"map",identify:($)=>$ instanceof Set,nodeClass:h1,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,X)=>h1.from($,Z,X),resolve($,Z){if(O8.isMap($))if($.hasAllNullValues(!0))return Object.assign(new h1,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};_K.YAMLSet=h1;_K.set=FK});var S3=E((jK)=>{var EK=U$();function w3($,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 s7($){let{value:Z}=$,X=(Y)=>Y;if(typeof Z==="bigint")X=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return EK.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 wK={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})=>w3($,X),stringify:s7},SK={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:($)=>w3($,!1),stringify:s7},a7={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(a7.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=w3(G,!1);if(Math.abs(V)<30)V*=60;q-=60000*V}return new Date(q)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};jK.floatTime=SK;jK.intTime=wK;jK.timestamp=a7});var t7=E((pK)=>{var yK=Y$(),vK=U8(),gK=W$(),fK=q2(),hK=A3(),o7=p7(),j3=i7(),N8=r7(),uK=$8(),mK=_3(),cK=K8(),lK=E3(),x3=S3(),dK=[yK.map,gK.seq,fK.string,vK.nullTag,o7.trueTag,o7.falseTag,N8.intBin,N8.intOct,N8.int,N8.intHex,j3.floatNaN,j3.floatExp,j3.float,hK.binary,uK.merge,mK.omap,cK.pairs,lK.set,x3.intTime,x3.floatTime,x3.timestamp];pK.schema=dK});var UX=E(($H)=>{var XX=Y$(),nK=U8(),zX=W$(),rK=q2(),sK=B3(),b3=O3(),k3=L3(),aK=k7(),oK=v7(),JX=A3(),H2=$8(),QX=_3(),YX=K8(),e7=t7(),WX=E3(),L8=S3(),$X=new Map([["core",aK.schema],["failsafe",[XX.map,zX.seq,rK.string]],["json",oK.schema],["yaml11",e7.schema],["yaml-1.1",e7.schema]]),ZX={binary:JX.binary,bool:sK.boolTag,float:b3.float,floatExp:b3.floatExp,floatNaN:b3.floatNaN,floatTime:L8.floatTime,int:k3.int,intHex:k3.intHex,intOct:k3.intOct,intTime:L8.intTime,map:XX.map,merge:H2.merge,null:nK.nullTag,omap:QX.omap,pairs:YX.pairs,seq:zX.seq,set:WX.set,timestamp:L8.timestamp},tK={"tag:yaml.org,2002:binary":JX.binary,"tag:yaml.org,2002:merge":H2.merge,"tag:yaml.org,2002:omap":QX.omap,"tag:yaml.org,2002:pairs":YX.pairs,"tag:yaml.org,2002:set":WX.set,"tag:yaml.org,2002:timestamp":L8.timestamp};function eK($,Z,X){let z=$X.get(Z);if(z&&!$)return X&&!z.includes(H2.merge)?z.concat(H2.merge):z.slice();let J=z;if(!J)if(Array.isArray($))J=[];else{let Q=Array.from($X.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(H2.merge);return J.reduce((Q,Y)=>{let W=typeof Y==="string"?ZX[Y]:Y;if(!W){let U=JSON.stringify(Y),q=Object.keys(ZX).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},[])}$H.coreKnownTags=tK;$H.getTags=eK});var g3=E((WH)=>{var y3=i(),zH=Y$(),JH=W$(),QH=q2(),D8=UX(),YH=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class v3{constructor({compat:$,customTags:Z,merge:X,resolveKnownTags:z,schema:J,sortMapEntries:Q,toStringDefaults:Y}){this.compat=Array.isArray($)?D8.getTags($,"compat"):$?D8.getTags(null,$):null,this.name=typeof J==="string"&&J||"core",this.knownTags=z?D8.coreKnownTags:{},this.tags=D8.getTags(Z,this.name,X),this.toStringOptions=Y??null,Object.defineProperty(this,y3.MAP,{value:zH.map}),Object.defineProperty(this,y3.SCALAR,{value:QH.string}),Object.defineProperty(this,y3.SEQ,{value:JH.seq}),this.sortMapEntries=typeof Q==="function"?Q:Q===!0?YH:null}clone(){let $=Object.create(v3.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}WH.Schema=v3});var qX=E((VH)=>{var qH=i(),f3=Y2(),B2=z2();function GH($,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=f3.createStringifyContext($,Z),{commentString:Q}=J.options;if($.commentBefore){if(X.length!==1)X.unshift("");let U=Q($.commentBefore);X.unshift(B2.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(qH.isNode($.contents)){if($.contents.spaceBefore&&z)X.push("");if($.contents.commentBefore){let G=Q($.contents.commentBefore);X.push(B2.indentComment(G,""))}J.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,q=f3.stringify($.contents,J,()=>W=null,U);if(W)q+=B2.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(f3.stringify($.contents,J));if($.directives?.docEnd)if($.comment){let U=Q($.comment);if(U.includes(`
|
|
81
|
+
`))X.push("..."),X.push(B2.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(B2.indentComment(Q(U),""))}}return X.join(`
|
|
82
82
|
`)+`
|
|
83
|
-
`}
|
|
83
|
+
`}VH.stringifyDocument=GH});var M2=E((IH)=>{var HH=Z2(),q$=n6(),y0=i(),BH=O1(),MH=H1(),OH=g3(),NH=qX(),h3=d6(),LH=J3(),DH=X2(),u3=z3();class m3{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 u3.Directives({version:Q});this.setSchema(Q,X),this.contents=$===void 0?null:this.createNode($,z,X)}clone(){let $=Object.create(m3.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=h3.anchorNames(this);$.anchor=!Z||X.has(Z)?h3.findNewAnchor(Z||"a",X):Z}return new HH.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}=h3.createNodeAnchors(this,Q||"a"),H={aliasDuplicateObjects:J??!0,keepUndefined:W??!1,onAnchor:G,onTagObj:U,replacer:z,schema:this.schema,sourceObjects:K},L=DH.createNode($,q,H);if(Y&&y0.isCollection(L))L.flow=!0;return V(),L}createPair($,Z,X={}){let z=this.createNode($,null,X),J=this.createNode(Z,null,X);return new BH.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 u3.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 u3.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 OH.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=MH.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"?LH.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 NH.stringifyDocument(this,$)}}function G$($){if(y0.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}IH.Document=m3});var O2=E((RH)=>{class I8 extends Error{constructor($,Z,X,z){super();this.name=$,this.code=X,this.message=z,this.pos=Z}}class GX extends I8{constructor($,Z,X){super("YAMLParseError",$,Z,X)}}class VX extends I8{constructor($,Z,X){super("YAMLWarning",$,Z,X)}}var AH=($,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
|
-
`}};
|
|
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||
|
|
91
|
-
`+
|
|
92
|
-
`+x.comment;else q.comment=x.comment;V=x.end;continue}if(!Y&&X.options.strict&&
|
|
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}
|
|
88
|
+
`}};RH.YAMLError=I8;RH.YAMLParseError=GX;RH.YAMLWarning=VX;RH.prettifyError=AH});var N2=E((wH)=>{function EH($,{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,L=!1,B=null,O=null,T=null,j=null,S=null,b=null,y=null;for(let F of $){if(L){if(F.type!=="space"&&F.type!=="newline"&&F.type!=="comma")Q(F.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(B){if(q&&F.type!=="comment"&&F.type!=="newline")Q(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");B=null}switch(F.type){case"space":if(!Z&&(X!=="doc-start"||z?.type!=="flow-collection")&&F.source.includes("\t"))B=F;G=!0;break;case"comment":{if(!G)Q(F,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let n=F.source.substring(1)||" ";if(!V)V=n;else V+=K+n;K="",q=!1;break}case"newline":if(q){if(V)V+=F.source;else if(!b||X!=="seq-item-ind")U=!0}else K+=F.source;if(q=!0,H=!0,O||T)j=F;G=!0;break;case"anchor":if(O)Q(F,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(F.source.endsWith(":"))Q(F.offset+F.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);O=F,y??(y=F.offset),q=!1,G=!1,L=!0;break;case"tag":{if(T)Q(F,"MULTIPLE_TAGS","A node can have at most one tag");T=F,y??(y=F.offset),q=!1,G=!1,L=!0;break}case X:if(O||T)Q(F,"BAD_PROP_ORDER",`Anchors and tags must be after the ${F.source} indicator`);if(b)Q(F,"UNEXPECTED_TOKEN",`Unexpected ${F.source} in ${Z??"collection"}`);b=F,q=X==="seq-item-ind"||X==="explicit-key-ind",G=!1;break;case"comma":if(Z){if(S)Q(F,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);S=F,q=!1,G=!1;break}default:Q(F,"UNEXPECTED_TOKEN",`Unexpected ${F.type} token`),q=!1,G=!1}}let x=$[$.length-1],m=x?x.offset+x.source.length:J;if(L&&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:S,found:b,spaceBefore:U,comment:V,hasNewline:H,anchor:O,tag:T,newlineAfterProp:j,end:m,start:y??m}}wH.resolveProps=EH});var T8=E((jH)=>{function c3($){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(c3(Z.key)||c3(Z.value))return!0}return!1;default:return!0}}jH.containsNewline=c3});var l3=E((yH)=>{var bH=T8();function kH($,Z,X){if(Z?.type==="flow-collection"){let z=Z.end[0];if(z.indent===$&&(z.source==="]"||z.source==="}")&&bH.containsNewline(Z))X(z,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}yH.flowIndentCheck=kH});var d3=E((fH)=>{var KX=i();function gH($,Z,X){let{uniqueKeys:z}=$.options;if(z===!1)return!1;let J=typeof z==="function"?z:(Q,Y)=>Q===Y||KX.isScalar(Q)&&KX.isScalar(Y)&&Q.value===Y.value;return Z.some((Q)=>J(Q.key,X))}fH.mapIncludes=gH});var NX=E((dH)=>{var HX=O1(),uH=L1(),BX=N2(),mH=T8(),MX=l3(),cH=d3(),OX="All mapping items must start at the same column";function lH({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let W=new(Q?.nodeClass??uH.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:L}=G,B=BX.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",OX)}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||mH.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",OX);X.atKey=!0;let T=B.end,j=K?$(X,K,B,J):Z(X,T,V,null,B,J);if(X.schema.compat)MX.flowIndentCheck(z.indent,K,J);if(X.atKey=!1,cH.mapIncludes(X,W.items,j))J(T,"DUPLICATE_KEY","Map keys must be unique");let S=BX.resolveProps(H??[],{indicator:"map-value-ind",next:L,offset:j.range[2],onError:J,parentIndent:z.indent,startOnNewline:!K||K.type==="block-scalar"});if(U=S.end,S.found){if(O){if(L?.type==="block-map"&&!S.hasNewline)J(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(X.options.strict&&B.start<S.found.offset-1024)J(j.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let b=L?$(X,L,S,J):Z(X,U,H,null,S,J);if(X.schema.compat)MX.flowIndentCheck(z.indent,L,J);U=b.range[2];let y=new HX.Pair(j,b);if(X.options.keepSourceTokens)y.srcToken=G;W.items.push(y)}else{if(O)J(j.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(S.comment)if(j.comment)j.comment+=`
|
|
91
|
+
`+S.comment;else j.comment=S.comment;let b=new HX.Pair(j);if(X.options.keepSourceTokens)b.srcToken=G;W.items.push(b)}}if(q&&q<U)J(q,"IMPOSSIBLE","Map comment with trailing content");return W.range=[z.offset,U,q??U],W}dH.resolveBlockMap=lH});var LX=E((aH)=>{var iH=D1(),nH=N2(),rH=l3();function sH({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let W=new(Q?.nodeClass??iH.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=nH.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)rH.flowIndentCheck(z.indent,V,J);U=H.range[2],W.items.push(H)}return W.range=[z.offset,U,q??U],W}aH.resolveBlockSeq=sH});var V$=E((eH)=>{function tH($,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}}eH.resolveEnd=tH});var TX=E((UB)=>{var ZB=i(),XB=O1(),DX=L1(),zB=D1(),JB=V$(),IX=N2(),QB=T8(),YB=d3(),p3="Block collections are not allowed within flow collections",i3=($)=>$&&($.type==="block-map"||$.type==="block-seq");function WB({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let Y=z.start.source==="{",W=Y?"flow map":"flow sequence",q=new(Q?.nodeClass??(Y?DX.YAMLMap:zB.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:j,key:S,sep:b,value:y}=T,x=IX.resolveProps(j,{flow:W,indicator:"explicit-key-ind",next:S??b?.[0],offset:V,onError:J,parentIndent:z.indent,startOnNewline:!1});if(!x.found){if(!x.anchor&&!x.tag&&!b&&!y){if(O===0&&x.comma)J(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`);else if(O<z.items.length-1)J(x.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${W}`);if(x.comment)if(q.comment)q.comment+=`
|
|
92
|
+
`+x.comment;else q.comment=x.comment;V=x.end;continue}if(!Y&&X.options.strict&&QB.containsNewline(S))J(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(O===0){if(x.comma)J(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`)}else{if(!x.comma)J(x.start,"MISSING_CHAR",`Missing , between ${W} items`);if(x.comment){let m="";$:for(let F of j)switch(F.type){case"comma":case"space":break;case"comment":m=F.source.substring(1);break $;default:break $}if(m){let F=q.items[q.items.length-1];if(ZB.isPair(F))F=F.value??F.key;if(F.comment)F.comment+=`
|
|
93
|
+
`+m;else F.comment=m;x.comment=x.comment.substring(m.length+1)}}}if(!Y&&!b&&!x.found){let m=y?$(X,y,x,J):Z(X,x.end,b,null,x,J);if(q.items.push(m),V=m.range[2],i3(y))J(m.range,"BLOCK_IN_FLOW",p3)}else{X.atKey=!0;let m=x.end,F=S?$(X,S,x,J):Z(X,m,j,null,x,J);if(i3(S))J(F.range,"BLOCK_IN_FLOW",p3);X.atKey=!1;let n=IX.resolveProps(b??[],{flow:W,indicator:"map-value-ind",next:y,offset:F.range[2],onError:J,parentIndent:z.indent,startOnNewline:!1});if(n.found){if(!Y&&!x.found&&X.options.strict){if(b)for(let P of b){if(P===n.found)break;if(P.type==="newline"){J(P,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(x.start<n.found.offset-1024)J(n.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(n.start,"MISSING_CHAR",`Missing , or : between ${W} items`);let p=y?$(X,y,n,J):n.found?Z(X,n.end,b,null,n,J):null;if(p){if(i3(y))J(p.range,"BLOCK_IN_FLOW",p3)}else if(n.comment)if(F.comment)F.comment+=`
|
|
94
|
+
`+n.comment;else F.comment=n.comment;let T0=new XB.Pair(F,p);if(X.options.keepSourceTokens)T0.srcToken=T;if(Y){let P=q;if(YB.mapIncludes(X,P.items,F))J(m,"DUPLICATE_KEY","Map keys must be unique");P.items.push(T0)}else{let P=new DX.YAMLMap(X.schema);P.flow=!0,P.items.push(T0);let d=(p??F).range;P.range=[F.range[0],d[1],d[2]],q.items.push(P)}V=p?p.range[2]:n.end}}let K=Y?"}":"]",[H,...L]=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)L.unshift(H)}if(L.length>0){let O=JB.resolveEnd(L,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}UB.resolveFlowCollection=WB});var AX=E((LB)=>{var GB=i(),VB=J0(),KB=L1(),HB=D1(),BB=NX(),MB=LX(),OB=TX();function n3($,Z,X,z,J,Q){let Y=X.type==="block-map"?BB.resolveBlockMap($,Z,X,z,Q):X.type==="block-seq"?MB.resolveBlockSeq($,Z,X,z,Q):OB.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 NB($,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,L=K&&Q?K.offset>Q.offset?K:Q:K??Q;if(L&&(!H||H.offset<L.offset))J(L,"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===KB.YAMLMap.tagName&&W==="map"||Y===HB.YAMLSeq.tagName&&W==="seq")return n3($,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 n3($,Z,X,J,Y)}}let q=n3($,Z,X,J,Y,U),G=U.resolve?.(q,(K)=>J(Q,"TAG_RESOLVE_FAILED",K),Z.options)??q,V=GB.isNode(G)?G:new VB.Scalar(G);if(V.range=q.range,V.tag=Y,U?.format)V.format=U.format;return V}LB.composeCollection=NB});var s3=E((RB)=>{var r3=J0();function IB($,Z,X){let z=Z.offset,J=TB(Z,$.options.strict,X);if(!J)return{value:"",type:null,comment:"",range:[z,z,z]};let Q=J.mode===">"?r3.Scalar.BLOCK_FOLDED:r3.Scalar.BLOCK_LITERAL,Y=Z.source?AB(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 j=T[T.length-1]==="\r";if(j)T=T.slice(0,-1);if(T&&O.length<U){let b=`Block scalar lines must not be less indented than their ${J.indent?"explicit indentation indicator":"first line"}`;X(q-T.length-(j?2:1),"BAD_INDENT",b),O=""}if(Q===r3.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,70 +107,70 @@ ${q}
|
|
|
107
107
|
`+Y[B][0].slice(U);if(V[V.length-1]!==`
|
|
108
108
|
`)V+=`
|
|
109
109
|
`;break;default:V+=`
|
|
110
|
-
`}let
|
|
110
|
+
`}let L=z+J.length+Z.source.length;return{value:V,type:Q,comment:J.comment,range:[z,L,L]}}function TB({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 L=Number(H);if(!Y&&L)Y=L;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 L=`Unexpected token in block scalar header: ${H.type}`;z(H,"UNEXPECTED_TOKEN",L);let B=H.source;if(B&&typeof B==="string")V+=B.length}}}return{mode:Q,indent:Y,chomp:W,comment:G,length:V}}function AB($){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}RB.resolveBlockScalar=IB});var o3=E((bB)=>{var a3=J0(),_B=V$();function CB($,Z,X){let{offset:z,type:J,source:Q,end:Y}=$,W,U,q=(K,H,L)=>X(z+K,H,L);switch(J){case"scalar":W=a3.Scalar.PLAIN,U=PB(Q,q);break;case"single-quoted-scalar":W=a3.Scalar.QUOTE_SINGLE,U=EB(Q,q);break;case"double-quoted-scalar":W=a3.Scalar.QUOTE_DOUBLE,U=wB(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=_B.resolveEnd(Y,G,Z,X);return{value:U,type:W,comment:V.comment,range:[z,G,V.offset]}}function PB($,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 RX($)}function EB($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return RX($.slice(1,-1)).replace(/''/g,"'")}function RX($){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=`
|
|
114
|
-
`;else J+=Q+z[1],Q=" ";Y=X.lastIndex}let W=/[ \t]*(.*)/sy;return W.lastIndex=Y,z=W.exec($),J+Q+(z?.[1]??"")}function
|
|
114
|
+
`;else J+=Q+z[1],Q=" ";Y=X.lastIndex}let W=/[ \t]*(.*)/sy;return W.lastIndex=Y,z=W.exec($),J+Q+(z?.[1]??"")}function wB($,Z){let X="";for(let z=1;z<$.length-1;++z){let J=$[z];if(J==="\r"&&$[z+1]===`
|
|
115
115
|
`)continue;if(J===`
|
|
116
|
-
`){let{fold:Q,offset:Y}=
|
|
116
|
+
`){let{fold:Q,offset:Y}=SB($,z);X+=Q,z=Y}else if(J==="\\"){let Q=$[++z],Y=jB[Q];if(Y)X+=Y;else if(Q===`
|
|
117
117
|
`){Q=$[z+1];while(Q===" "||Q==="\t")Q=$[++z+1]}else if(Q==="\r"&&$[z+1]===`
|
|
118
|
-
`){Q=$[++z+1];while(Q===" "||Q==="\t")Q=$[++z+1]}else if(Q==="x"||Q==="u"||Q==="U"){let W=Q==="x"?2:Q==="u"?4:8;X+=
|
|
118
|
+
`){Q=$[++z+1];while(Q===" "||Q==="\t")Q=$[++z+1]}else if(Q==="x"||Q==="u"||Q==="U"){let W=Q==="x"?2:Q==="u"?4:8;X+=xB($,z+1,W,Z),z+=W}else{let W=$.substr(z-1,2);Z(z-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),X+=W}}else if(J===" "||J==="\t"){let Q=z,Y=$[z+1];while(Y===" "||Y==="\t")Y=$[++z+1];if(Y!==`
|
|
119
119
|
`&&!(Y==="\r"&&$[z+2]===`
|
|
120
|
-
`))X+=z>Q?$.slice(Q,z+1):J}else X+=J}if($[$.length-1]!=='"'||$.length===1)Z($.length,"MISSING_CHAR",'Missing closing "quote');return X}function
|
|
120
|
+
`))X+=z>Q?$.slice(Q,z+1):J}else X+=J}if($[$.length-1]!=='"'||$.length===1)Z($.length,"MISSING_CHAR",'Missing closing "quote');return X}function SB($,Z){let X="",z=$[Z+1];while(z===" "||z==="\t"||z===`
|
|
121
121
|
`||z==="\r"){if(z==="\r"&&$[Z+2]!==`
|
|
122
122
|
`)break;if(z===`
|
|
123
123
|
`)X+=`
|
|
124
|
-
`;Z+=1,z=$[Z+1]}if(!X)X=" ";return{fold:X,offset:Z}}var
|
|
125
|
-
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function
|
|
124
|
+
`;Z+=1,z=$[Z+1]}if(!X)X=" ";return{fold:X,offset:Z}}var jB={"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 xB($,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}}bB.resolveFlowScalar=CB});var _X=E((uB)=>{var u1=i(),FX=J0(),yB=s3(),vB=o3();function gB($,Z,X,z){let{value:J,type:Q,comment:Y,range:W}=Z.type==="block-scalar"?yB.resolveBlockScalar($,Z,z):vB.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[u1.SCALAR];else if(U)q=fB($.schema,J,U,X,z);else if(Z.type==="scalar")q=hB($,J,Z,z);else q=$.schema[u1.SCALAR];let G;try{let V=q.resolve(J,(K)=>z(X??Z,"TAG_RESOLVE_FAILED",K),$.options);G=u1.isScalar(V)?V:new FX.Scalar(V)}catch(V){let K=V instanceof Error?V.message:String(V);z(X??Z,"TAG_RESOLVE_FAILED",K),G=new FX.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 fB($,Z,X,z,J){if(X==="!")return $[u1.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"),$[u1.SCALAR]}function hB({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[u1.SCALAR];if(X.compat){let W=X.compat.find((U)=>U.default&&U.test?.test(z))??X[u1.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}uB.composeScalar=gB});var CX=E((lB)=>{function cB($,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 $}lB.emptyScalarPosition=cB});var wX=E((tB)=>{var pB=Z2(),iB=i(),nB=AX(),PX=_X(),rB=V$(),sB=CX(),aB={composeNode:EX,composeEmptyNode:t3};function EX($,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=oB($,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=PX.composeScalar($,Z,U,z),W)q.anchor=W.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(q=nB.composeCollection(aB,$,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=t3($,Z.offset,void 0,null,X,z)),W&&q.anchor==="")z(W,"BAD_ALIAS","Anchor cannot be an empty string");if(J&&$.options.stringKeys&&(!iB.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 t3($,Z,X,z,{spaceBefore:J,comment:Q,anchor:Y,tag:W,end:U},q){let G={type:"scalar",offset:sB.emptyScalarPosition(Z,X,z),indent:-1,source:""},V=PX.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 oB({options:$},{offset:Z,source:X,end:z},J){let Q=new pB.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=rB.resolveEnd(z,Y,$.strict,J);if(Q.range=[Z,Y,W.offset],W.comment)Q.comment=W.comment;return Q}tB.composeEmptyNode=t3;tB.composeNode=EX});var jX=E((QM)=>{var ZM=M2(),SX=wX(),XM=V$(),zM=N2();function JM($,Z,{offset:X,start:z,value:J,end:Q},Y){let W=Object.assign({_directives:Z},$),U=new ZM.Document(void 0,W),q={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},G=zM.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?SX.composeNode(q,J,G,Y):SX.composeEmptyNode(q,G.end,z,null,G,Y);let V=U.contents.range[2],K=XM.resolveEnd(Q,V,!1,Y);if(K.comment)U.comment=K.comment;return U.range=[X,V,K.offset],U}QM.composeDoc=JM});var e3=E((KM)=>{var WM=_0("process"),UM=z3(),qM=M2(),L2=O2(),xX=i(),GM=jX(),VM=V$();function D2($){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 bX($){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 kX{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,X,z,J)=>{let Q=D2(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 UM.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:X,afterEmptyLine:z}=bX(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(xX.isCollection(J)&&!J.flow&&J.items.length>0){let Q=J.items[0];if(xX.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:bX(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(WM.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,X,z)=>{let J=D2($);J[0]+=Z,this.onError(J,"BAD_DIRECTIVE",X,z)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=GM.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(D2($),"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(D2($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=VM.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(D2($),"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 qM.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}}}KM.Composer=kX});var gX=E((TM)=>{var BM=s3(),MM=o3(),OM=O2(),yX=Q2();function NM($,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 OM.YAMLParseError([W,W+1],Q,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return MM.resolveFlowScalar($,Z,z);case"block-scalar":return BM.resolveBlockScalar({options:{strict:Z}},$,z)}}return null}function LM($,Z){let{implicitKey:X=!1,indent:z,inFlow:J=!1,offset:Q=-1,type:Y="PLAIN"}=Z,W=yX.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
|
|
135
|
+
`,K=[{type:"block-scalar-header",offset:Q,indent:z,source:G}];if(!vX(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 DM($,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=yX.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">":IM($,U);break;case'"':$Z($,U,"double-quoted-scalar");break;case"'":$Z($,U,"single-quoted-scalar");break;default:$Z($,U,"scalar")}}function IM($,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})}}}
|
|
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(!vX(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 vX($,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 $Z($,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})}}}TM.createScalarToken=LM;TM.resolveAsScalar=NM;TM.setScalarValue=DM});var fX=E((CM)=>{var _M=($)=>("type"in $)?R8($):A8($);function R8($){switch($.type){case"block-scalar":{let Z="";for(let X of $.props)Z+=R8(X);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let X of $.items)Z+=A8(X);return Z}case"flow-collection":{let Z=$.start.source;for(let X of $.items)Z+=A8(X);for(let X of $.end)Z+=X.source;return Z}case"document":{let Z=A8($);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 A8({start:$,key:Z,sep:X,value:z}){let J="";for(let Q of $)J+=Q.source;if(Z)J+=R8(Z);if(X)for(let Q of X)J+=Q.source;if(z)J+=R8(z);return J}CM.stringify=_M});var mX=E((wM)=>{var ZZ=Symbol("break visit"),EM=Symbol("skip children"),hX=Symbol("remove item");function m1($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};uX(Object.freeze([]),$,Z)}m1.BREAK=ZZ;m1.SKIP=EM;m1.REMOVE=hX;m1.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};m1.parentCollection=($,Z)=>{let X=m1.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 uX($,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=uX(Object.freeze($.concat([[J,Y]])),Q.items[Y],X);if(typeof W==="number")Y=W-1;else if(W===ZZ)return ZZ;else if(W===hX)Q.items.splice(Y,1),Y-=1}if(typeof z==="function"&&J==="key")z=z(Z,$)}}return typeof z==="function"?z(Z,$):z}wM.visit=m1});var F8=E((gM)=>{var XZ=gX(),jM=fX(),xM=mX(),zZ="\uFEFF",JZ="\x02",QZ="\x18",YZ="\x1F",bM=($)=>!!$&&("items"in $),kM=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function yM($){switch($){case zZ:return"<BOM>";case JZ:return"<DOC>";case QZ:return"<FLOW_END>";case YZ:return"<SCALAR>";default:return JSON.stringify($)}}function vM($){switch($){case zZ:return"byte-order-mark";case JZ:return"doc-mode";case QZ:return"flow-error-end";case YZ:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
141
141
|
`:case`\r
|
|
142
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch($[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}
|
|
143
|
-
`:case"\r":case"\t":return!0;default:return!1}}var
|
|
144
|
-
\r `),
|
|
142
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch($[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}gM.createScalarToken=XZ.createScalarToken;gM.resolveAsScalar=XZ.resolveAsScalar;gM.setScalarValue=XZ.setScalarValue;gM.stringify=jM.stringify;gM.visit=xM.visit;gM.BOM=zZ;gM.DOCUMENT=JZ;gM.FLOW_END=QZ;gM.SCALAR=YZ;gM.isCollection=bM;gM.isScalar=kM;gM.prettyToken=yM;gM.tokenType=vM});var UZ=E((eM)=>{var I2=F8();function c0($){switch($){case void 0:case" ":case`
|
|
143
|
+
`:case"\r":case"\t":return!0;default:return!1}}var cX=new Set("0123456789ABCDEFabcdef"),oM=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),_8=new Set(",[]{}"),tM=new Set(` ,[]{}
|
|
144
|
+
\r `),WZ=($)=>!$||tM.has($);class lX{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==="...")&&c0(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]===I2.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 I2.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==="...")&&c0(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&&!c0(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(($==="-"||$==="?"||$===":")&&c0(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(WZ),"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("..."))&&c0(z[3])){if(!(X===this.indentNext-1&&this.flowLevel===1&&(z[0]==="]"||z[0]==="}")))return this.flowLevel=0,yield I2.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(WZ),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let Q=this.charAt(1);if(this.flowKey||c0(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)=>c0(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 I2.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(c0(J)||$&&_8.has(J))break;Z=X}else if(c0(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==="#"||$&&_8.has(J))break;if(z===`
|
|
159
|
+
`){let Q=this.continueScalar(X+1);if(Q===-1)break;X=Math.max(X,Q-2)}}else{if($&&_8.has(z))break;Z=X}if(!z&&!this.atEnd)return this.setNext("plain-scalar");return yield I2.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(WZ),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let Z=this.flowLevel>0,X=this.charAt(1);if(c0(X)||Z&&_8.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(!c0(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(oM.has(Z))Z=this.buffer[++$];else if(Z==="%"&&cX.has(this.buffer[$+1])&&cX.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)}}
|
|
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)}}eM.Lexer=lX});var qZ=E((ZO)=>{class dX{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}}}}ZO.LineCounter=dX});var GZ=E((QO)=>{var zO=_0("process"),pX=F8(),JO=UZ();function I1($,Z){for(let X=0;X<$.length;++X)if($[X].type===Z)return!0;return!1}function iX($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function rX($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function C8($){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 P8($,Z){if(Z.length<1e5)Array.prototype.push.apply($,Z);else for(let X=0;X<Z.length;++X)$.push(Z[X])}function nX($){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,rX(Z.value))if(Z.value.end)P8(Z.value.end,Z.sep);else Z.value.end=Z.sep;else P8(Z.start,Z.sep);delete Z.sep}}}class sX{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 JO.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=$,zO.env.LOG_TOKENS)console.log("|",pX.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=pX.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")nX(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&&iX(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(iX($.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=C8(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)){P8(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(rX(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)){P8(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=C8(X),J=K$(z);nX($);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=C8($),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=C8($),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()}}}QO.Parser=sX});var $z=E((BO)=>{var aX=e3(),WO=M2(),T2=O2(),UO=q3(),qO=i(),GO=qZ(),oX=GZ();function tX($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new GO.LineCounter||null,prettyErrors:Z}}function VO($,Z={}){let{lineCounter:X,prettyErrors:z}=tX(Z),J=new oX.Parser(X?.addNewLine),Q=new aX.Composer(Z),Y=Array.from(Q.compose(J.parse($)));if(z&&X)for(let W of Y)W.errors.forEach(T2.prettifyError($,X)),W.warnings.forEach(T2.prettifyError($,X));if(Y.length>0)return Y;return Object.assign([],{empty:!0},Q.streamInfo())}function eX($,Z={}){let{lineCounter:X,prettyErrors:z}=tX(Z),J=new oX.Parser(X?.addNewLine),Q=new aX.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 T2.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&X)Y.errors.forEach(T2.prettifyError($,X)),Y.warnings.forEach(T2.prettifyError($,X));return Y}function KO($,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=eX($,X);if(!J)return null;if(J.warnings.forEach((Q)=>UO.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 HO($,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(qO.isDocument($)&&!z)return $.toString(X);return new WO.Document($,z,X).toString(X)}BO.parse=KO;BO.parseAllDocuments=VO;BO.parseDocument=eX;BO.stringify=HO});var Wz={};E9(Wz,{orange:()=>H0,italic:()=>QN,fafCyanDeep:()=>w8,fafCyan:()=>I,dim:()=>M,bold:()=>A,FAF_HEX:()=>R2});var HZ=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,A,M,QN,R2,I=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,w8=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,H0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var c=v(()=>{A=HZ("1"),M=HZ("2"),QN=HZ("3"),R2={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var tZ=E((sx,vA)=>{vA.exports={name:"faf-cli",version:"7.10.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 w($,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 N($,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 Z5=function(){let{crypto:$}=globalThis;if($?.randomUUID)return Z5=$.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 i2=($)=>{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,W0,O0,C1,w$,S$,j$,x$,b$,k$,y$,v$,g$;var R0=v(()=>{k=class k extends Error{};W0=class W0 extends k{constructor($,Z,X,z,J){super(`${W0.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 C1({message:X,cause:i2(Z)});let J=Z,Q=J?.error?.type;if($===400)return new S$($,J,X,z,Q);if($===401)return new j$($,J,X,z,Q);if($===403)return new x$($,J,X,z,Q);if($===404)return new b$($,J,X,z,Q);if($===409)return new k$($,J,X,z,Q);if($===422)return new y$($,J,X,z,Q);if($===429)return new v$($,J,X,z,Q);if($>=500)return new g$($,J,X,z,Q);return new W0($,J,X,z,Q)}};O0=class O0 extends W0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};C1=class C1 extends W0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};w$=class w$ extends C1{constructor({message:$}={}){super({message:$??"Request timed out."})}};S$=class S$ extends W0{};j$=class j$ extends W0{};x$=class x$ extends W0{};b$=class b$ extends W0{};k$=class k$ extends W0{};y$=class y$ extends W0{};v$=class v$ extends W0{};g$=class g$ extends W0{}});function O4($){if(typeof $!=="object")return{};return $??{}}function J5($){if(!$)return!0;for(let Z in $)return!1;return!0}function fQ($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var MR,gQ=($)=>{return MR.test($)},X5=($)=>(X5=Array.isArray,X5($)),z5,hQ=($,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},N4=($)=>{try{return JSON.parse($)}catch(Z){return}};var n1=v(()=>{R0();MR=/^[a-z][a-z0-9+.-]*:/i,z5=X5});var uQ=($)=>new Promise((Z)=>setTimeout(Z,$));var P1="0.91.1";function OR(){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 LR(){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 dQ=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},NR=()=>{let $=OR();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":P1,"X-Stainless-OS":cQ(Deno.build.os),"X-Stainless-Arch":mQ(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":P1,"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":P1,"X-Stainless-OS":cQ(globalThis.process.platform??"unknown"),"X-Stainless-Arch":mQ(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=LR();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":P1,"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":P1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},mQ=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},cQ=($)=>{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"},lQ,pQ=()=>{return lQ??(lQ=NR())};var Q5=()=>{};function iQ(){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 Y5(...$){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 L4($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return Y5({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 n2($){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 nQ($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),X=Z.cancel();Z.releaseLock(),await X}var rQ=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function sQ($){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 aQ=v(()=>{R0()});function eQ($){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 r2($){let Z;return(oQ??(Z=new globalThis.TextEncoder,oQ=Z.encode.bind(Z)))($)}function W5($){let Z;return(tQ??(Z=new globalThis.TextDecoder,tQ=Z.decode.bind(Z)))($)}var oQ,tQ;class E1{constructor(){S0.set(this,void 0),j0.set(this,void 0),w(this,S0,new Uint8Array,"f"),w(this,j0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?r2($):$;w(this,S0,eQ([N(this,S0,"f"),Z]),"f");let X=[],z;while((z=TR(N(this,S0,"f"),N(this,j0,"f")))!=null){if(z.carriage&&N(this,j0,"f")==null){w(this,j0,z.index,"f");continue}if(N(this,j0,"f")!=null&&(z.index!==N(this,j0,"f")+1||z.carriage)){X.push(W5(N(this,S0,"f").subarray(0,N(this,j0,"f")-1))),w(this,S0,N(this,S0,"f").subarray(N(this,j0,"f")),"f"),w(this,j0,null,"f");continue}let J=N(this,j0,"f")!==null?z.preceding-1:z.preceding,Q=W5(N(this,S0,"f").subarray(0,J));X.push(Q),w(this,S0,N(this,S0,"f").subarray(z.index),"f"),w(this,j0,null,"f")}return X}flush(){if(!N(this,S0,"f").length)return[];return this.decode(`
|
|
166
|
+
`)}}function TR($,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 $Y($){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 U5=v(()=>{W1();S0=new WeakMap,j0=new WeakMap;E1.NEWLINE_CHARS=new Set([`
|
|
167
|
+
`,"\r"]);E1.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function s2(){}function D4($,Z,X){if(!Z||I4[$]>I4[X])return s2;else return Z[$].bind(Z)}function M0($){let Z=$.logger,X=$.logLevel??"off";if(!Z)return AR;let z=ZY.get(Z);if(z&&z[0]===X)return z[1];let J={error:D4("error",Z,X),warn:D4("warn",Z,X),info:D4("info",Z,X),debug:D4("debug",Z,X)};return ZY.set(Z,[X,J]),J}var I4,q5=($,Z,X)=>{if(!$)return;if(fQ(I4,$))return $;M0(X).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(I4))}`);return},AR,ZY,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 T4=v(()=>{n1();I4={off:0,error:200,warn:300,info:400,debug:500};AR={error:s2,warn:s2,info:s2,debug:s2},ZY=new WeakMap});async function*RR($,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 XY,z=new E1,J=n2($.body);for await(let Q of FR(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*FR($){let Z=new Uint8Array;for await(let X of $){if(X==null)continue;let z=X instanceof ArrayBuffer?new Uint8Array(X):typeof X==="string"?r2(X):X,J=new Uint8Array(Z.length+z.length);J.set(Z),J.set(z,Z.length),Z=J;let Q;while((Q=$Y(Z))!==-1)yield Z.slice(0,Q),Z=Z.slice(Q)}if(Z.length>0)yield Z}class XY{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]=_R($,":");if(z.startsWith(" "))z=z.substring(1);if(Z==="event")this.event=z;else if(Z==="data")this.data.push(z);return null}}function _R($,Z){let X=$.indexOf(Z);if(X!==-1)return[$.substring(0,X),Z,$.substring(X+Z.length)];return[$,"",""]}var a2,x0;var G5=v(()=>{W1();R0();U5();n1();T4();R0();x0=class x0{constructor($,Z,X){this.iterator=$,a2.set(this,void 0),this.controller=Z,w(this,a2,X,"f")}static fromSSEResponse($,Z,X){let z=!1,J=X?M0(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 RR($,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=N4(W.data)??W.data,q=U?.error?.type;throw new W0(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 E1,W=n2($);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)}[(a2=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,N(this,a2,"f")),new x0(()=>z(Z),this.controller,N(this,a2,"f"))]}toReadableStream(){let $=this,Z;return Y5({async start(){Z=$[Symbol.asyncIterator]()},async pull(X){try{let{value:z,done:J}=await Z.next();if(J)return X.close();let Q=r2(JSON.stringify(z)+`
|
|
169
|
+
`);X.enqueue(Q)}catch(z){X.error(z)}},async cancel(){await Z.return?.()}})}}});async function A4($,Z){let{response:X,requestLogID:z,retryOfRequestLogID:J,startTime:Q}=Z,Y=await(async()=>{if(Z.options.stream){if(M0($).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 V5(K,X)}return await X.text()})();return M0($).debug(`[${z}] response parsed`,q1({retryOfRequestLogID:J,url:X.url,status:X.status,body:Y,durationMs:Date.now()-Q})),Y}function V5($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var K5=v(()=>{G5();T4()});var o2,w1;var R4=v(()=>{W1();K5();w1=class w1 extends Promise{constructor($,Z,X=A4){super((z)=>{z(null)});this.responsePromise=Z,this.parseResponse=X,o2.set(this,void 0),w(this,o2,$,"f")}_thenUnwrap($){return new w1(N(this,o2,"f"),this.responsePromise,async(Z,X)=>V5($(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(N(this,o2,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};o2=new WeakMap});var F4,H5,t2,n0,o;var z0=v(()=>{W1();R0();K5();R4();n1();H5=class H5{constructor($,Z,X,z){F4.set(this,void 0),w(this,F4,$,"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 N(this,F4,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(F4=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};t2=class t2 extends w1{constructor($,Z,X){super($,Z,async(z,J)=>new X(z,J.response,await A4(z,J),J.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};n0=class n0 extends H5{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:{...O4(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...O4(this.options.query),after_id:$}}}};o=class o extends H5{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:{...O4(this.options.query),page:$}}}}});function r1($,Z,X){return M5(),new File($,Z??"unknown_file",X)}function e2($,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 PR($){let Z=typeof $==="function"?$:$.fetch,X=zY.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 zY.set(Z,z),z}var M5=()=>{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`.":""))}},O5=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",f$=async($,Z,X=!0)=>{return{...$,body:await ER($.body,Z,X)}},zY,ER=async($,Z,X=!0)=>{if(!await PR(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])=>B5(z,J,Q,X))),z},wR=($)=>$ instanceof Blob&&("name"in $),B5=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()],e2(X,z),J))}else if(O5(X))$.append(Z,r1([await new Response(L4(X)).blob()],e2(X,z)));else if(wR(X))$.append(Z,r1([X],e2(X,z),{type:X.type}));else if(Array.isArray(X))await Promise.all(X.map((J)=>B5($,Z+"[]",J,z)));else if(typeof X==="object")await Promise.all(Object.entries(X).map(([J,Q])=>B5($,`${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 h$=v(()=>{zY=new WeakMap});async function $6($,Z,X){if(M5(),$=await $,Z||(Z=e2($,!0)),SR($)){if($ instanceof File&&Z==null&&X==null)return $;return r1([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...X})}if(jR($)){let J=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),r1(await N5(J),Z,X)}let z=await N5($);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 N5($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(JY($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(O5($))for await(let X of $)Z.push(...await N5(X));else{let X=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${X?`; constructor: ${X}`:""}${xR($)}`)}return Z}function xR($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((X)=>`"${X}"`).join(", ")}]`}var JY=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",SR=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&JY($),jR=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var QY=v(()=>{h$();h$()});var L5=v(()=>{QY()});var YY=()=>{};class h{constructor($){this._client=$}}function*kR($){if(!$)return;if(WY 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(z5($))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=z5(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 WY,D=($)=>{let Z=new Headers,X=new Set;for(let z of $){let J=new Set;for(let[Q,Y]of kR(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{[WY]:!0,values:Z,nulls:X}};var e=v(()=>{n1();WY=Symbol.for("brand.privateNullableHeaders")});function qY($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var UY,yR=($=qY)=>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],L=(J?encodeURIComponent:$)(""+H);if(K!==z.length&&(H==null||typeof H==="object"&&H.toString===Object.getPrototypeOf(Object.getPrototypeOf(H.hasOwnProperty??UY)??UY)?.toString))L=H+"",Q.push({start:G.length+V.length,length:L.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?"":L)},""),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 L=" ".repeat(H.start-G),B="^".repeat(H.length);return G=H.start+H.length,K+L+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},C;var U0=v(()=>{R0();UY=Object.freeze(Object.create(null)),C=yR(qY)});var Z6;var D5=v(()=>{z0();e();U0();Z6=class Z6 extends h{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(C`/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(C`/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",o,{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(C`/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(C`/v1/environments/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});function _4($){return typeof $==="object"&&$!==null&&X6 in $}function I5($,Z){let X=new Set;if($){for(let z of $)if(_4(z))X.add(z[X6])}if(Z)for(let z of Z){if(_4(z))X.add(z[X6]);if(Array.isArray(z.content)){for(let J of z.content)if(_4(J))X.add(J[X6])}}return Array.from(X)}function C4($,Z){let X=I5($,Z);if(X.length===0)return{};return{"x-stainless-helper":X.join(", ")}}function GY($){if(_4($))return{"x-stainless-helper":$[X6]};return{}}var X6;var z6=v(()=>{X6=Symbol("anthropic.sdk.stainlessHelper")});var J6;var T5=v(()=>{z0();e();z6();h$();U0();J6=class J6 extends h{list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/files?beta=true",n0,{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(C`/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(C`/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(C`/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()},GY(z.file),Z?.headers])},this._client))}}});var Q6;var A5=v(()=>{z0();e();U0();Q6=class Q6 extends h{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/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",n0,{query:z,...Z,headers:D([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var Y6;var R5=v(()=>{z0();e();U0();Y6=class Y6 extends h{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(C`/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(C`/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",o,{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(C`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}}});var W6;var F5=v(()=>{z0();e();U0();W6=class W6 extends h{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/agents/${$}/versions?beta=true`,o,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var u$;var _5=v(()=>{F5();F5();z0();e();U0();u$=class u$ extends h{constructor(){super(...arguments);this.versions=new W6(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(C`/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(C`/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",o,{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(C`/v1/agents/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};u$.Versions=W6});var U6;var C5=v(()=>{z0();e();U0();U6=class U6 extends h{create($,Z,X){let{view:z,betas:J,...Q}=Z;return this._client.post(C`/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(C`/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(C`/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(C`/v1/memory_stores/${$}/memories?beta=true`,o,{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(C`/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 q6;var P5=v(()=>{z0();e();U0();q6=class q6 extends h{retrieve($,Z,X){let{memory_store_id:z,betas:J,...Q}=Z;return this._client.get(C`/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(C`/v1/memory_stores/${$}/memory_versions?beta=true`,o,{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(C`/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 E5=v(()=>{C5();C5();P5();P5();z0();e();U0();s1=class s1 extends h{constructor(){super(...arguments);this.memories=new U6(this._client),this.memoryVersions=new q6(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(C`/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(C`/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",o,{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(C`/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(C`/v1/memory_stores/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};s1.Memories=U6;s1.MemoryVersions=q6});var m$=v(()=>{R0()});var P4;var w5=v(()=>{P4={"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 VY($){return $?.output_format??$?.output_config?.format}function S5($,Z,X){let z=VY(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 j5($,Z,X)}function j5($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=pR(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 pR($,Z){let X=VY($);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 x5=v(()=>{R0()});var iR=($)=>{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},c$=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),c$($);break;case"number":let X=Z.value[Z.value.length-1];if(X==="."||X==="-")return $=$.slice(0,$.length-1),c$($);case"string":let z=$[$.length-2];if(z?.type==="delimiter")return $=$.slice(0,$.length-1),c$($);else if(z?.type==="brace"&&z.value==="{")return $=$.slice(0,$.length-1),c$($);break;case"delimiter":return $=$.slice(0,$.length-1),c$($);break}return $},nR=($)=>{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 $},rR=($)=>{let Z="";return $.map((X)=>{switch(X.type){case"string":Z+='"'+X.value+'"';break;default:Z+=X.value;break}}),Z},E4=($)=>JSON.parse(rR(nR(c$(iR($)))));var b5=()=>{};var k5=v(()=>{G5()});function MY($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function OY($){}var f0,S1,l$,G6,w4,V6,K6,S4,H6,G1,B6,j4,x4,a1,b4,k4,M6,y5,KY,y4,v5,g5,f5,HY,BY="__json_buf",O6;var NY=v(()=>{W1();b5();m$();k5();x5();O6=class O6{constructor($,Z){f0.add(this),this.messages=[],this.receivedMessages=[],S1.set(this,void 0),l$.set(this,null),this.controller=new AbortController,G6.set(this,void 0),w4.set(this,()=>{}),V6.set(this,()=>{}),K6.set(this,void 0),S4.set(this,()=>{}),H6.set(this,()=>{}),G1.set(this,{}),B6.set(this,!1),j4.set(this,!1),x4.set(this,!1),a1.set(this,!1),b4.set(this,void 0),k4.set(this,void 0),M6.set(this,void 0),y4.set(this,(X)=>{if(w(this,j4,!0,"f"),U1(X))X=new O0;if(X instanceof O0)return w(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)))}),w(this,G6,new Promise((X,z)=>{w(this,w4,X,"f"),w(this,V6,z,"f")}),"f"),w(this,K6,new Promise((X,z)=>{w(this,S4,X,"f"),w(this,H6,z,"f")}),"f"),N(this,G6,"f").catch(()=>{}),N(this,K6,"f").catch(()=>{}),w(this,l$,$,"f"),w(this,M6,Z?.logger??console,"f")}get response(){return N(this,b4,"f")}get request_id(){return N(this,k4,"f")}async withResponse(){w(this,a1,!0,"f");let $=await N(this,G6,"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 O6(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new O6(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return w(J,l$,{...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")},N(this,y4,"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{N(this,f0,"m",v5).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)N(this,f0,"m",g5).call(this,W);if(Y.controller.signal?.aborted)throw new O0;N(this,f0,"m",f5).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;w(this,b4,$,"f"),w(this,k4,$?.headers.get("request-id"),"f"),N(this,w4,"f").call(this,$),this._emit("connect")}get ended(){return N(this,B6,"f")}get errored(){return N(this,j4,"f")}get aborted(){return N(this,x4,"f")}abort(){this.controller.abort()}on($,Z){return(N(this,G1,"f")[$]||(N(this,G1,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=N(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(N(this,G1,"f")[$]||(N(this,G1,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(w(this,a1,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){w(this,a1,!0,"f"),await N(this,K6,"f")}get currentMessage(){return N(this,S1,"f")}async finalMessage(){return await this.done(),N(this,f0,"m",y5).call(this)}async finalText(){return await this.done(),N(this,f0,"m",KY).call(this)}_emit($,...Z){if(N(this,B6,"f"))return;if($==="end")w(this,B6,!0,"f"),N(this,S4,"f").call(this);let X=N(this,G1,"f")[$];if(X)N(this,G1,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!N(this,a1,"f")&&!X?.length)Promise.reject(z);N(this,V6,"f").call(this,z),N(this,H6,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!N(this,a1,"f")&&!X?.length)Promise.reject(z);N(this,V6,"f").call(this,z),N(this,H6,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",N(this,f0,"m",y5).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{N(this,f0,"m",v5).call(this),this._connected(null);let J=x0.fromReadableStream($,this.controller);for await(let Q of J)N(this,f0,"m",g5).call(this,Q);if(J.controller.signal?.aborted)throw new O0;N(this,f0,"m",f5).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(S1=new WeakMap,l$=new WeakMap,G6=new WeakMap,w4=new WeakMap,V6=new WeakMap,K6=new WeakMap,S4=new WeakMap,H6=new WeakMap,G1=new WeakMap,B6=new WeakMap,j4=new WeakMap,x4=new WeakMap,a1=new WeakMap,b4=new WeakMap,k4=new WeakMap,M6=new WeakMap,y4=new WeakMap,f0=new WeakSet,y5=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},KY=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(" ")},v5=function(){if(this.ended)return;w(this,S1,void 0,"f")},g5=function(Z){if(this.ended)return;let X=N(this,f0,"m",HY).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(MY(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:OY(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(S5(X,N(this,l$,"f"),{logger:N(this,M6,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{w(this,S1,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=N(this,S1,"f");if(!Z)throw new k("request ended without sending any chunks");return w(this,S1,void 0,"f"),S5(Z,N(this,l$,"f"),{logger:N(this,M6,"f")})},HY=function(Z){let X=N(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.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&&MY(z)){let J=z[BY]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,BY,{value:J,enumerable:!1,writable:!0}),J)try{Q.input=E4(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}`);N(this,y4,"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:OY(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 d$;var v4=v(()=>{d$=class d$ 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 LY=1e5,DY=`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
|
|
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 TY(){let $,Z;return{promise:new Promise((z,J)=>{$=z,Z=J}),resolve:$,reject:Z}}async function sR($,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 d$?W.content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}var N6,p$,o1,K0,F0,b0,V1,j1,L6,IY,h5,D6;var u5=v(()=>{W1();v4();R0();e();z6();D6=class D6{constructor($,Z,X){N6.add(this),this.client=$,p$.set(this,!1),o1.set(this,!1),K0.set(this,void 0),F0.set(this,void 0),b0.set(this,void 0),V1.set(this,void 0),j1.set(this,void 0),L6.set(this,0),w(this,K0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let J=["BetaToolRunner",...I5(Z.tools,Z.messages)].join(", ");if(w(this,F0,{...X,headers:D([{"x-stainless-helper":J},X?.headers])},"f"),w(this,j1,TY(),"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*[(p$=new WeakMap,o1=new WeakMap,K0=new WeakMap,F0=new WeakMap,b0=new WeakMap,V1=new WeakMap,j1=new WeakMap,L6=new WeakMap,N6=new WeakSet,IY=async function(){let Z=N(this,K0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let X=0;if(N(this,b0,"f")!==void 0)try{let U=await N(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??LY;if(X<z)return!1;let J=Z.model??N(this,K0,"f").params.model,Q=Z.summaryPrompt??DY,Y=N(this,K0,"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:N(this,K0,"f").params.max_tokens},{signal:N(this,F0,"f").signal,headers:D([N(this,F0,"f").headers,{"x-stainless-helper":"compaction"}])});if(W.content[0]?.type!=="text")throw new k("Expected text response for compaction");return N(this,K0,"f").params.messages=[{role:"user",content:W.content}],!0},Symbol.asyncIterator)](){var $;if(N(this,p$,"f"))throw new k("Cannot iterate over a consumed stream");w(this,p$,!0,"f"),w(this,o1,!0,"f"),w(this,V1,void 0,"f");try{while(!0){let Z;try{if(N(this,K0,"f").params.max_iterations&&N(this,L6,"f")>=N(this,K0,"f").params.max_iterations)break;w(this,o1,!1,"f"),w(this,V1,void 0,"f"),w(this,L6,($=N(this,L6,"f"),$++,$),"f"),w(this,b0,void 0,"f");let{max_iterations:X,compactionControl:z,...J}=N(this,K0,"f").params;if(J.stream)Z=this.client.beta.messages.stream({...J},N(this,F0,"f")),w(this,b0,Z.finalMessage(),"f"),N(this,b0,"f").catch(()=>{}),yield Z;else w(this,b0,this.client.beta.messages.create({...J,stream:!1},N(this,F0,"f")),"f"),yield N(this,b0,"f");if(!await N(this,N6,"m",IY).call(this)){if(!N(this,o1,"f")){let{role:W,content:U}=await N(this,b0,"f");N(this,K0,"f").params.messages.push({role:W,content:U})}let Y=await N(this,N6,"m",h5).call(this,N(this,K0,"f").params.messages.at(-1));if(Y)N(this,K0,"f").params.messages.push(Y);else if(!N(this,o1,"f"))break}}finally{if(Z)Z.abort()}}if(!N(this,b0,"f"))throw new k("ToolRunner concluded without a message from the server");N(this,j1,"f").resolve(await N(this,b0,"f"))}catch(Z){throw w(this,p$,!1,"f"),N(this,j1,"f").promise.catch(()=>{}),N(this,j1,"f").reject(Z),w(this,j1,TY(),"f"),Z}}setMessagesParams($){if(typeof $==="function")N(this,K0,"f").params=$(N(this,K0,"f").params);else N(this,K0,"f").params=$;w(this,o1,!0,"f"),w(this,V1,void 0,"f")}setRequestOptions($){if(typeof $==="function")w(this,F0,$(N(this,F0,"f")),"f");else w(this,F0,{...N(this,F0,"f"),...$},"f")}async generateToolResponse($=N(this,F0,"f").signal){let Z=await N(this,b0,"f")??this.params.messages.at(-1);if(!Z)return null;return N(this,N6,"m",h5).call(this,Z,$)}done(){return N(this,j1,"f").promise}async runUntilDone(){if(!N(this,p$,"f"))for await(let $ of this);return this.done()}get params(){return N(this,K0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};h5=async function(Z,X=N(this,F0,"f").signal){if(N(this,V1,"f")!==void 0)return N(this,V1,"f");return w(this,V1,sR(N(this,K0,"f").params,Z,{...N(this,F0,"f"),signal:X}),"f"),N(this,V1,"f")}});var i$;var m5=v(()=>{R0();U5();i$=class i${constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new E1;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 i$(n2($.body),Z)}}});var I6;var c5=v(()=>{z0();e();m5();m$();U0();I6=class I6 extends h{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(C`/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",n0,{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(C`/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(C`/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)=>i$.fromResponse(Y.response,Y.controller))}}});function RY($){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 AY,oR,x1;var l5=v(()=>{m$();w5();e();z6();x5();NY();u5();v4();c5();c5();u5();v4();AY={"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"},oR=["claude-mythos-preview","claude-opus-4-6"];x1=class x1 extends h{constructor(){super(...arguments);this.batches=new I6(this._client)}create($,Z){let X=RY($),{betas:z,...J}=X;if(J.model in AY)console.warn(`The model '${J.model}' is deprecated and will reach end-of-life on ${AY[J.model]}
|
|
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=P4[J.model]??void 0;Q=this._client.calculateNonstreamingTimeout(J.max_tokens,W)}let Y=C4(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)=>j5(X,$,{logger:this._client.logger??console}))}stream($,Z){return O6.createMessage(this,$,Z)}countTokens($,Z){let X=RY($),{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 D6(this._client,$,Z)}};x1.Batches=I6;x1.BetaToolRunner=D6;x1.ToolError=d$});var T6;var d5=v(()=>{z0();e();U0();T6=class T6 extends h{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/sessions/${$}/events?beta=true`,o,{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(C`/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(C`/v1/sessions/${$}/events/stream?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers]),stream:!0})}}});var A6;var p5=v(()=>{z0();e();U0();A6=class A6 extends h{retrieve($,Z,X){let{session_id:z,betas:J}=Z;return this._client.get(C`/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(C`/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(C`/v1/sessions/${$}/resources?beta=true`,o,{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(C`/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(C`/v1/sessions/${$}/resources?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var t1;var i5=v(()=>{d5();d5();p5();p5();z0();e();U0();t1=class t1 extends h{constructor(){super(...arguments);this.events=new T6(this._client),this.resources=new A6(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(C`/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(C`/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",o,{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(C`/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(C`/v1/sessions/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};t1.Events=T6;t1.Resources=A6});var R6;var n5=v(()=>{z0();e();h$();U0();R6=class R6 extends h{create($,Z={},X){let{betas:z,...J}=Z??{};return this._client.post(C`/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(C`/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(C`/v1/skills/${$}/versions?beta=true`,o,{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(C`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}}});var n$;var r5=v(()=>{n5();n5();z0();e();h$();U0();n$=class n$ extends h{constructor(){super(...arguments);this.versions=new R6(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(C`/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",o,{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(C`/v1/skills/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}};n$.Versions=R6});var F6;var s5=v(()=>{z0();e();U0();F6=class F6 extends h{create($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/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(C`/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(C`/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(C`/v1/vaults/${$}/credentials?beta=true`,o,{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(C`/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(C`/v1/vaults/${z}/credentials/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var r$;var a5=v(()=>{s5();s5();z0();e();U0();r$=class r$ extends h{constructor(){super(...arguments);this.credentials=new F6(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(C`/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(C`/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",o,{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(C`/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(C`/v1/vaults/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};r$.Credentials=F6});var L0;var o5=v(()=>{D5();D5();T5();T5();A5();A5();R5();R5();_5();_5();E5();E5();l5();l5();i5();i5();r5();r5();a5();a5();L0=class L0 extends h{constructor(){super(...arguments);this.models=new Q6(this._client),this.messages=new x1(this._client),this.agents=new u$(this._client),this.environments=new Z6(this._client),this.sessions=new t1(this._client),this.vaults=new r$(this._client),this.memoryStores=new s1(this._client),this.files=new J6(this._client),this.skills=new n$(this._client),this.userProfiles=new Y6(this._client)}};L0.Models=Q6;L0.Messages=x1;L0.Agents=u$;L0.Environments=Z6;L0.Sessions=t1;L0.Vaults=r$;L0.MemoryStores=s1;L0.Files=J6;L0.Skills=n$;L0.UserProfiles=Y6});var s$;var t5=v(()=>{e();s$=class s$ extends h{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 FY($){return $?.output_config?.format}function e5($,Z,X){let z=FY(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 $9($,Z,X)}function $9($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=YF(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 YF($,Z){let X=FY($);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 Z9=v(()=>{R0()});function EY($){return $.type==="tool_use"||$.type==="server_tool_use"}function wY($){}var h0,b1,a$,_6,g4,C6,P6,f4,E6,K1,w6,h4,u4,e1,m4,c4,S6,X9,_Y,z9,J9,Q9,Y9,CY,PY="__json_buf",j6;var SY=v(()=>{W1();m$();k5();b5();Z9();j6=class j6{constructor($,Z){h0.add(this),this.messages=[],this.receivedMessages=[],b1.set(this,void 0),a$.set(this,null),this.controller=new AbortController,_6.set(this,void 0),g4.set(this,()=>{}),C6.set(this,()=>{}),P6.set(this,void 0),f4.set(this,()=>{}),E6.set(this,()=>{}),K1.set(this,{}),w6.set(this,!1),h4.set(this,!1),u4.set(this,!1),e1.set(this,!1),m4.set(this,void 0),c4.set(this,void 0),S6.set(this,void 0),z9.set(this,(X)=>{if(w(this,h4,!0,"f"),U1(X))X=new O0;if(X instanceof O0)return w(this,u4,!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)))}),w(this,_6,new Promise((X,z)=>{w(this,g4,X,"f"),w(this,C6,z,"f")}),"f"),w(this,P6,new Promise((X,z)=>{w(this,f4,X,"f"),w(this,E6,z,"f")}),"f"),N(this,_6,"f").catch(()=>{}),N(this,P6,"f").catch(()=>{}),w(this,a$,$,"f"),w(this,S6,Z?.logger??console,"f")}get response(){return N(this,m4,"f")}get request_id(){return N(this,c4,"f")}async withResponse(){w(this,e1,!0,"f");let $=await N(this,_6,"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 j6(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new j6(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return w(J,a$,{...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")},N(this,z9,"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{N(this,h0,"m",J9).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)N(this,h0,"m",Q9).call(this,W);if(Y.controller.signal?.aborted)throw new O0;N(this,h0,"m",Y9).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;w(this,m4,$,"f"),w(this,c4,$?.headers.get("request-id"),"f"),N(this,g4,"f").call(this,$),this._emit("connect")}get ended(){return N(this,w6,"f")}get errored(){return N(this,h4,"f")}get aborted(){return N(this,u4,"f")}abort(){this.controller.abort()}on($,Z){return(N(this,K1,"f")[$]||(N(this,K1,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=N(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(N(this,K1,"f")[$]||(N(this,K1,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(w(this,e1,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){w(this,e1,!0,"f"),await N(this,P6,"f")}get currentMessage(){return N(this,b1,"f")}async finalMessage(){return await this.done(),N(this,h0,"m",X9).call(this)}async finalText(){return await this.done(),N(this,h0,"m",_Y).call(this)}_emit($,...Z){if(N(this,w6,"f"))return;if($==="end")w(this,w6,!0,"f"),N(this,f4,"f").call(this);let X=N(this,K1,"f")[$];if(X)N(this,K1,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!N(this,e1,"f")&&!X?.length)Promise.reject(z);N(this,C6,"f").call(this,z),N(this,E6,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!N(this,e1,"f")&&!X?.length)Promise.reject(z);N(this,C6,"f").call(this,z),N(this,E6,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",N(this,h0,"m",X9).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{N(this,h0,"m",J9).call(this),this._connected(null);let J=x0.fromReadableStream($,this.controller);for await(let Q of J)N(this,h0,"m",Q9).call(this,Q);if(J.controller.signal?.aborted)throw new O0;N(this,h0,"m",Y9).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(b1=new WeakMap,a$=new WeakMap,_6=new WeakMap,g4=new WeakMap,C6=new WeakMap,P6=new WeakMap,f4=new WeakMap,E6=new WeakMap,K1=new WeakMap,w6=new WeakMap,h4=new WeakMap,u4=new WeakMap,e1=new WeakMap,m4=new WeakMap,c4=new WeakMap,S6=new WeakMap,z9=new WeakMap,h0=new WeakSet,X9=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(" ")},J9=function(){if(this.ended)return;w(this,b1,void 0,"f")},Q9=function(Z){if(this.ended)return;let X=N(this,h0,"m",CY).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(EY(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:wY(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(e5(X,N(this,a$,"f"),{logger:N(this,S6,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{w(this,b1,X,"f");break}case"content_block_start":case"message_delta":break}},Y9=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=N(this,b1,"f");if(!Z)throw new k("request ended without sending any chunks");return w(this,b1,void 0,"f"),e5(Z,N(this,a$,"f"),{logger:N(this,S6,"f")})},CY=function(Z){let X=N(this,b1,"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&&EY(z)){let J=z[PY]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,PY,{value:J,enumerable:!1,writable:!0}),J)Q.input=E4(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:wY(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 x6;var W9=v(()=>{z0();e();m5();m$();U0();x6=class x6 extends h{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(C`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",n0,{query:$,...Z})}delete($,Z){return this._client.delete(C`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(C`/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)=>i$.fromResponse(J.response,J.controller))}}});var $$,jY,UF;var U9=v(()=>{e();z6();SY();Z9();W9();W9();w5();$$=class $$ extends h{constructor(){super(...arguments);this.batches=new x6(this._client)}create($,Z){if($.model in jY)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${jY[$.model]}
|
|
197
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(UF.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=P4[$.model]??void 0;X=this._client.calculateNonstreamingTimeout($.max_tokens,J)}let z=C4($.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)=>$9(X,$,{logger:this._client.logger??console}))}stream($,Z){return j6.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};jY={"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"},UF=["claude-mythos-preview","claude-opus-4-6"];$$.Batches=x6});var o$;var q9=v(()=>{z0();e();U0();o$=class o$ extends h{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/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",n0,{query:z,...Z,headers:D([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var xY=v(()=>{o5();t5();U9();q9();YY()});var b6=($)=>{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 X0{constructor({baseURL:$=b6("ANTHROPIC_BASE_URL"),apiKey:Z=b6("ANTHROPIC_API_KEY")??null,authToken:X=b6("ANTHROPIC_AUTH_TOKEN")??null,...z}={}){G9.add(this),l4.set(this,void 0);let J={apiKey:Z,authToken:X,...z,baseURL:$||"https://api.anthropic.com"};if(!J.dangerouslyAllowBrowser&&dQ())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??V9.DEFAULT_TIMEOUT,this.logger=J.logger??console;let Q="warn";this.logLevel=Q,this.logLevel=q5(J.logLevel,"ClientOptions.logLevel",this)??q5(b6("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??Q,this.fetchOptions=J.fetchOptions,this.maxRetries=J.maxRetries??2,this.fetch=J.fetch??iQ(),w(this,l4,rQ,"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 sQ($)}getUserAgent(){return`${this.constructor.name}/JS ${P1}`}defaultIdempotencyKey(){return`stainless-node-retry-${Z5()}`}makeStatusError($,Z,X,z){return W0.generate($,Z,X,z)}buildURL($,Z,X){let z=!N(this,G9,"m",bY).call(this)&&X||this.baseURL,J=gQ($)?new URL($):new URL(z+(z.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),Q=this.defaultQuery(),Y=Object.fromEntries(J.searchParams);if(!J5(Q)||!J5(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 w1(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(M0(this).debug(`[${U}] sending request`,q1({retryOfRequestLogID:X,method:z.method,url:Y,options:z,headers:Q.headers})),z.signal?.aborted)throw new O0;let V=new AbortController,K=await this.fetchWithTimeout(Y,Q,W,V).catch(i2),H=Date.now();if(K instanceof globalThis.Error){let O=`retrying, ${Z} attempts remaining`;if(z.signal?.aborted)throw new O0;let T=U1(K)||/timed? ?out/i.test(String(K)+("cause"in K?String(K.cause):""));if(Z)return M0(this).info(`[${U}] connection ${T?"timed out":"failed"} - ${O}`),M0(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(M0(this).info(`[${U}] connection ${T?"timed out":"failed"} - error; no more retries left`),M0(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 w$;throw new C1({cause:K})}let L=[...K.headers.entries()].filter(([O])=>O==="request-id").map(([O,T])=>", "+O+": "+JSON.stringify(T)).join(""),B=`[${U}${q}${L}] ${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 nQ(K.body),M0(this).info(`${B} - ${x}`),M0(this).debug(`[${U}] response error (${x})`,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";M0(this).info(`${B} - ${T}`);let j=await K.text().catch((x)=>i2(x).message),S=N4(j),b=S?void 0:j;throw M0(this).debug(`[${U}] response error (${T})`,q1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,message:b,durationMs:Date.now()-G})),this.makeStatusError(K.status,S,b,K.headers)}return M0(this).info(B),M0(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 t2(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 uQ(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)hQ("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))}:{},...pQ(),...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:L4($)};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 N(this,l4,"f").call(this,{body:$,headers:X})}}var G9,V9,l4,bY,K9="\\n\\nHuman:",H9="\\n\\nAssistant:",k1;var B9=v(()=>{W1();n1();Q5();aQ();R0();z0();L5();xY();R4();t5();q9();o5();U9();Q5();e();T4();n1();V9=X0,l4=new WeakMap,G9=new WeakSet,bY=function(){return this.baseURL!=="https://api.anthropic.com"};X0.Anthropic=V9;X0.HUMAN_PROMPT=K9;X0.AI_PROMPT=H9;X0.DEFAULT_TIMEOUT=600000;X0.AnthropicError=k;X0.APIError=W0;X0.APIConnectionError=C1;X0.APIConnectionTimeoutError=w$;X0.APIUserAbortError=O0;X0.NotFoundError=b$;X0.ConflictError=k$;X0.RateLimitError=v$;X0.BadRequestError=S$;X0.AuthenticationError=j$;X0.InternalServerError=g$;X0.PermissionDeniedError=x$;X0.UnprocessableEntityError=y$;X0.toFile=$6;k1=class k1 extends X0{constructor(){super(...arguments);this.completions=new s$(this),this.messages=new $$(this),this.models=new o$(this),this.beta=new L0(this)}};k1.Completions=s$;k1.Messages=$$;k1.Models=o$;k1.Beta=L0});var kY={};E9(kY,{toFile:()=>$6,default:()=>k1,UnprocessableEntityError:()=>y$,RateLimitError:()=>v$,PermissionDeniedError:()=>x$,PagePromise:()=>t2,NotFoundError:()=>b$,InternalServerError:()=>g$,HUMAN_PROMPT:()=>K9,ConflictError:()=>k$,BaseAnthropic:()=>X0,BadRequestError:()=>S$,AuthenticationError:()=>j$,AnthropicError:()=>k,Anthropic:()=>k1,APIUserAbortError:()=>O0,APIPromise:()=>w1,APIError:()=>W0,APIConnectionTimeoutError:()=>w$,APIConnectionError:()=>C1,AI_PROMPT:()=>H9});var yY=v(()=>{B9();L5();R4();B9();z0();R0()});var p9=BW(d9(),1),{program:A_,createCommand:R_,createArgument:F_,createOption:__,CommanderError:C_,InvalidArgumentError:P_,InvalidOptionArgumentError:E_,Command:i9,Argument:w_,Option:S_,Help:j_}=p9.default;import{readFileSync as Jz,writeFileSync as XN,existsSync as Xz}from"fs";import{join as zz,dirname as Qz,basename as zN}from"path";import{execFileSync as JN}from"child_process";var DO=e3(),IO=M2(),TO=g3(),VZ=O2(),AO=Z2(),T1=i(),RO=O1(),FO=J0(),_O=L1(),CO=D1(),aC=F8(),PO=UZ(),EO=qZ(),wO=GZ(),E8=$z(),Zz=e$();var SO=DO.Composer,jO=IO.Document,xO=TO.Schema,bO=VZ.YAMLError,kO=VZ.YAMLParseError,yO=VZ.YAMLWarning,vO=AO.Alias,gO=T1.isAlias,fO=T1.isCollection,hO=T1.isDocument,uO=T1.isMap,mO=T1.isNode,cO=T1.isPair,lO=T1.isScalar,dO=T1.isSeq,pO=RO.Pair,iO=FO.Scalar,nO=_O.YAMLMap,rO=CO.YAMLSeq;var sO=PO.Lexer,aO=EO.LineCounter,oO=wO.Parser,D0=E8.parse,tO=E8.parseAllDocuments,eO=E8.parseDocument,A2=E8.stringify,$N=Zz.visit,ZN=Zz.visitAsync;function l($){let Z=Jz($,"utf-8");return D0(Z)}function KZ($){let Z=$._meta,X={...$};delete X._meta;let z=A2(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 $0($,Z){XN($,KZ(Z),"utf-8")}function u($){return Jz($,"utf-8")}function Yz($){return D0($)}function f($=process.cwd()){let Z=["project.faf",".faf"];for(let z of Z){let J=zz($,z);if(Xz(J))return J}let X=Qz($);if(X!==$)for(let z of Z){let J=zz(X,z);if(Xz(J))return J}return null}function H$($,Z=process.cwd()){return JN("git",["-C",Qz($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+zN($)}c();var B$=[{name:"TROPHY",indicator:`${H0("✪")} ${H0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${H0(A("★"))} ${H0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${I("◆")} ${I("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${w8("◇")} ${w8("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 l0($){return $.indicator}function A1($){for(let Z of B$)if($>=Z.threshold)return Z;return B$[B$.length-1]}var BZ=null;function F2(){if(BZ)return BZ;try{let $=_0("faf-scoring-kernel");return BZ=$,$}catch{throw Error(`faf-scoring-kernel not installed.
|
|
205
205
|
|
|
206
206
|
Run: npm install faf-scoring-kernel
|
|
207
|
-
`)}}function
|
|
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(`
|
|
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
|
|
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
|
|
215
|
-
`)){let J=X.replace(/#.*$/,"").match(/add_(?:runtime_|development_)?dependency\s*\(?\s*['"]([^'"]+)['"]/i);if(J)Z.add(J[1].toLowerCase())}return Z}function
|
|
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(`
|
|
217
|
-
`).length>4)return!1;return!0}function
|
|
207
|
+
`)}}function G0($){return JSON.parse(F2().score_faf($))}function Uz($){return F2().validate_faf($)}function S8($){return F2().compile_fafb($)}function qz($){return JSON.parse(F2().decompile_fafb($))}function Gz(){return F2().sdk_version()}var Vz=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function Kz($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function Hz($){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 B0($){return{score:$.score,tier:A1($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function Q0($){let Z=Hz($);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 B0(G0($))}c();c();import{existsSync as YN,readFileSync as WN,writeFileSync as UN,mkdirSync as qN}from"fs";import{join as Bz}from"path";import{homedir as GN}from"os";var VN=95,KN=30,HN=3,Mz=Bz(GN(),".config","faf"),MZ=Bz(Mz,"star-nudge"),BN="github.com/Wolfe-Jam/faf-cli";function MN($){if($.score<VN)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??HN))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??KN)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function ON(){try{if(!YN(MZ))return{shown:0,lastShownMs:null};let $=WN(MZ,"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 NN($,Z){try{qN(Mz,{recursive:!0}),UN(MZ,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}))}catch{}}function Oz($){let Z=Date.now(),X=ON();if(!MN({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(` ${H0("★")} ${M("Enjoying faf-cli? A star helps others find it:")} ${BN}`),NN(X.shown,Z)}function Y0($,Z,X=!1){let z=l0($.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(""),LN($);Oz($.score)}function LN($){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}`)}}c();function j8($,Z={}){let X=$??f();if(!X)console.error(`Error: project.faf not found
|
|
208
|
+
|
|
209
|
+
Run 'faf init' to create one.`),process.exit(2);let z=u(X),J=Q0(z);if(Z.json){let Q=l(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(`${l0(J.tier)} ${A(`${J.score}%`)}`);return}Y0(J,X,Z.verbose)}import{existsSync as EI}from"fs";import{join as ez}from"path";var Z0=[{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(Z0.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),_P=new Map(Z0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),CP=new Map(Z0.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 PP=Z0.filter(($)=>$.index<=21);var OZ=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 OZ.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 _,readFileSync as o0,readdirSync as FZ}from"fs";import{join as R}from"path";var Nz=[{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 Lz,readFileSync as IN,readdirSync as TN}from"fs";import{join as NZ}from"path";var N$={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 AN=N$.flutterDeps,RN=N$.mcpDeps,FN=N$.serverFrameworks,_N=N$.stateManagement,CN=N$.routing;function PN($){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 x8($){let Z=NZ($,"pubspec.yaml");if(!Lz(Z))return null;let X;try{X=IN(Z,"utf-8")}catch{return null}let z=PN(X),J=(S)=>z.has(S.toLowerCase()),Q=AN.some(J)||/^flutter:\s*$/m.test(X)||/\bsdk:\s*flutter\b/.test(X),Y=RN.find(J),W=FN.find(([S])=>J(S)),U=_N.find(([S])=>J(S)),q=U?U[1]:"",G=CN.find(([S])=>J(S)),V=G?G[1]:"",K=J("flutter_test")?"flutter_test":J("test")?"test":"",H=/^executables:\s*$/m.test(X),L=!1;try{L=TN(NZ($,"bin")).some((S)=>S.endsWith(".dart"))}catch{}let B=H||L,O,T="",j;if(Q)if(T="Flutter",Lz(NZ($,"lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(X))O="mobile",j="pubspec.yaml (Flutter app)";else O="library",j="pubspec.yaml (Flutter package)";else if(Y)O="mcp",j=`pubspec.yaml + ${Y} (Dart MCP server)`;else if(W)O="backend",T=W[1],j=`pubspec.yaml + ${W[0]} (Dart backend)`;else if(B)O="cli",j=H?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else O="library",j="pubspec.yaml (Dart package)";return{appType:O,isFlutter:Q,framework:T,stateManagement:q,routing:V,testing:K,found:j}}import{existsSync as LZ,readFileSync as Tz,readdirSync as Dz,statSync as wN}from"fs";import{join as k8}from"path";var b8={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 SN=b8.mcpModules,jN=b8.serverFrameworks,xN=b8.cliFrameworks;function bN($){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 Az($,Z){let X=Z.toLowerCase();for(let z of $)if(z===X||z.startsWith(`${X}/`))return!0;return!1}function Iz($,Z){let X;for(let z of Z){if(!Az($,z[0]))continue;if(!X||z[0].length>X[0].length)X=z}return X}function kN($,Z){let X;for(let z of Z){if(!Az($,z))continue;if(!X||z.length>X.length)X=z}return X}function yN($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function vN($){let Z=k8($,"cmd");if(!LZ(Z))return!1;try{for(let X of Dz(Z)){let z=k8(Z,X);try{if(wN(z).isDirectory()){if(Dz(z).some((Q)=>Q.endsWith(".go")))return!0}else if(X.endsWith(".go"))return!0}catch{}}}catch{}return!1}function gN($){let Z=k8($,"main.go");if(!LZ(Z))return!1;try{let X=Tz(Z,"utf-8");return/^package\s+main\b/m.test(X)}catch{return!1}}function y8($){let Z=k8($,"go.mod");if(!LZ(Z))return null;let X;try{X=Tz(Z,"utf-8")}catch{return null}let z=yN(X),J=bN(X),Q=kN(J,SN),Y=Iz(J,jN),W=Iz(J,xN),U=vN($),q=gN($),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 hN,readFileSync as uN,readdirSync as mN}from"fs";import{join as cN}from"path";var c1={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 lN=c1.mcpPackages.map(($)=>$.toLowerCase()),dN=c1.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),pN=c1.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),iN=c1.grpcServerPackages.map(($)=>$.toLowerCase()),nN=c1.specializedSdks,Rz=c1.baseSdk.toLowerCase();function rN($){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 L of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))K.add(L[1].toLowerCase());for(let L of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))K.add(L[1].toLowerCase());let H=new Set;for(let L of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))H.add(L[1].toLowerCase());return{sdk:z,outputType:J,targetFramework:W,isTestProject:U,useMaui:q,useWpf:G,useWindowsForms:V,packages:K,frameworkRefs:H}}function DZ($,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 Fz($,Z){let X;for(let[z,J]of Z){if(!DZ($,z))continue;if(!X||z.length>X[0].length)X=[z,J]}return X}function sN($){let Z;for(let X of lN){if(!DZ($,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 aN($){let Z=$.toLowerCase();if(!Z)return;let X;for(let z of nN){let J=z[0].toLowerCase();if(Z===J||Z.startsWith(`${J}/`)){if(!X||J.length>X[0].length)X=z}}return X}function v8($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function oN($,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 tN($,Z){let X=Z.replace(/\.csproj$/i,""),{sdk:z,packages:J,frameworkRefs:Q,outputType:Y}=$,W,U="",q,G=sN(J),V=aN(z),K=Fz(J,pN),H=Fz(J,dN),L=iN.some((O)=>DZ(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=L?"gRPC":V[2],q=`${Z} + Sdk=${V[0]}${L?" + 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&&v8(Y))W="backend",U="ASP.NET Core",q=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(B&&!v8(Y))W="library",U="ASP.NET Core",q=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(H&&(v8(Y)||!Y))W="cli",U=H[1],q=`${Z} + ${H[0]} (C# CLI)`;else if(v8(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()===Rz||z.toLowerCase().startsWith(`${Rz}/`))q=`${Z} (C# class library)`}return{appType:W,projectName:X,targetFramework:$.targetFramework,sdk:z||"Microsoft.NET.Sdk",framework:U,found:q}}function L$($){if(!hN($))return[];try{return mN($).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}catch{return[]}}function g8($){let Z=L$($);if(Z.length===0)return null;let X=null,z=999;for(let J of Z){let Q=cN($,J),Y;try{Y=uN(Q,"utf-8")}catch{continue}let W=rN(Y),U=tN(W,J),q=oN(U.appType,U.framework);if(!X||q<z)X=U,z=q}return X}import{existsSync as l1,readFileSync as $L,readdirSync as ZL,statSync as XL}from"fs";import{join as v0}from"path";var d0={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 zL=d0.mcpArtifacts.map(($)=>$.toLowerCase()),JL=d0.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),QL=d0.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),YL=d0.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),aP=d0.androidPlugins.map(($)=>$.toLowerCase()),WL=d0.kmpPlugins.map(($)=>$.toLowerCase()),UL=d0.jvmKotlinPlugins.map(($)=>$.toLowerCase()),qL=d0.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),GL=d0.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),VL=d0.libraryPlugins.map(($)=>$.toLowerCase()),KL=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function IZ($){return KL.some((Z)=>l1(v0($,Z)))}function P2($){try{return $L($,"utf-8")}catch{return null}}function HL($){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 L=`${H[0]}:${H[1]}`.toLowerCase();X.set(V,L),X.set(V.replace(/-/g,"."),L)}}}}return{plugins:Z,libraries:X}}function BL($){let Z=v0($,"gradle","libs.versions.toml");if(!l1(Z))return{plugins:new Map,libraries:new Map};let X=P2(Z);if(!X)return{plugins:new Map,libraries:new Map};return HL(X)}function ML($){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 OL($,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 NL($,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 Pz($){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 J1($,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=J1($,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 LL($){let Z;for(let X of zL)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 Ez($){let Z=new Set,X=!1,z=!1,J=[v0($,"src"),v0($,"src","main")],Q=(Y,W)=>{if(W>4||!l1(Y))return;let U;try{U=ZL(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(XL(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 DL($){let Z=[],X=$.plugins,z=$.artifacts,J=WL.some((b)=>J1(X,b))||$.sourceHints.has("commonMain"),Q=J1(X,"com.android.application"),Y=J1(X,"com.android.library")||J1(X,"com.android.kotlin.multiplatform.library");if(Q||Y)Z.push("android");if(J)Z.push("multiplatform");let W=LL(z),U=C2(X,JL,"plugin"),q=C2($.parents,QL,"parent"),G=C2(z,YL,"artifact"),V=C2(X,qL,"plugin"),K=C2(z,GL,"artifact"),H=VL.some((b)=>J1(X,b)),L=$.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 b=U?.[0]||q?.[0]||G?.[0]||"web";T=`${$.path||"root"} + ${b} (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(L)B="library",T=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{B="library";let b=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(T=`${$.path||"root"} (${b} library)`,H)T=`${$.path||"root"} + java-library (JVM library)`}let j="Java";if($.kotlinSources&&$.javaSources)j="Java/Kotlin";else if($.kotlinSources||UL.some((b)=>J1(X,b))||J)j="Kotlin";let S=[...new Set(Z)];return{appType:B,framework:O,facets:S,found:T,buildTool:$.buildTool,mainLanguage:j}}function IL($,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 _z($,Z,X){let z=Z?v0($,Z):$,J=v0(z,"build.gradle.kts"),Q=v0(z,"build.gradle"),Y=l1(J)?J:l1(Q)?Q:null;if(!Y)return null;let W=P2(Y);if(!W)return null;let U=OL(W,X),q=NL(W,X),G=Ez(z),V=/mainClass\s*[.=]/.test(W)||/mainClassName\s*=/.test(W)||/Main-Class/.test(W),K=J1(U,"application")||J1(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 Cz($,Z){let X=Z?v0($,Z):$,z=v0(X,"pom.xml");if(!l1(z))return null;let J=P2(z);if(!J)return null;let{packaging:Q,parents:Y,artifacts:W}=Pz(J),U=Ez(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(!IZ($))return null;let Z=BL($),X=[],z=null;for(let q of["settings.gradle.kts","settings.gradle"]){let G=v0($,q);if(l1(G)){z=P2(G);break}}let J=z?ML(z):[],Q=_z($,"",Z);if(Q)X.push(Q);for(let q of J){let G=_z($,q,Z);if(G)X.push(G)}let Y=Cz($,"");if(Y){X.push(Y);let q=P2(v0($,"pom.xml"));if(q){let{modules:G}=Pz(q);for(let V of G){let K=Cz($,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=DL(q),V=IL(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 AL,readdirSync as f8,statSync as RL}from"fs";import{join as p0}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 FL=w2.mcpGems.map(($)=>$.toLowerCase()),_L=w2.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),wz=w2.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),CL=w2.railsLayoutFiles;function PL($){return j2(p0($,"Gemfile"))||j2(p0($,"gems.rb"))||EL($)}function EL($){try{return f8($).some((Z)=>Z.endsWith(".gemspec"))}catch{return!1}}function S2($){try{return AL($,"utf-8")}catch{return null}}function wL($){let Z=new Set;for(let X of $.split(`
|
|
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 SL($){let Z=new Set,X=!1;for(let z of $.split(`
|
|
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 jL($){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 xL($){let Z=new Set,X=[];for(let J of["Gemfile","gems.rb"]){let Q=p0($,J),Y=S2(Q);if(Y){for(let W of wL(Y))Z.add(W);X.push(J)}}let z=S2(p0($,"Gemfile.lock"))||S2(p0($,"gems.locked"));if(z){for(let J of SL(z))Z.add(J);X.push("Gemfile.lock")}try{for(let J of f8($)){if(!J.endsWith(".gemspec"))continue;let Q=S2(p0($,J));if(Q){for(let Y of jL(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 TZ($,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 bL($){let Z;for(let X of FL)if(x2($,X)&&(!Z||X.length>Z.length))Z=X;return Z}function Sz($){for(let Z of CL)if(j2(p0($,Z)))return Z;return}function kL($,Z){let X=TZ(Z,wz);if(X)return{hit:!0,why:X[0]};try{for(let J of f8($)){if(!J.endsWith(".gemspec"))continue;let Q=S2(p0($,J));if(Q&&/executables\s*=/.test(Q)&&!/executables\s*=\s*\[\s*\]/.test(Q))return{hit:!0,why:`${J} executables`}}}catch{}let z=p0($,"bin");if(j2(z))try{let Q=f8(z).filter((Y)=>{if(Y==="setup"||Y==="console"||Y==="rake")return!1;try{return RL(p0(z,Y)).isFile()}catch{return!1}}).filter((Y)=>Y!=="rails");if(Q.length>0&&!x2(Z,"rails")&&!Sz($))return{hit:!0,why:`bin/${Q[0]}`}}catch{}return{hit:!1,why:""}}function h8($){if(!PL($))return null;let{gems:Z,sources:X}=xL($),z=X[0]||"Gemfile",J=X.some((O)=>O==="Gemfile"||O==="gems.rb"||O.includes("lock"))?"bundler":"rubygems",Q=bL(Z),Y=TZ(Z,_L),W=Sz($),U=x2(Z,"rails")||x2(Z,"railties"),q=kL($,Z),G=j2(p0($,"config.ru")),V=U||!!W,K=Y&&Y[1]!=="Rails"&&!(Y[0]==="rack"&&!G)?Y:void 0,H,L="",B;if(Q)H="mcp",L="MCP",B=`${z} + gem ${Q} (Ruby MCP)`;else if(V)if(H="backend",L="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",L=K[1],B=`${z} + gem ${K[0]} (Ruby backend)`;else if(q.hit)H="cli",L=TZ(Z,wz)?.[1]||"",B=`${z} + ${q.why} (Ruby CLI)`;else H="library",B=`${z} (Ruby library)`;return{appType:H,framework:L,packageManager:J,found:B}}import{existsSync as AZ,readFileSync as vL,readdirSync as gL,statSync as fL}from"fs";import{join as b2}from"path";var a0={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 hL=a0.mcpPackageUrls.map(($)=>$.toLowerCase()),uL=a0.mcpProducts.map(($)=>$.toLowerCase()),mL=a0.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),cL=a0.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),lL=a0.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),dL=a0.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),pL=a0.appProductTypes,iL=a0.cliProductTypes,nL=a0.vaporLayoutFiles;function rL($){return AZ(b2($,"Package.swift"))||RZ($).length>0}function RZ($){try{return gL($).filter((Z)=>{if(!Z.endsWith(".xcodeproj"))return!1;try{return fL(b2($,Z)).isDirectory()}catch{return!1}})}catch{return[]}}function bz($){try{return vL($,"utf-8")}catch{return null}}function sL($){let Z=aL($),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),L=/\.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:L}}function aL($){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 oL($,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 jz($,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 xz($,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 tL($){let Z=$.map((X)=>X.toLowerCase());return uL.some((X)=>Z.includes(X))}function eL($){let Z=!1,X=!1,z;for(let J of RZ($)){let Q=b2($,J,"project.pbxproj"),Y=bz(Q);if(!Y)continue;for(let W of pL)if(Y.includes(W))Z=!0,z=W;for(let W of iL)if(Y.includes(W)){if(X=!0,!z)z=W}}return{hasApplication:Z,hasTool:X,hit:z}}function $D($){for(let Z of nL)if(AZ(b2($,Z)))return Z;return}function k2($){if(!rL($))return null;let Z=b2($,"Package.swift"),X=AZ(Z),z=RZ($),J=z.length>0,Q=null;if(X){let n=bz(Z);if(n)Q=sL(n)}let Y=J?eL($):{hasApplication:!1,hasTool:!1},W=$D($),U=Q?.packageUrls??[],q=Q?.productNames??[],G=oL(U,hL),V=tL(q),K=jz(U,mL),H=xz(q,cL),L=jz(U,lL),B=xz(q,dL),O=!!(G||V),T=!!(K||H||W),j=!!(Q?.hasExecutableProduct||Q?.hasExecutableTarget),S=!!(L||B),b=Y.hasApplication,y=X&&J?"spm+xcode":X?"spm":"xcode",x,m="",F;if(O)if(x="mcp",m="MCP",V)F="Package.swift + product MCP (Swift MCP)";else F=`Package.swift + ${G} (Swift MCP)`;else if(T)if(x="backend",m=H?.[1]||K?.[1]||(W?"Vapor":""),H)F=`Package.swift + product ${H[1]} (Swift backend)`;else if(K)F=`Package.swift + ${K[1]} (Swift backend)`;else F=`${W} (Swift backend layout)`;else if(b)x="app",m="",F=`${z[0]} + ${Y.hit||"application"} (Swift app)`;else if(S||j&&!T&&!O)if(x="cli",m=B?.[1]||L?.[1]||"",B)F=`Package.swift + product ${B[1]} (Swift CLI)`;else if(L)F=`Package.swift + ${L[1]} (Swift CLI)`;else if(Q?.hasExecutableProduct)F="Package.swift + .executable product (Swift CLI)";else F="Package.swift + .executableTarget (Swift CLI)";else if(Y.hasTool&&!X)x="cli",F=`${z[0]} + tool productType (Swift CLI)`;else if(X)if(x="library",Q?.hasLibraryProduct)F="Package.swift + .library product (Swift library)";else F="Package.swift (Swift library)";else x="library",F=`${z[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:x,framework:m,packageManager:y,found:F}}function ZD($){let Z=R($,"Cargo.toml");if(!_(Z))return null;try{let z=o0(Z,"utf-8").match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return z?z[1]:null}catch{return null}}function XD($){let Z=R($,"Cargo.toml");if(!_(Z))return!1;try{let X=o0(Z,"utf-8");return/^\s*\[\[bin\]\]/m.test(X)}catch{return!1}}function zD($,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=ZD($);if(X&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(X))return`Cargo.toml name "${X}" → sdk`;return null}function JD($){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=R($,X);if(!_(z))continue;try{let J=JSON.parse(o0(z,"utf-8"));if(typeof J.manifest_version==="number")return`${X} manifest_version ${J.manifest_version} (browser extension)`}catch{}}return null}function QD($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,X=R($,"pyproject.toml");if(_(X))try{let Q=o0(X,"utf-8").match(Z);if(Q)return`pyproject.toml depends on ${Q[1]}`}catch{}let z=R($,"requirements.txt");if(_(z))try{let Q=o0(z,"utf-8").match(Z);if(Q)return`requirements.txt contains ${Q[1]}`}catch{}return null}function YD($,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(_(R($,"ios"))&&_(R($,"android")))return"ios/ + android/ dirs";return null}function WD($,Z){let X=R($,"Cargo.toml");if(_(X))try{let J=o0(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=R($,"build.zig");if(_(z))try{let J=o0(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 UD($,Z){if(!_(R($,"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 qD($,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 GD($,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 VD($,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 KD($,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 HD($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||_(R($,"pnpm-workspace.yaml"))))return null;return"private workspace + multi-package"}var BD=new Set(["node_modules","dist","build","out","vendor","target","coverage","docs","doc","e2e","tests","test","__tests__","scripts","deploy","bin","public","examples","example","fixtures","assets","static","migrations","config","contracts","proto","protos"]),kz=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,MD=new Set(["frontend","backend","database","css","ui","state"]);function OD($){if(_(R($,"pyproject.toml"))||_(R($,"manage.py"))||_(R($,"setup.py"))||u8($,"requirements*.txt"))return!0;if(_(R($,"go.mod")))return!0;if(_(R($,"Cargo.toml")))return!0;if(_(R($,"Gemfile")))return!0;if(_(R($,"pom.xml"))||u8($,"build.gradle*"))return!0;if(L$($).length>0)return!0;let Z=F1($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function m8($){let Z;try{Z=FZ($,{withFileTypes:!0})}catch{return[]}let X=[];for(let z of Z){if(!z.isDirectory()||z.name.startsWith(".")||BD.has(z.name))continue;let J=R($,z.name);if(!OD(J))continue;let Q=l8(J);if(Q==="Unknown")continue;let Y=c8(J).filter((G)=>MD.has(G.category)),W=Y.find((G)=>G.category==="frontend"),U=Y.find((G)=>G.category==="backend"),q=W??U??Y[0]??null;X.push({name:z.name,language:Q,topFramework:q?.name??null,frontend:!!W,backend:!!U||kz.test(Q),hasFramework:!!q,appRoot:_(R(J,"manage.py"))||_(R(J,"config.ru"))||_(R(J,"bin/rails"))||_(R(J,"artisan"))})}return X}function ND($,Z){if(Z?.workspaces||_(R($,"pnpm-workspace.yaml")))return null;let X=m8($),z=new Set(X.map((J)=>J.language));if(X.length<2||z.size<2)return null;if(!X.some((J)=>J.frontend)||!X.some((J)=>J.backend))return null;return`polyglot: ${X.map((J)=>`${J.name}/ (${J.language})`).join(", ")}`}function yz($){let Z=m8($);if(Z.length<2)return null;let X=(Y)=>(Y.appRoot?2:0)+(kz.test(Y.language)?2:0)+(Y.hasFramework?1:0)+(Y.frontend?0.5:0),z=[...Z].sort((Y,W)=>X(W)-X(Y)),J=new Set,Q=[];for(let Y of z){if(J.has(Y.language))continue;J.add(Y.language);let W=Y.frontend?"frontend":Y.backend?"backend":"service";Q.push(Y.topFramework?`${Y.language} (${Y.topFramework} · ${W})`:`${Y.language} (${W})`)}return Q.join("; ")}function F1($){let Z=R($,"package.json");if(!_(Z))return null;try{return JSON.parse(o0(Z,"utf-8"))}catch{return null}}function u8($,Z){if(!Z.includes("*"))return _(R($,Z));let X=Z.split("/");if(X.length===1){let W=Z.split("*")[0];try{return FZ($).some((U)=>U.startsWith(W))}catch{return!1}}let z=R($,...X.slice(0,-1)),J=X[X.length-1],Q=J.split("*")[0],Y=J.split("*")[1]||"";try{return FZ(z).some((W)=>W.startsWith(Q)&&W.endsWith(Y))}catch{return!1}}function LD($,Z,X){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return u8(X,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!u8(X,$.pattern))return!1;try{let z=R(X,$.pattern);if(!_(z))return!1;return o0(z,"utf-8").toLowerCase().includes($.key.toLowerCase())}catch{return!1}}default:return!1}}function c8($){let Z=F1($);return Nz.map((X)=>{let J=X.signals.filter((Q)=>LD(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 l8($){let Z=F1($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(_(R($,"tsconfig.json")))return"TypeScript";if(_(R($,"Cargo.toml")))return"Rust";if(_(R($,"go.mod")))return"Go";if(L$($).length>0)return"C#";if(_(R($,"pyproject.toml"))||_(R($,"setup.py")))return"Python";if(_(R($,"Gemfile")))return"Ruby";if(IZ($)){let X=E2($);if(X)return X.mainLanguage==="Java/Kotlin"?"Kotlin":X.mainLanguage;return"Java"}if(_(R($,"Package.swift")))return"Swift";if(_(R($,"build.zig")))return"Zig";if(_(R($,"pubspec.yaml")))return"Dart";if(Z)return"JavaScript";return"Unknown"}function vz($){let Z=F1($),X=c8($),z=[],J=qD($,Z);if(J)return z.push(J),{type:"documentation",found:z};let Q=zD($,Z);if(Q)return z.push(Q),{type:"sdk",found:z};let Y=JD($);if(Y)return z.push(Y),{type:"extension",found:z};let W=KD($,Z,X);if(W)return z.push(W),{type:"mcpaas",found:z};let U=VD($,Z);if(U)return z.push(U),{type:"saas",found:z};let q=WD($,Z);if(q)return z.push(q),{type:"wasm",found:z};let G=x8($);if(G)return z.push(G.found),{type:G.appType,found:z};let V=y8($);if(V)return z.push(V.found),{type:V.appType,found:z};let K=g8($);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 L=h8($);if(L)return z.push(L.found),{type:L.appType,found:z};let B=k2($);if(B)return z.push(B.found),{type:B.appType,found:z};let O=YD($,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(XD($))return z.push("Cargo.toml [[bin]]"),{type:"cli",found:z};if(_(R($,"build.zig"))){if(z.push("build.zig"),_(R($,"src/main.zig")))return z.push("src/main.zig"),{type:"cli",found:z};if(_(R($,"src/root.zig")))return z.push("src/root.zig"),{type:"library",found:z}}let j=X.some((r)=>r.slug==="svelte"||r.slug==="sveltekit");if(Z?.private===!0&&(_(R($,"pnpm-workspace.yaml"))||Z?.workspaces!==void 0)&&j)return z.push("private workspace","Svelte"),{type:"framework",found:z};if(j)return z.push("Svelte/SvelteKit"),{type:"svelte",found:z};let b=X.some((r)=>r.category==="frontend"),y=X.some((r)=>r.category==="backend");if(Z?.private&&(Z.workspaces||_(R($,"pnpm-workspace.yaml")))&&b&&y)return z.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:z};let x=HD($,Z);if(x)return z.push(x),{type:"monorepo-root",found:z};let m=GD($,Z,X);if(m)return z.push(m),{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 n=X.some((r)=>r.category==="frontend"),p=X.some((r)=>r.category==="backend");if(n&&p)return z.push("frontend framework","backend framework"),{type:"fullstack",found:z};if(n)return z.push("frontend framework"),{type:"frontend",found:z};if(p)return z.push("backend framework"),{type:"backend",found:z};let T0=QD($);if(T0)return z.push(T0),{type:"data-science",found:z};let P=UD($,Z);if(P)return z.push(P),{type:"html",found:z};let d=ND($,Z);if(d)return z.push(d),{type:"fullstack",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 gz($){if(_(R($,"bunfig.toml")))return"Bun";if(_(R($,"deno.json"))||_(R($,"deno.jsonc")))return"Deno";if(F1($))return"Node.js";if(_(R($,"Cargo.toml")))return"Rust";if(_(R($,"go.mod")))return"Go";if(L$($).length>0)return".NET";if(_(R($,"pubspec.yaml")))return"Dart";return"Unknown"}function fz($){if(_(R($,"pubspec.yaml")))return"pub";if(_(R($,"go.mod")))return"go modules";if(L$($).length>0)return"NuGet";if(_(R($,"pom.xml")))return"maven";if(_(R($,"build.gradle"))||_(R($,"build.gradle.kts"))||_(R($,"settings.gradle"))||_(R($,"settings.gradle.kts")))return"gradle";if(_(R($,"bun.lockb"))||_(R($,"bun.lock")))return"bun";if(_(R($,"pnpm-lock.yaml")))return"pnpm";if(_(R($,"yarn.lock")))return"yarn";if(_(R($,"package-lock.json")))return"npm";return"npm"}function hz($){if(_(R($,".github/workflows")))return"GitHub Actions";if(_(R($,".gitlab-ci.yml")))return"GitLab CI";if(_(R($,".circleci")))return"CircleCI";if(_(R($,"Jenkinsfile")))return"Jenkins";return null}function uz($){if(_(R($,"vercel.json")))return"Vercel";if(_(R($,"netlify.toml")))return"Netlify";if(_(R($,"wrangler.toml")))return"Cloudflare";if(_(R($,"Dockerfile")))return"Docker";if(_(R($,"fly.toml")))return"Fly.io";if(_(R($,"render.yaml")))return"Render";return null}function mz($){let Z=R($,"svelte.config.js");if(!_(Z))return null;try{let z=o0(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 cz($){let Z=F1($);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(_(R($,"tsconfig.json"))&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function d8($){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)=>_(R($,X)))}function p8($,Z){let X={};if(Z?.scripts){for(let z of["build","test","lint","dev","start"])if(Z.scripts[z]){let J=_(R($,"bun.lock"))||_(R($,"bun.lockb"))?"bun run":"npm run";X[z]=`${J} ${z}`}}if(_(R($,"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(_(R($,"build.zig"))){if(!X.build)X.build="zig build";if(!X.test)X.test="zig build test"}if(_(R($,"go.mod"))){if(!X.build)X.build="go build ./...";if(!X.test)X.test="go test ./..."}if(_(R($,"pyproject.toml"))||_(R($,"pytest.ini"))){if(!X.test)X.test="pytest"}return X}function lz($,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(_(R($,"bunfig.toml")))J.push("Bun");else if(_(R($,"deno.json"))||_(R($,"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 i8($){let Z=F1($),X=c8($),z=vz($),J=z.type,Q=z.found.some((s)=>s.startsWith("polyglot:")),Y=Q&&yz($)||l8($),W=gz($),U=fz($),q=hz($),G=uz($),V=cz($),K=X.find((s)=>s.category==="frontend"),H=X.find((s)=>s.category==="css"),L=X.find((s)=>s.category==="ui"),B=X.find((s)=>s.category==="state"),O=X.find((s)=>s.category==="backend"),T=X.find((s)=>s.category==="database"),j=O$[J]||O$.library,S=J==="framework",b=X.some((s)=>s.slug==="svelte"||s.slug==="sveltekit"),y=S&&b?"svelte":S?null:null,x=J==="svelte"||y==="svelte",m=x?mz($):null,F=x&&X.some((s)=>s.slug==="sveltekit"),n=new Set(["css_framework","ui_library","database","connection","hosting"]),p={},T0=Z0.filter((s)=>s.path.startsWith("stack."));for(let s of T0){let t=s.path.replace("stack.","");if(!j.includes(s.category)){p[t]="slotignored";continue}if(S&&n.has(t)){p[t]="slotignored";continue}switch(t){case"frontend":p[t]=K?.name??(J==="cli"?"CLI":"");break;case"css_framework":p[t]=H?.name??"";break;case"ui_library":p[t]=L?.name??"";break;case"state_management":p[t]=x?B?.name??"Runes":B?.name??"";break;case"backend":p[t]=x?F?"SvelteKit":O?.name??"":O?.name??"";break;case"api_type":p[t]=F?"Server Routes":"";break;case"runtime":p[t]=W!=="Unknown"?W:"";break;case"database":p[t]=T?.name??"";break;case"connection":p[t]=T?.name??"";break;case"hosting":if(x&&m)p[t]=m;else p[t]=G??"";break;case"build":p[t]=x?"Vite":V??"";break;case"cicd":p[t]=q??"";break;case"package_manager":p[t]=U;break;default:p[t]="";break}}let P={},d=Z0.filter((s)=>s.path.startsWith("monorepo."));for(let s of d){let t=s.path.replace("monorepo.","");if(!j.includes(s.category))P[t]="slotignored";else P[t]=""}let r={name:Z?.name??$.split("/").pop()??"project",goal:Q?"":Z?.description??"",main_language:Y,type:J};if(S&&y)r.framework=y;let u0=lz($,Z,X,Q?l8($):Y);if(Q){for(let s of m8($))for(let t of[s.language,s.topFramework])if(t&&!u0.includes(t))u0.push(t)}let C9=d8($),P9=p8($,Z),g6={faf_version:R1,project:r,stack:p,human_context:{who:"",what:Q?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:P,_meta:{found:z.found}};if(u0.length>0)g6.tech_stack=u0;if(C9.length>0)g6.key_files=C9;if(Object.keys(P9).length>0)g6.commands=P9;return g6}import{existsSync as ID,readFileSync as TD}from"fs";import{join as AD}from"path";var dz={MIN_LENGTH:8,MAX_LENGTH:280},DD=[/^(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 i0($){let Z=$.trim();if(Z.length<dz.MIN_LENGTH)return!1;if(Z.length>dz.MAX_LENGTH)return!1;if(DD.some((X)=>X.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
|
|
217
|
+
`).length>4)return!1;return!0}function RD($){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
|
-
`)}function
|
|
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
|
|
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(`
|
|
219
|
+
`)}function FD($){let X=RD($).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 _D($){let Z=d1($,/^(use\s+cases?|goal)\b/i);if(Z&&i0(Z))return Z;let X=FD($);if(X&&i0(X))return X;return}function CD($){let Z=d1($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&i0(Z))return Z;return}function PD($){let Z=d1($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&i0(Z))return Z;return}function ED($){let Z=d1($,/^(why|motivation|problem|rationale)\b/i);if(Z&&i0(Z))return Z;return}function wD($){let Z=d1($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&i0(Z))return Z;return}function SD($){let Z=d1($,/^(status|history|timeline|since|launched)\b/i);if(Z&&i0(Z))return Z;return}function jD($){let Z=d1($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&i0(Z))return Z;return}function _Z($){let Z=["README.md","README.MD","Readme.md","readme.md"],X=null;for(let H of Z){let L=AD($,H);if(ID(L)){X=L;break}}if(!X)return{};let z;try{z=TD(X,"utf-8")}catch{return{}}z=z.replace(/<!--[\s\S]*?-->/g,"");let J={},Q=_D(z);if(Q)J.project={goal:Q};let Y={},W=CD(z);if(W)Y.what=W;let U=PD(z);if(U)Y.who=U;let q=ED(z);if(q)Y.why=q;let G=wD(z);if(G)Y.where=G;let V=SD(z);if(V)Y.when=V;let K=jD(z);if(K)Y.how=K;if(Object.keys(Y).length>0)J.human_context=Y;return J}import{existsSync as xD,readFileSync as bD}from"fs";import{join as kD}from"path";function yD($,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 CZ($){let Z=kD($,"Cargo.toml");if(!xD(Z))return{};let X;try{X=bD(Z,"utf-8")}catch{return{}}let z=yD(X,"description");if(z&&i0(z))return{project:{goal:z}};return{}}import{readFileSync as vD,readdirSync as gD}from"fs";import{join as pz}from"path";var fD=[{re:/^postgres|postgis|pgvector/,slot:"database",label:"PostgreSQL"},{re:/^mysql/,slot:"database",label:"MySQL"},{re:/^mariadb/,slot:"database",label:"MariaDB"},{re:/^mongo/,slot:"database",label:"MongoDB"},{re:/clickhouse/,slot:"database",label:"ClickHouse"},{re:/^cockroach/,slot:"database",label:"CockroachDB"},{re:/^redis|^valkey/,slot:"cache",label:"Redis"},{re:/^memcached/,slot:"cache",label:"Memcached"},{re:/elasticsearch/,slot:"search",label:"Elasticsearch"},{re:/opensearch/,slot:"search",label:"OpenSearch"},{re:/meilisearch/,slot:"search",label:"Meilisearch"},{re:/typesense/,slot:"search",label:"Typesense"},{re:/qdrant/,slot:"search",label:"Qdrant (vector)"},{re:/weaviate/,slot:"search",label:"Weaviate (vector)"},{re:/^minio/,slot:"storage",label:"MinIO (S3-compatible)"},{re:/localstack/,slot:"storage",label:"LocalStack (AWS)"},{re:/rabbitmq/,slot:"runtime",label:"RabbitMQ"},{re:/kafka/,slot:"runtime",label:"Kafka"},{re:/nats/,slot:"runtime",label:"NATS"},{re:/temporalio\/|temporal-server|temporal:/,slot:"runtime",label:"Temporal"}],hD=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function uD($){let Z=[],X=(z,J)=>{let Q;try{Q=gD(z,{withFileTypes:!0})}catch{return}for(let Y of Q)if(Y.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(Y.name))Z.push(pz(z,Y.name));else if(Y.isDirectory()&&J>0&&!Y.name.startsWith(".")&&!hD.has(Y.name))X(pz(z,Y.name),J-1)};return X($,1),Z}function y2($){return[...$].join(" · ")}function PZ($){let Z=uD($);if(Z.length===0)return{};let X={database:new Set,cache:new Set,search:new Set,storage:new Set,runtime:new Set};for(let J of Z){let Q;try{Q=vD(J,"utf-8")}catch{continue}for(let Y of Q.matchAll(/^\s*image:\s*["']?([^\s"'#]+)/gm)){let W=Y[1].toLowerCase(),U=W.replace(/:[^/]*$/,"").split("/").pop()??W,q=W.replace(/:[^/]*$/,"");for(let{re:G,slot:V,label:K}of fD)if(G.test(U)||G.test(q))X[V].add(K)}}let z={};if(X.database.size)z.database=y2(X.database);if(X.cache.size)z.cache=y2(X.cache);if(X.search.size)z.search=y2(X.search);if(X.storage.size)z.storage=y2(X.storage);if(X.runtime.size)z.runtime=`Docker Compose (${y2(X.runtime)})`;if(Object.keys(z).length===0&&!X.runtime.size)return{stack:{hosting:"Docker Compose"}};return z.hosting="Docker Compose",{stack:z}}import{existsSync as n8,readFileSync as mD,readdirSync as cD}from"fs";import{join as v2}from"path";var lD=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),dD=[{file:"Makefile",runner:"make",targets:($)=>[...$.matchAll(/^([a-zA-Z][\w-]*)\s*:(?!=)/gm)].map((Z)=>Z[1])},{file:"justfile",runner:"just",targets:($)=>[...$.matchAll(/^([a-zA-Z][\w-]*)\s*(?:\([^)]*\))?\s*:/gm)].map((Z)=>Z[1])},{file:"Taskfile.yml",runner:"task",targets:($)=>{let Z=$.indexOf("tasks:");if(Z===-1)return[];return[...$.slice(Z).matchAll(/^\s{2}([a-zA-Z][\w-]*):/gm)].map((X)=>X[1])}}];function EZ($,Z){for(let X of Z){let z=$.find((J)=>X.test(J));if(z)return z}return null}function pD($){let Z=[$];try{for(let X of cD($,{withFileTypes:!0}))if(X.isDirectory()&&!X.name.startsWith(".")&&!lD.has(X.name))Z.push(v2($,X.name))}catch{}return Z}function iD($){let Z=0;if(n8(v2($,"manage.py"))||n8(v2($,"pyproject.toml"))||n8(v2($,"Gemfile")))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function wZ($){let Z=[];for(let z of pD($)){let J=z===$,Q=J?"":`cd ${z.slice($.length+1)} && `;for(let Y of dD){let W=v2(z,Y.file);if(!n8(W))continue;let U;try{U=mD(W,"utf-8")}catch{continue}let q=Y.targets(U);if(q.length===0)continue;let G={},V=EZ(q,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),K=EZ(q,[/^build$/i,/^compile$/i,/^build/i]),H=EZ(q,[/^check-all$/i,/^check$/i,/^lint$/i,/^lint/i,/^fmt$/i,/^format$/i]);if(V)G.test=`${Q}${Y.runner} ${V}`;if(K)G.build=`${Q}${Y.runner} ${K}`;if(H)G.lint=`${Q}${Y.runner} ${H}`;if(Object.keys(G).length===0)continue;Z.push({score:Object.keys(G).length+(J?10:iD(z)),commands:G})}}let X=Z.sort((z,J)=>J.score-z.score)[0];return X?{commands:X.commands}:{}}import{existsSync as nD}from"fs";import{join as rD}from"path";var sD=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function SZ($){for(let Z of sD)if(nD(rD($,Z)))return{security:{secrets:".env",example:Z}};return{}}function aD($,Z){let X={project:{...Z.project??{},...$.project??{}},human_context:{...Z.human_context??{},...$.human_context??{}},stack:{...Z.stack??{},...$.stack??{}},commands:{...Z.commands??{},...$.commands??{}},security:{...Z.security??{},...$.security??{}}};for(let z of["project","human_context","stack","commands","security"])if(X[z]&&Object.keys(X[z]).length===0)delete X[z];return X}function r8($){return[_Z($),CZ($),PZ($),wZ($),SZ($)].reduce(aD,{})}import{existsSync as oD,readdirSync as iz,readFileSync as tD}from"fs";import{join as xZ,dirname as eD,extname as $I,resolve as ZI}from"path";var jZ={"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 XI=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),zI=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),JI={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"]},QI=[["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 YI($,Z){for(let[X,z]of QI)if(X in $)return z;return Z.length>0?"framework":"config"}function WI($){try{let Z=JSON.parse(tD($,"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 UI($){let Z=[],X=ZI($),z=oD(xZ($,".git")),J=new Set;for(let Q=0;Q<10;Q++){let Y;try{Y=iz(X)}catch{break}for(let U of Y){if(U.toLowerCase().endsWith(".csproj")){let G=g8(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=jZ[U];if(!q)continue;if(U==="manifest.json"&&WI(xZ(X,U))!=="chrome")continue;if(U==="pubspec.yaml"){let G=x8(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=y8(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=h8(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=eD(X);if(W===X)break;X=W}return Z}function qI($){let Z=[];for(let X of nz($,2,{count:0})){let z=jZ[`*${X}`],J=z?.slots?.mainLanguage;if(J)Z.push({slots:{mainLanguage:J},priority:z.priority,frameworks:z.frameworks})}return Z}function GI($){let Z=[...UI($),...qI($)],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:YI(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 s8($){let{slotFills:Z}=GI($),X={};for(let[z,J]of Object.entries(Z)){let Q=JI[z];if(!Q||!J)continue;let[Y,W]=Q;if(Y==="project")(X.project??={})[W]=J;else(X.stack??={})[W]=J}return X}function nz($,Z,X){let z=new Set;if(Z<0||X.count>400)return z;let J;try{J=iz($,{withFileTypes:!0})}catch{return z}for(let Q of J){if(X.count++>400)break;if(!Q.isDirectory()){let Y=$I(Q.name);if(zI.has(Y))z.add(Y);continue}if(XI.has(Q.name)||Q.name.startsWith("."))continue;for(let Y of nz(xZ($,Q.name),Z-1,X))z.add(Y)}return z}import{existsSync as rz,readFileSync as sz}from"fs";import{join as az}from"path";var N0=($,Z,X)=>({value:$,source:Z,confidence:X});function VI($,Z={}){let X=Z.toolingRoot?null:KI($),z=HI($),J={},Q=(Y,W)=>{if(W)J[Y]=W};return Q("what",MI(X,z)),Q("who",OI(z)),Q("why",NI(z)),Q("where",LI(X,z)),Q("when",DI(z)),Q("how",II(X,z)),J}function a8($,Z={}){let X=VI($,Z),z={};return Object.keys(X).forEach((J)=>{let Q=X[J];if(Q)z[J]=Q.value}),z}function KI($){let Z=az($,"package.json");if(!rz(Z))return null;try{return JSON.parse(sz(Z,"utf-8"))}catch{return null}}function HI($){let Z=az($,"README.md");if(!rz(Z))return"";let X;try{X=sz(Z,"utf-8")}catch{return""}return X.replace(/<!--[\s\S]*?-->/g,"").split(`
|
|
223
223
|
`).filter((z)=>!/^\s*\[!\[/.test(z)&&!/^\s*!\[/.test(z)).join(`
|
|
224
|
-
`).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function
|
|
225
|
-
`,"utf-8")}generateProjectDNA(){return
|
|
226
|
-
run ${A("'faf go'")} to fill empty slots`))}
|
|
227
|
-
run ${A("'faf go'")} to reach ✪ Trophy`))}import{existsSync as
|
|
224
|
+
`).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function p1($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function BI($){if(!$)return 0;return($.match(/\[[^\]]*\]\([^)]*\)/g)??[]).join("").length/$.length}function D$($,Z){let X=new RegExp(`##?\\s+(${Z})\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n##?|$)`,"i"),z=$.match(X);if(!z||!z[2]||z[2].trim().length<=20||BI(z[2])>0.4)return null;return{body:p1(z[2]),heading:z[1].trim()}}function g2($,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 MI($,Z){if($?.description&&$.description.length>20)return N0(p1($.description),"package.json:description",0.95);let X=D$(Z,"Purpose|What|About|Overview|Description");if(X)return N0(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 N0(p1(z),"README:first-paragraph",0.5);let J=g2(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?N0(J,"README:problem-heuristic",0.6):null}function OI($){let Z=D$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return N0(Z.body,`README:## ${Z.heading}`,0.8);let X=g2($,[/\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?N0(X,"README:audience-heuristic",0.6):null}function NI($){let Z=D$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return N0(Z.body,`README:## ${Z.heading}`,0.8);let X=g2($,[/(?: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?N0(X,"README:mission-heuristic",0.6):null}function LI($,Z){let X=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(X)return N0(p1(X.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return N0(p1($.homepage),"package.json:homepage",0.9);let z=g2(Z,[/\b(?:deployed|hosted|available|published)\s+(?:on|at|via)\s+([^.\n]{3,80})/i],3);return z?N0(z,"README:deploy-heuristic",0.6):null}function DI($){let Z=D$($,"Timeline|Status|Release|Roadmap");if(Z)return N0(Z.body,`README:## ${Z.heading}`,0.8);let X=g2($,[/\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?N0(X,"README:since-heuristic",0.6):null}function II($,Z){let X=$?.scripts?Object.keys($.scripts):[],z=["start","dev","build"].filter((Y)=>X.includes(Y));if(z.length)return N0(p1(z.map((Y)=>`npm run ${Y}`).join(", ")),"package.json:scripts",0.9);let J=D$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(J)return N0(J.body,`README:## ${J.heading}`,0.8);let Q=D$(Z,"Architecture|Approach|How it works|Methodology|How");return Q?N0(Q.body,`README:## ${Q.heading}`,0.7):null}function I$($){let Z=i8($),X=r8($),z={};if(X.stack)z.stack=X.stack;if(X.commands)z.commands=X.commands;if(X.security)z.security=X.security;let J={};if(X.project)J.project=X.project;if(X.human_context)J.human_context=X.human_context;let Q=t0(t0(z,Z),J);TI(Q);let W=(Z._meta?.found??[]).some((q)=>q.startsWith("polyglot:")),U=t0(Q,s8($));return t0(U,{human_context:a8($,{toolingRoot:W})})}function TI($){let Z=$.project?.type??"library",X=O$[Z]||O$.library;for(let z of Z0){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 t0($,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]=t0(Q,J)}return X}import{existsSync as oz,readFileSync as AI,writeFileSync as RI}from"fs";import{join as FI,basename as _I}from"path";import{createHash as CI}from"crypto";class Q1{projectPath;dnaPath;dna=null;constructor($){this.projectPath=$,this.dnaPath=FI($,".faf-dna")}exists(){return oz(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(!oz(this.dnaPath))return null;try{return this.dna=JSON.parse(AI(this.dnaPath,"utf-8")),this.dna}catch{return null}}save(){if(!this.dna)return;this.dna.lastModified=new Date().toISOString(),RI(this.dnaPath,`${JSON.stringify(this.dna,null,2)}
|
|
225
|
+
`,"utf-8")}generateProjectDNA(){return CI("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=_I(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")}}c();c();import{homedir as tz}from"os";import{resolve as o8}from"path";function PI($=process.cwd()){let Z=o8($),X=o8(tz());if(Z===X)return!0;if(Z==="/"||/^[A-Za-z]:[\\/]?$/.test(Z))return!0;return!1}function T$($=process.cwd(),Z="faf"){if(!PI($))return;let X=o8($)===o8(tz())?"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 bZ($={}){T$(process.cwd(),"faf init");let Z=process.cwd(),X=$.output?$.output.endsWith(".faf")?$.output:ez(Z,$.output):ez(Z,"project.faf");if(EI(X)&&!$.force)console.error(`project.faf already exists. Use ${A("--force")} to overwrite.`),process.exit(1);let z=I$(Z);$0(X,z);let J=u(X),Q=Q0(J),Y=new Q1(Z);if(!Y.exists()||$.force)Y.birth(Q.score);if(console.log(`${I("created")} ${X}`),Y0(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`))}c();function $J(){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(H0(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 wI}from"fs";import{join as SI}from"path";c();function t8(){T$(process.cwd(),"faf auto");let $=process.cwd(),Z=SI($,"project.faf");if(wI(Z)){let Q=l(Z),Y=t0(Q,r8($)),W=t0(Y,i8($)),U=t0(W,s8($)),q=t0(U,{human_context:a8($)});$0(Z,q),console.log(`${I("updated")} ${Z}`)}else $0(Z,I$($)),console.log(`${I("created")} ${Z}`);let X=u(Z),z=B0(G0(X)),J=new Q1($);if(J.exists())J.recordGrowth(z.score,["faf auto"]);if(Y0(z,Z),z.score<100)console.log(M(`
|
|
227
|
+
run ${A("'faf go'")} to reach ✪ Trophy`))}import{existsSync as fI}from"fs";import{join as hI}from"path";var A$="(terse — 3-4 words)",jI=[{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? ${A$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${A$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${A$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${A$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${A$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${A$}`,header:"How",type:"text",required:!0}],xI=[{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}],e8=[...jI,...xI],bI=new Map(e8.map(($)=>[$.path,$])),ew=Object.fromEntries(e8.map(($)=>[$.path,$]));function $4($){let Z=bI.get($);if(Z)return Z.question;let X=M$.get($)??Z0.find((z)=>z.canonical===$);return X?`${X.description}?`.replace(/\?\?$/,"?"):`${$}?`}function yZ($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||P0(Z)}return!1}function kI($,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 yI($){if($==="project.goal")return!0;return M$.get($)?.category==="human"}function vI($,Z=yZ){let X=[],z=[];for(let J of e8){let Q=kI($,J.path);if(Q==="slotignored")continue;if(!Z(Q))continue;(yI(J.path)?X:z).push(J.path)}return{human:X,sourceable:z}}function gI($,Z,X=yZ){let z=vI(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"?kZ(z):[];return{status:J,score:$,gaps:z,ask:Q}}function kZ($){return $.human.map((Z)=>({path:Z,question:$4(Z)}))}function ZJ($,Z={}){let X=Math.max(1,Z.maxRounds??5),z=Z.isEmpty??yZ,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=gI(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:kZ(G.gaps)}:{status:"stuck",score:q,rounds:Q,history:J,ask:[]};if(Q>=X)return{status:"capped",score:q,rounds:Q,history:J,ask:kZ(G.gaps)};$.runAuto(),Q++}return{status:"capped",score:J[J.length-1]??0,rounds:Q,history:J,ask:[]}}c();function XJ($={}){let Z=process.cwd(),X=hI(Z,"project.faf"),z=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;uI(ZJ({read:()=>fI(X)?{data:l(X),yaml:u(X)}:{data:{},yaml:""},score:(Q)=>Q?B0(G0(Q)).score:0,runAuto:()=>t8()},{maxRounds:z}))}function uI($){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 z4,statSync as GJ}from"fs";import{join as VJ,dirname as tI}from"path";import{readFileSync as nI,existsSync as rI,statSync as NS}from"fs";import{join as JJ}from"path";import{readFileSync as mI,writeFileSync as Z4,existsSync as cI}from"fs";var lI="<!-- faf:start -->",dI="<!-- faf:end -->",pI="<!-- faf:";function e0($,Z,X=lI,z=dI){let J=`${X}
|
|
230
230
|
${Z.trim()}
|
|
231
|
-
${z}`;if(!
|
|
232
|
-
`,"utf-8");return}let Q=
|
|
233
|
-
`,"utf-8");return}
|
|
231
|
+
${z}`;if(!cI($)){Z4($,`${J}
|
|
232
|
+
`,"utf-8");return}let Q=mI($,"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);Z4($,`${U}${J}${q}`,"utf-8");return}if(Q.trimStart().startsWith(pI)){Z4($,`${J}
|
|
233
|
+
`,"utf-8");return}Z4($,`${J}
|
|
234
234
|
|
|
235
|
-
${Q}`,"utf-8")}var
|
|
236
|
-
${U}`}function
|
|
237
|
-
`)}function
|
|
235
|
+
${Q}`,"utf-8")}var iI=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 vZ($){return $.split("_").map((Z)=>{if(!Z)return Z;let X=Z.toUpperCase();return iI.has(X)?X:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function E0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function g0($){let Z=M$.get($);if(Z?.label)return Z.label;let X=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return vZ(X)}var QJ="CLAUDE.md",sI="STATUS: BI-SYNC ACTIVE";function YJ($){let Z=JJ($,QJ);if(!rI(Z))return null;return nI(Z,"utf-8")}function WJ($,Z){e0(JJ($,QJ),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 UJ($){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(`**${g0(`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])=>`- **${g0(`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(`*${sI} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
|
|
237
|
+
`)}function zJ($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function X4($){let Z={project:{}},X=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(X)Z.project.name=zJ(X[1].trim());if(!Z.project.name){let Q=$.match(/\*\*Name:\*\*\s*(.+)/);if(Q)Z.project.name=zJ(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 RS,writeFileSync as aI,existsSync as FS}from"fs";import{join as oI}from"path";function qJ($,Z){aI(oI($,"MEMORY.md"),Z,"utf-8")}c();function R$(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function gZ($={}){let Z=process.cwd(),X=f(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=VJ(Z,"CLAUDE.md"),J=VJ(Z,"MEMORY.md"),Q=$.direction??"auto";if(Q==="auto")KJ(X,z,Z);else if(Q==="push")HJ(X,Z);else if(Q==="pull")eI(X,z);if(R$())BJ(X,J,Z);if($.watch)console.log(M("watching for changes... (Ctrl+C to stop)")),ZT(X,z,J,Z)}function KJ($,Z,X){HJ($,X)}function HJ($,Z){let X=l($),z=UJ(X);WJ(Z,z),console.log(`${I("◆")} sync .faf → CLAUDE.md ${M("← bi-sync")}`);let J=B0(G0(u($)));Y0(J,$)}function eI($,Z){let X=B0(G0(u($)));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=YJ(tI(Z));if(!z){console.error("CLAUDE.md not found.");return}let J=X4(z),Q=l($);if(J.project?.name)Q.project={...Q.project,name:J.project.name};if(J.project?.goal)Q.project={...Q.project,goal:J.project.goal};if(J.project?.main_language)Q.project={...Q.project,main_language:J.project.main_language};$0($,Q),console.log(`${I("◆")} sync CLAUDE.md → .faf ${M("← bi-sync (Trophy-gated)")}`);let Y=B0(G0(u($)));Y0(Y,$)}function BJ($,Z,X){let z=l($),J=GJ($).mtimeMs,Q=z4(Z)?GJ(Z).mtimeMs:0;if(!z4(Z)||J>Q){let Y=$T(z);qJ(X,Y),console.log(`${I("◆")} sync .faf → MEMORY.md ${M("← tri-sync")}`)}else console.log(`${I("◆")} sync MEMORY.md → .faf ${M("← tri-sync")}`)}function $T($){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
|
|
241
|
+
`}function ZT($,Z,X,z){let{watch:J}=_0("fs"),Q=null,Y=()=>{if(Q)clearTimeout(Q);Q=setTimeout(()=>{if(console.log(M("change detected...")),KJ($,Z,z),R$())BJ($,X,z)},200)};if(J($,Y),z4(Z))J(Z,Y);if(R$()&&z4(X))J(X,Y)}import{writeFileSync as XT}from"fs";c();function MJ($,Z={}){let X=$??f();if(!X)console.error(`Error: project.faf not found
|
|
242
242
|
|
|
243
|
-
Run 'faf init' to create one.`),process.exit(2);let z=
|
|
243
|
+
Run 'faf init' to create one.`),process.exit(2);let z=u(X),J=S8(z),Q=Z.output??X.replace(/\.faf$/,".fafb");XT(Q,J),console.log(`${I("compiled")} ${Q} ${M(`(${J.length} bytes)`)}`)}import{readFileSync as zT}from"fs";function OJ($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let X=new Uint8Array(zT($));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=qz(X);console.log(JSON.stringify(z,null,2))}function NJ($){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(!Kz(X)||typeof X.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!Vz.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}}c();function fZ($,Z={}){let X=$??f();if(!X)console.error(`Error: project.faf not found
|
|
244
244
|
|
|
245
|
-
Run 'faf init' to create one.`),process.exit(2);let z=
|
|
246
|
-
--strict requires 100%`)),process.exit(1)}import{join as
|
|
247
|
-
`)}function
|
|
248
|
-
`)}function
|
|
249
|
-
`)}function
|
|
250
|
-
`)}function
|
|
251
|
-
`)}function
|
|
245
|
+
Run 'faf init' to create one.`),process.exit(2);let z=l(X),J=NJ(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=u(X);if(!Uz(Q))console.log(`${A("invalid yaml")} ${X}`),process.exit(3);console.log(`${I("valid")} ${X}`);let Y=Q0(Q);if(Y0(Y,X,Z.verbose),Z.strict&&Y.score<100)console.log(M(`
|
|
246
|
+
--strict requires 100%`)),process.exit(1)}import{mkdirSync as gT}from"fs";import{resolve as fT}from"path";import{join as JT}from"path";var w0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),LJ=($)=>Array.isArray($)?$.join(", "):String($),QT=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),YT=new Set(["target_user","core_problem","mission_purpose"]);function WT($){let Z=[],X=(P="")=>Z.push(P),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(([,P])=>w0(P)):[],V=G.filter(([P])=>/test/i.test(P)),K=G.filter(([P])=>/lint|check/i.test(P)&&!/test/i.test(P)),H=G.filter(([P])=>!/test|lint|check/i.test(P)),L=(P)=>{let d=P.toLowerCase();if(/install|deps/.test(d))return 0;if(/^build$|build/.test(d)&&!/rebuild/.test(d))return 1;if(/^dev$|develop/.test(d))return 2;if(/^start$|run/.test(d))return 3;return 4},B=[...H].sort((P,d)=>L(P[0])-L(d[0])||P[0].localeCompare(d[0])),O=[...V,...K],T=V[0]?.[1],j=B.find(([P])=>/build/i.test(P))?.[1];X(Y1($)),X(),X(`# AGENTS.md — ${$.project?.name??"Project"}`),X();let S=[];if($.project?.main_language)S.push(String($.project.main_language));if(w0($.project?.type))S.push(`type: ${String($.project?.type)}`);if(w0($.project?.version))S.push(`v${String($.project?.version)}`);let b=$.project?.goal?String($.project.goal).trim():"";if(S.length)b+=(b?" — ":"")+S.join(" · ");if(b)X(b),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[P,d]of B)X(`${d} # ${P}`);X("```"),X()}if(O.length){X("## Run the tests"),X(),X("```bash");for(let[,P]of O)X(P);X("```"),X()}if(U&&U.length){X("## Where things live"),X();let P=U.map((d)=>{let r=String(d),u0=r.indexOf(" — ");return u0>0?{path:r.slice(0,u0),role:r.slice(u0+3)}:{path:r,role:""}});if(P.some((d)=>d.role)){X("| Path | Role |"),X("|------|------|");for(let d of P)X(`| \`${d.path}\` | ${d.role} |`)}else for(let d of P)X(`- \`${d.path}\``);X()}let y=new Map,x=(P)=>{if(!P)return;for(let[d,r]of Object.entries(P)){if(QT.has(d)||!w0(r))continue;let u0=vZ(d);if(!y.has(u0))y.set(u0,LJ(r))}};x(z?.working_style),x(J);let m=$.conventions??[];if(y.size||m.length){X("## Conventions"),X();for(let[P,d]of y)X(`- **${P}:** ${d}`);for(let P of m)if(w0(P))X(`- ${P}`);X()}let F=(z?.warnings??[]).filter((P)=>w0(P)),n=["read the tree"];if(T)n.push(`run the tests (\`${T}\`)`);if(j)n.push("build the project");for(let[,P]of K.slice(0,1))n.push(`\`${P}\``);X("## Guardrails"),X();for(let P of F)X(`- ${P}`);X(`- **Always OK:** ${[...new Set(n)].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 p=[];for(let[,P]of K)p.push(`\`${P}\` exits 0`);for(let[,P]of V)p.push(`\`${P}\` passes`);if(p.push("changes committed with a conventional message"),X("## Definition of Done"),X(),X(`Done when: ${[...new Set(p)].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 P=w0(Y.example)?` (see \`${Y.example}\`)`:"";X(`- Secrets live in \`${Y.secrets}\`${P}. Never read or commit them.`)}for(let P of Y.never??[])if(w0(P))X(`- Never read or commit \`${P}\`.`);X()}if(X("## Commit & PR"),X(),J&&w0(J.commit_style))X(`- Commit style: ${LJ(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 P=[];for(let[d,r]of Object.entries($.stack)){if(YT.has(d))continue;if(E0(r))P.push(`- **${g0(`stack.${d}`)}:** ${r.trim()}`)}if(P.length){X("## Stack"),X();for(let d of P)X(d);X()}}let T0=$.generated;if(w0(T0))X(`*Context authored: ${String(T0)}*`);return Z.join(`
|
|
247
|
+
`)}function DJ($,Z){e0(JT($,"AGENTS.md"),WT(Z))}import{existsSync as J4,readFileSync as IJ}from"fs";import{join as f2}from"path";function UT($,Z){let X=[],z=(U)=>J4(f2($,U)),J=(U)=>{try{return IJ(f2($,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 hZ($,Z){let X={...Z},z=null,J=f2($,"package.json");if(J4(J))try{z=JSON.parse(IJ(J,"utf-8"))}catch{z=null}let Q=p8($,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=d8($);if(W.length)X.key_files=W}if(!Z.security){let U=[".env",".env.local",".env.development"].find((q)=>J4(f2($,q)));if(U){let q=[".env.example",".env.sample",".env.template"].find((G)=>J4(f2($,G)));X.security={secrets:U,...q?{example:q}:{}}}}if(!Z.conventions){let W=UT($,z);if(W.length)X.conventions=W}return X}import{join as qT}from"path";function GT($){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(`# ${g0(`stack.${X}`)}: ${z.trim()}`)}return Z.push(""),Z.join(`
|
|
248
|
+
`)}function TJ($,Z){e0(qT($,".cursorrules"),GT(Z),"# faf:start","# faf:end")}import{join as VT}from"path";var KT=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),HT=new Set(["target_user","core_problem","mission_purpose"]);function BT($){let Z=[],X=$.instant_context,z=$.commands,J=$.key_files??X?.key_files,Q=z?Object.entries(z).filter(([,K])=>KT(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,L]of Object.entries($.stack)){if(HT.has(H))continue;if(E0(L))K.push(`- ${g0(`stack.${H}`)}: ${L.trim()}`)}if(K.length){Z.push(""),Z.push("## Stack");for(let H of K)Z.push(H)}}return Z.push(""),Z.push("## Before changing things"),Z.push(""),Z.push("- Ask first: dependency installs, deletions, migrations, schema changes, publish/release."),Z.push("- Never: force-push · push straight to `main` · commit secrets."),Z.push(""),Z.join(`
|
|
249
|
+
`)}function AJ($,Z){e0(VT($,"GEMINI.md"),BT(Z))}import{join as RJ}from"path";import{mkdirSync as MT}from"fs";var FJ=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],OT=new Set([...FJ.map(([$])=>$),"cicd"]);function NT($){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(OT.has(q))continue;if(E0(G))J.push(`- **${g0(`stack.${q}`)}:** ${G.trim()}`)}if(J.length>0)Z.push("## Tech stack","",...J,"");let Q=[];for(let[q,G]of FJ){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])=>`- **${g0(`human_context.${q}`)}:** ${G.trim()}`);if(U.length>0)Z.push("## Project context","",...U,"");return Z.join(`
|
|
250
|
+
`)}function _J($,Z){MT(RJ($,".github"),{recursive:!0}),e0(RJ($,".github","copilot-instructions.md"),NT(Z))}import{existsSync as LT,mkdirSync as DT,readFileSync as IT,writeFileSync as CJ}from"fs";import{join as PJ}from"path";var TT="https://mcpaas.live/grok/mcp/v1",EJ="mcp_servers.grok-faf-mcp";function AT($){return[`[${EJ}]`,`url = "${TT}"`,""].join(`
|
|
251
|
+
`)}function wJ($,Z){let X=PJ($,".grok"),z=PJ(X,"config.toml"),J=AT(Z);if(!LT(z))return DT(X,{recursive:!0}),CJ(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=IT(z,"utf-8");if(Q.includes(`[${EJ}]`))return"unchanged";let Y=Q.endsWith(`
|
|
254
254
|
|
|
255
255
|
`)?"":Q.endsWith(`
|
|
256
256
|
`)?`
|
|
257
257
|
`:`
|
|
258
258
|
|
|
259
|
-
`;return
|
|
260
|
-
`)}function
|
|
259
|
+
`;return CJ(z,Q+Y+J,"utf-8"),"merged"}c();import{writeFileSync as RT}from"fs";import{join as FT}from"path";var SJ=R2.orange,_T=R2.cyan,CT=R2.cyanDeep,PT="#FF9500",ET="#FF3B30",wT="#E6EDF3",ST="#6E7681",jJ={TROPHY:{glyph:"✪",color:SJ},GOLD:{glyph:"★",color:SJ},SILVER:{glyph:"◆",color:_T},BRONZE:{glyph:"◇",color:CT},GREEN:{glyph:"●",color:wT},YELLOW:{glyph:"●",color:PT},RED:{glyph:"○",color:ET},WHITE:{glyph:"♡",color:ST}};function F$($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var xJ=["who","what","why","where","when","how"];function Q4($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,X])=>`<div class="row"><div class="k">${F$(Z)}</div><div class="v">${F$(X)}</div></div>`).join(`
|
|
260
|
+
`)}function jT($,Z,X="project.faf"){let z=F$($.project?.name??"Project"),J=Z.tier?.name??"WHITE",Q=jJ[J]??jJ.WHITE,Y=Z.inherited?Z.represents?`inherited from ${F$(Z.represents)}`:"inherited":`${Z.score}%`,W=J==="TROPHY"&&!Z.inherited,U=$.human_context??{},q=xJ.map((B)=>[B,U[B]]),G=Object.entries(U).filter(([B])=>!xJ.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()!==""),L=K.filter(([,B])=>B==="slotignored").length;return`<!DOCTYPE html>
|
|
261
261
|
<html lang="en">
|
|
262
262
|
<head>
|
|
263
263
|
<meta charset="UTF-8">
|
|
@@ -298,105 +298,105 @@ 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} ${F$(J)}</span>
|
|
302
302
|
<span class="score">${Y}</span>
|
|
303
303
|
</header>
|
|
304
304
|
<div class="meter"><span></span></div>
|
|
305
|
-
${W?'<p class="award statline"><span class="awd-pre">✅ All Required slots filled.</span> <span class="awd-win">100% Trophy ✪ Awarded</span></p>':`<p class="muted statline">${Z.populated}/${Z.active} slots populated · ${Z.total} total${
|
|
305
|
+
${W?'<p class="award statline"><span class="awd-pre">✅ All Required slots filled.</span> <span class="awd-win">100% Trophy ✪ Awarded</span></p>':`<p class="muted statline">${Z.populated}/${Z.active} slots populated · ${Z.total} total${L?` · ${L} N/A`:""}</p>`}
|
|
306
306
|
|
|
307
307
|
<section>
|
|
308
308
|
<h2>The 6 W's</h2>
|
|
309
|
-
${
|
|
310
|
-
${G.length?
|
|
309
|
+
${Q4(q)||'<p class="muted">No human_context yet.</p>'}
|
|
310
|
+
${G.length?Q4(G):""}
|
|
311
311
|
</section>
|
|
312
312
|
|
|
313
313
|
<section>
|
|
314
314
|
<h2>Project</h2>
|
|
315
|
-
${
|
|
315
|
+
${Q4(V)||'<p class="muted">—</p>'}
|
|
316
316
|
</section>
|
|
317
317
|
|
|
318
318
|
<section>
|
|
319
319
|
<h2>Stack</h2>
|
|
320
|
-
${H.length?
|
|
320
|
+
${H.length?Q4(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>${F$(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 Y4($,Z,X,z="project.faf"){RT(FT($,"project.html"),jT(Z,X,z),"utf-8")}import{writeFileSync as xT}from"fs";import{join as bT}from"path";var bJ="application/vnd.faf+yaml",kT="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",yT=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function yJ($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&yT.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 vT($){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 h2($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:bJ,iana:`https://www.iana.org/assignments/media-types/${bJ}`,deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function uZ($,Z={}){let X={$schema:kT,name:yJ($),version:String($.project?.version??"0.1.0"),description:vT($)},z=cZ($)??$.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":h2($,Z)},X}var mZ="io.modelcontextprotocol.registry/publisher-provided",kJ=4096;function vJ($,Z={}){let X={"one.faf/context":h2($,Z)},z=new TextEncoder().encode(JSON.stringify(X)).length;if(z>kJ)throw Error(`publisher-provided _meta is ${z}B — exceeds the registry ${kJ}B cap`);return{[mZ]:X}}function gJ($){return yJ($)}function cZ($){let Z=$.project?.title;if(typeof Z==="string"){let X=Z.trim();if(X&&X.length<=100)return X}return}function fJ($,Z,X={}){let z=uZ(Z,X),J=bT($,"server-card");return xT(J,`${JSON.stringify(z,null,2)}
|
|
331
|
+
`,"utf-8"),J}c();function _$($={}){let Z=f();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
|
|
333
|
+
Run 'faf init' to create one.`),process.exit(2);let X=$.output?fT(process.cwd(),$.output):process.cwd();if($.output)gT(X,{recursive:!0});let z=l(Z),J=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.conductor&&!$.html&&!$.card;if(J||$.agents)DJ(X,hZ(X,z)),console.log(" AGENTS.md");if(J||$.cursor)TJ(X,z),console.log(" .cursorrules");if(J||$.gemini)AJ(X,hZ(X,z)),console.log(" GEMINI.md");if(J||$.copilot)_J(X,z),console.log(" .github/copilot-instructions.md");if($.grok){let Y=wJ(X,z);console.log(` .grok/config.toml (${Y})`)}if(J||$.html){let Y=Q0(u(Z));Y4(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=fJ(X,z);console.log(` ${Y.replace(`${X}/`,"")}`)}console.log(`${I("exported")} ${M(`from ${Z}`)}`)}import{existsSync as nJ,readFileSync as tT,writeFileSync as eT}from"fs";import{resolve as pZ}from"path";import{existsSync as hJ,mkdirSync as hT,readFileSync as uT,writeFileSync as mT}from"fs";import{dirname as mJ,join as uJ}from"path";var cT="https://faf.one/context",lT="JSONRPC",cJ="1.0",lZ=["a2a","mcp","registry","catalog"];function lJ($){return D0(uT($,"utf-8"))}function dJ($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let z of Z){let J=uJ($,z);if(hJ(J))return J}let X=mJ($);if(X!==$)for(let z of Z){let J=uJ(X,z);if(hJ(J))return J}return null}function dT($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function dZ($,Z={}){let X=dT($);if(X.length>0)return X;let z=Z.doorUrl?.trim();if(z)return[{protocol:"a2a",location:z,version:cJ}];return[]}function pT($,Z,X={}){let z=$.agent??{},J=dZ($,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=h2(Z,X),V=($.capabilities??[]).map((K)=>{let H=String(K.name??"").trim();if(!H)throw Error("A2A skill missing capabilities[].name");let L=Array.isArray(K.tags)?K.tags.map(String):[];return{id:H,name:H,description:String(K.description??"").trim()||H,tags:L}});return{name:Q,description:Y,supportedInterfaces:J.map((K)=>({url:String(K.location),protocolBinding:lT,protocolVersion:String(K.version??cJ)})),provider:{organization:U,url:q},version:W,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[{uri:cT,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 iT($){let Z=$.agent?.homepage;if(!Z)return"local";try{return new URL(Z).hostname.replace(/^www\./,"")}catch{return"local"}}function nT($,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 rT($,Z,X={}){let z=iT($),J=$.agent??{},Q=String(J.name??"agent"),Y=X.now??Z.generated??new Date().toISOString(),W=[];if(dZ($,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:nT($,X),updatedAt:Y});let U=sT($,"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 sT($,Z){let X=$.agent?.homepage;if(!X)return;try{return new URL(`/.well-known/${Z}`,X).href}catch{return}}function aT($,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 pJ($,Z){let X=$?{...$,entries:[...$.entries??[]]}:{specVersion:"1.0",entries:[]};for(let z of Z){let J=aT(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 W4($){let Z=$.opts??{},X=new Set($.targets?.length?$.targets:lZ),J={block:h2($.faf,Z)};if(X.has("mcp"))J.mcp=uZ($.faf,Z);if(X.has("registry")){let Q=cZ($.faf);J.registry={name:gJ($.faf),...Q?{title:Q}:{},_meta:vJ($.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(dZ($.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=pT($.fafa,$.faf,Z);if(X.has("catalog")&&$.fafa)J.catalog=rT($.fafa,$.faf,Z);return oT(J),J}function oT($){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 u2($,Z){hT(mJ($),{recursive:!0}),mT($,`${JSON.stringify(Z,null,2)}
|
|
334
|
+
`,"utf-8")}function iJ($){if(!$)return;let Z=$.split(",").map((z)=>z.trim().toLowerCase()).filter(Boolean),X=Z.filter((z)=>!lZ.includes(z));if(X.length)throw Error(`unknown card target: ${X.join(", ")} (use ${lZ.join(",")})`);return Z}c();var $A=["$schema","name","title","description","icons","version","repository","websiteUrl","packages","remotes","_meta"];function rJ($={}){let Z=$.faf?pZ($.faf):f();if(!Z||!nJ(Z))console.error(`Error: project.faf not found
|
|
335
335
|
|
|
336
|
-
Run 'faf init' to create one.`),process.exit(2);let X=
|
|
336
|
+
Run 'faf init' to create one.`),process.exit(2);let X=l(Z),z=pZ($.in??"./server.json");if(!nJ(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(
|
|
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?.[mZ]?.["one.faf/context"]?.generated,W=$.generated??Y,U=W4({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 $A)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 L=`${JSON.stringify(H,null,2)}
|
|
340
|
+
`;if($.check){process.stdout.write(L);return}let B=pZ($.out??z);eT(B,L),console.error(`${I("✓")} ${B} — name=${q} title=${G??"(none)"} ${M("(identity emitted from faf-cli)")}`)}import{existsSync as U4,readFileSync as sJ}from"fs";import{join as q4,resolve as iZ}from"path";c();function aJ($={}){let Z=$.dir?iZ($.dir):process.cwd(),X;try{X=iJ($.target)}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}let z=$.faf?iZ($.faf):f(Z);if(!z||!U4(z))console.error(`Error: project.faf not found
|
|
341
341
|
|
|
342
|
-
Run 'faf init' to create one.`),process.exit(2);let J=
|
|
343
|
-
`);return}let U=[];if(W.a2a){let q=
|
|
342
|
+
Run 'faf init' to create one.`),process.exit(2);let J=l(z),Q=$.fafa?iZ($.fafa):dJ(Z),Y=Q&&U4(Q)?lJ(Q):void 0,W;try{W=W4({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=q4(Z,".well-known","agent-card.json");u2(q,W.a2a),U.push(q)}if(W.mcp){let q=q4(Z,"server-card");u2(q,W.mcp),U.push(q)}if(W.catalog){let q=q4(Z,".well-known","ai-catalog.json"),G;if(U4(q))G=JSON.parse(sJ(q,"utf-8"));u2(q,pJ(G,W.catalog)),U.push(q)}if(W.registry){let q=q4(Z,"server.json");if(U4(q)){let G=JSON.parse(sJ(q,"utf-8")),V={...G,name:W.registry.name,_meta:{...G._meta??{},...W.registry._meta}};if(W.registry.title)V.title=W.registry.title;u2(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 ZA}from"path";import XA from"open";c();function zA($){if(process.env.CI)return!1;try{return XA($).catch(()=>{return}),!0}catch{return!1}}function oJ(){let $=f();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=
|
|
348
|
-
`+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:X}}function
|
|
347
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=l($),z=Q0(u($));Y4(Z,X,z,$);let J=ZA(Z,"project.html"),Q=zA(J);console.log(" project.html"),console.log(Q?`${I("opened")} ${M("in your browser")}`:`${I("rendered")} ${M(`file://${J}`)}`)}import{mkdirSync as JA,rmSync as QA,existsSync as YA}from"fs";import{join as tJ,resolve as WA}from"path";import{execFileSync as UA}from"child_process";import{tmpdir as qA}from"os";c();function GA($){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 VA($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function KA($,Z,X){return["clone","--depth","1",...X?["--branch",X]:[],"--",$,Z]}function HA($,Z=process.cwd()){if($.stdout)return{outputPath:null};let X=$.output?WA(Z,$.output):tJ(Z,"project.faf");if(YA(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 eJ($,Z={},X=process.cwd()){let z;try{z=GA($)}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=HA(Z,X)}catch(Y){console.error(`Error: ${Y.message}`),process.exit(1);return}let Q=tJ(qA(),`faf-git-${Date.now()}`);JA(Q,{recursive:!0});try{console.error(M(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{UA("git",KA(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=I$(Q);if(Y.project&&/^faf-git-\d+$/.test(String(Y.project.name??"")))Y.project.name=VA(z);if(J.outputPath===null){process.stdout.write(KZ(Y));return}$0(J.outputPath,Y),console.log(`${I("created")} ${J.outputPath}`);let W=u(J.outputPath),U=B0(G0(W));Y0(U,J.outputPath)}finally{QA(Q,{recursive:!0,force:!0})}}import{execFileSync as _1}from"child_process";import{readFileSync as JQ,existsSync as QQ,appendFileSync as BA}from"fs";import{join as MA}from"path";var C$=($)=>String($).trim(),OA="slotignored",$Q=($)=>P0($)||typeof $==="string"&&$.trim().toLowerCase()===OA;function NA($,Z){let X=[],z=0,J=0;for(let Q of Z0){let Y=_2($,Q),W=_2(Z,Q),U=!$Q(Y),q=!$Q(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:C$(W)});else if(U&&!q)X.push({...V,kind:"removed",from:C$(Y)});else if(U&&q&&C$(Y)!==C$(W))X.push({...V,kind:"changed",from:C$(Y),to:C$(W)})}return{changes:X,filledBase:z,filledTarget:J}}function ZQ($){if(!$.trim())return 0;try{return Q0($).score??0}catch{return 0}}function XQ($){if(!$.trim())return{};try{return Yz($)??{}}catch{return{}}}function K4($,Z){let{changes:X,filledBase:z,filledTarget:J}=NA(XQ($),XQ(Z)),Q=ZQ($),Y=ZQ(Z);return{changes:X,scoreBase:Q,scoreTarget:Y,scoreDelta:Y-Q,filledBase:z,filledTarget:J}}var LA={added:"+",removed:"-",changed:"~"},zQ=($)=>$>0?`+${$}`:`${$}`,G4=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function YQ($,Z,X){let z=[],J=l0(A1($.scoreBase)),Q=l0(A1($.scoreTarget));if(z.push(`project.faf ${Z} → ${X}`),z.push(`Score: ${$.scoreBase}% ${J} → ${$.scoreTarget}% ${Q} (${zQ($.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=LA[W.kind],q=W.label.padEnd(16);if(W.kind==="changed")z.push(` ${U} ${q} ${G4(W.from)} → ${G4(W.to)}`);else if(W.kind==="added")z.push(` ${U} ${q} ${G4(W.to)} (added)`);else z.push(` ${U} ${q} ${G4(W.from)} (removed)`)}}return z.push(""),z.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${zQ($.filledTarget-$.filledBase)})`),z.join(`
|
|
356
|
+
`)}function DA($,Z){try{return _1("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function m2($,Z){if(!DA($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function P$($,Z,X){try{return _1("git",["show",`${$}:${Z}`],{cwd:X,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function WQ($){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"&&QQ(Q)?JQ(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=K4(X($[1]),X($[4]));console.log(YQ(J,z($[1],$[2]),z($[4],$[5])))}catch(X){console.log(`${Z} — faf diff unavailable (${X instanceof Error?X.message:"error"})`)}}var V4="*.faf diff=faf";function nZ($){let[Z,...X]=$.trim().split(/\s+/);try{return _1(Z,X,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function UQ($){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 IA($){let Z=UQ($),X=MA(Z,".gitattributes"),z=QQ(X)?JQ(X,"utf-8"):"";if(!z.split(`
|
|
357
|
+
`).some((J)=>J.trim()===V4))BA(X,`${z&&!z.endsWith(`
|
|
358
358
|
`)?`
|
|
359
|
-
`:""}${
|
|
360
|
-
`),console.log(`✅ .gitattributes ${
|
|
359
|
+
`:""}${V4}
|
|
360
|
+
`),console.log(`✅ .gitattributes ${V4}`);else console.log(`• .gitattributes already opts in (${V4})`);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."),!nZ("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 TA($){UQ($);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 qQ($,Z={},X=process.cwd()){if(Z.installDriver)return IA(X);if(Z.uninstallDriver)return TA(X);let z=f(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=P$("HEAD",Q,X),q=u(z);else if($.includes("...")){let[V,K]=$.split("...");m2(V,X),m2(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=P$(H,Q,X),q=P$(K,Q,X)}else if($.includes("..")){let[V,K]=$.split("..");m2(V,X),m2(K,X),Y=V,W=K,U=P$(V,Q,X),q=P$(K,Q,X)}else m2($,X),Y=$,W="(working tree)",U=P$($,Q,X),q=u(z);let G=K4(U,q);if(Z.json)console.log(JSON.stringify({base:Y,target:W,...G},null,2));else console.log(YQ(G,Y,W))}import{execFileSync as rZ}from"child_process";function AA($){if(!$.trim())return 0;try{return Q0($).score??0}catch{return 0}}var RA=($)=>$>0?`+${$}`:`${$}`;function FA($){let Z=$.map((X)=>({...X,score:AA(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 _A($,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?" ·":RA(z.delta).padStart(4);X.push(` ${J} ${Q} ${z.date} ${z.hex} ${l0(A1(z.score))} ${z.subject}`)}return X.join(`
|
|
363
|
+
`)}function CA($,Z,X){try{return rZ("git",["show",`${$}:${Z}`],{cwd:X,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function GQ($={},Z=process.cwd()){let X=f(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[
|
|
365
|
+
Run 'faf init' to create one.`),process.exit(2);let z;try{z=rZ("git",["rev-parse","--show-toplevel"],{cwd:Z,encoding:"utf-8"}).trim()}catch{console.error("Error: not a git repository — faf log reads the .faf score across git history."),process.exit(2);return}let J=H$(X,Z),Q=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=rZ("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",J],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let W=Y.split(`
|
|
366
|
+
`).filter(Boolean).map((H)=>{let[L,B,O]=H.split("\x1F");return{hex:L,date:B,subject:O??""}}),U=Q>0?Math.min(W.length,Q+1):W.length,q=W.slice(0,U).map((H)=>({...H,raw:CA(H.hex,J,Z)})),G=FA(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=_A(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 H4}from"child_process";import{existsSync as sZ,readFileSync as aZ,writeFileSync as HQ,chmodSync as PA,mkdirSync as EA}from"fs";import{resolve as wA,dirname as SA}from"path";var B4="# >>> faf >>>",c2="# <<< faf <<<",VQ="faf hooks-run",jA=($)=>$>0?`+${$}`:`${$}`;function BQ($){return H4("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function KQ($,Z){try{return H4("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function MQ($,Z){try{return H4("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function oZ($){let Z=H4("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return wA($,Z)}function OQ($={},Z=process.cwd()){try{let X;try{X=BQ(Z)}catch{return}let z=f(Z);if(!z)return;let J=H$(z,Z),Q=KQ(`:${J}`,Z);if(Q===null)return;let Y=KQ(`HEAD:${J}`,Z)??"",W=K4(Y,Q),U=`${W.scoreBase}% → ${W.scoreTarget}% (${jA(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 xA($,Z){let X=$.trim().split(/\s+/)[0],z=Z?`${$} --strict || exit 1`:`${$} || true`;return[B4,`if command -v ${X} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${z}`,"fi",c2,""].join(`
|
|
369
|
+
`)}function bA($,Z={}){let X;try{X=BQ($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let z=MQ("core.hooksPath",$);if(z){let G=Z.runnerCmd??VQ;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=oZ($),Q=Z.runnerCmd??VQ;if(!nZ(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=xA(Q,!!Z.strict),W=sZ(J)?aZ(J,"utf-8"):"",U=W.indexOf(B4),q=W.indexOf(c2);if(U!==-1&&q!==-1){let G=W.slice(q+c2.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
|
|
376
|
-
`);let $=new Map;for(let Z of
|
|
374
|
+
${Y}`;return EA(SA(J),{recursive:!0}),HQ(J,W),PA(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 kA($){let Z;try{Z=oZ($)}catch{return console.error("Error: not a git repository."),!1}if(!sZ(Z))return console.log("• no pre-commit hook to clean."),!0;let X=aZ(Z,"utf-8"),z=X.indexOf(B4),J=X.indexOf(c2);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+c2.length).replace(/^\n/,"")).replace(/^#!\/bin\/sh\s*$/,`#!/bin/sh
|
|
375
|
+
`);return HQ(Z,Q),console.log("✅ faf pre-commit block removed (other hook content preserved)."),!0}function yA($){let Z;try{Z=oZ($)}catch{console.error("Error: not a git repository.");return}let X=MQ("core.hooksPath",$),z=sZ(Z)?aZ(Z,"utf-8"):"",J=z.includes(B4),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 NQ($={}){let Z=process.cwd();if($.install){if(!bA(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!kA(Z))process.exit(2);return}yA(Z)}c();function LQ($={}){if($.version||Object.keys($).length===0)gA()}function gA(){let $=tZ();console.log(`${I(A("faf"))} v${$.version}`),console.log(M(`kernel ${Gz()} IANA application/vnd.faf+yaml`))}var l2=[{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"}];c();function DQ(){console.log(`${I("formats")} ${M("— supported file types")}
|
|
376
|
+
`);let $=new Map;for(let Z of l2){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(` ${l2.length} formats across ${$.size} categories`))}c();import{readdirSync as fA,rmSync as hA}from"fs";import{tmpdir as uA}from"os";import{join as mA}from"path";function IQ(){let $=uA(),Z=0;try{let X=fA($);for(let z of X)if(z.startsWith("faf-git-"))hA(mA($,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 TQ($={}){let Z=f();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=
|
|
378
|
+
Run 'faf init' to create one.`),process.exit(2);if($.json){let X=l(Z);console.log(JSON.stringify(X,null,2))}else{let X=u(Z);console.log(X)}}c();function AQ(){let $=f();if(!$)console.error(`Error: project.faf not found
|
|
379
379
|
|
|
380
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=
|
|
381
|
-
`))}import{existsSync as
|
|
380
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=l($),X=[];for(let z of Z0){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 cA,statSync as RQ}from"fs";import{join as lA}from"path";c();var dA=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"];function FQ(){let $=f();if(!$)console.error(`Error: project.faf not found
|
|
382
382
|
|
|
383
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=
|
|
384
|
-
`),console.log(` ${A(".faf")} ${M(
|
|
385
|
-
run ${A("'faf sync'")} to resolve drift`))}function
|
|
383
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=RQ($).mtimeMs;console.log(`${I("drift")} ${M("— context file sync status")}
|
|
384
|
+
`),console.log(` ${A(".faf")} ${M(eZ(X))}`);let z=0;for(let J of dA){let Q=lA(Z,J);if(!cA(Q)){console.log(` ${M("○")} ${J} ${M("missing")}`);continue}let Y=RQ(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(eZ(Y))}`),z++;else console.log(` ${M("○")} ${J} ${M("older")} ${M(eZ(Y))}`),z++}if(z>0)console.log(M(`
|
|
385
|
+
run ${A("'faf sync'")} to resolve drift`))}function eZ($){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`}c();function _Q($,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=f();if(!X)console.error(`Error: project.faf not found
|
|
388
388
|
|
|
389
|
-
Run 'faf init' to create one.`),process.exit(2);let z=
|
|
389
|
+
Run 'faf init' to create one.`),process.exit(2);let z=l(X),J=$.split(".");if(J.length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let[Q,Y]=J;if(!z[Q]||typeof z[Q]!=="object")z[Q]={};z[Q][Y]=Z,$0(X,z),console.log(`${I("updated")} ${$} ${M("→")} ${Z}`)}import{existsSync as M4,readFileSync as $5}from"fs";import{join as d2}from"path";c();function CQ(){let $=process.cwd(),Z=[],X={faf_version:R1,project:{}},z=d2($,"CLAUDE.md");if(M4(z)){let U=$5(z,"utf-8"),q=X4(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=d2($,"AGENTS.md");if(M4(J)){let U=$5(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=d2($,"GEMINI.md");if(M4(Q)){let U=$5(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=d2($,".cursorrules");if(M4(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=f($);if(W){let U=l(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;$0(W,U),console.log(`${I("◆")} recover merged into ${W}`)}else{let U=d2($,"project.faf");$0(U,X),console.log(`${I("◆")} recover created ${U}`)}console.log(M(` sources: ${Z.join(", ")}`))}c();var p2=R1;function PQ($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
|
|
390
390
|
|
|
391
|
-
Run 'faf init' to create one.`),process.exit(2);let X=
|
|
392
|
-
`),console.log(` Status: ${$?
|
|
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=l(Z),z=X.faf_version??"unknown";if(z===p2){console.log(`${I("◆")} migrate already at v${p2}`);return}if(X.faf_version=p2,!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${p2}`),console.log(M(` would update ${Z}`));return}$0(Z,X),console.log(`${I("◆")} migrate v${z} → v${p2}`),console.log(M(` updated ${Z}`))}c();function EQ($){if($==="features")iA();else if($==="activate")nA();else pA()}function pA(){let $=R$();if(console.log(`${I("pro")} ${M("— FAF Pro status")}
|
|
392
|
+
`),console.log(` Status: ${$?H0(A("PRO")):A("Free")}`),console.log(""),!$)console.log(M(" Upgrade: faf pro activate"))}function iA(){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 nA(){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 rA}from"zlib";c();function wQ($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
|
|
395
395
|
|
|
396
|
-
Run 'faf init' to create one.`),process.exit(2);let X=
|
|
396
|
+
Run 'faf init' to create one.`),process.exit(2);let X=u(Z),J=rA(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
397
|
`),console.log(` ${Q}`),$.copy)try{let{execSync:Y}=_0("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 sA,writeFileSync as aA,rmSync as oA}from"fs";import{tmpdir as tA}from"os";import{join as SQ}from"path";c();function jQ(){let $=SQ(tA(),`faf-demo-${Date.now()}`);sA($,{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=
|
|
426
|
-
`)),console.log(` ${A("2.")} Scoring...`);let z=
|
|
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
|
|
425
|
+
`,X=SQ($,"project.faf");aA(X,Z),console.log(` ${A("1.")} Created sample project.faf`),console.log(M(` ${X}
|
|
426
|
+
`)),console.log(` ${A("2.")} Scoring...`);let z=B0(G0(u(X)));console.log(""),Y0(z,"project.faf",!0),oA($,{recursive:!0,force:!0}),console.log(`
|
|
427
|
+
${M(' Demo complete. Run "faf init" in your project to get started.')}`)}c();function xQ($,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=Z0.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=l2.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 bQ,existsSync as E$,mkdirSync as eA}from"fs";import{join as i1}from"path";c();var $R="Wolfe-Jam/faf-taf-git@v2.2.0";function kQ($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;if($==="setup"){JR(Z);return}QR(Z)}function ZR($){if(E$(i1($,"bun.lockb"))||E$(i1($,"bun.lock")))return"bun";if(E$(i1($,"pnpm-lock.yaml")))return"pnpm";if(E$(i1($,"yarn.lock")))return"yarn";return"npm"}var XR={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 zR($){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(E$(i1($,"package.json"))){let J=XR[ZR($)];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: ${$R}
|
|
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 JR($){let Z=process.cwd(),X=zR(Z),z=i1(Z,".github","workflows","taf.yml");if($.write){if(E$(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}eA(i1(Z,".github","workflows"),{recursive:!0}),bQ(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 QR($){console.error(M("note: `faf taf` (score snapshot) is deprecated — use `faf score --json`. (`faf taf setup` wires the Receipt Printer.)"));let Z=f();if(!Z)console.error(`Error: project.faf not found
|
|
467
467
|
|
|
468
|
-
Run 'faf init' to create one.`),process.exit(2);let X=
|
|
468
|
+
Run 'faf init' to create one.`),process.exit(2);let X=l(Z),z=u(Z),J=Q0(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)bQ($.output,Y,"utf-8"),console.log(`${I("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as YR}from"readline";import{existsSync as yQ,readFileSync as WR,writeFileSync as UR,unlinkSync as qR}from"fs";import{join as GR}from"path";c();var VR=".faf-session.json";function KR($,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 HR($,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 vQ($={}){T$(process.cwd(),"faf go");let Z=f();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=
|
|
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
|
|
470
|
+
Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=GR(X,VR),J=0;if($.resume&&yQ(z))try{J=JSON.parse(WR(z,"utf-8")).slotIndex,console.log(M(` resuming from slot #${J+1}`))}catch{}let Q=l(Z),Y=Z0.filter((H)=>{let L=KR(Q,H.path);return P0(L)&&L!=="slotignored"});if(Y.length===0){console.log(`${I("◆")} go all slots populated — ✪ Trophy`);let H=B0(G0(u(Z)));Y0(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=YR({input:process.stdin,output:process.stdout}),q=(H)=>new Promise((L)=>U.question(H,L)),G=0,V=Y.slice(J);for(let H=0;H<V.length;H++){let L=V[H],B=await q(` ${A(`#${L.index}`)} ${$4(L.path)} ${M(`(${L.path})`)}: `);if(B.toLowerCase()==="quit"){let O={slotIndex:J+H,fafPath:Z};UR(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;HR(Q,L.path,B.trim()),G++}if(U.close(),G>0)$0(Z,Q),console.log(`
|
|
473
|
+
${I("◆")} go filled ${G} slot${G===1?"":"s"}`);let K=B0(G0(u(Z)));if(Y0(K,Z),yQ(z))try{qR(z)}catch{}}c();var GF=[/^(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 VF($){if(typeof $!=="string")return!1;let Z=$.trim();if(Z.length<4||Z.length>280)return!1;return!GF.some((X)=>X.test(Z))}function KF($,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 HF($,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 vY($){if($==="analyze")await MF();else if($==="enhance")await BF();else console.log(`${I("ai")} ${M("— AI-powered features")}
|
|
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 gY(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
|
|
475
475
|
|
|
476
|
-
export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (
|
|
476
|
+
export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (yY(),kY));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 BF(){let $=f();if(!$)console.error(`Error: project.faf not found
|
|
479
479
|
|
|
480
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=
|
|
480
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=l($),X=u($),z=Z0.filter((U)=>{let q=KF(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 gY(),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=
|
|
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(VF(H))HF(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){$0($,Z),console.log(`
|
|
497
|
+
${I("◆")} ai enhance filled ${G} slot${G===1?"":"s"}${V>0?` (${V} rejected)`:""}`);let K=B0(G0(u($)));Y0(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 MF(){let $=f();if(!$)console.error(`Error: project.faf not found
|
|
500
500
|
|
|
501
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=
|
|
501
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=u($);console.log(`${I("ai")} analyze ${M("getting suggestions...")}`);let z=await(await gY()).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 M9,readFileSync as O9,readdirSync as OF}from"fs";import{join as fY}from"path";c();function hY($,Z){if($==="import")NF(Z);else if($==="export")LF();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 NF($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!M9($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:R1,project:{}};if(M9($)&&$.endsWith(".json")){let J=JSON.parse(O9($,"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(M9($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let J=D0(O9($,"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=OF($);for(let Q of J){let Y=fY($,Q);if(Q.endsWith(".json"))try{let W=JSON.parse(O9(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=f(X);if(z){let J=l(z);if(!J.project)J.project={};if(Z.project.name&&!J.project.name)J.project.name=Z.project.name;if(Z.project.goal&&!J.project.goal)J.project.goal=Z.project.goal;if(Z.project.main_language&&!J.project.main_language)J.project.main_language=Z.project.main_language;$0(z,J),console.log(`${I("◆")} conductor import merged into ${z}`)}else{let J=fY(X,"project.faf");$0(J,Z),console.log(`${I("◆")} conductor import created ${J}`)}}function LF(){let $=f();if(!$)console.error(`Error: project.faf not found
|
|
507
507
|
|
|
508
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=
|
|
509
|
-
`,"utf-8")}function
|
|
508
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=l($),X={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(X,null,2))}c();import{readdirSync as DF,readFileSync as IF,existsSync as TF}from"fs";import{join as AF}from"path";var RF=["BRAKE","ENGINE","AERO","TYRE","PIT"],FF=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function _F($){let Z=$.match(FF);if(!Z)return null;return Z[1].toUpperCase()}function CF($){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 PF($,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),L=H.length>0?`${H.join(" > ")} > ${K.name}`:K.name;X.push(L)}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 EF=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function uY($,Z=[]){let X;try{X=DF($,{withFileTypes:!0})}catch{return Z}for(let z of X){if(EF.has(z.name))continue;if(z.name.startsWith(".")&&z.name!==".")continue;let J=AF($,z.name);if(z.isDirectory())uY(J,Z);else if(z.isFile())Z.push(J)}return Z}function wF($){let Z=[];if(!TF($))return Z;let X=uY($);for(let z of X){let J=z.split("/").pop()??"",Q=CF(J);if(!Q.ok||!Q.lang)continue;let Y;try{Y=IF(z,"utf-8")}catch{continue}if(Q.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(Q.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let W=PF(Y,Q.lang),U=z.replace(`${$}/`,"");for(let q of W)Z.push({file:U,language:Q.lang,testName:q,tier:_F(q)})}return Z}function SF($){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 jF($){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 RF){let X=$.byTier[Z],z=(X/$.totalTests*100).toFixed(0),J=Z==="BRAKE"?H0("●"):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(H0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function mY($={}){let Z=$.path??"tests",X=wF(Z),z=SF(X);if($.json)console.log(JSON.stringify(z,null,2));else jF(z);if($.strict&&z.untiered>0)process.exit(1)}import{createHash as dY}from"crypto";import{readFileSync as pY,writeFileSync as xF,existsSync as iY}from"fs";import{join as nY,dirname as bF}from"path";c();var cY="faf-bench/1",kF={"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 yF($,Z){return kF[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var vF=[["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"]],k6=new Map;vF.forEach(($,Z)=>$.forEach((X)=>k6.set(X,Z)));var gF=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function N9($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function lY($){return N9($).split(" ").filter((Z)=>Z&&!gF.has(Z))}function fF($,Z){let X=N9($),z=N9(Z);if(!X||!z)return!1;if(X===z)return!0;let J=k6.get(X);if(J!==void 0&&k6.get(z)===J)return!0;let Q=lY($);if(Q.length===0)return!1;let Y=new Set(lY(Z));return Q.every((W)=>{if(Y.has(W))return!0;let U=k6.get(W);return U!==void 0&&[...Y].some((q)=>k6.get(q)===U)})}function hF($){let Z=Q0($),X=D0($),z=[],J={},Q=0;for(let U of Z0){if(Z.slots[U.path]!=="populated")continue;let q=_2(X,U);if(typeof q!=="string")continue;let G=q.trim();if(!G||OZ.has(G.toLowerCase()))continue;Q+=1,z.push({n:Q,path:U.path,question:yF(U.path,U.description)}),J[Q]=G}let Y=JSON.stringify({v:cY,q:z.map((U)=>[U.path,U.question])}),W=dY("sha256").update(Y).digest("hex").slice(0,12);return{version:cY,qsetHash:W,questions:z,answers:J}}function uF($,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()!==""&&fF($.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 rY=".faf-bench.json";function mF($){let Z=nY($,rY);if(!iY(Z))return null;try{return JSON.parse(pY(Z,"utf-8"))}catch{return null}}function cF($,Z){xF(nY($,rY),`${JSON.stringify(Z,null,2)}
|
|
509
|
+
`,"utf-8")}function L9($,Z){let X=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:X,hash:dY("sha256").update(X).digest("hex")}}var d4=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function lF($,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
|
-
${
|
|
514
|
-
${A(`faf bench — ${Z}`)} ${
|
|
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 ${
|
|
511
|
+
`),console.log(` ${M("without context")} ${I("with .faf")}`),console.log(`answers ${X.score}/${X.total} ${A(`${z.score}/${z.total}`)}`),console.log(`tokens ${d4(X.tokens)} ${d4(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=L9($,Z);console.log(`
|
|
513
|
+
${H0("✪ 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 dF($,Z){let X=$.cold,z=X.total-X.score;if(console.log(`
|
|
514
|
+
${A(`faf bench — ${Z}`)} ${H0("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 ${d4(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 pF="https://mcpaas.live/bench/submit";async function iF($,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 sY($,Z,X={}){let z=X.file??f();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=
|
|
519
|
+
Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let J=u(z),Q=hF(J),Y=bF(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||!
|
|
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||!iY(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(pY(Z,"utf-8")),q=U.answers??U,G=uF(Q,q),V={score:G.correct,total:G.total,...X.tokens?{tokens:parseInt(X.tokens,10)}:{},...X.model?{model:X.model}:{}},K=mF(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(cF(Y,H),X.json){let L=L9(H,W);console.log(JSON.stringify({...H,receipt:L.hash,perQuestion:G.perQuestion},null,2));return}if(H.cold&&H.faf)lF(H,W);if(X.submit&&H.cold&&H.faf){let{cold:L,faf:B}=H,O=L9(H,W);iF({date:new Date().toISOString().slice(0,10),model:B.model??L.model??X.model??"unreported",repo:W,qset:H.qsetHash,cold:`${L.score}/${L.total}`,faf:`${B.score}/${B.total}`,sha256:O.hash.slice(0,16)},X.endpoint??pF)}else if(H.cold)dF(H,W);else console.log(`
|
|
523
|
+
${A(`faf bench — ${W}`)} ${I("with .faf")}: ${A(`${V.score}/${V.total}`)} ${M(`tokens ${d4(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 nF,writeFileSync as rF}from"fs";c();function aY($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
|
|
528
528
|
|
|
529
|
-
Run 'faf init' to create one.`),process.exit(2);let X=
|
|
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=u(Z),z=Q0(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(nF(q)){let V=S8(X);rF(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: ${l0(z.tier)} ${A(`${z.score}%`)}`)}if(J.exists())J.recordGrowth(z.score,["refresh — re-grounded"]);else J.birth(z.score)}c();import{existsSync as JW}from"fs";import{resolve as v6}from"path";var oY=["ephemeral","standard","high","critical"],Z$=Object.fromEntries(oY.map(($,Z)=>[$,Z])),D9=new Set(["user","feedback","project","reference"]),I9=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),T9=new Set(["facts","sessions","preferences","custom"]),A9={low:"ephemeral",medium:"standard"};import{readFileSync as sF,writeFileSync as aF,existsSync as oF}from"fs";function y6(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function I0($){return $===null||$===void 0}function p4($){if(I0($))return"standard";if(A9[$])return A9[$];if($ in Z$)return $;return"standard"}var tF=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function tY($){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(!tF.has(z))X[z]=J;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:p4(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 eY($){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 $1{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??y6(),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(!oF($))throw Error(`soul file not found: ${$}`);let Z=sF($,"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(!I9.has(U))Q[U]=structuredClone(q);let Y={};for(let[U,q]of Object.entries(z))if(!T9.has(U))Y[U]=structuredClone(q);let W=new $1(String(X.namepoint??$.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(X.profile??"voice"),facts:J.map(tY),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 $1.load($)}toDoc(){let $={facts:this._facts.map(eY),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[X,z]of Object.entries(this._memoryExtra))if(!T9.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(!I9.has(X))Z[X]=structuredClone(z);return Z}toYaml(){return A2(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 aF($,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:p4(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:y6(),source:Z.source??null,extra:{}})}recall($,Z={}){let X=Z$[p4(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 eF,readFileSync as $_,statSync as $W,existsSync as Z_}from"fs";import{join as X_,basename as ZW,resolve as z_}from"path";var XW=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),J_=/\[\[([^\]]+)\]\]/g;function Q_($){let Z=$W($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function Y_($){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 W_($,Z,X){if(!X.name)return null;let z=X.metadata&&typeof X.metadata==="object"?X.metadata:{},J=z.type;if(typeof J!=="string"||!D9.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(J_)].map((G)=>G[1]))].sort();return{text:W,id:Q,type:J,priority:"standard",tags:[],links:q,timestamp:Q_($),source:`claude-code memory: ${ZW($)}`,extra:U}}function R9($,Z={}){let X=z_($);if(!Z_(X))throw Error(`Claude memory directory not found: ${X}`);if(!$W(X).isDirectory())throw Error(`Claude memory path is not a directory: ${X}`);let z=Z.skip??XW,J=Z.namepoint??`@claude-code:${ZW(X)}`,Q=[],Y=eF(X).filter((V)=>V.endsWith(".md")).sort();for(let V of Y){if(z.has(V))continue;let K=X_(X,V),H;try{H=$_(K,"utf-8")}catch{continue}let{fm:L,body:B}=Y_(H);if(!L)continue;let O=W_(K,B,L);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):y6(),q=W.length?W.reduce((V,K)=>V>K?V:K):U,G=new $1(J,{profile:"knowledge",facts:Q,created:U});return G.last_etched=q,G.rebuildIndex(),G}function F9(){return v6(process.cwd(),"soul.fafm")}function _9($){let Z=v6($??F9());if(!JW(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 $1.load(Z)}function U_($,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=v6($);try{let z=R9(X,{namepoint:Z.namepoint}),J=v6(Z.output??F9());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 q_($){let Z=_9($.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 G_($,Z){let X=_9(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 V_($,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=v6(Z.file??F9()),z=JW(X)?$1.load(X):new $1(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 K_($){let Z=_9($.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
|
|
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 QW($,Z,X={}){if(Z&&typeof Z==="object")X=Z,Z=void 0;switch($){case"convert":U_(Z,X);break;case"ls":case"list":q_(X);break;case"recall":G_(Z,X);break;case"etch":V_(Z,X);break;case"show":K_(X);break;case void 0:case"help":zW();break;default:console.error(`Unknown memory subcommand: ${$}`),zW(),process.exit(2)}}function zW(){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:YW}=tZ(),g=new i9;g.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(YW,"-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(($)=>bZ($));g.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>$J());g.command("auto").description("Zero to 100% in one command").action(()=>t8());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(($)=>XJ($));g.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>vQ($));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)=>j8($,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)=>sY($,Z,X));g.command("show").description("Render project.faf → project.html and open it").action(()=>oJ());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(($)=>gZ($));g.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").action(($,Z)=>MJ($,Z));g.command("decompile <file>").description("Decompile .fafb to JSON").option("--output <path>","Output path").action(($,Z)=>OJ($,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)=>eJ($,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)=>qQ($,Z));g.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>WQ($??[]));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(($)=>GQ($));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(($)=>NQ($));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(($)=>OQ($));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(($)=>rJ($));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(($)=>aJ($));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)=>fZ($,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(($)=>LQ($));g.command("formats").description("Show supported formats").action(()=>DQ());g.command("clear").description("Clear cached data").action(()=>IQ());g.command("convert").description("Convert .faf to other formats").option("--json","Output as JSON").action(($)=>TQ($));g.command("context").description("Author context output").action(()=>AQ());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(($)=>aY($));g.command("drift").description("Check context drift").action(()=>FQ());g.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>_Q($,Z));g.command("recover").description("Recover .faf from context files").action(()=>CQ());g.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>PQ($));g.command("pro [subcommand]").description("Pro features & licensing").action(($)=>EQ($));g.command("share").description("Share .faf via URL").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>wQ($));g.command("demo").description("Demo walkthrough").action(()=>jQ());g.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>xQ($,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)=>kQ($,Z));g.command("ai [subcommand]").description("AI-powered features (enhance|analyze)").action(($)=>vY($));g.command("conductor [subcommand] [path]").description("Conductor integration").action(($,Z)=>hY($,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(($)=>mY($));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)=>QW($,Z,X));g.command("bi-sync",{hidden:!0}).action(()=>gZ());g.command("status",{hidden:!0}).action(()=>j8(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(($)=>fZ($));g.command("yolo",{hidden:!0}).action(()=>bZ({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:X}=await Promise.resolve().then(() => (c(),Wz)),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${YW}`)}`);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 j8(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=DF17850D534273D464756E2164756E21
|
|
546
546
|
//# sourceMappingURL=cli.js.map
|