faf-cli 7.12.1 → 7.13.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 +39 -32
- package/dist/cli.js +364 -337
- package/dist/cli.js.map +70 -59
- package/dist/core/cwd-guard.d.ts +8 -0
- package/dist/core/faf-dna.d.ts +147 -0
- package/dist/core/faf-source.d.ts +27 -0
- package/dist/core/json-edit.d.ts +77 -0
- package/dist/core/render-hash.d.ts +55 -0
- package/dist/core/safe-write.d.ts +228 -0
- package/dist/core/scorer.d.ts +7 -2
- package/dist/core/shape.d.ts +11 -0
- package/dist/core/slots.d.ts +30 -0
- package/dist/core/typed-none.d.ts +25 -0
- package/dist/core/types.d.ts +8 -0
- package/dist/core/yaml-edit.d.ts +136 -0
- package/dist/detect/assemble.d.ts +49 -5
- package/dist/detect/git-repo.d.ts +50 -0
- package/dist/detect/scanner.d.ts +9 -4
- package/dist/detect/stack.d.ts +14 -1
- package/dist/detect/turbo-cat-knowledge.d.ts +10 -0
- package/dist/detect/turbo-cat.d.ts +6 -2
- package/dist/fafm/index.d.ts +1 -0
- package/dist/fafm/soul.d.ts +108 -6
- package/dist/index.d.ts +24 -3
- package/dist/index.js +203 -163
- package/dist/index.js.map +35 -23
- package/dist/interop/cards.d.ts +52 -3
- package/dist/interop/claude-memory.d.ts +134 -0
- package/dist/interop/claude.d.ts +5 -1
- package/dist/interop/commonmark.d.ts +144 -0
- package/dist/interop/copilot-instructions.d.ts +1 -0
- package/dist/interop/faf.d.ts +123 -11
- package/dist/interop/inject.d.ts +112 -22
- package/dist/interop/projecthtml.d.ts +19 -2
- package/dist/interop/servercard.d.ts +51 -2
- package/dist/wasm/kernel.d.ts +7 -4
- package/package.json +5 -4
- package/project.faf +11 -4
package/dist/cli.js
CHANGED
|
@@ -1,176 +1,176 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as
|
|
3
|
-
`)}displayWidth($){return
|
|
4
|
-
`+" ".repeat(Z+W));return
|
|
5
|
-
${
|
|
6
|
-
`)}}function
|
|
2
|
+
import{createRequire as Wq}from"node:module";var aH=Object.create;var{getPrototypeOf:tH,defineProperty:mZ,getOwnPropertyNames:eH}=Object;var $q=Object.prototype.hasOwnProperty;function Zq($){return this[$]}var zq,Qq,Xq=($,Z,z)=>{var Q=$!=null&&typeof $==="object";if(Q){var X=Z?zq??=new WeakMap:Qq??=new WeakMap,J=X.get($);if(J)return J}z=$!=null?aH(tH($)):{};let Y=Z||!$||!$.__esModule?mZ(z,"default",{value:$,enumerable:!0}):z;for(let W of eH($))if(!$q.call(Y,W))mZ(Y,W,{get:Zq.bind($,W),enumerable:!0});if(Q)X.set($,Y);return Y};var F=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var Jq=($)=>$;function Yq($,Z){this[$]=Jq.bind(null,Z)}var _Q=($,Z)=>{for(var z in Z)mZ($,z,{get:Z[z],enumerable:!0,configurable:!0,set:Yq.bind(Z,z)})};var g=($,Z)=>()=>($&&(Z=$($=0)),Z);var l0=Wq(import.meta.url);var G1=F((Uq)=>{class cZ extends Error{constructor($,Z,z){super(z);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=Z,this.exitCode=$,this.nestedError=void 0}}class FQ extends cZ{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}Uq.CommanderError=cZ;Uq.InvalidArgumentError=FQ});var B8=F((Kq)=>{var{InvalidArgumentError:Hq}=G1();class PQ{constructor($,Z){switch(this.description=Z||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue($,Z){if(Z===this.defaultValue||!Array.isArray(Z))return[$];return Z.push($),Z}default($,Z){return this.defaultValue=$,this.defaultValueDescription=Z,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(Z,z)=>{if(!this.argChoices.includes(Z))throw new Hq(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,z);return Z},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function qq($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}Kq.Argument=PQ;Kq.humanReadableArgName=qq});var pZ=F((Nq)=>{var{humanReadableArgName:Lq}=B8();class EQ{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext($){this.helpWidth=this.helpWidth??$.helpWidth??80}visibleCommands($){let Z=$.commands.filter((Q)=>!Q._hidden),z=$._getHelpCommand();if(z&&!z._hidden)Z.push(z);if(this.sortSubcommands)Z.sort((Q,X)=>{return Q.name().localeCompare(X.name())});return Z}compareOptions($,Z){let z=(Q)=>{return Q.short?Q.short.replace(/^-/,""):Q.long.replace(/^--/,"")};return z($).localeCompare(z(Z))}visibleOptions($){let Z=$.options.filter((Q)=>!Q.hidden),z=$._getHelpOption();if(z&&!z.hidden){let Q=z.short&&$._findOption(z.short),X=z.long&&$._findOption(z.long);if(!Q&&!X)Z.push(z);else if(z.long&&!X)Z.push($.createOption(z.long,z.description));else if(z.short&&!Q)Z.push($.createOption(z.short,z.description))}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let Z=[];for(let z=$.parent;z;z=z.parent){let Q=z.options.filter((X)=>!X.hidden);Z.push(...Q)}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((Z)=>{Z.description=Z.description||$._argsDescription[Z.name()]||""});if($.registeredArguments.find((Z)=>Z.description))return $.registeredArguments;return[]}subcommandTerm($){let Z=$.registeredArguments.map((z)=>Lq(z)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(Z?" "+Z:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,Z){return Z.visibleCommands($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleSubcommandTerm(Z.subcommandTerm(Q))))},0)}longestOptionTermLength($,Z){return Z.visibleOptions($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(Q))))},0)}longestGlobalOptionTermLength($,Z){return Z.visibleGlobalOptions($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(Q))))},0)}longestArgumentTermLength($,Z){return Z.visibleArguments($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleArgumentTerm(Z.argumentTerm(Q))))},0)}commandUsage($){let Z=$._name;if($._aliases[0])Z=Z+"|"+$._aliases[0];let z="";for(let Q=$.parent;Q;Q=Q.parent)z=Q.name()+" "+z;return z+Z+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((z)=>JSON.stringify(z)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)Z.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)Z.push(`env: ${$.envVar}`);if(Z.length>0){let z=`(${Z.join(", ")})`;if($.description)return`${$.description} ${z}`;return z}return $.description}argumentDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((z)=>JSON.stringify(z)).join(", ")}`);if($.defaultValue!==void 0)Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(Z.length>0){let z=`(${Z.join(", ")})`;if($.description)return`${$.description} ${z}`;return z}return $.description}formatItemList($,Z,z){if(Z.length===0)return[];return[z.styleTitle($),...Z,""]}groupItems($,Z,z){let Q=new Map;return $.forEach((X)=>{let J=z(X);if(!Q.has(J))Q.set(J,[])}),Z.forEach((X)=>{let J=z(X);if(!Q.has(J))Q.set(J,[]);Q.get(J).push(X)}),Q}formatHelp($,Z){let z=Z.padWidth($,Z),Q=Z.helpWidth??80;function X(V,H){return Z.formatItem(V,z,H,Z)}let J=[`${Z.styleTitle("Usage:")} ${Z.styleUsage(Z.commandUsage($))}`,""],Y=Z.commandDescription($);if(Y.length>0)J=J.concat([Z.boxWrap(Z.styleCommandDescription(Y),Q),""]);let W=Z.visibleArguments($).map((V)=>{return X(Z.styleArgumentTerm(Z.argumentTerm(V)),Z.styleArgumentDescription(Z.argumentDescription(V)))});if(J=J.concat(this.formatItemList("Arguments:",W,Z)),this.groupItems($.options,Z.visibleOptions($),(V)=>V.helpGroupHeading??"Options:").forEach((V,H)=>{let q=V.map((K)=>{return X(Z.styleOptionTerm(Z.optionTerm(K)),Z.styleOptionDescription(Z.optionDescription(K)))});J=J.concat(this.formatItemList(H,q,Z))}),Z.showGlobalOptions){let V=Z.visibleGlobalOptions($).map((H)=>{return X(Z.styleOptionTerm(Z.optionTerm(H)),Z.styleOptionDescription(Z.optionDescription(H)))});J=J.concat(this.formatItemList("Global Options:",V,Z))}return this.groupItems($.commands,Z.visibleCommands($),(V)=>V.helpGroup()||"Commands:").forEach((V,H)=>{let q=V.map((K)=>{return X(Z.styleSubcommandTerm(Z.subcommandTerm(K)),Z.styleSubcommandDescription(Z.subcommandDescription(K)))});J=J.concat(this.formatItemList(H,q,Z))}),J.join(`
|
|
3
|
+
`)}displayWidth($){return wQ($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((Z)=>{if(Z==="[options]")return this.styleOptionText(Z);if(Z==="[command]")return this.styleSubcommandText(Z);if(Z[0]==="["||Z[0]==="<")return this.styleArgumentText(Z);return this.styleCommandText(Z)}).join(" ")}styleCommandDescription($){return this.styleDescriptionText($)}styleOptionDescription($){return this.styleDescriptionText($)}styleSubcommandDescription($){return this.styleDescriptionText($)}styleArgumentDescription($){return this.styleDescriptionText($)}styleDescriptionText($){return $}styleOptionTerm($){return this.styleOptionText($)}styleSubcommandTerm($){return $.split(" ").map((Z)=>{if(Z==="[options]")return this.styleOptionText(Z);if(Z[0]==="["||Z[0]==="<")return this.styleArgumentText(Z);return this.styleSubcommandText(Z)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,Z){return Math.max(Z.longestOptionTermLength($,Z),Z.longestGlobalOptionTermLength($,Z),Z.longestSubcommandTermLength($,Z),Z.longestArgumentTermLength($,Z))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,Z,z,Q){let J=" ".repeat(2);if(!z)return J+$;let Y=$.padEnd(Z+$.length-Q.displayWidth($)),W=2,G=(this.helpWidth??80)-Z-W-2,V;if(G<this.minWidthToWrap||Q.preformatted(z))V=z;else V=Q.boxWrap(z,G).replace(/\n/g,`
|
|
4
|
+
`+" ".repeat(Z+W));return J+Y+" ".repeat(W)+V.replace(/\n/g,`
|
|
5
|
+
${J}`)}boxWrap($,Z){if(Z<this.minWidthToWrap)return $;let z=$.split(/\r\n|\n/),Q=/[\s]*[^\s]+/g,X=[];return z.forEach((J)=>{let Y=J.match(Q);if(Y===null){X.push("");return}let W=[Y.shift()],U=this.displayWidth(W[0]);Y.forEach((G)=>{let V=this.displayWidth(G);if(U+V<=Z){W.push(G),U+=V;return}X.push(W.join(""));let H=G.trimStart();W=[H],U=this.displayWidth(H)}),X.push(W.join(""))}),X.join(`
|
|
6
|
+
`)}}function wQ($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}Nq.Help=EQ;Nq.stripColor=wQ});var lZ=F((Aq)=>{var{InvalidArgumentError:Iq}=G1();class SQ{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let z=Tq($);if(this.short=z.shortFlag,this.long=z.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default($,Z){return this.defaultValue=$,this.defaultValueDescription=Z,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let Z=$;if(typeof $==="string")Z={[$]:!0};return this.implied=Object.assign(this.implied||{},Z),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_collectValue($,Z){if(Z===this.defaultValue||!Array.isArray(Z))return[$];return Z.push($),Z}choices($){return this.argChoices=$.slice(),this.parseArg=(Z,z)=>{if(!this.argChoices.includes(Z))throw new Iq(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,z);return Z},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return jQ(this.name().replace(/^no-/,""));return jQ(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class xQ{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((Z)=>{if(Z.negate)this.negativeOptions.set(Z.attributeName(),Z);else this.positiveOptions.set(Z.attributeName(),Z)}),this.negativeOptions.forEach((Z,z)=>{if(this.positiveOptions.has(z))this.dualOptions.add(z)})}valueFromOption($,Z){let z=Z.attributeName();if(!this.dualOptions.has(z))return!0;let Q=this.negativeOptions.get(z).presetArg,X=Q!==void 0?Q:!1;return Z.negate===(X===$)}}function jQ($){return $.split("-").reduce((Z,z)=>{return Z+z[0].toUpperCase()+z.slice(1)})}function Tq($){let Z,z,Q=/^-[^-]$/,X=/^--[^-]/,J=$.split(/[ |,]+/).concat("guard");if(Q.test(J[0]))Z=J.shift();if(X.test(J[0]))z=J.shift();if(!Z&&Q.test(J[0]))Z=J.shift();if(!Z&&X.test(J[0]))Z=z,z=J.shift();if(J[0].startsWith("-")){let Y=J[0],W=`option creation failed due to '${Y}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${W}
|
|
7
7
|
- a short flag is a single dash and a single character
|
|
8
8
|
- either use a single dash and a single character (for a short flag)
|
|
9
|
-
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(
|
|
10
|
-
- too many short flags`);if(
|
|
9
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(Q.test(Y))throw Error(`${W}
|
|
10
|
+
- too many short flags`);if(X.test(Y))throw Error(`${W}
|
|
11
11
|
- too many long flags`);throw Error(`${W}
|
|
12
|
-
- unrecognised flag format`)}if(Z===void 0&&
|
|
13
|
-
(Did you mean one of ${
|
|
14
|
-
(Did you mean ${
|
|
15
|
-
- specify the name in Command constructor or using .name()`);if(Z=Z||{},Z.isDefault)this._defaultCommandName=$._name;if(Z.noHelp||Z.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,Z){return new
|
|
16
|
-
Expecting one of '${
|
|
17
|
-
- already used by option '${Z.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let Z=(
|
|
18
|
-
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,Z,
|
|
19
|
-
- if '${
|
|
12
|
+
- unrecognised flag format`)}if(Z===void 0&&z===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:Z,longFlag:z}}Aq.Option=SQ;Aq.DualOptions=xQ});var kQ=F((Pq)=>{function _q($,Z){if(Math.abs($.length-Z.length)>3)return Math.max($.length,Z.length);let z=[];for(let Q=0;Q<=$.length;Q++)z[Q]=[Q];for(let Q=0;Q<=Z.length;Q++)z[0][Q]=Q;for(let Q=1;Q<=Z.length;Q++)for(let X=1;X<=$.length;X++){let J=1;if($[X-1]===Z[Q-1])J=0;else J=1;if(z[X][Q]=Math.min(z[X-1][Q]+1,z[X][Q-1]+1,z[X-1][Q-1]+J),X>1&&Q>1&&$[X-1]===Z[Q-2]&&$[X-2]===Z[Q-1])z[X][Q]=Math.min(z[X][Q],z[X-2][Q-2]+1)}return z[$.length][Z.length]}function Fq($,Z){if(!Z||Z.length===0)return"";Z=Array.from(new Set(Z));let z=$.startsWith("--");if(z)$=$.slice(2),Z=Z.map((Y)=>Y.slice(2));let Q=[],X=3,J=0.4;if(Z.forEach((Y)=>{if(Y.length<=1)return;let W=_q($,Y),U=Math.max($.length,Y.length);if((U-W)/U>J){if(W<X)X=W,Q=[Y];else if(W===X)Q.push(Y)}}),Q.sort((Y,W)=>Y.localeCompare(W)),z)Q=Q.map((Y)=>`--${Y}`);if(Q.length>1)return`
|
|
13
|
+
(Did you mean one of ${Q.join(", ")}?)`;if(Q.length===1)return`
|
|
14
|
+
(Did you mean ${Q[0]}?)`;return""}Pq.suggestSimilar=Fq});var gQ=F((yq)=>{var wq=l0("node:events").EventEmitter,dZ=l0("node:child_process"),P2=l0("node:path"),M8=l0("node:fs"),e=l0("node:process"),{Argument:jq,humanReadableArgName:Sq}=B8(),{CommanderError:iZ}=G1(),{Help:xq,stripColor:kq}=pZ(),{Option:bQ,DualOptions:bq}=lZ(),{suggestSimilar:yQ}=kQ();class rZ extends wq{constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(Z)=>e.stdout.write(Z),writeErr:(Z)=>e.stderr.write(Z),outputError:(Z,z)=>z(Z),getOutHelpWidth:()=>e.stdout.isTTY?e.stdout.columns:void 0,getErrHelpWidth:()=>e.stderr.isTTY?e.stderr.columns:void 0,getOutHasColors:()=>nZ()??(e.stdout.isTTY&&e.stdout.hasColors?.()),getErrHasColors:()=>nZ()??(e.stderr.isTTY&&e.stderr.hasColors?.()),stripColor:(Z)=>kq(Z)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._helpOption=$._helpOption,this._helpCommand=$._helpCommand,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let Z=this;Z;Z=Z.parent)$.push(Z);return $}command($,Z,z){let Q=Z,X=z;if(typeof Q==="object"&&Q!==null)X=Q,Q=null;X=X||{};let[,J,Y]=$.match(/([^ ]+) *(.*)/),W=this.createCommand(J);if(Q)W.description(Q),W._executableHandler=!0;if(X.isDefault)this._defaultCommandName=W._name;if(W._hidden=!!(X.noHelp||X.hidden),W._executableFile=X.executableFile||null,Y)W.arguments(Y);if(this._registerCommand(W),W.parent=this,W.copyInheritedSettings(this),Q)return this;return W}createCommand($){return new rZ($)}createHelp(){return Object.assign(new xq,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 jq($,Z)}argument($,Z,z,Q){let X=this.createArgument($,Z);if(typeof z==="function")X.default(Q).argParser(z);else X.default(z);return this.addArgument(X),this}arguments($){return $.trim().split(/ +/).forEach((Z)=>{this.argument(Z)}),this}addArgument($){let Z=this.registeredArguments.slice(-1)[0];if(Z?.variadic)throw Error(`only the last argument can be variadic '${Z.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}helpCommand($,Z){if(typeof $==="boolean"){if(this._addImplicitHelpCommand=$,$&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let z=$??"help [command]",[,Q,X]=z.match(/([^ ]+) *(.*)/),J=Z??"display help for command",Y=this.createCommand(Q);if(Y.helpOption(!1),X)Y.arguments(X);if(J)Y.description(J);if(this._addImplicitHelpCommand=!0,this._helpCommand=Y,$||Z)this._initCommandGroup(Y);return this}addHelpCommand($,Z){if(typeof $!=="object")return this.helpCommand($,Z),this;return this._addImplicitHelpCommand=!0,this._helpCommand=$,this._initCommandGroup($),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook($,Z){let z=["preSubcommand","preAction","postAction"];if(!z.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
|
|
16
|
+
Expecting one of '${z.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(Z);else this._lifeCycleHooks[$]=[Z];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(Z)=>{if(Z.code!=="commander.executeSubCommandAsync")throw Z};return this}_exit($,Z,z){if(this._exitCallback)this._exitCallback(new iZ($,Z,z));e.exit($)}action($){let Z=(z)=>{let Q=this.registeredArguments.length,X=z.slice(0,Q);if(this._storeOptionsAsProperties)X[Q]=this;else X[Q]=this.opts();return X.push(this),$.apply(this,X)};return this._actionHandler=Z,this}createOption($,Z){return new bQ($,Z)}_callParseArg($,Z,z,Q){try{return $.parseArg(Z,z)}catch(X){if(X.code==="commander.invalidArgument"){let J=`${Q} ${X.message}`;this.error(J,{exitCode:X.exitCode,code:X.code})}throw X}}_registerOption($){let Z=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(Z){let z=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${z}'
|
|
17
|
+
- already used by option '${Z.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let Z=(Q)=>{return[Q.name()].concat(Q.aliases())},z=Z($).find((Q)=>this._findCommand(Q));if(z){let Q=Z(this._findCommand(z)).join("|"),X=Z($).join("|");throw Error(`cannot add command '${X}' as already have command '${Q}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let Z=$.name(),z=$.attributeName();if($.negate){let X=$.long.replace(/^--no-/,"--");if(!this._findOption(X))this.setOptionValueWithSource(z,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(z,$.defaultValue,"default");let Q=(X,J,Y)=>{if(X==null&&$.presetArg!==void 0)X=$.presetArg;let W=this.getOptionValue(z);if(X!==null&&$.parseArg)X=this._callParseArg($,X,W,J);else if(X!==null&&$.variadic)X=$._collectValue(X,W);if(X==null)if($.negate)X=!1;else if($.isBoolean()||$.optional)X=!0;else X="";this.setOptionValueWithSource(z,X,Y)};if(this.on("option:"+Z,(X)=>{let J=`error: option '${$.flags}' argument '${X}' is invalid.`;Q(X,J,"cli")}),$.envVar)this.on("optionEnv:"+Z,(X)=>{let J=`error: option '${$.flags}' value '${X}' from env '${$.envVar}' is invalid.`;Q(X,J,"env")});return this}_optionEx($,Z,z,Q,X){if(typeof Z==="object"&&Z instanceof bQ)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let J=this.createOption(Z,z);if(J.makeOptionMandatory(!!$.mandatory),typeof Q==="function")J.default(X).argParser(Q);else if(Q instanceof RegExp){let Y=Q;Q=(W,U)=>{let G=Y.exec(W);return G?G[0]:U},J.default(X).argParser(Q)}else J.default(Q);return this.addOption(J)}option($,Z,z,Q){return this._optionEx({},$,Z,z,Q)}requiredOption($,Z,z,Q){return this._optionEx({mandatory:!0},$,Z,z,Q)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,Z){return this.setOptionValueWithSource($,Z,void 0)}setOptionValueWithSource($,Z,z){if(this._storeOptionsAsProperties)this[$]=Z;else this._optionValues[$]=Z;return this._optionValueSources[$]=z,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let Z;return this._getCommandAndAncestors().forEach((z)=>{if(z.getOptionValueSource($)!==void 0)Z=z.getOptionValueSource($)}),Z}_prepareUserArgs($,Z){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(Z=Z||{},$===void 0&&Z.from===void 0){if(e.versions?.electron)Z.from="electron";let Q=e.execArgv??[];if(Q.includes("-e")||Q.includes("--eval")||Q.includes("-p")||Q.includes("--print"))Z.from="eval"}if($===void 0)$=e.argv;this.rawArgs=$.slice();let z;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],z=$.slice(2);break;case"electron":if(e.defaultApp)this._scriptPath=$[1],z=$.slice(2);else z=$.slice(1);break;case"user":z=$.slice(0);break;case"eval":z=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${Z.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",z}parse($,Z){this._prepareForParse();let z=this._prepareUserArgs($,Z);return this._parseCommand([],z),this}async parseAsync($,Z){this._prepareForParse();let z=this._prepareUserArgs($,Z);return await this._parseCommand([],z),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
18
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,Z,z){if(M8.existsSync($))return;let Q=Z?`searched for local subcommand relative to directory '${Z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",X=`'${$}' does not exist
|
|
19
|
+
- if '${z}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
20
20
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
21
|
-
- ${
|
|
21
|
+
- ${Q}`;throw Error(X)}_executeSubCommand($,Z){Z=Z.slice();let z=!1,Q=[".js",".ts",".tsx",".mjs",".cjs"];function X(G,V){let H=P2.resolve(G,V);if(M8.existsSync(H))return H;if(Q.includes(P2.extname(V)))return;let q=Q.find((K)=>M8.existsSync(`${H}${K}`));if(q)return`${H}${q}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let G;try{G=M8.realpathSync(this._scriptPath)}catch{G=this._scriptPath}Y=P2.resolve(P2.dirname(G),Y)}if(Y){let G=X(Y,J);if(!G&&!$._executableFile&&this._scriptPath){let V=P2.basename(this._scriptPath,P2.extname(this._scriptPath));if(V!==this._name)G=X(Y,`${V}-${$._name}`)}J=G||J}z=Q.includes(P2.extname(J));let W;if(e.platform!=="win32")if(z)Z.unshift(J),Z=vQ(e.execArgv).concat(Z),W=dZ.spawn(e.argv[0],Z,{stdio:"inherit"});else W=dZ.spawn(J,Z,{stdio:"inherit"});else this._checkForMissingExecutable(J,Y,$._name),Z.unshift(J),Z=vQ(e.execArgv).concat(Z),W=dZ.spawn(e.execPath,Z,{stdio:"inherit"});if(!W.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((V)=>{e.on(V,()=>{if(W.killed===!1&&W.exitCode===null)W.kill(V)})});let U=this._exitCallback;W.on("close",(G)=>{if(G=G??1,!U)e.exit(G);else U(new iZ(G,"commander.executeSubCommandAsync","(close)"))}),W.on("error",(G)=>{if(G.code==="ENOENT")this._checkForMissingExecutable(J,Y,$._name);else if(G.code==="EACCES")throw Error(`'${J}' not executable`);if(!U)e.exit(1);else{let V=new iZ(1,"commander.executeSubCommandAsync","(error)");V.nestedError=G,U(V)}}),this.runningCommand=W}_dispatchSubcommand($,Z,z){let Q=this._findCommand($);if(!Q)this.help({error:!0});Q._prepareForParse();let X;return X=this._chainOrCallSubCommandHook(X,Q,"preSubcommand"),X=this._chainOrCall(X,()=>{if(Q._executableHandler)this._executeSubCommand(Q,Z.concat(z));else return Q._parseCommand(Z,z)}),X}_dispatchHelpCommand($){if(!$)this.help();let Z=this._findCommand($);if(Z&&!Z._executableHandler)Z.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,Z)=>{if($.required&&this.args[Z]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(z,Q,X)=>{let J=Q;if(Q!==null&&z.parseArg){let Y=`error: command-argument value '${Q}' is invalid for argument '${z.name()}'.`;J=this._callParseArg(z,Q,X,Y)}return J};this._checkNumberOfArguments();let Z=[];this.registeredArguments.forEach((z,Q)=>{let X=z.defaultValue;if(z.variadic){if(Q<this.args.length){if(X=this.args.slice(Q),z.parseArg)X=X.reduce((J,Y)=>{return $(z,Y,J)},z.defaultValue)}else if(X===void 0)X=[]}else if(Q<this.args.length){if(X=this.args[Q],z.parseArg)X=$(z,X,z.defaultValue)}Z[Q]=X}),this.processedArgs=Z}_chainOrCall($,Z){if($?.then&&typeof $.then==="function")return $.then(()=>Z());return Z()}_chainOrCallHooks($,Z){let z=$,Q=[];if(this._getCommandAndAncestors().reverse().filter((X)=>X._lifeCycleHooks[Z]!==void 0).forEach((X)=>{X._lifeCycleHooks[Z].forEach((J)=>{Q.push({hookedCommand:X,callback:J})})}),Z==="postAction")Q.reverse();return Q.forEach((X)=>{z=this._chainOrCall(z,()=>{return X.callback(X.hookedCommand,this)})}),z}_chainOrCallSubCommandHook($,Z,z){let Q=$;if(this._lifeCycleHooks[z]!==void 0)this._lifeCycleHooks[z].forEach((X)=>{Q=this._chainOrCall(Q,()=>{return X(this,Z)})});return Q}_parseCommand($,Z){let z=this.parseOptions(Z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(z.operands),Z=z.unknown,this.args=$.concat(Z),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),Z);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(Z),this._dispatchSubcommand(this._defaultCommandName,$,Z);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(z.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Q=()=>{if(z.unknown.length>0)this.unknownOption(z.unknown[0])},X=`command:${this.name()}`;if(this._actionHandler){Q(),this._processArguments();let J;if(J=this._chainOrCallHooks(J,"preAction"),J=this._chainOrCall(J,()=>this._actionHandler(this.processedArgs)),this.parent)J=this._chainOrCall(J,()=>{this.parent.emit(X,$,Z)});return J=this._chainOrCallHooks(J,"postAction"),J}if(this.parent?.listenerCount(X))Q(),this._processArguments(),this.parent.emit(X,$,Z);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,Z);if(this.listenerCount("command:*"))this.emit("command:*",$,Z);else if(this.commands.length)this.unknownCommand();else Q(),this._processArguments()}else if(this.commands.length)Q(),this.help({error:!0});else Q(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((Z)=>Z._name===$||Z._aliases.includes($))}_findOption($){return this.options.find((Z)=>Z.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((Z)=>{if(Z.mandatory&&$.getOptionValue(Z.attributeName())===void 0)$.missingMandatoryOptionValue(Z)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((z)=>{let Q=z.attributeName();if(this.getOptionValue(Q)===void 0)return!1;return this.getOptionValueSource(Q)!=="default"});$.filter((z)=>z.conflictsWith.length>0).forEach((z)=>{let Q=$.find((X)=>z.conflictsWith.includes(X.attributeName()));if(Q)this._conflictingOption(z,Q)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let Z=[],z=[],Q=Z;function X(G){return G.length>1&&G[0]==="-"}let J=(G)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(G))return!1;return!this._getCommandAndAncestors().some((V)=>V.options.map((H)=>H.short).some((H)=>/^-\d$/.test(H)))},Y=null,W=null,U=0;while(U<$.length||W){let G=W??$[U++];if(W=null,G==="--"){if(Q===z)Q.push(G);Q.push(...$.slice(U));break}if(Y&&(!X(G)||J(G))){this.emit(`option:${Y.name()}`,G);continue}if(Y=null,X(G)){let V=this._findOption(G);if(V){if(V.required){let H=$[U++];if(H===void 0)this.optionMissingArgument(V);this.emit(`option:${V.name()}`,H)}else if(V.optional){let H=null;if(U<$.length&&(!X($[U])||J($[U])))H=$[U++];this.emit(`option:${V.name()}`,H)}else this.emit(`option:${V.name()}`);Y=V.variadic?V:null;continue}}if(G.length>2&&G[0]==="-"&&G[1]!=="-"){let V=this._findOption(`-${G[1]}`);if(V){if(V.required||V.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${V.name()}`,G.slice(2));else this.emit(`option:${V.name()}`),W=`-${G.slice(2)}`;continue}}if(/^--[^=]+=/.test(G)){let V=G.indexOf("="),H=this._findOption(G.slice(0,V));if(H&&(H.required||H.optional)){this.emit(`option:${H.name()}`,G.slice(V+1));continue}}if(Q===Z&&X(G)&&!(this.commands.length===0&&J(G)))Q=z;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&z.length===0){if(this._findCommand(G)){Z.push(G),z.push(...$.slice(U));break}else if(this._getHelpCommand()&&G===this._getHelpCommand().name()){Z.push(G,...$.slice(U));break}else if(this._defaultCommandName){z.push(G,...$.slice(U));break}}if(this._passThroughOptions){Q.push(G,...$.slice(U));break}Q.push(G)}return{operands:Z,unknown:z}}opts(){if(this._storeOptionsAsProperties){let $={},Z=this.options.length;for(let z=0;z<Z;z++){let Q=this.options[z].attributeName();$[Q]=Q===this._versionOptionName?this._version:this[Q]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,Z)=>Object.assign($,Z.opts()),{})}error($,Z){if(this._outputConfiguration.outputError(`${$}
|
|
22
22
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
23
23
|
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
|
|
24
|
-
`),this.outputHelp({error:!0});let
|
|
25
|
-
`),this._exit(0,"commander.version",$)}),this}description($,Z){if($===void 0&&Z===void 0)return this._description;if(this._description=$,Z)this._argsDescription=Z;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let Z=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)Z=this.commands[this.commands.length-1];if($===Z._name)throw Error("Command alias can't be the same as its name");let
|
|
26
|
-
Expecting one of '${
|
|
27
|
-
`)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((
|
|
28
|
-
`)}}
|
|
29
|
-
`)?
|
|
24
|
+
`),this.outputHelp({error:!0});let z=Z||{},Q=z.exitCode||1,X=z.code||"commander.error";this._exit(Q,X,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in e.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,e.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new bq(this.options),Z=(z)=>{return this.getOptionValue(z)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(z))};this.options.filter((z)=>z.implied!==void 0&&Z(z.attributeName())&&$.valueFromOption(this.getOptionValue(z.attributeName()),z)).forEach((z)=>{Object.keys(z.implied).filter((Q)=>!Z(Q)).forEach((Q)=>{this.setOptionValueWithSource(Q,z.implied[Q],"implied")})})}missingArgument($){let Z=`error: missing required argument '${$}'`;this.error(Z,{code:"commander.missingArgument"})}optionMissingArgument($){let Z=`error: option '${$.flags}' argument missing`;this.error(Z,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let Z=`error: required option '${$.flags}' not specified`;this.error(Z,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,Z){let z=(J)=>{let Y=J.attributeName(),W=this.getOptionValue(Y),U=this.options.find((V)=>V.negate&&Y===V.attributeName()),G=this.options.find((V)=>!V.negate&&Y===V.attributeName());if(U&&(U.presetArg===void 0&&W===!1||U.presetArg!==void 0&&W===U.presetArg))return U;return G||J},Q=(J)=>{let Y=z(J),W=Y.attributeName();if(this.getOptionValueSource(W)==="env")return`environment variable '${Y.envVar}'`;return`option '${Y.flags}'`},X=`error: ${Q($)} cannot be used with ${Q(Z)}`;this.error(X,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let Z="";if($.startsWith("--")&&this._showSuggestionAfterError){let Q=[],X=this;do{let J=X.createHelp().visibleOptions(X).filter((Y)=>Y.long).map((Y)=>Y.long);Q=Q.concat(J),X=X.parent}while(X&&!X._enablePositionalOptions);Z=yQ($,Q)}let z=`error: unknown option '${$}'${Z}`;this.error(z,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let Z=this.registeredArguments.length,z=Z===1?"":"s",X=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Z} argument${z} but got ${$.length}.`;this.error(X,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],Z="";if(this._showSuggestionAfterError){let Q=[];this.createHelp().visibleCommands(this).forEach((X)=>{if(Q.push(X.name()),X.alias())Q.push(X.alias())}),Z=yQ($,Q)}let z=`error: unknown command '${$}'${Z}`;this.error(z,{code:"commander.unknownCommand"})}version($,Z,z){if($===void 0)return this._version;this._version=$,Z=Z||"-V, --version",z=z||"output the version number";let Q=this.createOption(Z,z);return this._versionOptionName=Q.attributeName(),this._registerOption(Q),this.on("option:"+Q.name(),()=>{this._outputConfiguration.writeOut(`${$}
|
|
25
|
+
`),this._exit(0,"commander.version",$)}),this}description($,Z){if($===void 0&&Z===void 0)return this._description;if(this._description=$,Z)this._argsDescription=Z;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let Z=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)Z=this.commands[this.commands.length-1];if($===Z._name)throw Error("Command alias can't be the same as its name");let z=this.parent?._findCommand($);if(z){let Q=[z.name()].concat(z.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${Q}'`)}return Z._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((Z)=>this.alias(Z)),this}usage($){if($===void 0){if(this._usage)return this._usage;let Z=this.registeredArguments.map((z)=>{return Sq(z)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?Z:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}helpGroup($){if($===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=$,this}commandsGroup($){if($===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=$,this}optionsGroup($){if($===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=$,this}_initOptionGroup($){if(this._defaultOptionGroup&&!$.helpGroupHeading)$.helpGroup(this._defaultOptionGroup)}_initCommandGroup($){if(this._defaultCommandGroup&&!$.helpGroup())$.helpGroup(this._defaultCommandGroup)}nameFromFilename($){return this._name=P2.basename($,P2.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let Z=this.createHelp(),z=this._getOutputContext($);Z.prepareContext({error:z.error,helpWidth:z.helpWidth,outputHasColors:z.hasColors});let Q=Z.formatHelp(this,Z);if(z.hasColors)return Q;return this._outputConfiguration.stripColor(Q)}_getOutputContext($){$=$||{};let Z=!!$.error,z,Q,X;if(Z)z=(Y)=>this._outputConfiguration.writeErr(Y),Q=this._outputConfiguration.getErrHasColors(),X=this._outputConfiguration.getErrHelpWidth();else z=(Y)=>this._outputConfiguration.writeOut(Y),Q=this._outputConfiguration.getOutHasColors(),X=this._outputConfiguration.getOutHelpWidth();return{error:Z,write:(Y)=>{if(!Q)Y=this._outputConfiguration.stripColor(Y);return z(Y)},hasColors:Q,helpWidth:X}}outputHelp($){let Z;if(typeof $==="function")Z=$,$=void 0;let z=this._getOutputContext($),Q={error:z.error,write:z.write,command:this};this._getCommandAndAncestors().reverse().forEach((J)=>J.emit("beforeAllHelp",Q)),this.emit("beforeHelp",Q);let X=this.helpInformation({error:z.error});if(Z){if(X=Z(X),typeof X!=="string"&&!Buffer.isBuffer(X))throw Error("outputHelp callback must return a string or a Buffer")}if(z.write(X),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",Q),this._getCommandAndAncestors().forEach((J)=>J.emit("afterAllHelp",Q))}helpOption($,Z){if(typeof $==="boolean"){if($){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption($??"-h, --help",Z??"display help for command"),$||Z)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let Z=Number(e.exitCode??0);if(Z===0&&$&&typeof $!=="function"&&$.error)Z=1;this._exit(Z,"commander.help","(outputHelp)")}addHelpText($,Z){let z=["beforeAll","before","after","afterAll"];if(!z.includes($))throw Error(`Unexpected value for position to addHelpText.
|
|
26
|
+
Expecting one of '${z.join("', '")}'`);let Q=`${$}Help`;return this.on(Q,(X)=>{let J;if(typeof Z==="function")J=Z({error:X.error,command:X.command});else J=Z;if(J)X.write(`${J}
|
|
27
|
+
`)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((Q)=>Z.is(Q)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function vQ($){return $.map((Z)=>{if(!Z.startsWith("--inspect"))return Z;let z,Q="127.0.0.1",X="9229",J;if((J=Z.match(/^(--inspect(-brk)?)$/))!==null)z=J[1];else if((J=Z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(z=J[1],/^\d+$/.test(J[3]))X=J[3];else Q=J[3];else if((J=Z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)z=J[1],Q=J[3],X=J[4];if(z&&X!=="0")return`${z}=${Q}:${parseInt(X)+1}`;return Z})}function nZ(){if(e.env.NO_COLOR||e.env.FORCE_COLOR==="0"||e.env.FORCE_COLOR==="false")return!1;if(e.env.FORCE_COLOR||e.env.CLICOLOR_FORCE!==void 0)return!0;return}yq.Command=rZ;yq.useColor=nZ});var mQ=F((uq)=>{var{Argument:hQ}=B8(),{Command:sZ}=gQ(),{CommanderError:hq,InvalidArgumentError:fQ}=G1(),{Help:fq}=pZ(),{Option:uQ}=lZ();uq.program=new sZ;uq.createCommand=($)=>new sZ($);uq.createOption=($,Z)=>new uQ($,Z);uq.createArgument=($,Z)=>new hQ($,Z);uq.Command=sZ;uq.Option=uQ;uq.Argument=hQ;uq.Help=fq;uq.CommanderError=hq;uq.InvalidArgumentError=fQ;uq.InvalidOptionArgumentError=fQ});var o=F((JK)=>{var oZ=Symbol.for("yaml.alias"),lQ=Symbol.for("yaml.document"),L8=Symbol.for("yaml.map"),dQ=Symbol.for("yaml.pair"),aZ=Symbol.for("yaml.scalar"),N8=Symbol.for("yaml.seq"),E2=Symbol.for("yaml.node.type"),tq=($)=>!!$&&typeof $==="object"&&$[E2]===oZ,eq=($)=>!!$&&typeof $==="object"&&$[E2]===lQ,$K=($)=>!!$&&typeof $==="object"&&$[E2]===L8,ZK=($)=>!!$&&typeof $==="object"&&$[E2]===dQ,iQ=($)=>!!$&&typeof $==="object"&&$[E2]===aZ,zK=($)=>!!$&&typeof $==="object"&&$[E2]===N8;function nQ($){if($&&typeof $==="object")switch($[E2]){case L8:case N8:return!0}return!1}function QK($){if($&&typeof $==="object")switch($[E2]){case oZ:case L8:case aZ:case N8:return!0}return!1}var XK=($)=>(iQ($)||nQ($))&&!!$.anchor;JK.ALIAS=oZ;JK.DOC=lQ;JK.MAP=L8;JK.NODE_TYPE=E2;JK.PAIR=dQ;JK.SCALAR=aZ;JK.SEQ=N8;JK.hasAnchor=XK;JK.isAlias=tq;JK.isCollection=nQ;JK.isDocument=eq;JK.isMap=$K;JK.isNode=QK;JK.isPair=ZK;JK.isScalar=iQ;JK.isSeq=zK});var V1=F((AK)=>{var O0=o(),g0=Symbol("break visit"),rQ=Symbol("skip children"),A2=Symbol("remove node");function D8($,Z){let z=sQ(Z);if(O0.isDocument($)){if(W$(null,$.contents,z,Object.freeze([$]))===A2)$.contents=null}else W$(null,$,z,Object.freeze([]))}D8.BREAK=g0;D8.SKIP=rQ;D8.REMOVE=A2;function W$($,Z,z,Q){let X=oQ($,Z,z,Q);if(O0.isNode(X)||O0.isPair(X))return aQ($,Q,X),W$($,X,z,Q);if(typeof X!=="symbol"){if(O0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=W$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===g0)return g0;else if(Y===A2)Z.items.splice(J,1),J-=1}}else if(O0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=W$("key",Z.key,z,Q);if(J===g0)return g0;else if(J===A2)Z.key=null;let Y=W$("value",Z.value,z,Q);if(Y===g0)return g0;else if(Y===A2)Z.value=null}}return X}async function O8($,Z){let z=sQ(Z);if(O0.isDocument($)){if(await U$(null,$.contents,z,Object.freeze([$]))===A2)$.contents=null}else await U$(null,$,z,Object.freeze([]))}O8.BREAK=g0;O8.SKIP=rQ;O8.REMOVE=A2;async function U$($,Z,z,Q){let X=await oQ($,Z,z,Q);if(O0.isNode(X)||O0.isPair(X))return aQ($,Q,X),U$($,X,z,Q);if(typeof X!=="symbol"){if(O0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=await U$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===g0)return g0;else if(Y===A2)Z.items.splice(J,1),J-=1}}else if(O0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=await U$("key",Z.key,z,Q);if(J===g0)return g0;else if(J===A2)Z.key=null;let Y=await U$("value",Z.value,z,Q);if(Y===g0)return g0;else if(Y===A2)Z.value=null}}return X}function sQ($){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 oQ($,Z,z,Q){if(typeof z==="function")return z($,Z,Q);if(O0.isMap(Z))return z.Map?.($,Z,Q);if(O0.isSeq(Z))return z.Seq?.($,Z,Q);if(O0.isPair(Z))return z.Pair?.($,Z,Q);if(O0.isScalar(Z))return z.Scalar?.($,Z,Q);if(O0.isAlias(Z))return z.Alias?.($,Z,Q);return}function aQ($,Z,z){let Q=Z[Z.length-1];if(O0.isCollection(Q))Q.items[$]=z;else if(O0.isPair(Q))if($==="key")Q.key=z;else Q.value=z;else if(O0.isDocument(Q))Q.contents=z;else{let X=O0.isAlias(Q)?"alias":"scalar";throw Error(`Cannot replace node with ${X} parent`)}}AK.visit=D8;AK.visitAsync=O8});var tZ=F((EK)=>{var tQ=o(),_K=V1(),FK={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},PK=($)=>$.replace(/[!,[\]{}]/g,(Z)=>FK[Z]);class t0{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t0.defaultYaml,$),this.tags=Object.assign({},t0.defaultTags,Z)}clone(){let $=new t0(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new t0(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t0.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t0.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:t0.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t0.defaultTags),this.atNextDocument=!1;let z=$.trim().split(/[ \t]+/),Q=z.shift();switch(Q){case"%TAG":{if(z.length!==2){if(Z(0,"%TAG directive should contain exactly two parts"),z.length<2)return!1}let[X,J]=z;return this.tags[X]=J,!0}case"%YAML":{if(this.yaml.explicit=!0,z.length!==1)return Z(0,"%YAML directive should contain exactly one part"),!1;let[X]=z;if(X==="1.1"||X==="1.2")return this.yaml.version=X,!0;else{let J=/^\d+\.\d+$/.test(X);return Z(6,`Unsupported YAML version ${X}`,J),!1}}default:return Z(0,`Unknown directive ${Q}`,!0),!1}}tagName($,Z){if($==="!")return"!";if($[0]!=="!")return Z(`Not a valid tag: ${$}`),null;if($[1]==="<"){let J=$.slice(2,-1);if(J==="!"||J==="!!")return Z(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")Z("Verbatim tags must end with a >");return J}let[,z,Q]=$.match(/^(.*!)([^!]*)$/s);if(!Q)Z(`The ${$} tag has no suffix`);let X=this.tags[z];if(X)try{return X+decodeURIComponent(Q)}catch(J){return Z(String(J)),null}if(z==="!")return $;return Z(`Could not resolve tag: ${$}`),null}tagString($){for(let[Z,z]of Object.entries(this.tags))if($.startsWith(z))return Z+PK($.substring(z.length));return $[0]==="!"?$:`!<${$}>`}toString($){let Z=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],z=Object.entries(this.tags),Q;if($&&z.length>0&&tQ.isNode($.contents)){let X={};_K.visit($.contents,(J,Y)=>{if(tQ.isNode(Y)&&Y.tag)X[Y.tag]=!0}),Q=Object.keys(X)}else Q=[];for(let[X,J]of z){if(X==="!!"&&J==="tag:yaml.org,2002:")continue;if(!$||Q.some((Y)=>Y.startsWith(J)))Z.push(`%TAG ${X} ${J}`)}return Z.join(`
|
|
28
|
+
`)}}t0.defaultYaml={explicit:!1,version:"1.2"};t0.defaultTags={"!!":"tag:yaml.org,2002:"};EK.Directives=t0});var I8=F((kK)=>{var eQ=o(),jK=V1();function SK($){if(/[\x00-\x19\s,[\]{}]/.test($)){let z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(z)}return!0}function $X($){let Z=new Set;return jK.visit($,{Value(z,Q){if(Q.anchor)Z.add(Q.anchor)}}),Z}function ZX($,Z){for(let z=1;;++z){let Q=`${$}${z}`;if(!Z.has(Q))return Q}}function xK($,Z){let z=[],Q=new Map,X=null;return{onAnchor:(J)=>{z.push(J),X??(X=$X($));let Y=ZX(Z,X);return X.add(Y),Y},setAnchors:()=>{for(let J of z){let Y=Q.get(J);if(typeof Y==="object"&&Y.anchor&&(eQ.isScalar(Y.node)||eQ.isCollection(Y.node)))Y.node.anchor=Y.anchor;else{let W=Error("Failed to resolve repeated object (this should not happen)");throw W.source=J,W}}},sourceObjects:Q}}kK.anchorIsValid=SK;kK.anchorNames=$X;kK.createNodeAnchors=xK;kK.findNewAnchor=ZX});var eZ=F((hK)=>{function H1($,Z,z,Q){if(Q&&typeof Q==="object")if(Array.isArray(Q))for(let X=0,J=Q.length;X<J;++X){let Y=Q[X],W=H1($,Q,String(X),Y);if(W===void 0)delete Q[X];else if(W!==Y)Q[X]=W}else if(Q instanceof Map)for(let X of Array.from(Q.keys())){let J=Q.get(X),Y=H1($,Q,X,J);if(Y===void 0)Q.delete(X);else if(Y!==J)Q.set(X,Y)}else if(Q instanceof Set)for(let X of Array.from(Q)){let J=H1($,Q,X,X);if(J===void 0)Q.delete(X);else if(J!==X)Q.delete(X),Q.add(J)}else for(let[X,J]of Object.entries(Q)){let Y=H1($,Q,X,J);if(Y===void 0)delete Q[X];else if(Y!==J)Q[X]=Y}return $.call(Z,z,Q)}hK.applyReviver=H1});var o2=F((mK)=>{var uK=o();function zX($,Z,z){if(Array.isArray($))return $.map((Q,X)=>zX(Q,String(X),z));if($&&typeof $.toJSON==="function"){if(!z||!uK.hasAnchor($))return $.toJSON(Z,z);let Q={aliasCount:0,count:1,res:void 0};z.anchors.set($,Q),z.onCreate=(J)=>{Q.res=J,delete z.onCreate};let X=$.toJSON(Z,z);if(z.onCreate)z.onCreate(X);return X}if(typeof $==="bigint"&&!z?.keep)return Number($);return $}mK.toJS=zX});var T8=F((dK)=>{var pK=eZ(),QX=o(),lK=o2();class XX{constructor($){Object.defineProperty(this,QX.NODE_TYPE,{value:$})}clone(){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)$.range=this.range.slice();return $}toJS($,{mapAsMap:Z,maxAliasCount:z,onAnchor:Q,reviver:X}={}){if(!QX.isDocument($))throw TypeError("A document argument is required");let J={anchors:new Map,doc:$,keep:!0,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof z==="number"?z:100},Y=lK.toJS(this,"",J);if(typeof Q==="function")for(let{count:W,res:U}of J.anchors.values())Q(U,W);return typeof X==="function"?pK.applyReviver(X,{"":Y},"",Y):Y}}dK.NodeBase=XX});var q1=F((aK)=>{var nK=I8(),rK=V1(),G$=o(),sK=T8(),oK=o2();class JX extends sK.NodeBase{constructor($){super(G$.ALIAS);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,Z){if(Z?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let z;if(Z?.aliasResolveCache)z=Z.aliasResolveCache;else if(z=[],rK.visit($,{Node:(X,J)=>{if(G$.isAlias(J)||G$.hasAnchor(J))z.push(J)}}),Z)Z.aliasResolveCache=z;let Q=void 0;for(let X of z){if(X===this)break;if(X.anchor===this.source)Q=X}return Q}toJSON($,Z){if(!Z)return{source:this.source};let{anchors:z,doc:Q,maxAliasCount:X}=Z,J=this.resolve(Q,Z);if(!J){let W=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(W)}let Y=z.get(J);if(!Y)oK.toJS(J,null,Z),Y=z.get(J);if(Y?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(X>=0){if(Y.count+=1,Y.aliasCount===0)Y.aliasCount=A8(Q,J,z);if(Y.count*Y.aliasCount>X)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return Y.res}toString($,Z,z){let Q=`*${this.source}`;if($){if(nK.anchorIsValid(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let X=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(X)}if($.implicitKey)return`${Q} `}return Q}}function A8($,Z,z){if(G$.isAlias(Z)){let Q=Z.resolve($),X=z&&Q&&z.get(Q);return X?X.count*X.aliasCount:0}else if(G$.isCollection(Z)){let Q=0;for(let X of Z.items){let J=A8($,X,z);if(J>Q)Q=J}return Q}else if(G$.isPair(Z)){let Q=A8($,Z.key,z),X=A8($,Z.value,z);return Math.max(Q,X)}return 1}aK.Alias=JX});var B0=F((QB)=>{var eK=o(),$B=T8(),ZB=o2(),zB=($)=>!$||typeof $!=="function"&&typeof $!=="object";class _6 extends $B.NodeBase{constructor($){super(eK.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:ZB.toJS(this.value,$,Z)}toString(){return String(this.value)}}_6.BLOCK_FOLDED="BLOCK_FOLDED";_6.BLOCK_LITERAL="BLOCK_LITERAL";_6.PLAIN="PLAIN";_6.QUOTE_DOUBLE="QUOTE_DOUBLE";_6.QUOTE_SINGLE="QUOTE_SINGLE";QB.Scalar=_6;QB.isScalarValue=zB});var K1=F((VB)=>{var YB=q1(),F6=o(),YX=B0(),WB="tag:yaml.org,2002:";function UB($,Z,z){if(Z){let Q=z.filter((J)=>J.tag===Z),X=Q.find((J)=>!J.format)??Q[0];if(!X)throw Error(`Tag ${Z} not found`);return X}return z.find((Q)=>Q.identify?.($)&&!Q.format)}function GB($,Z,z){if(F6.isDocument($))$=$.contents;if(F6.isNode($))return $;if(F6.isPair($)){let H=z.schema[F6.MAP].createNode?.(z.schema,null,z);return H.items.push($),H}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:Q,onAnchor:X,onTagObj:J,schema:Y,sourceObjects:W}=z,U=void 0;if(Q&&$&&typeof $==="object")if(U=W.get($),U)return U.anchor??(U.anchor=X($)),new YB.Alias(U.anchor);else U={anchor:null,node:null},W.set($,U);if(Z?.startsWith("!!"))Z=WB+Z.slice(2);let G=UB($,Z,Y.tags);if(!G){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let H=new YX.Scalar($);if(U)U.node=H;return H}G=$ instanceof Map?Y[F6.MAP]:(Symbol.iterator in Object($))?Y[F6.SEQ]:Y[F6.MAP]}if(J)J(G),delete z.onTagObj;let V=G?.createNode?G.createNode(z.schema,$,z):typeof G?.nodeClass?.from==="function"?G.nodeClass.from(z.schema,$,z):new YX.Scalar($);if(Z)V.tag=Z;else if(!G.default)V.tag=G.tag;if(U)U.node=V;return V}VB.createNode=GB});var R8=F((BB)=>{var qB=K1(),R2=o(),KB=T8();function $7($,Z,z){let Q=z;for(let X=Z.length-1;X>=0;--X){let J=Z[X];if(typeof J==="number"&&Number.isInteger(J)&&J>=0){let Y=[];Y[J]=Q,Q=Y}else Q=new Map([[J,Q]])}return qB.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var WX=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class UX extends KB.NodeBase{constructor($,Z){super($);Object.defineProperty(this,"schema",{value:Z,configurable:!0,enumerable:!1,writable:!0})}clone($){let Z=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if($)Z.schema=$;if(Z.items=Z.items.map((z)=>R2.isNode(z)||R2.isPair(z)?z.clone($):z),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(WX($))this.add(Z);else{let[z,...Q]=$,X=this.get(z,!0);if(R2.isCollection(X))X.addIn(Q,Z);else if(X===void 0&&this.schema)this.set(z,$7(this.schema,Q,Z));else throw Error(`Expected YAML collection at ${z}. Remaining path: ${Q}`)}}deleteIn($){let[Z,...z]=$;if(z.length===0)return this.delete(Z);let Q=this.get(Z,!0);if(R2.isCollection(Q))return Q.deleteIn(z);else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${z}`)}getIn($,Z){let[z,...Q]=$,X=this.get(z,!0);if(Q.length===0)return!Z&&R2.isScalar(X)?X.value:X;else return R2.isCollection(X)?X.getIn(Q,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!R2.isPair(Z))return!1;let z=Z.value;return z==null||$&&R2.isScalar(z)&&z.value==null&&!z.commentBefore&&!z.comment&&!z.tag})}hasIn($){let[Z,...z]=$;if(z.length===0)return this.has(Z);let Q=this.get(Z,!0);return R2.isCollection(Q)?Q.hasIn(z):!1}setIn($,Z){let[z,...Q]=$;if(Q.length===0)this.set(z,Z);else{let X=this.get(z,!0);if(R2.isCollection(X))X.setIn(Q,Z);else if(X===void 0&&this.schema)this.set(z,$7(this.schema,Q,Z));else throw Error(`Expected YAML collection at ${z}. Remaining path: ${Q}`)}}}BB.Collection=UX;BB.collectionFromPath=$7;BB.isEmptyPath=WX});var B1=F((IB)=>{var DB=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function Z7($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var OB=($,Z,z)=>$.endsWith(`
|
|
29
|
+
`)?Z7(z,Z):z.includes(`
|
|
30
30
|
`)?`
|
|
31
|
-
`+
|
|
32
|
-
`){if(
|
|
33
|
-
`&&
|
|
34
|
-
`&&
|
|
35
|
-
${Z}${$.slice(0,
|
|
36
|
-
${Z}${$.slice(
|
|
37
|
-
`);
|
|
38
|
-
`){if(
|
|
39
|
-
|
|
40
|
-
`;while(
|
|
41
|
-
`,U+=2;if(Y+=
|
|
42
|
-
`)||/[ \t]\n|\n[ \t]/.test($))return
|
|
43
|
-
${
|
|
31
|
+
`+Z7(z,Z):($.endsWith(" ")?"":" ")+z;IB.indentComment=Z7;IB.lineComment=OB;IB.stringifyComment=DB});var VX=F((_B)=>{function CB($,Z,z="flow",{indentAtStart:Q,lineWidth:X=80,minContentWidth:J=20,onFold:Y,onOverflow:W}={}){if(!X||X<0)return $;if(X<J)J=0;let U=Math.max(1+J,1+X-Z.length);if($.length<=U)return $;let G=[],V={},H=X-Z.length;if(typeof Q==="number")if(Q>X-Math.max(2,J))G.push(0);else H=X-Q;let q=void 0,K=void 0,L=!1,B=-1,N=-1,T=-1;if(z==="block"){if(B=GX($,B,Z.length),B!==-1)H=B+U}for(let j;j=$[B+=1];){if(z==="quoted"&&j==="\\"){switch(N=B,$[B+1]){case"x":B+=3;break;case"u":B+=5;break;case"U":B+=9;break;default:B+=1}T=B}if(j===`
|
|
32
|
+
`){if(z==="block")B=GX($,B,Z.length);H=B+Z.length+U,q=void 0}else{if(j===" "&&K&&K!==" "&&K!==`
|
|
33
|
+
`&&K!=="\t"){let x=$[B+1];if(x&&x!==" "&&x!==`
|
|
34
|
+
`&&x!=="\t")q=B}if(B>=H)if(q)G.push(q),H=q+U,q=void 0;else if(z==="quoted"){while(K===" "||K==="\t")K=j,j=$[B+=1],L=!0;let x=B>T+1?B-2:N-1;if(V[x])return $;G.push(x),V[x]=!0,H=x+U,q=void 0}else L=!0}K=j}if(L&&W)W();if(G.length===0)return $;if(Y)Y();let w=$.slice(0,G[0]);for(let j=0;j<G.length;++j){let x=G[j],v=G[j+1]||$.length;if(x===0)w=`
|
|
35
|
+
${Z}${$.slice(0,v)}`;else{if(z==="quoted"&&V[x])w+=`${$[x]}\\`;w+=`
|
|
36
|
+
${Z}${$.slice(x+1,v)}`}}return w}function GX($,Z,z){let Q=Z,X=Z+1,J=$[X];while(J===" "||J==="\t")if(Z<X+z)J=$[++Z];else{do J=$[++Z];while(J&&J!==`
|
|
37
|
+
`);Q=Z,X=Z+1,J=$[X]}return Q}_B.FOLD_BLOCK="block";_B.FOLD_FLOW="flow";_B.FOLD_QUOTED="quoted";_B.foldFlowLines=CB});var L1=F((kB)=>{var V2=B0(),a2=VX(),_8=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),F8=($)=>/^(%|---|\.\.\.)/m.test($);function jB($,Z,z){if(!Z||Z<0)return!1;let Q=Z-z,X=$.length;if(X<=Q)return!1;for(let J=0,Y=0;J<X;++J)if($[J]===`
|
|
38
|
+
`){if(J-Y>Q)return!0;if(Y=J+1,X-Y<=Q)return!1}return!0}function M1($,Z){let z=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return z;let{implicitKey:Q}=Z,X=Z.options.doubleQuotedMinMultiLineLength,J=Z.indent||(F8($)?" ":""),Y="",W=0;for(let U=0,G=z[U];G;G=z[++U]){if(G===" "&&z[U+1]==="\\"&&z[U+2]==="n")Y+=z.slice(W,U)+"\\ ",U+=1,W=U,G="\\";if(G==="\\")switch(z[U+1]){case"u":{Y+=z.slice(W,U);let V=z.substr(U+2,4);switch(V){case"0000":Y+="\\0";break;case"0007":Y+="\\a";break;case"000b":Y+="\\v";break;case"001b":Y+="\\e";break;case"0085":Y+="\\N";break;case"00a0":Y+="\\_";break;case"2028":Y+="\\L";break;case"2029":Y+="\\P";break;default:if(V.substr(0,2)==="00")Y+="\\x"+V.substr(2);else Y+=z.substr(U,6)}U+=5,W=U+1}break;case"n":if(Q||z[U+2]==='"'||z.length<X)U+=1;else{Y+=z.slice(W,U)+`
|
|
39
|
+
|
|
40
|
+
`;while(z[U+2]==="\\"&&z[U+3]==="n"&&z[U+4]!=='"')Y+=`
|
|
41
|
+
`,U+=2;if(Y+=J,z[U+2]===" ")Y+="\\";U+=1,W=U+1}break;default:U+=1}}return Y=W?Y+z.slice(W):z,Q?Y:a2.foldFlowLines(Y,J,a2.FOLD_QUOTED,_8(Z,!1))}function z7($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
|
|
42
|
+
`)||/[ \t]\n|\n[ \t]/.test($))return M1($,Z);let z=Z.indent||(F8($)?" ":""),Q="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
43
|
+
${z}`)+"'";return Z.implicitKey?Q:a2.foldFlowLines(Q,z,a2.FOLD_FLOW,_8(Z,!1))}function V$($,Z){let{singleQuote:z}=Z.options,Q;if(z===!1)Q=M1;else{let X=$.includes('"'),J=$.includes("'");if(X&&!J)Q=z7;else if(J&&!X)Q=M1;else Q=z?z7:M1}return Q($,Z)}var Q7;try{Q7=new RegExp(`(^|(?<!
|
|
44
44
|
))
|
|
45
45
|
+(?!
|
|
46
|
-
|$)`,"g")}catch{
|
|
46
|
+
|$)`,"g")}catch{Q7=/\n+(?!\n|$)/g}function C8({comment:$,type:Z,value:z},Q,X,J){let{blockQuote:Y,commentString:W,lineWidth:U}=Q.options;if(!Y||/\n[\t ]+$/.test(z))return V$(z,Q);let G=Q.indent||(Q.forceBlockIndent||F8(z)?" ":""),V=Y==="literal"?!0:Y==="folded"||Z===V2.Scalar.BLOCK_FOLDED?!1:Z===V2.Scalar.BLOCK_LITERAL?!0:!jB(z,U,G.length);if(!z)return V?`|
|
|
47
47
|
`:`>
|
|
48
|
-
`;let
|
|
49
|
-
`&&
|
|
50
|
-
`);if(L===-1)
|
|
51
|
-
`)
|
|
52
|
-
`)T=
|
|
53
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${
|
|
54
|
-
${
|
|
55
|
-
${
|
|
56
|
-
`)||
|
|
57
|
-
`)?
|
|
58
|
-
`))return
|
|
59
|
-
${U}`);if(Y){let
|
|
60
|
-
${Z.indent}${W}`}
|
|
61
|
-
${W}:`}else if(
|
|
62
|
-
`:"",
|
|
63
|
-
${
|
|
64
|
-
`&&
|
|
65
|
-
|
|
66
|
-
`}else
|
|
67
|
-
${
|
|
68
|
-
`),
|
|
69
|
-
${
|
|
70
|
-
`)
|
|
48
|
+
`;let H,q;for(q=z.length;q>0;--q){let v=z[q-1];if(v!==`
|
|
49
|
+
`&&v!=="\t"&&v!==" ")break}let K=z.substring(q),L=K.indexOf(`
|
|
50
|
+
`);if(L===-1)H="-";else if(z===K||L!==K.length-1){if(H="+",J)J()}else H="";if(K){if(z=z.slice(0,-K.length),K[K.length-1]===`
|
|
51
|
+
`)K=K.slice(0,-1);K=K.replace(Q7,`$&${G}`)}let B=!1,N,T=-1;for(N=0;N<z.length;++N){let v=z[N];if(v===" ")B=!0;else if(v===`
|
|
52
|
+
`)T=N;else break}let w=z.substring(0,T<N?T+1:N);if(w)z=z.substring(w.length),w=w.replace(/\n+/g,`$&${G}`);let x=(B?G?"2":"1":"")+H;if($){if(x+=" "+W($.replace(/ ?[\r\n]+/g," ")),X)X()}if(!V){let v=z.replace(/\n+/g,`
|
|
53
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${G}`),k=!1,l=_8(Q,!0);if(Y!=="folded"&&Z!==V2.Scalar.BLOCK_FOLDED)l.onOverflow=()=>{k=!0};let R=a2.foldFlowLines(`${w}${v}${K}`,G,a2.FOLD_BLOCK,l);if(!k)return`>${x}
|
|
54
|
+
${G}${R}`}return z=z.replace(/\n+/g,`$&${G}`),`|${x}
|
|
55
|
+
${G}${w}${z}${K}`}function SB($,Z,z,Q){let{type:X,value:J}=$,{actualString:Y,implicitKey:W,indent:U,indentStep:G,inFlow:V}=Z;if(W&&J.includes(`
|
|
56
|
+
`)||V&&/[[\]{},]/.test(J))return V$(J,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(J))return W||V||!J.includes(`
|
|
57
|
+
`)?V$(J,Z):C8($,Z,z,Q);if(!W&&!V&&X!==V2.Scalar.PLAIN&&J.includes(`
|
|
58
|
+
`))return C8($,Z,z,Q);if(F8(J)){if(U==="")return Z.forceBlockIndent=!0,C8($,Z,z,Q);else if(W&&U===G)return V$(J,Z)}let H=J.replace(/\n+/g,`$&
|
|
59
|
+
${U}`);if(Y){let q=(B)=>B.default&&B.tag!=="tag:yaml.org,2002:str"&&B.test?.test(H),{compat:K,tags:L}=Z.doc.schema;if(L.some(q)||K?.some(q))return V$(J,Z)}return W?H:a2.foldFlowLines(H,U,a2.FOLD_FLOW,_8(Z,!1))}function xB($,Z,z,Q){let{implicitKey:X,inFlow:J}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:W}=$;if(W!==V2.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))W=V2.Scalar.QUOTE_DOUBLE}let U=(V)=>{switch(V){case V2.Scalar.BLOCK_FOLDED:case V2.Scalar.BLOCK_LITERAL:return X||J?V$(Y.value,Z):C8(Y,Z,z,Q);case V2.Scalar.QUOTE_DOUBLE:return M1(Y.value,Z);case V2.Scalar.QUOTE_SINGLE:return z7(Y.value,Z);case V2.Scalar.PLAIN:return SB(Y,Z,z,Q);default:return null}},G=U(W);if(G===null){let{defaultKeyType:V,defaultStringType:H}=Z.options,q=X&&V||H;if(G=U(q),G===null)throw Error(`Unsupported default string type ${q}`)}return G}kB.stringifyString=xB});var N1=F((cB)=>{var yB=I8(),t2=o(),vB=B1(),gB=L1();function hB($,Z){let z=Object.assign({blockQuote:!0,commentString:vB.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},$.schema.toStringOptions,Z),Q;switch(z.collectionStyle){case"block":Q=!1;break;case"flow":Q=!0;break;default:Q=null}return{anchors:new Set,doc:$,flowCollectionPadding:z.flowCollectionPadding?" ":"",indent:"",indentStep:typeof z.indent==="number"?" ".repeat(z.indent):" ",inFlow:Q,options:z}}function fB($,Z){if(Z.tag){let X=$.filter((J)=>J.tag===Z.tag);if(X.length>0)return X.find((J)=>J.format===Z.format)??X[0]}let z=void 0,Q;if(t2.isScalar(Z)){Q=Z.value;let X=$.filter((J)=>J.identify?.(Q));if(X.length>1){let J=X.filter((Y)=>Y.test);if(J.length>0)X=J}z=X.find((J)=>J.format===Z.format)??X.find((J)=>!J.format)}else Q=Z,z=$.find((X)=>X.nodeClass&&Q instanceof X.nodeClass);if(!z){let X=Q?.constructor?.name??(Q===null?"null":typeof Q);throw Error(`Tag not resolved for ${X} value`)}return z}function uB($,Z,{anchors:z,doc:Q}){if(!Q.directives)return"";let X=[],J=(t2.isScalar($)||t2.isCollection($))&&$.anchor;if(J&&yB.anchorIsValid(J))z.add(J),X.push(`&${J}`);let Y=$.tag??(Z.default?null:Z.tag);if(Y)X.push(Q.directives.tagString(Y));return X.join(" ")}function mB($,Z,z,Q){if(t2.isPair($))return $.toString(Z,z,Q);if(t2.isAlias($)){if(Z.doc.directives)return $.toString(Z);if(Z.resolvedAliases?.has($))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(Z.resolvedAliases)Z.resolvedAliases.add($);else Z.resolvedAliases=new Set([$]);$=$.resolve(Z.doc)}}let X=void 0,J=t2.isNode($)?$:Z.doc.createNode($,{onTagObj:(U)=>X=U});X??(X=fB(Z.doc.schema.tags,J));let Y=uB(J,X,Z);if(Y.length>0)Z.indentAtStart=(Z.indentAtStart??0)+Y.length+1;let W=typeof X.stringify==="function"?X.stringify(J,Z,z,Q):t2.isScalar(J)?gB.stringifyString(J,Z,z,Q):J.toString(Z,z,Q);if(!Y)return W;return t2.isScalar(J)||W[0]==="{"||W[0]==="["?`${Y} ${W}`:`${Y}
|
|
60
|
+
${Z.indent}${W}`}cB.createStringifyContext=hB;cB.stringify=mB});var KX=F((iB)=>{var w2=o(),HX=B0(),qX=N1(),D1=B1();function dB({key:$,value:Z},z,Q,X){let{allNullValues:J,doc:Y,indent:W,indentStep:U,options:{commentString:G,indentSeq:V,simpleKeys:H}}=z,q=w2.isNode($)&&$.comment||null;if(H){if(q)throw Error("With simple keys, key nodes cannot have comments");if(w2.isCollection($)||!w2.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let K=!H&&(!$||q&&Z==null&&!z.inFlow||w2.isCollection($)||(w2.isScalar($)?$.type===HX.Scalar.BLOCK_FOLDED||$.type===HX.Scalar.BLOCK_LITERAL:typeof $==="object"));z=Object.assign({},z,{allNullValues:!1,implicitKey:!K&&(H||!J),indent:W+U});let L=!1,B=!1,N=qX.stringify($,z,()=>L=!0,()=>B=!0);if(!K&&!z.inFlow&&N.length>1024){if(H)throw Error("With simple keys, single line scalar must not span more than 1024 characters");K=!0}if(z.inFlow){if(J||Z==null){if(L&&Q)Q();return N===""?"?":K?`? ${N}`:N}}else if(J&&!H||Z==null&&K){if(N=`? ${N}`,q&&!L)N+=D1.lineComment(N,z.indent,G(q));else if(B&&X)X();return N}if(L)q=null;if(K){if(q)N+=D1.lineComment(N,z.indent,G(q));N=`? ${N}
|
|
61
|
+
${W}:`}else if(N=`${N}:`,q)N+=D1.lineComment(N,z.indent,G(q));let T,w,j;if(w2.isNode(Z))T=!!Z.spaceBefore,w=Z.commentBefore,j=Z.comment;else if(T=!1,w=null,j=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(z.implicitKey=!1,!K&&!q&&w2.isScalar(Z))z.indentAtStart=N.length+1;if(B=!1,!V&&U.length>=2&&!z.inFlow&&!K&&w2.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)z.indent=z.indent.substring(2);let x=!1,v=qX.stringify(Z,z,()=>x=!0,()=>B=!0),k=" ";if(q||T||w){if(k=T?`
|
|
62
|
+
`:"",w){let l=G(w);k+=`
|
|
63
|
+
${D1.indentComment(l,z.indent)}`}if(v===""&&!z.inFlow){if(k===`
|
|
64
|
+
`&&j)k=`
|
|
65
|
+
|
|
66
|
+
`}else k+=`
|
|
67
|
+
${z.indent}`}else if(!K&&w2.isCollection(Z)){let l=v[0],R=v.indexOf(`
|
|
68
|
+
`),u=R!==-1,D0=z.inFlow??Z.flow??Z.items.length===0;if(u||!D0){let k0=!1;if(u&&(l==="&"||l==="!")){let _=v.indexOf(" ");if(l==="&"&&_!==-1&&_<R&&v[_+1]==="!")_=v.indexOf(" ",_+1);if(_===-1||R<_)k0=!0}if(!k0)k=`
|
|
69
|
+
${z.indent}`}}else if(v===""||v[0]===`
|
|
70
|
+
`)k="";if(N+=k+v,z.inFlow){if(x&&Q)Q()}else if(j&&!x)N+=D1.lineComment(N,z.indent,G(j));else if(B&&X)X();return N}iB.stringifyPair=dB});var X7=F((oB)=>{var BX=l0("process");function rB($,...Z){if($==="debug")console.log(...Z)}function sB($,Z){if($==="debug"||$==="warn")if(typeof BX.emitWarning==="function")BX.emitWarning(Z);else console.warn(Z)}oB.debug=rB;oB.warn=sB});var j8=F(($M)=>{var w8=o(),MX=B0(),P8="<<",E8={identify:($)=>$===P8||typeof $==="symbol"&&$.description===P8,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new MX.Scalar(Symbol(P8)),{addToJSMap:LX}),stringify:()=>P8},eB=($,Z)=>(E8.identify(Z)||w8.isScalar(Z)&&(!Z.type||Z.type===MX.Scalar.PLAIN)&&E8.identify(Z.value))&&$?.doc.schema.tags.some((z)=>z.tag===E8.tag&&z.default);function LX($,Z,z){let Q=NX($,z);if(w8.isSeq(Q))for(let X of Q.items)J7($,Z,X);else if(Array.isArray(Q))for(let X of Q)J7($,Z,X);else J7($,Z,Q)}function J7($,Z,z){let Q=NX($,z);if(!w8.isMap(Q))throw Error("Merge sources must be maps or map aliases");let X=Q.toJSON(null,$,Map);for(let[J,Y]of X)if(Z instanceof Map){if(!Z.has(J))Z.set(J,Y)}else if(Z instanceof Set)Z.add(J);else if(!Object.prototype.hasOwnProperty.call(Z,J))Object.defineProperty(Z,J,{value:Y,writable:!0,enumerable:!0,configurable:!0});return Z}function NX($,Z){return $&&w8.isAlias(Z)?Z.resolve($.doc,$):Z}$M.addMergeToJSMap=LX;$M.isMergeKey=eB;$M.merge=E8});var W7=F((UM)=>{var XM=X7(),DX=j8(),JM=N1(),OX=o(),Y7=o2();function YM($,Z,{key:z,value:Q}){if(OX.isNode(z)&&z.addToJSMap)z.addToJSMap($,Z,Q);else if(DX.isMergeKey($,z))DX.addMergeToJSMap($,Z,Q);else{let X=Y7.toJS(z,"",$);if(Z instanceof Map)Z.set(X,Y7.toJS(Q,X,$));else if(Z instanceof Set)Z.add(X);else{let J=WM(z,X,$),Y=Y7.toJS(Q,J,$);if(J in Z)Object.defineProperty(Z,J,{value:Y,writable:!0,enumerable:!0,configurable:!0});else Z[J]=Y}}return Z}function WM($,Z,z){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(OX.isNode($)&&z?.doc){let Q=JM.createStringifyContext(z.doc,{});Q.anchors=new Set;for(let J of z.anchors.keys())Q.anchors.add(J.anchor);Q.inFlow=!0,Q.inStringifyKey=!0;let X=$.toString(Q);if(!z.mapKeyWarned){let J=JSON.stringify(X);if(J.length>40)J=J.substring(0,36)+'..."';XM.warn(z.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${J}. Set mapAsMap: true to use object keys.`),z.mapKeyWarned=!0}return X}return JSON.stringify(Z)}UM.addPairToJSMap=YM});var e2=F((KM)=>{var IX=K1(),VM=KX(),HM=W7(),S8=o();function qM($,Z,z){let Q=IX.createNode($,void 0,z),X=IX.createNode(Z,void 0,z);return new x8(Q,X)}class x8{constructor($,Z=null){Object.defineProperty(this,S8.NODE_TYPE,{value:S8.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:z}=this;if(S8.isNode(Z))Z=Z.clone($);if(S8.isNode(z))z=z.clone($);return new x8(Z,z)}toJSON($,Z){let z=Z?.mapAsMap?new Map:{};return HM.addPairToJSMap(Z,z,this)}toString($,Z,z){return $?.doc?VM.stringifyPair(this,$,Z,z):JSON.stringify(this)}}KM.Pair=x8;KM.createPair=qM});var U7=F((OM)=>{var P6=o(),TX=N1(),k8=B1();function LM($,Z,z){return(Z.inFlow??$.flow?DM:NM)($,Z,z)}function NM({comment:$,items:Z},z,{blockItemPrefix:Q,flowChars:X,itemIndent:J,onChompKeep:Y,onComment:W}){let{indent:U,options:{commentString:G}}=z,V=Object.assign({},z,{indent:J,type:null}),H=!1,q=[];for(let L=0;L<Z.length;++L){let B=Z[L],N=null;if(P6.isNode(B)){if(!H&&B.spaceBefore)q.push("");if(b8(z,q,B.commentBefore,H),B.comment)N=B.comment}else if(P6.isPair(B)){let w=P6.isNode(B.key)?B.key:null;if(w){if(!H&&w.spaceBefore)q.push("");b8(z,q,w.commentBefore,H)}}H=!1;let T=TX.stringify(B,V,()=>N=null,()=>H=!0);if(N)T+=k8.lineComment(T,J,G(N));if(H&&N)H=!1;q.push(Q+T)}let K;if(q.length===0)K=X.start+X.end;else{K=q[0];for(let L=1;L<q.length;++L){let B=q[L];K+=B?`
|
|
71
71
|
${U}${B}`:`
|
|
72
|
-
`}}if($){if(
|
|
73
|
-
`+
|
|
74
|
-
`)),L<$.length-1)T+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)
|
|
75
|
-
${
|
|
72
|
+
`}}if($){if(K+=`
|
|
73
|
+
`+k8.indentComment(G($),U),W)W()}else if(H&&Y)Y();return K}function DM({items:$},Z,{flowChars:z,itemIndent:Q}){let{indent:X,indentStep:J,flowCollectionPadding:Y,options:{commentString:W}}=Z;Q+=J;let U=Object.assign({},Z,{indent:Q,inFlow:!0,type:null}),G=!1,V=0,H=[];for(let L=0;L<$.length;++L){let B=$[L],N=null;if(P6.isNode(B)){if(B.spaceBefore)H.push("");if(b8(Z,H,B.commentBefore,!1),B.comment)N=B.comment}else if(P6.isPair(B)){let w=P6.isNode(B.key)?B.key:null;if(w){if(w.spaceBefore)H.push("");if(b8(Z,H,w.commentBefore,!1),w.comment)G=!0}let j=P6.isNode(B.value)?B.value:null;if(j){if(j.comment)N=j.comment;if(j.commentBefore)G=!0}else if(B.value==null&&w?.comment)N=w.comment}if(N)G=!0;let T=TX.stringify(B,U,()=>N=null);if(G||(G=H.length>V||T.includes(`
|
|
74
|
+
`)),L<$.length-1)T+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)G||(G=H.reduce((w,j)=>w+j.length+2,2)+(T.length+2)>Z.options.lineWidth);if(G)T+=","}if(N)T+=k8.lineComment(T,Q,W(N));H.push(T),V=H.length}let{start:q,end:K}=z;if(H.length===0)return q+K;else{if(!G){let L=H.reduce((B,N)=>B+N.length+2,2);G=Z.options.lineWidth>0&&L>Z.options.lineWidth}if(G){let L=q;for(let B of H)L+=B?`
|
|
75
|
+
${J}${X}${B}`:`
|
|
76
76
|
`;return`${L}
|
|
77
|
-
${
|
|
78
|
-
`:" ")}return
|
|
79
|
-
${
|
|
80
|
-
${Q.comment}`:z.comment}z=J}$.items[X]=V8.isPair(z)?z:new I3.Pair(z)}else Z("Expected a sequence for this tag");return $}function h7($,Z,X){let{replacer:z}=X,J=new YK.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(I3.createPair(W,U,X))}return J}var WK={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:f7,createNode:h7};UK.createPairs=h7;UK.pairs=WK;UK.resolvePairs=f7});var A3=E((BK)=>{var u7=i(),T3=H1(),V2=L1(),KK=D1(),m7=K8();class f1 extends KK.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(u7.isPair(z))J=T3.toJS(z.key,"",Z),Q=T3.toJS(z.value,J,Z);else J=T3.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=m7.createPairs($,Z,X),J=new this;return J.items=z.items,J}}f1.tag="tag:yaml.org,2002:omap";var HK={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:f1,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let X=m7.resolvePairs($,Z),z=[];for(let{key:J}of X.items)if(u7.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)};BK.YAMLOMap=f1;BK.omap=HK});var i7=E((NK)=>{var c7=J0();function l7({value:$,source:Z},X){if(Z&&($?d7:p7).test.test(Z))return Z;return $?X.options.trueStr:X.options.falseStr}var d7={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new c7.Scalar(!0),stringify:l7},p7={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new c7.Scalar(!1),stringify:l7};NK.falseTag=p7;NK.trueTag=d7});var n7=E((_K)=>{var IK=J0(),R3=q$(),TK={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:R3.stringifyNumber},AK={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():R3.stringifyNumber($)}},RK={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new IK.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:R3.stringifyNumber};_K.float=RK;_K.floatExp=AK;_K.floatNaN=TK});var s7=E((xK)=>{var r7=q$(),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 _3($,Z,X){let{value:z}=$;if(K2(z)){let J=z.toString(Z);return z<0?"-"+X+J.substr(1):X+J}return r7.stringifyNumber($)}var EK={identify:K2,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,X)=>H8($,2,2,X),stringify:($)=>_3($,2,"0b")},wK={identify:K2,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,X)=>H8($,1,8,X),stringify:($)=>_3($,8,"0")},SK={identify:K2,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,X)=>H8($,0,10,X),stringify:r7.stringifyNumber},jK={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:($)=>_3($,16,"0x")};xK.int=SK;xK.intBin=EK;xK.intHex=jK;xK.intOct=wK});var F3=E((fK)=>{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 gK={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 $}};fK.YAMLSet=h1;fK.set=gK});var P3=E((dK)=>{var mK=q$();function C3($,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 a7($){let{value:Z}=$,X=(Y)=>Y;if(typeof Z==="bigint")X=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return mK.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 cK={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})=>C3($,X),stringify:a7},lK={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:($)=>C3($,!1),stringify:a7},o7={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(o7.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=C3(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=lK;dK.intTime=cK;dK.timestamp=o7});var e7=E((JH)=>{var rK=W$(),sK=U8(),aK=U$(),oK=q2(),tK=D3(),t7=i7(),E3=n7(),N8=s7(),eK=$8(),$H=A3(),ZH=K8(),XH=F3(),w3=P3(),zH=[rK.map,aK.seq,oK.string,sK.nullTag,t7.trueTag,t7.falseTag,N8.intBin,N8.intOct,N8.int,N8.intHex,E3.floatNaN,E3.floatExp,E3.float,tK.binary,eK.merge,$H.omap,ZH.pairs,XH.set,w3.intTime,w3.floatTime,w3.timestamp];JH.schema=zH});var qX=E((HH)=>{var zX=W$(),YH=U8(),JX=U$(),WH=q2(),UH=V3(),S3=H3(),j3=M3(),qH=y7(),GH=g7(),QX=D3(),H2=$8(),YX=A3(),WX=K8(),$X=e7(),UX=F3(),L8=P3(),ZX=new Map([["core",qH.schema],["failsafe",[zX.map,JX.seq,WH.string]],["json",GH.schema],["yaml11",$X.schema],["yaml-1.1",$X.schema]]),XX={binary:QX.binary,bool:UH.boolTag,float:S3.float,floatExp:S3.floatExp,floatNaN:S3.floatNaN,floatTime:L8.floatTime,int:j3.int,intHex:j3.intHex,intOct:j3.intOct,intTime:L8.intTime,map:zX.map,merge:H2.merge,null:YH.nullTag,omap:YX.omap,pairs:WX.pairs,seq:JX.seq,set:UX.set,timestamp:L8.timestamp},VH={"tag:yaml.org,2002:binary":QX.binary,"tag:yaml.org,2002:merge":H2.merge,"tag:yaml.org,2002:omap":YX.omap,"tag:yaml.org,2002:pairs":WX.pairs,"tag:yaml.org,2002:set":UX.set,"tag:yaml.org,2002:timestamp":L8.timestamp};function KH($,Z,X){let z=ZX.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(ZX.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"?XX[Y]:Y;if(!W){let U=JSON.stringify(Y),q=Object.keys(XX).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},[])}HH.coreKnownTags=VH;HH.getTags=KH});var k3=E((IH)=>{var x3=i(),OH=W$(),NH=U$(),LH=q2(),D8=qX(),DH=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class b3{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,x3.MAP,{value:OH.map}),Object.defineProperty(this,x3.SCALAR,{value:LH.string}),Object.defineProperty(this,x3.SEQ,{value:NH.seq}),this.sortMapEntries=typeof Q==="function"?Q:Q===!0?DH:null}clone(){let $=Object.create(b3.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}IH.Schema=b3});var GX=E((_H)=>{var AH=i(),y3=Y2(),B2=z2();function RH($,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=y3.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(AH.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=y3.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(y3.stringify($.contents,J));if($.directives?.docEnd)if($.comment){let U=Q($.comment);if(U.includes(`
|
|
81
|
-
`))
|
|
77
|
+
${X}${K}`}else return`${q}${Y}${H.join(" ")}${Y}${K}`}}function b8({indent:$,options:{commentString:Z}},z,Q,X){if(Q&&X)Q=Q.replace(/^\n+/,"");if(Q){let J=k8.indentComment(Z(Q),$);z.push(J.trimStart())}}OM.stringifyCollection=LM});var Z6=F((_M)=>{var TM=U7(),AM=W7(),RM=R8(),$6=o(),y8=e2(),CM=B0();function O1($,Z){let z=$6.isScalar(Z)?Z.value:Z;for(let Q of $)if($6.isPair(Q)){if(Q.key===Z||Q.key===z)return Q;if($6.isScalar(Q.key)&&Q.key.value===z)return Q}return}class AX extends RM.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super($6.MAP,$);this.items=[]}static from($,Z,z){let{keepUndefined:Q,replacer:X}=z,J=new this($),Y=(W,U)=>{if(typeof X==="function")U=X.call(Z,W,U);else if(Array.isArray(X)&&!X.includes(W))return;if(U!==void 0||Q)J.items.push(y8.createPair(W,U,z))};if(Z instanceof Map)for(let[W,U]of Z)Y(W,U);else if(Z&&typeof Z==="object")for(let W of Object.keys(Z))Y(W,Z[W]);if(typeof $.sortMapEntries==="function")J.items.sort($.sortMapEntries);return J}add($,Z){let z;if($6.isPair($))z=$;else if(!$||typeof $!=="object"||!("key"in $))z=new y8.Pair($,$?.value);else z=new y8.Pair($.key,$.value);let Q=O1(this.items,z.key),X=this.schema?.sortMapEntries;if(Q){if(!Z)throw Error(`Key ${z.key} already set`);if($6.isScalar(Q.value)&&CM.isScalarValue(z.value))Q.value.value=z.value;else Q.value=z.value}else if(X){let J=this.items.findIndex((Y)=>X(z,Y)<0);if(J===-1)this.items.push(z);else this.items.splice(J,0,z)}else this.items.push(z)}delete($){let Z=O1(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let Q=O1(this.items,$)?.value;return(!Z&&$6.isScalar(Q)?Q.value:Q)??void 0}has($){return!!O1(this.items,$)}set($,Z){this.add(new y8.Pair($,Z),!0)}toJSON($,Z,z){let Q=z?new z:Z?.mapAsMap?new Map:{};if(Z?.onCreate)Z.onCreate(Q);for(let X of this.items)AM.addPairToJSMap(Z,Q,X);return Q}toString($,Z,z){if(!$)return JSON.stringify(this);for(let Q of this.items)if(!$6.isPair(Q))throw Error(`Map items must all be pairs; found ${JSON.stringify(Q)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return TM.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:z,onComment:Z})}}_M.YAMLMap=AX;_M.findPair=O1});var H$=F((jM)=>{var EM=o(),RX=Z6(),wM={collection:"map",default:!0,nodeClass:RX.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!EM.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,z)=>RX.YAMLMap.from($,Z,z)};jM.map=wM});var z6=F((gM)=>{var xM=K1(),kM=U7(),bM=R8(),g8=o(),yM=B0(),vM=o2();class CX extends bM.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(g8.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=v8($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let z=v8($);if(typeof z!=="number")return;let Q=this.items[z];return!Z&&g8.isScalar(Q)?Q.value:Q}has($){let Z=v8($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let z=v8($);if(typeof z!=="number")throw Error(`Expected a valid index, not ${$}.`);let Q=this.items[z];if(g8.isScalar(Q)&&yM.isScalarValue(Z))Q.value=Z;else this.items[z]=Z}toJSON($,Z){let z=[];if(Z?.onCreate)Z.onCreate(z);let Q=0;for(let X of this.items)z.push(vM.toJS(X,String(Q++),Z));return z}toString($,Z,z){if(!$)return JSON.stringify(this);return kM.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:z,onComment:Z})}static from($,Z,z){let{replacer:Q}=z,X=new this($);if(Z&&Symbol.iterator in Object(Z)){let J=0;for(let Y of Z){if(typeof Q==="function"){let W=Z instanceof Set?Y:String(J++);Y=Q.call(Z,W,Y)}X.items.push(xM.createNode(Y,void 0,z))}}return X}}function v8($){let Z=g8.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}gM.YAMLSeq=CX});var q$=F((mM)=>{var fM=o(),_X=z6(),uM={collection:"seq",default:!0,nodeClass:_X.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!fM.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,z)=>_X.YAMLSeq.from($,Z,z)};mM.seq=uM});var I1=F((dM)=>{var pM=L1(),lM={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,z,Q){return Z=Object.assign({actualString:!0},Z),pM.stringifyString($,Z,z,Q)}};dM.string=lM});var h8=F((nM)=>{var FX=B0(),PX={identify:($)=>$==null,createNode:()=>new FX.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new FX.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&PX.test.test($)?$:Z.options.nullStr};nM.nullTag=PX});var G7=F((oM)=>{var sM=B0(),EX={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new sM.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},z){if($&&EX.test.test($)){let Q=$[0]==="t"||$[0]==="T";if(Z===Q)return $}return Z?z.options.trueStr:z.options.falseStr}};oM.boolTag=EX});var K$=F((eM)=>{function tM({format:$,minFractionDigits:Z,tag:z,value:Q}){if(typeof Q==="bigint")return String(Q);let X=typeof Q==="number"?Q:Number(Q);if(!isFinite(X))return isNaN(X)?".nan":X<0?"-.inf":".inf";let J=Object.is(Q,-0)?"-0":JSON.stringify(Q);if(!$&&Z&&(!z||z==="tag:yaml.org,2002:float")&&/^-?\d/.test(J)&&!J.includes("e")){let Y=J.indexOf(".");if(Y<0)Y=J.length,J+=".";let W=Z-(J.length-Y-1);while(W-- >0)J+="0"}return J}eM.stringifyNumber=tM});var H7=F((JL)=>{var ZL=B0(),V7=K$(),zL={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:V7.stringifyNumber},QL={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():V7.stringifyNumber($)}},XL={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new ZL.Scalar(parseFloat($)),z=$.indexOf(".");if(z!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-z-1;return Z},stringify:V7.stringifyNumber};JL.float=XL;JL.floatExp=QL;JL.floatNaN=zL});var K7=F((qL)=>{var wX=K$(),f8=($)=>typeof $==="bigint"||Number.isInteger($),q7=($,Z,z,{intAsBigInt:Q})=>Q?BigInt($):parseInt($.substring(Z),z);function jX($,Z,z){let{value:Q}=$;if(f8(Q)&&Q>=0)return z+Q.toString(Z);return wX.stringifyNumber($)}var GL={identify:($)=>f8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,z)=>q7($,2,8,z),stringify:($)=>jX($,8,"0o")},VL={identify:f8,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,z)=>q7($,0,10,z),stringify:wX.stringifyNumber},HL={identify:($)=>f8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,z)=>q7($,2,16,z),stringify:($)=>jX($,16,"0x")};qL.int=VL;qL.intHex=HL;qL.intOct=GL});var SX=F((AL)=>{var LL=H$(),NL=h8(),DL=q$(),OL=I1(),IL=G7(),B7=H7(),M7=K7(),TL=[LL.map,DL.seq,OL.string,NL.nullTag,IL.boolTag,M7.intOct,M7.int,M7.intHex,B7.floatNaN,B7.floatExp,B7.float];AL.schema=TL});var kX=F((jL)=>{var CL=B0(),_L=H$(),FL=q$();function xX($){return typeof $==="bigint"||Number.isInteger($)}var u8=({value:$})=>JSON.stringify($),PL=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:u8},{identify:($)=>$==null,createNode:()=>new CL.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:u8},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:u8},{identify:xX,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:z})=>z?BigInt($):parseInt($,10),stringify:({value:$})=>xX($)?$.toString():JSON.stringify($)},{identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:($)=>parseFloat($),stringify:u8}],EL={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},wL=[_L.map,FL.seq].concat(PL,EL);jL.schema=wL});var N7=F((bL)=>{var T1=l0("buffer"),L7=B0(),xL=L1(),kL={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof T1.Buffer==="function")return T1.Buffer.from($,"base64");else if(typeof atob==="function"){let z=atob($.replace(/[\n\r]/g,"")),Q=new Uint8Array(z.length);for(let X=0;X<z.length;++X)Q[X]=z.charCodeAt(X);return Q}else return Z("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:Z,value:z},Q,X,J){if(!z)return"";let Y=z,W;if(typeof T1.Buffer==="function")W=Y instanceof T1.Buffer?Y.toString("base64"):T1.Buffer.from(Y.buffer).toString("base64");else if(typeof btoa==="function"){let U="";for(let G=0;G<Y.length;++G)U+=String.fromCharCode(Y[G]);W=btoa(U)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(Z??(Z=L7.Scalar.BLOCK_LITERAL),Z!==L7.Scalar.QUOTE_DOUBLE){let U=Math.max(Q.options.lineWidth-Q.indent.length,Q.options.minContentWidth),G=Math.ceil(W.length/U),V=Array(G);for(let H=0,q=0;H<G;++H,q+=U)V[H]=W.substr(q,U);W=V.join(Z===L7.Scalar.BLOCK_LITERAL?`
|
|
78
|
+
`:" ")}return xL.stringifyString({comment:$,type:Z,value:W},Q,X,J)}};bL.binary=kL});var c8=F((fL)=>{var m8=o(),D7=e2(),vL=B0(),gL=z6();function bX($,Z){if(m8.isSeq($))for(let z=0;z<$.items.length;++z){let Q=$.items[z];if(m8.isPair(Q))continue;else if(m8.isMap(Q)){if(Q.items.length>1)Z("Each pair must have its own sequence indicator");let X=Q.items[0]||new D7.Pair(new vL.Scalar(null));if(Q.commentBefore)X.key.commentBefore=X.key.commentBefore?`${Q.commentBefore}
|
|
79
|
+
${X.key.commentBefore}`:Q.commentBefore;if(Q.comment){let J=X.value??X.key;J.comment=J.comment?`${Q.comment}
|
|
80
|
+
${J.comment}`:Q.comment}Q=X}$.items[z]=m8.isPair(Q)?Q:new D7.Pair(Q)}else Z("Expected a sequence for this tag");return $}function yX($,Z,z){let{replacer:Q}=z,X=new gL.YAMLSeq($);X.tag="tag:yaml.org,2002:pairs";let J=0;if(Z&&Symbol.iterator in Object(Z))for(let Y of Z){if(typeof Q==="function")Y=Q.call(Z,String(J++),Y);let W,U;if(Array.isArray(Y))if(Y.length===2)W=Y[0],U=Y[1];else throw TypeError(`Expected [key, value] tuple: ${Y}`);else if(Y&&Y instanceof Object){let G=Object.keys(Y);if(G.length===1)W=G[0],U=Y[W];else throw TypeError(`Expected tuple with one key, not ${G.length} keys`)}else W=Y;X.items.push(D7.createPair(W,U,z))}return X}var hL={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:bX,createNode:yX};fL.createPairs=yX;fL.pairs=hL;fL.resolvePairs=bX});var I7=F((dL)=>{var vX=o(),O7=o2(),A1=Z6(),pL=z6(),gX=c8();class E6 extends pL.YAMLSeq{constructor(){super();this.add=A1.YAMLMap.prototype.add.bind(this),this.delete=A1.YAMLMap.prototype.delete.bind(this),this.get=A1.YAMLMap.prototype.get.bind(this),this.has=A1.YAMLMap.prototype.has.bind(this),this.set=A1.YAMLMap.prototype.set.bind(this),this.tag=E6.tag}toJSON($,Z){if(!Z)return super.toJSON($);let z=new Map;if(Z?.onCreate)Z.onCreate(z);for(let Q of this.items){let X,J;if(vX.isPair(Q))X=O7.toJS(Q.key,"",Z),J=O7.toJS(Q.value,X,Z);else X=O7.toJS(Q,"",Z);if(z.has(X))throw Error("Ordered maps must not include duplicate keys");z.set(X,J)}return z}static from($,Z,z){let Q=gX.createPairs($,Z,z),X=new this;return X.items=Q.items,X}}E6.tag="tag:yaml.org,2002:omap";var lL={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:E6,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let z=gX.resolvePairs($,Z),Q=[];for(let{key:X}of z.items)if(vX.isScalar(X))if(Q.includes(X.value))Z(`Ordered maps must not include duplicate keys: ${X.value}`);else Q.push(X.value);return Object.assign(new E6,z)},createNode:($,Z,z)=>E6.from($,Z,z)};dL.YAMLOMap=E6;dL.omap=lL});var cX=F((rL)=>{var hX=B0();function fX({value:$,source:Z},z){if(Z&&($?uX:mX).test.test(Z))return Z;return $?z.options.trueStr:z.options.falseStr}var uX={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new hX.Scalar(!0),stringify:fX},mX={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new hX.Scalar(!1),stringify:fX};rL.falseTag=mX;rL.trueTag=uX});var pX=F((ZN)=>{var aL=B0(),T7=K$(),tL={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:T7.stringifyNumber},eL={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():T7.stringifyNumber($)}},$N={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new aL.Scalar(parseFloat($.replace(/_/g,""))),z=$.indexOf(".");if(z!==-1){let Q=$.substring(z+1).replace(/_/g,"");if(Q[Q.length-1]==="0")Z.minFractionDigits=Q.length}return Z},stringify:T7.stringifyNumber};ZN.float=$N;ZN.floatExp=eL;ZN.floatNaN=tL});var dX=F((GN)=>{var lX=K$(),R1=($)=>typeof $==="bigint"||Number.isInteger($);function p8($,Z,z,{intAsBigInt:Q}){let X=$[0];if(X==="-"||X==="+")Z+=1;if($=$.substring(Z).replace(/_/g,""),Q){switch(z){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let Y=BigInt($);return X==="-"?BigInt(-1)*Y:Y}let J=parseInt($,z);return X==="-"?-1*J:J}function A7($,Z,z){let{value:Q}=$;if(R1(Q)){let X=Q.toString(Z);return Q<0?"-"+z+X.substr(1):z+X}return lX.stringifyNumber($)}var JN={identify:R1,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,z)=>p8($,2,2,z),stringify:($)=>A7($,2,"0b")},YN={identify:R1,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,z)=>p8($,1,8,z),stringify:($)=>A7($,8,"0")},WN={identify:R1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,z)=>p8($,0,10,z),stringify:lX.stringifyNumber},UN={identify:R1,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,z)=>p8($,2,16,z),stringify:($)=>A7($,16,"0x")};GN.int=WN;GN.intBin=JN;GN.intHex=UN;GN.intOct=YN});var R7=F((MN)=>{var i8=o(),l8=e2(),d8=Z6();class w6 extends d8.YAMLMap{constructor($){super($);this.tag=w6.tag}add($){let Z;if(i8.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new l8.Pair($.key,null);else Z=new l8.Pair($,null);if(!d8.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let z=d8.findPair(this.items,$);return!Z&&i8.isPair(z)?i8.isScalar(z.key)?z.key.value:z.key:z}set($,Z){if(typeof Z!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof Z}`);let z=d8.findPair(this.items,$);if(z&&!Z)this.items.splice(this.items.indexOf(z),1);else if(!z&&Z)this.items.push(new l8.Pair($))}toJSON($,Z){return super.toJSON($,Z,Set)}toString($,Z,z){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),Z,z);else throw Error("Set items must all have null values")}static from($,Z,z){let{replacer:Q}=z,X=new this($);if(Z&&Symbol.iterator in Object(Z))for(let J of Z){if(typeof Q==="function")J=Q.call(Z,J,J);X.items.push(l8.createPair(J,null,z))}return X}}w6.tag="tag:yaml.org,2002:set";var BN={collection:"map",identify:($)=>$ instanceof Set,nodeClass:w6,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,z)=>w6.from($,Z,z),resolve($,Z){if(i8.isMap($))if($.hasAllNullValues(!0))return Object.assign(new w6,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};MN.YAMLSet=w6;MN.set=BN});var _7=F((TN)=>{var DN=K$();function C7($,Z){let z=$[0],Q=z==="-"||z==="+"?$.substring(1):$,X=(Y)=>Z?BigInt(Y):Number(Y),J=Q.replace(/_/g,"").split(":").reduce((Y,W)=>Y*X(60)+X(W),X(0));return z==="-"?X(-1)*J:J}function iX($){let{value:Z}=$,z=(Y)=>Y;if(typeof Z==="bigint")z=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return DN.stringifyNumber($);let Q="";if(Z<0)Q="-",Z*=z(-1);let X=z(60),J=[Z%X];if(Z<60)J.unshift(0);else if(Z=(Z-J[0])/X,J.unshift(Z%X),Z>=60)Z=(Z-J[0])/X,J.unshift(Z);return Q+J.map((Y)=>String(Y).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var ON={identify:($)=>typeof $==="bigint"||Number.isInteger($),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:($,Z,{intAsBigInt:z})=>C7($,z),stringify:iX},IN={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:($)=>C7($,!1),stringify:iX},nX={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(nX.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,z,Q,X,J,Y,W]=Z.map(Number),U=Z[7]?Number((Z[7]+"00").substr(1,3)):0,G=Date.UTC(z,Q-1,X,J||0,Y||0,W||0,U),V=Z[8];if(V&&V!=="Z"){let H=C7(V,!1);if(Math.abs(H)<30)H*=60;G-=60000*H}return new Date(G)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};TN.floatTime=IN;TN.intTime=ON;TN.timestamp=nX});var sX=F((yN)=>{var _N=H$(),FN=h8(),PN=q$(),EN=I1(),wN=N7(),rX=cX(),F7=pX(),n8=dX(),jN=j8(),SN=I7(),xN=c8(),kN=R7(),P7=_7(),bN=[_N.map,PN.seq,EN.string,FN.nullTag,rX.trueTag,rX.falseTag,n8.intBin,n8.intOct,n8.int,n8.intHex,F7.floatNaN,F7.floatExp,F7.float,wN.binary,jN.merge,SN.omap,xN.pairs,kN.set,P7.intTime,P7.floatTime,P7.timestamp];yN.schema=bN});var JJ=F((lN)=>{var eX=H$(),gN=h8(),$J=q$(),hN=I1(),fN=G7(),E7=H7(),w7=K7(),uN=SX(),mN=kX(),ZJ=N7(),C1=j8(),zJ=I7(),QJ=c8(),oX=sX(),XJ=R7(),r8=_7(),aX=new Map([["core",uN.schema],["failsafe",[eX.map,$J.seq,hN.string]],["json",mN.schema],["yaml11",oX.schema],["yaml-1.1",oX.schema]]),tX={binary:ZJ.binary,bool:fN.boolTag,float:E7.float,floatExp:E7.floatExp,floatNaN:E7.floatNaN,floatTime:r8.floatTime,int:w7.int,intHex:w7.intHex,intOct:w7.intOct,intTime:r8.intTime,map:eX.map,merge:C1.merge,null:gN.nullTag,omap:zJ.omap,pairs:QJ.pairs,seq:$J.seq,set:XJ.set,timestamp:r8.timestamp},cN={"tag:yaml.org,2002:binary":ZJ.binary,"tag:yaml.org,2002:merge":C1.merge,"tag:yaml.org,2002:omap":zJ.omap,"tag:yaml.org,2002:pairs":QJ.pairs,"tag:yaml.org,2002:set":XJ.set,"tag:yaml.org,2002:timestamp":r8.timestamp};function pN($,Z,z){let Q=aX.get(Z);if(Q&&!$)return z&&!Q.includes(C1.merge)?Q.concat(C1.merge):Q.slice();let X=Q;if(!X)if(Array.isArray($))X=[];else{let J=Array.from(aX.keys()).filter((Y)=>Y!=="yaml11").map((Y)=>JSON.stringify(Y)).join(", ");throw Error(`Unknown schema "${Z}"; use one of ${J} or define customTags array`)}if(Array.isArray($))for(let J of $)X=X.concat(J);else if(typeof $==="function")X=$(X.slice());if(z)X=X.concat(C1.merge);return X.reduce((J,Y)=>{let W=typeof Y==="string"?tX[Y]:Y;if(!W){let U=JSON.stringify(Y),G=Object.keys(tX).map((V)=>JSON.stringify(V)).join(", ");throw Error(`Unknown custom tag ${U}; use one of ${G}`)}if(!J.includes(W))J.push(W);return J},[])}lN.coreKnownTags=cN;lN.getTags=pN});var x7=F((aN)=>{var j7=o(),nN=H$(),rN=q$(),sN=I1(),s8=JJ(),oN=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class S7{constructor({compat:$,customTags:Z,merge:z,resolveKnownTags:Q,schema:X,sortMapEntries:J,toStringDefaults:Y}){this.compat=Array.isArray($)?s8.getTags($,"compat"):$?s8.getTags(null,$):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?s8.coreKnownTags:{},this.tags=s8.getTags(Z,this.name,z),this.toStringOptions=Y??null,Object.defineProperty(this,j7.MAP,{value:nN.map}),Object.defineProperty(this,j7.SCALAR,{value:sN.string}),Object.defineProperty(this,j7.SEQ,{value:rN.seq}),this.sortMapEntries=typeof J==="function"?J:J===!0?oN:null}clone(){let $=Object.create(S7.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}aN.Schema=S7});var YJ=F((ZD)=>{var eN=o(),k7=N1(),_1=B1();function $D($,Z){let z=[],Q=Z.directives===!0;if(Z.directives!==!1&&$.directives){let U=$.directives.toString($);if(U)z.push(U),Q=!0;else if($.directives.docStart)Q=!0}if(Q)z.push("---");let X=k7.createStringifyContext($,Z),{commentString:J}=X.options;if($.commentBefore){if(z.length!==1)z.unshift("");let U=J($.commentBefore);z.unshift(_1.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(eN.isNode($.contents)){if($.contents.spaceBefore&&Q)z.push("");if($.contents.commentBefore){let V=J($.contents.commentBefore);z.push(_1.indentComment(V,""))}X.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,G=k7.stringify($.contents,X,()=>W=null,U);if(W)G+=_1.lineComment(G,"",J(W));if((G[0]==="|"||G[0]===">")&&z[z.length-1]==="---")z[z.length-1]=`--- ${G}`;else z.push(G)}else z.push(k7.stringify($.contents,X));if($.directives?.docEnd)if($.comment){let U=J($.comment);if(U.includes(`
|
|
81
|
+
`))z.push("..."),z.push(_1.indentComment(U,""));else z.push(`... ${U}`)}else z.push("...");else{let U=$.comment;if(U&&Y)U=U.replace(/^\n+/,"");if(U){if((!Y||W)&&z[z.length-1]!=="")z.push("");z.push(_1.indentComment(J(U),""))}}return z.join(`
|
|
82
82
|
`)+`
|
|
83
|
-
`}
|
|
84
|
-
`;Y=W+Y}if(/[^ ]/.test(Y)){let W=1,U=
|
|
83
|
+
`}ZD.stringifyDocument=$D});var F1=F((VD)=>{var QD=q1(),B$=R8(),e0=o(),XD=e2(),JD=o2(),YD=x7(),WD=YJ(),b7=I8(),UD=eZ(),GD=K1(),y7=tZ();class v7{constructor($,Z,z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,e0.NODE_TYPE,{value:e0.DOC});let Q=null;if(typeof Z==="function"||Array.isArray(Z))Q=Z;else if(z===void 0&&Z)z=Z,Z=void 0;let X=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},z);this.options=X;let{version:J}=X;if(z?._directives){if(this.directives=z._directives.atDocument(),this.directives.yaml.explicit)J=this.directives.yaml.version}else this.directives=new y7.Directives({version:J});this.setSchema(J,z),this.contents=$===void 0?null:this.createNode($,Q,z)}clone(){let $=Object.create(v7.prototype,{[e0.NODE_TYPE]:{value:e0.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=e0.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(M$(this.contents))this.contents.add($)}addIn($,Z){if(M$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let z=b7.anchorNames(this);$.anchor=!Z||z.has(Z)?b7.findNewAnchor(Z||"a",z):Z}return new QD.Alias($.anchor)}createNode($,Z,z){let Q=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),Q=Z;else if(Array.isArray(Z)){let B=(T)=>typeof T==="number"||T instanceof String||T instanceof Number,N=Z.filter(B).map(String);if(N.length>0)Z=Z.concat(N);Q=Z}else if(z===void 0&&Z)z=Z,Z=void 0;let{aliasDuplicateObjects:X,anchorPrefix:J,flow:Y,keepUndefined:W,onTagObj:U,tag:G}=z??{},{onAnchor:V,setAnchors:H,sourceObjects:q}=b7.createNodeAnchors(this,J||"a"),K={aliasDuplicateObjects:X??!0,keepUndefined:W??!1,onAnchor:V,onTagObj:U,replacer:Q,schema:this.schema,sourceObjects:q},L=GD.createNode($,G,K);if(Y&&e0.isCollection(L))L.flow=!0;return H(),L}createPair($,Z,z={}){let Q=this.createNode($,null,z),X=this.createNode(Z,null,z);return new XD.Pair(Q,X)}delete($){return M$(this.contents)?this.contents.delete($):!1}deleteIn($){if(B$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return M$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return e0.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(B$.isEmptyPath($))return!Z&&e0.isScalar(this.contents)?this.contents.value:this.contents;return e0.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return e0.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(B$.isEmptyPath($))return this.contents!==void 0;return e0.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=B$.collectionFromPath(this.schema,[$],Z);else if(M$(this.contents))this.contents.set($,Z)}setIn($,Z){if(B$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=B$.collectionFromPath(this.schema,Array.from($),Z);else if(M$(this.contents))this.contents.setIn($,Z)}setSchema($,Z={}){if(typeof $==="number")$=String($);let z;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new y7.Directives({version:"1.1"});z={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new y7.Directives({version:$});z={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;z=null;break;default:{let Q=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${Q}`)}}if(Z.schema instanceof Object)this.schema=Z.schema;else if(z)this.schema=new YD.Schema(Object.assign(z,Z));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:Z,mapAsMap:z,maxAliasCount:Q,onAnchor:X,reviver:J}={}){let Y={anchors:new Map,doc:this,keep:!$,mapAsMap:z===!0,mapKeyWarned:!1,maxAliasCount:typeof Q==="number"?Q:100},W=JD.toJS(this.contents,Z??"",Y);if(typeof X==="function")for(let{count:U,res:G}of Y.anchors.values())X(G,U);return typeof J==="function"?UD.applyReviver(J,{"":W},"",W):W}toJSON($,Z){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:Z})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let Z=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${Z}`)}return WD.stringifyDocument(this,$)}}function M$($){if(e0.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}VD.Document=v7});var P1=F((KD)=>{class o8 extends Error{constructor($,Z,z,Q){super();this.name=$,this.code=z,this.message=Q,this.pos=Z}}class WJ extends o8{constructor($,Z,z){super("YAMLParseError",$,Z,z)}}class UJ extends o8{constructor($,Z,z){super("YAMLWarning",$,Z,z)}}var qD=($,Z)=>(z)=>{if(z.pos[0]===-1)return;z.linePos=z.pos.map((W)=>Z.linePos(W));let{line:Q,col:X}=z.linePos[0];z.message+=` at line ${Q}, column ${X}`;let J=X-1,Y=$.substring(Z.lineStarts[Q-1],Z.lineStarts[Q]).replace(/[\n\r]+$/,"");if(J>=60&&Y.length>80){let W=Math.min(J-39,Y.length-79);Y="…"+Y.substring(W),J-=W-1}if(Y.length>80)Y=Y.substring(0,79)+"…";if(Q>1&&/^ *$/.test(Y.substring(0,J))){let W=$.substring(Z.lineStarts[Q-2],Z.lineStarts[Q-1]);if(W.length>80)W=W.substring(0,79)+`…
|
|
84
|
+
`;Y=W+Y}if(/[^ ]/.test(Y)){let W=1,U=z.linePos[1];if(U?.line===Q&&U.col>X)W=Math.max(1,Math.min(U.col-X,80-J));let G=" ".repeat(J)+"^".repeat(W);z.message+=`:
|
|
85
85
|
|
|
86
86
|
${Y}
|
|
87
|
-
${
|
|
88
|
-
`}};
|
|
89
|
-
`))return!0;if($.end){for(let Z of $.end)if(Z.type==="newline")return!0}return!1;case"flow-collection":for(let Z of $.items){for(let
|
|
90
|
-
`+B.comment;else W.comment=B.comment;continue}if(B.newlineAfterProp
|
|
91
|
-
`+
|
|
92
|
-
`+
|
|
93
|
-
`+
|
|
94
|
-
`+
|
|
95
|
-
`+
|
|
96
|
-
`.repeat(Math.max(1,Y.length-1)):"",
|
|
97
|
-
`;for(let B=
|
|
98
|
-
`;else if(
|
|
99
|
-
`;else if(!
|
|
100
|
-
`)
|
|
101
|
-
|
|
102
|
-
`;
|
|
103
|
-
`,
|
|
104
|
-
`)
|
|
105
|
-
`;else
|
|
106
|
-
`;else
|
|
107
|
-
`+Y[B][0].slice(U);if(
|
|
108
|
-
`)
|
|
109
|
-
`;break;default:
|
|
110
|
-
`}let L=
|
|
111
|
-
`,"sy"),
|
|
112
|
-
`,"sy")}catch{Z=/(.*?)[ \t]*\r?\n/sy,
|
|
113
|
-
`)J
|
|
114
|
-
`;else J
|
|
115
|
-
`)continue;if(
|
|
116
|
-
`){let{fold:
|
|
117
|
-
`){
|
|
118
|
-
`){
|
|
119
|
-
`&&!(Y==="\r"&&$[
|
|
120
|
-
`))
|
|
121
|
-
`||
|
|
122
|
-
`)break;if(
|
|
123
|
-
`)
|
|
124
|
-
`;Z+=1,
|
|
125
|
-
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function
|
|
87
|
+
${G}
|
|
88
|
+
`}};KD.YAMLError=o8;KD.YAMLParseError=WJ;KD.YAMLWarning=UJ;KD.prettifyError=qD});var E1=F((OD)=>{function DD($,{flow:Z,indicator:z,next:Q,offset:X,onError:J,parentIndent:Y,startOnNewline:W}){let U=!1,G=W,V=W,H="",q="",K=!1,L=!1,B=null,N=null,T=null,w=null,j=null,x=null,v=null;for(let R of $){if(L){if(R.type!=="space"&&R.type!=="newline"&&R.type!=="comma")J(R.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(B){if(G&&R.type!=="comment"&&R.type!=="newline")J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");B=null}switch(R.type){case"space":if(!Z&&(z!=="doc-start"||Q?.type!=="flow-collection")&&R.source.includes("\t"))B=R;V=!0;break;case"comment":{if(!V)J(R,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=R.source.substring(1)||" ";if(!H)H=u;else H+=q+u;q="",G=!1;break}case"newline":if(G){if(H)H+=R.source;else if(!x||z!=="seq-item-ind")U=!0}else q+=R.source;if(G=!0,K=!0,N||T)w=R;V=!0;break;case"anchor":if(N)J(R,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(R.source.endsWith(":"))J(R.offset+R.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);N=R,v??(v=R.offset),G=!1,V=!1,L=!0;break;case"tag":{if(T)J(R,"MULTIPLE_TAGS","A node can have at most one tag");T=R,v??(v=R.offset),G=!1,V=!1,L=!0;break}case z:if(N||T)J(R,"BAD_PROP_ORDER",`Anchors and tags must be after the ${R.source} indicator`);if(x)J(R,"UNEXPECTED_TOKEN",`Unexpected ${R.source} in ${Z??"collection"}`);x=R,G=z==="seq-item-ind"||z==="explicit-key-ind",V=!1;break;case"comma":if(Z){if(j)J(R,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);j=R,G=!1,V=!1;break}default:J(R,"UNEXPECTED_TOKEN",`Unexpected ${R.type} token`),G=!1,V=!1}}let k=$[$.length-1],l=k?k.offset+k.source.length:X;if(L&&Q&&Q.type!=="space"&&Q.type!=="newline"&&Q.type!=="comma"&&(Q.type!=="scalar"||Q.source!==""))J(Q.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(B&&(G&&B.indent<=Y||Q?.type==="block-map"||Q?.type==="block-seq"))J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:j,found:x,spaceBefore:U,comment:H,hasNewline:K,anchor:N,tag:T,newlineAfterProp:w,end:l,start:v??l}}OD.resolveProps=DD});var a8=F((TD)=>{function g7($){if(!$)return null;switch($.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if($.source.includes(`
|
|
89
|
+
`))return!0;if($.end){for(let Z of $.end)if(Z.type==="newline")return!0}return!1;case"flow-collection":for(let Z of $.items){for(let z of Z.start)if(z.type==="newline")return!0;if(Z.sep){for(let z of Z.sep)if(z.type==="newline")return!0}if(g7(Z.key)||g7(Z.value))return!0}return!1;default:return!0}}TD.containsNewline=g7});var h7=F((_D)=>{var RD=a8();function CD($,Z,z){if(Z?.type==="flow-collection"){let Q=Z.end[0];if(Q.indent===$&&(Q.source==="]"||Q.source==="}")&&RD.containsNewline(Z))z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}_D.flowIndentCheck=CD});var f7=F((ED)=>{var GJ=o();function PD($,Z,z){let{uniqueKeys:Q}=$.options;if(Q===!1)return!1;let X=typeof Q==="function"?Q:(J,Y)=>J===Y||GJ.isScalar(J)&&GJ.isScalar(Y)&&J.value===Y.value;return Z.some((J)=>X(J.key,z))}ED.mapIncludes=PD});var BJ=F((bD)=>{var VJ=e2(),jD=Z6(),HJ=E1(),SD=a8(),qJ=h7(),xD=f7(),KJ="All mapping items must start at the same column";function kD({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??jD.YAMLMap)(z.schema);if(z.atRoot)z.atRoot=!1;let U=Q.offset,G=null;for(let V of Q.items){let{start:H,key:q,sep:K,value:L}=V,B=HJ.resolveProps(H,{indicator:"explicit-key-ind",next:q??K?.[0],offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0}),N=!B.found;if(N){if(q){if(q.type==="block-seq")X(U,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in q&&q.indent!==Q.indent)X(U,"BAD_INDENT",KJ)}if(!B.anchor&&!B.tag&&!K){if(G=B.end,B.comment)if(W.comment)W.comment+=`
|
|
90
|
+
`+B.comment;else W.comment=B.comment;continue}if(B.newlineAfterProp||SD.containsNewline(q))X(q??H[H.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(B.found?.indent!==Q.indent)X(U,"BAD_INDENT",KJ);z.atKey=!0;let T=B.end,w=q?$(z,q,B,X):Z(z,T,H,null,B,X);if(z.schema.compat)qJ.flowIndentCheck(Q.indent,q,X);if(z.atKey=!1,xD.mapIncludes(z,W.items,w))X(T,"DUPLICATE_KEY","Map keys must be unique");let j=HJ.resolveProps(K??[],{indicator:"map-value-ind",next:L,offset:w.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!q||q.type==="block-scalar"});if(U=j.end,j.found){if(N){if(L?.type==="block-map"&&!j.hasNewline)X(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(z.options.strict&&B.start<j.found.offset-1024)X(w.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let x=L?$(z,L,j,X):Z(z,U,K,null,j,X);if(z.schema.compat)qJ.flowIndentCheck(Q.indent,L,X);U=x.range[2];let v=new VJ.Pair(w,x);if(z.options.keepSourceTokens)v.srcToken=V;W.items.push(v)}else{if(N)X(w.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(j.comment)if(w.comment)w.comment+=`
|
|
91
|
+
`+j.comment;else w.comment=j.comment;let x=new VJ.Pair(w);if(z.options.keepSourceTokens)x.srcToken=V;W.items.push(x)}}if(G&&G<U)X(G,"IMPOSSIBLE","Map comment with trailing content");return W.range=[Q.offset,U,G??U],W}bD.resolveBlockMap=kD});var MJ=F((uD)=>{var vD=z6(),gD=E1(),hD=h7();function fD({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??vD.YAMLSeq)(z.schema);if(z.atRoot)z.atRoot=!1;if(z.atKey)z.atKey=!1;let U=Q.offset,G=null;for(let{start:V,value:H}of Q.items){let q=gD.resolveProps(V,{indicator:"seq-item-ind",next:H,offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0});if(!q.found)if(q.anchor||q.tag||H)if(H?.type==="block-seq")X(q.end,"BAD_INDENT","All sequence items must start at the same column");else X(U,"MISSING_CHAR","Sequence item without - indicator");else{if(G=q.end,q.comment)W.comment=q.comment;continue}let K=H?$(z,H,q,X):Z(z,q.end,V,null,q,X);if(z.schema.compat)hD.flowIndentCheck(Q.indent,H,X);U=K.range[2],W.items.push(K)}return W.range=[Q.offset,U,G??U],W}uD.resolveBlockSeq=fD});var L$=F((pD)=>{function cD($,Z,z,Q){let X="";if($){let J=!1,Y="";for(let W of $){let{source:U,type:G}=W;switch(G){case"space":J=!0;break;case"comment":{if(z&&!J)Q(W,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let V=U.substring(1)||" ";if(!X)X=V;else X+=Y+V;Y="";break}case"newline":if(X)Y+=U;J=!0;break;default:Q(W,"UNEXPECTED_TOKEN",`Unexpected ${G} at node end`)}Z+=U.length}}return{comment:X,offset:Z}}pD.resolveEnd=cD});var DJ=F((tD)=>{var dD=o(),iD=e2(),LJ=Z6(),nD=z6(),rD=L$(),NJ=E1(),sD=a8(),oD=f7(),u7="Block collections are not allowed within flow collections",m7=($)=>$&&($.type==="block-map"||$.type==="block-seq");function aD({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let Y=Q.start.source==="{",W=Y?"flow map":"flow sequence",G=new(J?.nodeClass??(Y?LJ.YAMLMap:nD.YAMLSeq))(z.schema);G.flow=!0;let V=z.atRoot;if(V)z.atRoot=!1;if(z.atKey)z.atKey=!1;let H=Q.offset+Q.start.source.length;for(let N=0;N<Q.items.length;++N){let T=Q.items[N],{start:w,key:j,sep:x,value:v}=T,k=NJ.resolveProps(w,{flow:W,indicator:"explicit-key-ind",next:j??x?.[0],offset:H,onError:X,parentIndent:Q.indent,startOnNewline:!1});if(!k.found){if(!k.anchor&&!k.tag&&!x&&!v){if(N===0&&k.comma)X(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`);else if(N<Q.items.length-1)X(k.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${W}`);if(k.comment)if(G.comment)G.comment+=`
|
|
92
|
+
`+k.comment;else G.comment=k.comment;H=k.end;continue}if(!Y&&z.options.strict&&sD.containsNewline(j))X(j,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(N===0){if(k.comma)X(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`)}else{if(!k.comma)X(k.start,"MISSING_CHAR",`Missing , between ${W} items`);if(k.comment){let l="";$:for(let R of w)switch(R.type){case"comma":case"space":break;case"comment":l=R.source.substring(1);break $;default:break $}if(l){let R=G.items[G.items.length-1];if(dD.isPair(R))R=R.value??R.key;if(R.comment)R.comment+=`
|
|
93
|
+
`+l;else R.comment=l;k.comment=k.comment.substring(l.length+1)}}}if(!Y&&!x&&!k.found){let l=v?$(z,v,k,X):Z(z,k.end,x,null,k,X);if(G.items.push(l),H=l.range[2],m7(v))X(l.range,"BLOCK_IN_FLOW",u7)}else{z.atKey=!0;let l=k.end,R=j?$(z,j,k,X):Z(z,l,w,null,k,X);if(m7(j))X(R.range,"BLOCK_IN_FLOW",u7);z.atKey=!1;let u=NJ.resolveProps(x??[],{flow:W,indicator:"map-value-ind",next:v,offset:R.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!1});if(u.found){if(!Y&&!k.found&&z.options.strict){if(x)for(let _ of x){if(_===u.found)break;if(_.type==="newline"){X(_,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(k.start<u.found.offset-1024)X(u.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(v)if("source"in v&&v.source?.[0]===":")X(v,"MISSING_CHAR",`Missing space after : in ${W}`);else X(u.start,"MISSING_CHAR",`Missing , or : between ${W} items`);let D0=v?$(z,v,u,X):u.found?Z(z,u.end,x,null,u,X):null;if(D0){if(m7(v))X(D0.range,"BLOCK_IN_FLOW",u7)}else if(u.comment)if(R.comment)R.comment+=`
|
|
94
|
+
`+u.comment;else R.comment=u.comment;let k0=new iD.Pair(R,D0);if(z.options.keepSourceTokens)k0.srcToken=T;if(Y){let _=G;if(oD.mapIncludes(z,_.items,R))X(l,"DUPLICATE_KEY","Map keys must be unique");_.items.push(k0)}else{let _=new LJ.YAMLMap(z.schema);_.flow=!0,_.items.push(k0);let i=(D0??R).range;_.range=[R.range[0],i[1],i[2]],G.items.push(_)}H=D0?D0.range[2]:u.end}}let q=Y?"}":"]",[K,...L]=Q.end,B=H;if(K?.source===q)B=K.offset+K.source.length;else{let N=W[0].toUpperCase()+W.substring(1),T=V?`${N} must end with a ${q}`:`${N} in block collection must be sufficiently indented and end with a ${q}`;if(X(H,V?"MISSING_CHAR":"BAD_INDENT",T),K&&K.source.length!==1)L.unshift(K)}if(L.length>0){let N=rD.resolveEnd(L,B,z.options.strict,X);if(N.comment)if(G.comment)G.comment+=`
|
|
95
|
+
`+N.comment;else G.comment=N.comment;G.range=[Q.offset,B,N.offset]}else G.range=[Q.offset,B,B];return G}tD.resolveFlowCollection=aD});var OJ=F((UO)=>{var $O=o(),ZO=B0(),zO=Z6(),QO=z6(),XO=BJ(),JO=MJ(),YO=DJ();function c7($,Z,z,Q,X,J){let Y=z.type==="block-map"?XO.resolveBlockMap($,Z,z,Q,J):z.type==="block-seq"?JO.resolveBlockSeq($,Z,z,Q,J):YO.resolveFlowCollection($,Z,z,Q,J),W=Y.constructor;if(X==="!"||X===W.tagName)return Y.tag=W.tagName,Y;if(X)Y.tag=X;return Y}function WO($,Z,z,Q,X){let J=Q.tag,Y=!J?null:Z.directives.tagName(J.source,(q)=>X(J,"TAG_RESOLVE_FAILED",q));if(z.type==="block-seq"){let{anchor:q,newlineAfterProp:K}=Q,L=q&&J?q.offset>J.offset?q:J:q??J;if(L&&(!K||K.offset<L.offset))X(L,"MISSING_CHAR","Missing newline after block sequence props")}let W=z.type==="block-map"?"map":z.type==="block-seq"?"seq":z.start.source==="{"?"map":"seq";if(!J||!Y||Y==="!"||Y===zO.YAMLMap.tagName&&W==="map"||Y===QO.YAMLSeq.tagName&&W==="seq")return c7($,Z,z,X,Y);let U=Z.schema.tags.find((q)=>q.tag===Y&&q.collection===W);if(!U){let q=Z.schema.knownTags[Y];if(q?.collection===W)Z.schema.tags.push(Object.assign({},q,{default:!1})),U=q;else{if(q)X(J,"BAD_COLLECTION_TYPE",`${q.tag} used for ${W} collection, but expects ${q.collection??"scalar"}`,!0);else X(J,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return c7($,Z,z,X,Y)}}let G=c7($,Z,z,X,Y,U),V=U.resolve?.(G,(q)=>X(J,"TAG_RESOLVE_FAILED",q),Z.options)??G,H=$O.isNode(V)?V:new ZO.Scalar(V);if(H.range=G.range,H.tag=Y,U?.format)H.format=U.format;return H}UO.composeCollection=WO});var l7=F((KO)=>{var p7=B0();function VO($,Z,z){let Q=Z.offset,X=HO(Z,$.options.strict,z);if(!X)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let J=X.mode===">"?p7.Scalar.BLOCK_FOLDED:p7.Scalar.BLOCK_LITERAL,Y=Z.source?qO(Z.source):[],W=Y.length;for(let B=Y.length-1;B>=0;--B){let N=Y[B][1];if(N===""||N==="\r")W=B;else break}if(W===0){let B=X.chomp==="+"&&Y.length>0?`
|
|
96
|
+
`.repeat(Math.max(1,Y.length-1)):"",N=Q+X.length;if(Z.source)N+=Z.source.length;return{value:B,type:J,comment:X.comment,range:[Q,N,N]}}let U=Z.indent+X.indent,G=Z.offset+X.length,V=0;for(let B=0;B<W;++B){let[N,T]=Y[B];if(T===""||T==="\r"){if(X.indent===0&&N.length>U)U=N.length}else{if(N.length<U)z(G+N.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(X.indent===0)U=N.length;if(V=B,U===0&&!$.atRoot)z(G,"BAD_INDENT","Block scalar values in collections must be indented");break}G+=N.length+T.length+1}for(let B=Y.length-1;B>=W;--B)if(Y[B][0].length>U)W=B+1;let H="",q="",K=!1;for(let B=0;B<V;++B)H+=Y[B][0].slice(U)+`
|
|
97
|
+
`;for(let B=V;B<W;++B){let[N,T]=Y[B];G+=N.length+T.length+1;let w=T[T.length-1]==="\r";if(w)T=T.slice(0,-1);if(T&&N.length<U){let x=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;z(G-T.length-(w?2:1),"BAD_INDENT",x),N=""}if(J===p7.Scalar.BLOCK_LITERAL)H+=q+N.slice(U)+T,q=`
|
|
98
|
+
`;else if(N.length>U||T[0]==="\t"){if(q===" ")q=`
|
|
99
|
+
`;else if(!K&&q===`
|
|
100
|
+
`)q=`
|
|
101
|
+
|
|
102
|
+
`;H+=q+N.slice(U)+T,q=`
|
|
103
|
+
`,K=!0}else if(T==="")if(q===`
|
|
104
|
+
`)H+=`
|
|
105
|
+
`;else q=`
|
|
106
|
+
`;else H+=q+T,q=" ",K=!1}switch(X.chomp){case"-":break;case"+":for(let B=W;B<Y.length;++B)H+=`
|
|
107
|
+
`+Y[B][0].slice(U);if(H[H.length-1]!==`
|
|
108
|
+
`)H+=`
|
|
109
|
+
`;break;default:H+=`
|
|
110
|
+
`}let L=Q+X.length+Z.source.length;return{value:H,type:J,comment:X.comment,range:[Q,L,L]}}function HO({offset:$,props:Z},z,Q){if(Z[0].type!=="block-scalar-header")return Q(Z[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:X}=Z[0],J=X[0],Y=0,W="",U=-1;for(let q=1;q<X.length;++q){let K=X[q];if(!W&&(K==="-"||K==="+"))W=K;else{let L=Number(K);if(!Y&&L)Y=L;else if(U===-1)U=$+q}}if(U!==-1)Q(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${X}`);let G=!1,V="",H=X.length;for(let q=1;q<Z.length;++q){let K=Z[q];switch(K.type){case"space":G=!0;case"newline":H+=K.source.length;break;case"comment":if(z&&!G)Q(K,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");H+=K.source.length,V=K.source.substring(1);break;case"error":Q(K,"UNEXPECTED_TOKEN",K.message),H+=K.source.length;break;default:{let L=`Unexpected token in block scalar header: ${K.type}`;Q(K,"UNEXPECTED_TOKEN",L);let B=K.source;if(B&&typeof B==="string")H+=B.length}}}return{mode:J,indent:Y,chomp:W,comment:V,length:H}}function qO($){let Z=$.split(/\n( *)/),z=Z[0],Q=z.match(/^( *)/),J=[Q?.[1]?[Q[1],z.slice(Q[1].length)]:["",z]];for(let Y=1;Y<Z.length;Y+=2)J.push([Z[Y],Z[Y+1]]);return J}KO.resolveBlockScalar=VO});var i7=F((RO)=>{var d7=B0(),MO=L$();function LO($,Z,z){let{offset:Q,type:X,source:J,end:Y}=$,W,U,G=(q,K,L)=>z(Q+q,K,L);switch(X){case"scalar":W=d7.Scalar.PLAIN,U=NO(J,G);break;case"single-quoted-scalar":W=d7.Scalar.QUOTE_SINGLE,U=DO(J,G);break;case"double-quoted-scalar":W=d7.Scalar.QUOTE_DOUBLE,U=OO(J,G);break;default:return z($,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${X}`),{value:"",type:null,comment:"",range:[Q,Q+J.length,Q+J.length]}}let V=Q+J.length,H=MO.resolveEnd(Y,V,Z,z);return{value:U,type:W,comment:H.comment,range:[Q,V,H.offset]}}function NO($,Z){let z="";switch($[0]){case"\t":z="a tab character";break;case",":z="flow indicator character ,";break;case"%":z="directive indicator character %";break;case"|":case">":{z=`block scalar indicator ${$[0]}`;break}case"@":case"`":{z=`reserved character ${$[0]}`;break}}if(z)Z(0,"BAD_SCALAR_START",`Plain value cannot start with ${z}`);return IJ($)}function DO($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return IJ($.slice(1,-1)).replace(/''/g,"'")}function IJ($){let Z,z;try{Z=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
111
|
+
`,"sy"),z=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
112
|
+
`,"sy")}catch{Z=/(.*?)[ \t]*\r?\n/sy,z=/[ \t]*(.*?)[ \t]*\r?\n/sy}let Q=Z.exec($);if(!Q)return $;let X=Q[1],J=" ",Y=Z.lastIndex;z.lastIndex=Y;while(Q=z.exec($)){if(Q[1]==="")if(J===`
|
|
113
|
+
`)X+=J;else J=`
|
|
114
|
+
`;else X+=J+Q[1],J=" ";Y=z.lastIndex}let W=/[ \t]*(.*)/sy;return W.lastIndex=Y,Q=W.exec($),X+J+(Q?.[1]??"")}function OO($,Z){let z="";for(let Q=1;Q<$.length-1;++Q){let X=$[Q];if(X==="\r"&&$[Q+1]===`
|
|
115
|
+
`)continue;if(X===`
|
|
116
|
+
`){let{fold:J,offset:Y}=IO($,Q);z+=J,Q=Y}else if(X==="\\"){let J=$[++Q],Y=TO[J];if(Y)z+=Y;else if(J===`
|
|
117
|
+
`){J=$[Q+1];while(J===" "||J==="\t")J=$[++Q+1]}else if(J==="\r"&&$[Q+1]===`
|
|
118
|
+
`){J=$[++Q+1];while(J===" "||J==="\t")J=$[++Q+1]}else if(J==="x"||J==="u"||J==="U"){let W=J==="x"?2:J==="u"?4:8;z+=AO($,Q+1,W,Z),Q+=W}else{let W=$.substr(Q-1,2);Z(Q-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),z+=W}}else if(X===" "||X==="\t"){let J=Q,Y=$[Q+1];while(Y===" "||Y==="\t")Y=$[++Q+1];if(Y!==`
|
|
119
|
+
`&&!(Y==="\r"&&$[Q+2]===`
|
|
120
|
+
`))z+=Q>J?$.slice(J,Q+1):X}else z+=X}if($[$.length-1]!=='"'||$.length===1)Z($.length,"MISSING_CHAR",'Missing closing "quote');return z}function IO($,Z){let z="",Q=$[Z+1];while(Q===" "||Q==="\t"||Q===`
|
|
121
|
+
`||Q==="\r"){if(Q==="\r"&&$[Z+2]!==`
|
|
122
|
+
`)break;if(Q===`
|
|
123
|
+
`)z+=`
|
|
124
|
+
`;Z+=1,Q=$[Z+1]}if(!z)z=" ";return{fold:z,offset:Z}}var TO={"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 AO($,Z,z,Q){let X=$.substr(Z,z),Y=X.length===z&&/^[0-9a-fA-F]+$/.test(X)?parseInt(X,16):NaN;try{return String.fromCodePoint(Y)}catch{let W=$.substr(Z-2,z+2);return Q(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),W}}RO.resolveFlowScalar=LO});var AJ=F((jO)=>{var j6=o(),TJ=B0(),_O=l7(),FO=i7();function PO($,Z,z,Q){let{value:X,type:J,comment:Y,range:W}=Z.type==="block-scalar"?_O.resolveBlockScalar($,Z,Q):FO.resolveFlowScalar(Z,$.options.strict,Q),U=z?$.directives.tagName(z.source,(H)=>Q(z,"TAG_RESOLVE_FAILED",H)):null,G;if($.options.stringKeys&&$.atKey)G=$.schema[j6.SCALAR];else if(U)G=EO($.schema,X,U,z,Q);else if(Z.type==="scalar")G=wO($,X,Z,Q);else G=$.schema[j6.SCALAR];let V;try{let H=G.resolve(X,(q)=>Q(z??Z,"TAG_RESOLVE_FAILED",q),$.options);V=j6.isScalar(H)?H:new TJ.Scalar(H)}catch(H){let q=H instanceof Error?H.message:String(H);Q(z??Z,"TAG_RESOLVE_FAILED",q),V=new TJ.Scalar(X)}if(V.range=W,V.source=X,J)V.type=J;if(U)V.tag=U;if(G.format)V.format=G.format;if(Y)V.comment=Y;return V}function EO($,Z,z,Q,X){if(z==="!")return $[j6.SCALAR];let J=[];for(let W of $.tags)if(!W.collection&&W.tag===z)if(W.default&&W.test)J.push(W);else return W;for(let W of J)if(W.test?.test(Z))return W;let Y=$.knownTags[z];if(Y&&!Y.collection)return $.tags.push(Object.assign({},Y,{default:!1,test:void 0})),Y;return X(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${z}`,z!=="tag:yaml.org,2002:str"),$[j6.SCALAR]}function wO({atKey:$,directives:Z,schema:z},Q,X,J){let Y=z.tags.find((W)=>(W.default===!0||$&&W.default==="key")&&W.test?.test(Q))||z[j6.SCALAR];if(z.compat){let W=z.compat.find((U)=>U.default&&U.test?.test(Q))??z[j6.SCALAR];if(Y.tag!==W.tag){let U=Z.tagString(Y.tag),G=Z.tagString(W.tag),V=`Value may be parsed as either ${U} or ${G}`;J(X,"TAG_RESOLVE_FAILED",V,!0)}}return Y}jO.composeScalar=PO});var RJ=F((kO)=>{function xO($,Z,z){if(Z){z??(z=Z.length);for(let Q=z-1;Q>=0;--Q){let X=Z[Q];switch(X.type){case"space":case"comment":case"newline":$-=X.source.length;continue}X=Z[++Q];while(X?.type==="space")$+=X.source.length,X=Z[++Q];break}}return $}kO.emptyScalarPosition=xO});var FJ=F((cO)=>{var yO=q1(),vO=o(),gO=OJ(),CJ=AJ(),hO=L$(),fO=RJ(),uO={composeNode:_J,composeEmptyNode:n7};function _J($,Z,z,Q){let X=$.atKey,{spaceBefore:J,comment:Y,anchor:W,tag:U}=z,G,V=!0;switch(Z.type){case"alias":if(G=mO($,Z,Q),W||U)Q(Z,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(G=CJ.composeScalar($,Z,U,Q),W)G.anchor=W.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(G=gO.composeCollection(uO,$,Z,z,Q),W)G.anchor=W.source.substring(1)}catch(H){let q=H instanceof Error?H.message:String(H);Q(Z,"RESOURCE_EXHAUSTION",q)}break;default:{let H=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;Q(Z,"UNEXPECTED_TOKEN",H),V=!1}}if(G??(G=n7($,Z.offset,void 0,null,z,Q)),W&&G.anchor==="")Q(W,"BAD_ALIAS","Anchor cannot be an empty string");if(X&&$.options.stringKeys&&(!vO.isScalar(G)||typeof G.value!=="string"||G.tag&&G.tag!=="tag:yaml.org,2002:str"))Q(U??Z,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(J)G.spaceBefore=!0;if(Y)if(Z.type==="scalar"&&Z.source==="")G.comment=Y;else G.commentBefore=Y;if($.options.keepSourceTokens&&V)G.srcToken=Z;return G}function n7($,Z,z,Q,{spaceBefore:X,comment:J,anchor:Y,tag:W,end:U},G){let V={type:"scalar",offset:fO.emptyScalarPosition(Z,z,Q),indent:-1,source:""},H=CJ.composeScalar($,V,W,G);if(Y){if(H.anchor=Y.source.substring(1),H.anchor==="")G(Y,"BAD_ALIAS","Anchor cannot be an empty string")}if(X)H.spaceBefore=!0;if(J)H.comment=J,H.range[2]=U;return H}function mO({options:$},{offset:Z,source:z,end:Q},X){let J=new yO.Alias(z.substring(1));if(J.source==="")X(Z,"BAD_ALIAS","Alias cannot be an empty string");if(J.source.endsWith(":"))X(Z+z.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let Y=Z+z.length,W=hO.resolveEnd(Q,Y,$.strict,X);if(J.range=[Z,Y,W.offset],W.comment)J.comment=W.comment;return J}cO.composeEmptyNode=n7;cO.composeNode=_J});var EJ=F((sO)=>{var dO=F1(),PJ=FJ(),iO=L$(),nO=E1();function rO($,Z,{offset:z,start:Q,value:X,end:J},Y){let W=Object.assign({_directives:Z},$),U=new dO.Document(void 0,W),G={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},V=nO.resolveProps(Q,{indicator:"doc-start",next:X??J?.[0],offset:z,onError:Y,parentIndent:0,startOnNewline:!0});if(V.found){if(U.directives.docStart=!0,X&&(X.type==="block-map"||X.type==="block-seq")&&!V.hasNewline)Y(V.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}U.contents=X?PJ.composeNode(G,X,V,Y):PJ.composeEmptyNode(G,V.end,Q,null,V,Y);let H=U.contents.range[2],q=iO.resolveEnd(J,H,!1,Y);if(q.comment)U.comment=q.comment;return U.range=[z,H,q.offset],U}sO.composeDoc=rO});var r7=F((zI)=>{var aO=l0("process"),tO=tZ(),eO=F1(),w1=P1(),wJ=o(),$I=EJ(),ZI=L$();function j1($){if(typeof $==="number")return[$,$+1];if(Array.isArray($))return $.length===2?$:[$[0],$[1]];let{offset:Z,source:z}=$;return[Z,Z+(typeof z==="string"?z.length:1)]}function jJ($){let Z="",z=!1,Q=!1;for(let X=0;X<$.length;++X){let J=$[X];switch(J[0]){case"#":Z+=(Z===""?"":Q?`
|
|
126
126
|
|
|
127
127
|
`:`
|
|
128
|
-
`)+(
|
|
129
|
-
${
|
|
130
|
-
${Y}`:
|
|
131
|
-
${
|
|
132
|
-
${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.push(new
|
|
133
|
-
`}];switch(W[0]){case"|":case">":{let
|
|
134
|
-
`),
|
|
135
|
-
`,
|
|
136
|
-
`});return{type:"block-scalar",offset:
|
|
137
|
-
`),
|
|
138
|
-
`;if($.type==="block-scalar"){let
|
|
139
|
-
`});for(let U of Object.keys($))if(U!=="type"&&U!=="offset")delete $[U];Object.assign($,{type:"block-scalar",indent:Y,props:W,source:
|
|
140
|
-
`};delete $.items,Object.assign($,{type:
|
|
128
|
+
`)+(J.substring(1)||" "),z=!0,Q=!1;break;case"%":if($[X+1]?.[0]!=="#")X+=1;z=!1;break;default:if(!z)Q=!0;z=!1}}return{comment:Z,afterEmptyLine:Q}}class SJ{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,z,Q,X)=>{let J=j1(Z);if(X)this.warnings.push(new w1.YAMLWarning(J,z,Q));else this.errors.push(new w1.YAMLParseError(J,z,Q))},this.directives=new tO.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:z,afterEmptyLine:Q}=jJ(this.prelude);if(z){let X=$.contents;if(Z)$.comment=$.comment?`${$.comment}
|
|
129
|
+
${z}`:z;else if(Q||$.directives.docStart||!X)$.commentBefore=z;else if(wJ.isCollection(X)&&!X.flow&&X.items.length>0){let J=X.items[0];if(wJ.isPair(J))J=J.key;let Y=J.commentBefore;J.commentBefore=Y?`${z}
|
|
130
|
+
${Y}`:z}else{let J=X.commentBefore;X.commentBefore=J?`${z}
|
|
131
|
+
${J}`:z}}if(Z){for(let X=0;X<this.errors.length;++X)$.errors.push(this.errors[X]);for(let X=0;X<this.warnings.length;++X)$.warnings.push(this.warnings[X])}else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:jJ(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose($,Z=!1,z=-1){for(let Q of $)yield*this.next(Q);yield*this.end(Z,z)}*next($){if(aO.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,z,Q)=>{let X=j1($);X[0]+=Z,this.onError(X,"BAD_DIRECTIVE",z,Q)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=$I.composeDoc(this.options,this.directives,$,this.onError);if(this.atDirectives&&!Z.directives.docStart)this.onError($,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(Z,!1),this.doc)yield this.doc;this.doc=Z,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push($.source);break;case"error":{let Z=$.source?`${$.message}: ${JSON.stringify($.source)}`:$.message,z=new w1.YAMLParseError(j1($),"UNEXPECTED_TOKEN",Z);if(this.atDirectives||!this.doc)this.errors.push(z);else this.doc.errors.push(z);break}case"doc-end":{if(!this.doc){this.errors.push(new w1.YAMLParseError(j1($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=ZI.resolveEnd($.end,$.offset+$.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),Z.comment){let z=this.doc.comment;this.doc.comment=z?`${z}
|
|
132
|
+
${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.push(new w1.YAMLParseError(j1($),"UNEXPECTED_TOKEN",`Unsupported token ${$.type}`))}}*end($=!1,Z=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if($){let z=Object.assign({_directives:this.directives},this.options),Q=new eO.Document(void 0,z);if(this.atDirectives)this.onError(Z,"MISSING_CHAR","Missing directives-end indicator line");Q.range=[0,Z,Z],this.decorate(Q,!1),yield Q}}}zI.Composer=SJ});var bJ=F((HI)=>{var XI=l7(),JI=i7(),YI=P1(),xJ=L1();function WI($,Z=!0,z){if($){let Q=(X,J,Y)=>{let W=typeof X==="number"?X:Array.isArray(X)?X[0]:X.offset;if(z)z(W,J,Y);else throw new YI.YAMLParseError([W,W+1],J,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return JI.resolveFlowScalar($,Z,Q);case"block-scalar":return XI.resolveBlockScalar({options:{strict:Z}},$,Q)}}return null}function UI($,Z){let{implicitKey:z=!1,indent:Q,inFlow:X=!1,offset:J=-1,type:Y="PLAIN"}=Z,W=xJ.stringifyString({type:Y,value:$},{implicitKey:z,indent:Q>0?" ".repeat(Q):"",inFlow:X,options:{blockQuote:!0,lineWidth:-1}}),U=Z.end??[{type:"newline",offset:-1,indent:Q,source:`
|
|
133
|
+
`}];switch(W[0]){case"|":case">":{let G=W.indexOf(`
|
|
134
|
+
`),V=W.substring(0,G),H=W.substring(G+1)+`
|
|
135
|
+
`,q=[{type:"block-scalar-header",offset:J,indent:Q,source:V}];if(!kJ(q,U))q.push({type:"newline",offset:-1,indent:Q,source:`
|
|
136
|
+
`});return{type:"block-scalar",offset:J,indent:Q,props:q,source:H}}case'"':return{type:"double-quoted-scalar",offset:J,indent:Q,source:W,end:U};case"'":return{type:"single-quoted-scalar",offset:J,indent:Q,source:W,end:U};default:return{type:"scalar",offset:J,indent:Q,source:W,end:U}}}function GI($,Z,z={}){let{afterKey:Q=!1,implicitKey:X=!1,inFlow:J=!1,type:Y}=z,W="indent"in $?$.indent:null;if(Q&&typeof W==="number")W+=2;if(!Y)switch($.type){case"single-quoted-scalar":Y="QUOTE_SINGLE";break;case"double-quoted-scalar":Y="QUOTE_DOUBLE";break;case"block-scalar":{let G=$.props[0];if(G.type!=="block-scalar-header")throw Error("Invalid block scalar header");Y=G.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:Y="PLAIN"}let U=xJ.stringifyString({type:Y,value:Z},{implicitKey:X||W===null,indent:W!==null&&W>0?" ".repeat(W):"",inFlow:J,options:{blockQuote:!0,lineWidth:-1}});switch(U[0]){case"|":case">":VI($,U);break;case'"':s7($,U,"double-quoted-scalar");break;case"'":s7($,U,"single-quoted-scalar");break;default:s7($,U,"scalar")}}function VI($,Z){let z=Z.indexOf(`
|
|
137
|
+
`),Q=Z.substring(0,z),X=Z.substring(z+1)+`
|
|
138
|
+
`;if($.type==="block-scalar"){let J=$.props[0];if(J.type!=="block-scalar-header")throw Error("Invalid block scalar header");J.source=Q,$.source=X}else{let{offset:J}=$,Y="indent"in $?$.indent:-1,W=[{type:"block-scalar-header",offset:J,indent:Y,source:Q}];if(!kJ(W,"end"in $?$.end:void 0))W.push({type:"newline",offset:-1,indent:Y,source:`
|
|
139
|
+
`});for(let U of Object.keys($))if(U!=="type"&&U!=="offset")delete $[U];Object.assign($,{type:"block-scalar",indent:Y,props:W,source:X})}}function kJ($,Z){if(Z)for(let z of Z)switch(z.type){case"space":case"comment":$.push(z);break;case"newline":return $.push(z),!0}return!1}function s7($,Z,z){switch($.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":$.type=z,$.source=Z;break;case"block-scalar":{let Q=$.props.slice(1),X=Z.length;if($.props[0].type==="block-scalar-header")X-=$.props[0].source.length;for(let J of Q)J.offset+=X;delete $.props,Object.assign($,{type:z,source:Z,end:Q});break}case"block-map":case"block-seq":{let X={type:"newline",offset:$.offset+Z.length,indent:$.indent,source:`
|
|
140
|
+
`};delete $.items,Object.assign($,{type:z,source:Z,end:[X]});break}default:{let Q="indent"in $?$.indent:-1,X="end"in $&&Array.isArray($.end)?$.end.filter((J)=>J.type==="space"||J.type==="comment"||J.type==="newline"):[];for(let J of Object.keys($))if(J!=="type"&&J!=="offset")delete $[J];Object.assign($,{type:z,indent:Q,source:Z,end:X})}}}HI.createScalarToken=UI;HI.resolveAsScalar=WI;HI.setScalarValue=GI});var yJ=F((LI)=>{var MI=($)=>("type"in $)?e8($):t8($);function e8($){switch($.type){case"block-scalar":{let Z="";for(let z of $.props)Z+=e8(z);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let z of $.items)Z+=t8(z);return Z}case"flow-collection":{let Z=$.start.source;for(let z of $.items)Z+=t8(z);for(let z of $.end)Z+=z.source;return Z}case"document":{let Z=t8($);if($.end)for(let z of $.end)Z+=z.source;return Z}default:{let Z=$.source;if("end"in $&&$.end)for(let z of $.end)Z+=z.source;return Z}}}function t8({start:$,key:Z,sep:z,value:Q}){let X="";for(let J of $)X+=J.source;if(Z)X+=e8(Z);if(z)for(let J of z)X+=J.source;if(Q)X+=e8(Q);return X}LI.stringify=MI});var hJ=F((OI)=>{var o7=Symbol("break visit"),DI=Symbol("skip children"),vJ=Symbol("remove item");function S6($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};gJ(Object.freeze([]),$,Z)}S6.BREAK=o7;S6.SKIP=DI;S6.REMOVE=vJ;S6.itemAtPath=($,Z)=>{let z=$;for(let[Q,X]of Z){let J=z?.[Q];if(J&&"items"in J)z=J.items[X];else return}return z};S6.parentCollection=($,Z)=>{let z=S6.itemAtPath($,Z.slice(0,-1)),Q=Z[Z.length-1][0],X=z?.[Q];if(X&&"items"in X)return X;throw Error("Parent collection not found")};function gJ($,Z,z){let Q=z(Z,$);if(typeof Q==="symbol")return Q;for(let X of["key","value"]){let J=Z[X];if(J&&"items"in J){for(let Y=0;Y<J.items.length;++Y){let W=gJ(Object.freeze($.concat([[X,Y]])),J.items[Y],z);if(typeof W==="number")Y=W-1;else if(W===o7)return o7;else if(W===vJ)J.items.splice(Y,1),Y-=1}if(typeof Q==="function"&&X==="key")Q=Q(Z,$)}}return typeof Q==="function"?Q(Z,$):Q}OI.visit=S6});var $5=F((PI)=>{var a7=bJ(),TI=yJ(),AI=hJ(),t7="\uFEFF",e7="\x02",$3="\x18",Z3="\x1F",RI=($)=>!!$&&("items"in $),CI=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function _I($){switch($){case t7:return"<BOM>";case e7:return"<DOC>";case $3:return"<FLOW_END>";case Z3:return"<SCALAR>";default:return JSON.stringify($)}}function FI($){switch($){case t7:return"byte-order-mark";case e7:return"doc-mode";case $3:return"flow-error-end";case Z3: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}PI.createScalarToken=a7.createScalarToken;PI.resolveAsScalar=a7.resolveAsScalar;PI.setScalarValue=a7.setScalarValue;PI.stringify=TI.stringify;PI.visit=AI.visit;PI.BOM=t7;PI.DOCUMENT=e7;PI.FLOW_END=$3;PI.SCALAR=Z3;PI.isCollection=RI;PI.isScalar=CI;PI.prettyToken=_I;PI.tokenType=FI});var Q3=F((pI)=>{var S1=$5();function H2($){switch($){case void 0:case" ":case`
|
|
143
|
+
`:case"\r":case"\t":return!0;default:return!1}}var fJ=new Set("0123456789ABCDEFabcdef"),mI=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Z5=new Set(",[]{}"),cI=new Set(` ,[]{}
|
|
144
|
+
\r `),z3=($)=>!$||cI.has($);class uJ{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex($,Z=!1){if($){if(typeof $!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+$:$,this.lineEndPos=null}this.atEnd=!Z;let z=this.next??"stream";while(z&&(Z||this.hasChars(1)))z=yield*this.parseNext(z)}atLineEnd(){let $=this.pos,Z=this.buffer[$];while(Z===" "||Z==="\t")Z=this.buffer[++$];if(!Z||Z==="#"||Z===`
|
|
145
145
|
`)return!0;if(Z==="\r")return this.buffer[$+1]===`
|
|
146
|
-
`;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let Z=this.buffer[$];if(this.indentNext>0){let
|
|
147
|
-
`||!
|
|
148
|
-
`||
|
|
149
|
-
`,this.pos),this.lineEndPos=$;if($===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[$-1]==="\r")$-=1;return this.buffer.substring(this.pos,$)}hasChars($){return this.pos+$<=this.buffer.length}setNext($){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=$,null}peek($){return this.buffer.substr(this.pos,$)}*parseNext($){switch($){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let $=this.getLine();if($===null)return this.setNext("stream");if($[0]===
|
|
150
|
-
`,this.pos);if(
|
|
151
|
-
`,
|
|
152
|
-
`:$=
|
|
153
|
-
`)break}default:break $}if(!
|
|
154
|
-
`,
|
|
155
|
-
`)
|
|
156
|
-
`&&
|
|
157
|
-
`)
|
|
158
|
-
`,
|
|
159
|
-
`){let
|
|
146
|
+
`;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let Z=this.buffer[$];if(this.indentNext>0){let z=0;while(Z===" ")Z=this.buffer[++z+$];if(Z==="\r"){let Q=this.buffer[z+$+1];if(Q===`
|
|
147
|
+
`||!Q&&!this.atEnd)return $+z+1}return Z===`
|
|
148
|
+
`||z>=this.indentNext||!Z&&!this.atEnd?$+z:-1}if(Z==="-"||Z==="."){let z=this.buffer.substr($,3);if((z==="---"||z==="...")&&H2(this.buffer[$+3]))return-1}return $}getLine(){let $=this.lineEndPos;if(typeof $!=="number"||$!==-1&&$<this.pos)$=this.buffer.indexOf(`
|
|
149
|
+
`,this.pos),this.lineEndPos=$;if($===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[$-1]==="\r")$-=1;return this.buffer.substring(this.pos,$)}hasChars($){return this.pos+$<=this.buffer.length}setNext($){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=$,null}peek($){return this.buffer.substr(this.pos,$)}*parseNext($){switch($){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let $=this.getLine();if($===null)return this.setNext("stream");if($[0]===S1.BOM)yield*this.pushCount(1),$=$.substring(1);if($[0]==="%"){let Z=$.length,z=$.indexOf("#");while(z!==-1){let X=$[z-1];if(X===" "||X==="\t"){Z=z-1;break}else z=$.indexOf("#",z+1)}while(!0){let X=$[Z-1];if(X===" "||X==="\t")Z-=1;else break}let Q=(yield*this.pushCount(Z))+(yield*this.pushSpaces(!0));return yield*this.pushCount($.length-Q),this.pushNewline(),"stream"}if(this.atLineEnd()){let Z=yield*this.pushSpaces(!0);return yield*this.pushCount($.length-Z),yield*this.pushNewline(),"stream"}return yield S1.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let $=this.charAt(0);if(!$&&!this.atEnd)return this.setNext("line-start");if($==="-"||$==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let Z=this.peek(3);if((Z==="---"||Z==="...")&&H2(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,Z==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!H2(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[$,Z]=this.peek(2);if(!Z&&!this.atEnd)return this.setNext("block-start");if(($==="-"||$==="?"||$===":")&&H2(Z)){let z=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=z,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let $=this.getLine();if($===null)return this.setNext("doc");let Z=yield*this.pushIndicators();switch($[Z]){case"#":yield*this.pushCount($.length-Z);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(z3),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return Z+=yield*this.parseBlockScalarHeader(),Z+=yield*this.pushSpaces(!0),yield*this.pushCount($.length-Z),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let $,Z,z=-1;do{if($=yield*this.pushNewline(),$>0)Z=yield*this.pushSpaces(!1),this.indentValue=z=Z;else Z=0;Z+=yield*this.pushSpaces(!0)}while($+Z>0);let Q=this.getLine();if(Q===null)return this.setNext("flow");if(z!==-1&&z<this.indentNext&&Q[0]!=="#"||z===0&&(Q.startsWith("---")||Q.startsWith("..."))&&H2(Q[3])){if(!(z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield S1.FLOW_END,yield*this.parseLineStart()}let X=0;while(Q[X]===",")X+=yield*this.pushCount(1),X+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(X+=yield*this.pushIndicators(),Q[X]){case void 0:return"flow";case"#":return yield*this.pushCount(Q.length-X),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(z3),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let J=this.charAt(1);if(this.flowKey||H2(J)||J===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=this.charAt(0),Z=this.buffer.indexOf($,this.pos+1);if($==="'")while(Z!==-1&&this.buffer[Z+1]==="'")Z=this.buffer.indexOf("'",Z+2);else while(Z!==-1){let X=0;while(this.buffer[Z-1-X]==="\\")X+=1;if(X%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let z=this.buffer.substring(0,Z),Q=z.indexOf(`
|
|
150
|
+
`,this.pos);if(Q!==-1){while(Q!==-1){let X=this.continueScalar(Q+1);if(X===-1)break;Q=z.indexOf(`
|
|
151
|
+
`,X)}if(Q!==-1)Z=Q-(z[Q-1]==="\r"?2:1)}if(Z===-1){if(!this.atEnd)return this.setNext("quoted-scalar");Z=this.buffer.length}return yield*this.pushToIndex(Z+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let $=this.pos;while(!0){let Z=this.buffer[++$];if(Z==="+")this.blockScalarKeep=!0;else if(Z>"0"&&Z<="9")this.blockScalarIndent=Number(Z)-1;else if(Z!=="-")break}return yield*this.pushUntil((Z)=>H2(Z)||Z==="#")}*parseBlockScalar(){let $=this.pos-1,Z=0,z;$:for(let X=this.pos;z=this.buffer[X];++X)switch(z){case" ":Z+=1;break;case`
|
|
152
|
+
`:$=X,Z=0;break;case"\r":{let J=this.buffer[X+1];if(!J&&!this.atEnd)return this.setNext("block-scalar");if(J===`
|
|
153
|
+
`)break}default:break $}if(!z&&!this.atEnd)return this.setNext("block-scalar");if(Z>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=Z;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let X=this.continueScalar($+1);if(X===-1)break;$=this.buffer.indexOf(`
|
|
154
|
+
`,X)}while($!==-1);if($===-1){if(!this.atEnd)return this.setNext("block-scalar");$=this.buffer.length}}let Q=$+1;z=this.buffer[Q];while(z===" ")z=this.buffer[++Q];if(z==="\t"){while(z==="\t"||z===" "||z==="\r"||z===`
|
|
155
|
+
`)z=this.buffer[++Q];$=Q-1}else if(!this.blockScalarKeep)do{let X=$-1,J=this.buffer[X];if(J==="\r")J=this.buffer[--X];let Y=X;while(J===" ")J=this.buffer[--X];if(J===`
|
|
156
|
+
`&&X>=this.pos&&X+1+Z>Y)$=X;else break}while(!0);return yield S1.SCALAR,yield*this.pushToIndex($+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let $=this.flowLevel>0,Z=this.pos-1,z=this.pos-1,Q;while(Q=this.buffer[++z])if(Q===":"){let X=this.buffer[z+1];if(H2(X)||$&&Z5.has(X))break;Z=z}else if(H2(Q)){let X=this.buffer[z+1];if(Q==="\r")if(X===`
|
|
157
|
+
`)z+=1,Q=`
|
|
158
|
+
`,X=this.buffer[z+1];else Z=z;if(X==="#"||$&&Z5.has(X))break;if(Q===`
|
|
159
|
+
`){let J=this.continueScalar(z+1);if(J===-1)break;z=Math.max(z,J-2)}}else{if($&&Z5.has(Q))break;Z=z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield S1.SCALAR,yield*this.pushToIndex(Z+1,!0),$?"flow":"doc"}*pushCount($){if($>0)return yield this.buffer.substr(this.pos,$),this.pos+=$,$;return 0}*pushToIndex($,Z){let z=this.buffer.slice(this.pos,$);if(z)return yield z,this.pos+=z.length,z.length;else if(Z)yield"";return 0}*pushIndicators(){let $=0;$:while(!0){switch(this.charAt(0)){case"!":$+=yield*this.pushTag(),$+=yield*this.pushSpaces(!0);continue $;case"&":$+=yield*this.pushUntil(z3),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let Z=this.flowLevel>0,z=this.charAt(1);if(H2(z)||Z&&Z5.has(z)){if(!Z)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;$+=yield*this.pushCount(1),$+=yield*this.pushSpaces(!0);continue $}}}break $}return $}*pushTag(){if(this.charAt(1)==="<"){let $=this.pos+2,Z=this.buffer[$];while(!H2(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(mI.has(Z))Z=this.buffer[++$];else if(Z==="%"&&fJ.has(this.buffer[$+1])&&fJ.has(this.buffer[$+2]))Z=this.buffer[$+=3];else break;return yield*this.pushToIndex($,!1)}}*pushNewline(){let $=this.buffer[this.pos];if($===`
|
|
160
160
|
`)return yield*this.pushCount(1);else if($==="\r"&&this.charAt(1)===`
|
|
161
|
-
`)return yield*this.pushCount(2);else return 0}*pushSpaces($){let Z=this.pos-1,
|
|
161
|
+
`)return yield*this.pushCount(2);else return 0}*pushSpaces($){let Z=this.pos-1,z;do z=this.buffer[++Z];while(z===" "||$&&z==="\t");let Q=Z-this.pos;if(Q>0)yield this.buffer.substr(this.pos,Q),this.pos=Z;return Q}*pushUntil($){let Z=this.pos,z=this.buffer[Z];while(!$(z))z=this.buffer[++Z];return yield*this.pushToIndex(Z,!1)}}pI.Lexer=uJ});var X3=F((dI)=>{class mJ{constructor(){this.lineStarts=[],this.addNewLine=($)=>this.lineStarts.push($),this.linePos=($)=>{let Z=0,z=this.lineStarts.length;while(Z<z){let X=Z+z>>1;if(this.lineStarts[X]<$)Z=X+1;else z=X}if(this.lineStarts[Z]===$)return{line:Z+1,col:1};if(Z===0)return{line:0,col:$};let Q=this.lineStarts[Z-1];return{line:Z,col:$-Q+1}}}}dI.LineCounter=mJ});var J3=F((sI)=>{var nI=l0("process"),cJ=$5(),rI=Q3();function Q6($,Z){for(let z=0;z<$.length;++z)if($[z].type===Z)return!0;return!1}function pJ($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function dJ($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function z5($){switch($.type){case"document":return $.start;case"block-map":{let Z=$.items[$.items.length-1];return Z.sep??Z.start}case"block-seq":return $.items[$.items.length-1].start;default:return[]}}function N$($){if($.length===0)return[];let Z=$.length;$:while(--Z>=0)switch($[Z].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break $}while($[++Z]?.type==="space");return $.splice(Z,$.length)}function Q5($,Z){if(Z.length<1e5)Array.prototype.push.apply($,Z);else for(let z=0;z<Z.length;++z)$.push(Z[z])}function lJ($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!Q6(Z.start,"explicit-key-ind")&&!Q6(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,dJ(Z.value))if(Z.value.end)Q5(Z.value.end,Z.sep);else Z.value.end=Z.sep;else Q5(Z.start,Z.sep);delete Z.sep}}}class iJ{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 rI.Lexer,this.onNewLine=$}*parse($,Z=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let z of this.lexer.lex($,Z))yield*this.next(z);if(!Z)yield*this.end()}*next($){if(this.source=$,nI.env.LOG_TOKENS)console.log("|",cJ.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=cJ.tokenType($);if(!Z){let z=`Not a YAML token: ${$}`;yield*this.pop({type:"error",offset:this.offset,message:z,source:$}),this.offset+=$.length}else if(Z==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=Z,yield*this.step(),Z){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+$.length);break;case"space":if(this.atNewLine&&$[0]===" ")this.indent+=$.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=$.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=$.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let $=this.peek(1);if(this.type==="doc-end"&&$?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!$)return yield*this.stream();switch($.type){case"document":return yield*this.document($);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar($);case"block-scalar":return yield*this.blockScalar($);case"block-map":return yield*this.blockMap($);case"block-seq":return yield*this.blockSequence($);case"flow-collection":return yield*this.flowCollection($);case"doc-end":return yield*this.documentEnd($)}yield*this.pop()}peek($){return this.stack[this.stack.length-$]}*pop($){let Z=$??this.stack.pop();if(!Z)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield Z;else{let z=this.peek(1);if(Z.type==="block-scalar")Z.indent="indent"in z?z.indent:0;else if(Z.type==="flow-collection"&&z.type==="document")Z.indent=0;if(Z.type==="flow-collection")lJ(Z);switch(z.type){case"document":z.value=Z;break;case"block-scalar":z.props.push(Z);break;case"block-map":{let Q=z.items[z.items.length-1];if(Q.value){z.items.push({start:[],key:Z,sep:[]}),this.onKeyLine=!0;return}else if(Q.sep)Q.value=Z;else{Object.assign(Q,{key:Z,sep:[]}),this.onKeyLine=!Q.explicitKey;return}break}case"block-seq":{let Q=z.items[z.items.length-1];if(Q.value)z.items.push({start:[],value:Z});else Q.value=Z;break}case"flow-collection":{let Q=z.items[z.items.length-1];if(!Q||Q.value)z.items.push({start:[],key:Z,sep:[]});else if(Q.sep)Q.value=Z;else Object.assign(Q,{key:Z,sep:[]});return}default:yield*this.pop(),yield*this.pop(Z)}if((z.type==="document"||z.type==="block-map"||z.type==="block-seq")&&(Z.type==="block-map"||Z.type==="block-seq")){let Q=Z.items[Z.items.length-1];if(Q&&!Q.sep&&!Q.value&&Q.start.length>0&&pJ(Q.start)===-1&&(Z.indent===0||Q.start.every((X)=>X.type!=="comment"||X.indent<Z.indent))){if(z.type==="document")z.end=Q.start;else z.items.push({start:Q.start});Z.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let $={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")$.start.push(this.sourceToken);this.stack.push($);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document($){if($.value)return yield*this.lineEnd($);switch(this.type){case"doc-start":{if(pJ($.start)!==-1)yield*this.pop(),yield*this.step();else $.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":$.start.push(this.sourceToken);return}let Z=this.startBlockValue($);if(Z)this.stack.push(Z);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar($){if(this.type==="map-value-ind"){let Z=z5(this.peek(2)),z=N$(Z),Q;if($.end)Q=$.end,Q.push(this.sourceToken),delete $.end;else Q=[this.sourceToken];let X={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:z,key:$,sep:Q}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=X}else yield*this.lineEnd($)}*blockScalar($){switch(this.type){case"space":case"comment":case"newline":$.props.push(this.sourceToken);return;case"scalar":if($.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let Z=this.source.indexOf(`
|
|
162
162
|
`)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
|
|
163
|
-
`,Z)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,Z.value){let
|
|
163
|
+
`,Z)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,Z.value){let z="end"in Z.value?Z.value.end:void 0;if((Array.isArray(z)?z[z.length-1]:void 0)?.type==="comment")z?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else{if(this.atIndentedComment(Z.start,$.indent)){let Q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(Q)){Q5(Q,Z.start),Q.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let z=!this.onKeyLine&&this.indent===$.indent,Q=z&&(Z.sep||Z.explicitKey)&&this.type!=="seq-item-ind",X=[];if(Q&&Z.sep&&!Z.value){let J=[];for(let Y=0;Y<Z.sep.length;++Y){let W=Z.sep[Y];switch(W.type){case"newline":J.push(Y);break;case"space":break;case"comment":if(W.indent>$.indent)J.length=0;break;default:J.length=0}}if(J.length>=2)X=Z.sep.splice(J[1])}switch(this.type){case"anchor":case"tag":if(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X}),this.onKeyLine=!0;else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"explicit-key-ind":if(!Z.sep&&!Z.explicitKey)Z.start.push(this.sourceToken),Z.explicitKey=!0;else if(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(Z.explicitKey)if(!Z.sep)if(Q6(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let J=N$(Z.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]})}else if(Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Q6(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]});else if(dJ(Z.key)&&!Q6(Z.sep,"newline")){let J=N$(Z.start),Y=Z.key,W=Z.sep;W.push(this.sourceToken),delete Z.key,delete Z.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:Y,sep:W}]})}else if(X.length>0)Z.sep=Z.sep.concat(X,this.sourceToken);else Z.sep.push(this.sourceToken);else if(!Z.sep)Object.assign(Z,{key:null,sep:[this.sourceToken]});else if(Z.value||Q)$.items.push({start:X,key:null,sep:[this.sourceToken]});else if(Q6(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else Z.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let J=this.flowScalar(this.type);if(Q||Z.value)$.items.push({start:X,key:J,sep:[]}),this.onKeyLine=!0;else if(Z.sep)this.stack.push(J);else Object.assign(Z,{key:J,sep:[]}),this.onKeyLine=!0;return}default:{let J=this.startBlockValue($);if(J){if(J.type==="block-seq"){if(!Z.explicitKey&&Z.sep&&!Q6(Z.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(z)$.items.push({start:X});this.stack.push(J);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(Z.value){let z="end"in Z.value?Z.value.end:void 0;if((Array.isArray(z)?z[z.length-1]:void 0)?.type==="comment")z?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(Z.start,$.indent)){let Q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(Q)){Q5(Q,Z.start),Q.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return;case"anchor":case"tag":if(Z.value||this.indent<=$.indent)break;Z.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(Z.value||Q6(Z.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return}if(this.indent>$.indent){let z=this.startBlockValue($);if(z){this.stack.push(z);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let Z=$.items[$.items.length-1];if(this.type==="flow-error-end"){let z;do yield*this.pop(),z=this.peek(1);while(z?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!Z||Z.sep)$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return;case"map-value-ind":if(!Z||Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Object.assign(Z,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!Z||Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let Q=this.flowScalar(this.type);if(!Z||Z.value)$.items.push({start:[],key:Q,sep:[]});else if(Z.sep)this.stack.push(Q);else Object.assign(Z,{key:Q,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let z=this.startBlockValue($);if(z)this.stack.push(z);else yield*this.pop(),yield*this.step()}else{let z=this.peek(2);if(z.type==="block-map"&&(this.type==="map-value-ind"&&z.indent===$.indent||this.type==="newline"&&!z.items[z.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&z.type!=="flow-collection"){let Q=z5(z),X=N$(Q);lJ($);let J=$.end.splice(1,$.end.length);J.push(this.sourceToken);let Y={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:X,key:$,sep:J}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=Y}else yield*this.lineEnd($)}}flowScalar($){if(this.onNewLine){let Z=this.source.indexOf(`
|
|
164
164
|
`)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
|
|
165
|
-
`,Z)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Z=C8($),X=H$(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=H$(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()}}}LO.Parser=aX});var Zz=E((PO)=>{var oX=a3(),IO=M2(),T2=O2(),TO=Y3(),AO=i(),RO=YZ(),tX=WZ();function eX($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new RO.LineCounter||null,prettyErrors:Z}}function _O($,Z={}){let{lineCounter:X,prettyErrors:z}=eX(Z),J=new tX.Parser(X?.addNewLine),Q=new oX.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 $z($,Z={}){let{lineCounter:X,prettyErrors:z}=eX(Z),J=new tX.Parser(X?.addNewLine),Q=new oX.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 FO($,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=$z($,X);if(!J)return null;if(J.warnings.forEach((Q)=>TO.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 CO($,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(AO.isDocument($)&&!z)return $.toString(X);return new IO.Document($,z,X).toString(X)}PO.parse=FO;PO.parseAllDocuments=_O;PO.parseDocument=$z;PO.stringify=CO});var Uz={};w9(Uz,{orange:()=>H0,italic:()=>LN,fafCyanDeep:()=>w8,fafCyan:()=>I,dim:()=>M,bold:()=>A,FAF_HEX:()=>R2});var GZ=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,A,M,LN,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 l=v(()=>{A=GZ("1"),M=GZ("2"),LN=GZ("3"),R2={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var $5=E((Rb,$R)=>{$R.exports={name:"faf-cli",version:"7.12.1",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","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 X5=function(){let{crypto:$}=globalThis;if($?.randomUUID)return X5=$.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 _0=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 H4($){if(typeof $!=="object")return{};return $??{}}function Q5($){if(!$)return!0;for(let Z in $)return!1;return!0}function oQ($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var vR,aQ=($)=>{return vR.test($)},z5=($)=>(z5=Array.isArray,z5($)),J5,tQ=($,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},B4=($)=>{try{return JSON.parse($)}catch(Z){return}};var r1=v(()=>{_0();vR=/^[a-z][a-z0-9+.-]*:/i,J5=z5});var eQ=($)=>new Promise((Z)=>setTimeout(Z,$));var P1="0.91.1";function gR(){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 hR(){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 zY=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},fR=()=>{let $=gR();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":P1,"X-Stainless-OS":ZY(Deno.build.os),"X-Stainless-Arch":$Y(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":ZY(globalThis.process.platform??"unknown"),"X-Stainless-Arch":$Y(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=hR();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"}},$Y=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},ZY=($)=>{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"},XY,JY=()=>{return XY??(XY=fR())};var Y5=()=>{};function QY(){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 W5(...$){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 M4($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return W5({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 YY($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),X=Z.cancel();Z.releaseLock(),await X}var WY=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function UY($){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 qY=v(()=>{_0()});function KY($){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(GY??(Z=new globalThis.TextEncoder,GY=Z.encode.bind(Z)))($)}function U5($){let Z;return(VY??(Z=new globalThis.TextDecoder,VY=Z.decode.bind(Z)))($)}var GY,VY;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,KY([N(this,S0,"f"),Z]),"f");let X=[],z;while((z=cR(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(U5(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=U5(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
|
|
167
|
-
`,"\r"]);
|
|
168
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],
|
|
169
|
-
`);
|
|
170
|
-
${
|
|
165
|
+
`,Z)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Z=z5($),z=N$(Z);return z.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Z=z5($),z=N$(Z);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Z){if(this.type!=="comment")return!1;if(this.indent<=Z)return!1;return $.every((z)=>z.type==="newline"||z.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}sI.Parser=iJ});var aJ=F((XT)=>{var nJ=r7(),aI=F1(),x1=P1(),tI=X7(),eI=o(),$T=X3(),rJ=J3();function sJ($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new $T.LineCounter||null,prettyErrors:Z}}function ZT($,Z={}){let{lineCounter:z,prettyErrors:Q}=sJ(Z),X=new rJ.Parser(z?.addNewLine),J=new nJ.Composer(Z),Y=Array.from(J.compose(X.parse($)));if(Q&&z)for(let W of Y)W.errors.forEach(x1.prettifyError($,z)),W.warnings.forEach(x1.prettifyError($,z));if(Y.length>0)return Y;return Object.assign([],{empty:!0},J.streamInfo())}function oJ($,Z={}){let{lineCounter:z,prettyErrors:Q}=sJ(Z),X=new rJ.Parser(z?.addNewLine),J=new nJ.Composer(Z),Y=null;for(let W of J.compose(X.parse($),!0,$.length))if(!Y)Y=W;else if(Y.options.logLevel!=="silent"){Y.errors.push(new x1.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&z)Y.errors.forEach(x1.prettifyError($,z)),Y.warnings.forEach(x1.prettifyError($,z));return Y}function zT($,Z,z){let Q=void 0;if(typeof Z==="function")Q=Z;else if(z===void 0&&Z&&typeof Z==="object")z=Z;let X=oJ($,z);if(!X)return null;if(X.warnings.forEach((J)=>tI.warn(X.options.logLevel,J)),X.errors.length>0)if(X.options.logLevel!=="silent")throw X.errors[0];else X.errors=[];return X.toJS(Object.assign({reviver:Q},z))}function QT($,Z,z){let Q=null;if(typeof Z==="function"||Array.isArray(Z))Q=Z;else if(z===void 0&&Z)z=Z;if(typeof z==="string")z=z.length;if(typeof z==="number"){let X=Math.round(z);z=X<1?void 0:X>8?{indent:8}:{indent:X}}if($===void 0){let{keepUndefined:X}=z??Z??{};if(!X)return}if(eI.isDocument($)&&!Q)return $.toString(z);return new aI.Document($,Q,z).toString(z)}XT.parse=zT;XT.parseAllDocuments=ZT;XT.parseDocument=oJ;XT.stringify=QT});var oY={};_Q(oY,{orange:()=>R0,italic:()=>aA,fafCyanDeep:()=>I5,fafCyan:()=>I,dim:()=>M,bold:()=>A,FAF_HEX:()=>i1});var P3=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,A,M,aA,i1,I=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,I5=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,R0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var p=g(()=>{A=P3("1"),M=P3("2"),aA=P3("3"),i1={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var i9=F((xc,wj)=>{wj.exports={name:"faf-cli",version:"7.13.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)","check:engines":"node scripts/check-engines.mjs",prepublishOnly:"bun run check:engines && bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational","agents-md","context-engineering","codex","windsurf","fafm","ai-memory","agents"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.3","faf-scoring-kernel":"^2.0.3",open:"^11.0.0",yaml:"^2.9.0"},optionalDependencies:{"@anthropic-ai/sdk":"^0.91.1"},devDependencies:{"@faf/specification":"github:Wolfe-Jam/faf","@types/bun":"^1.3.14","@types/node":"^22.20.1","@typescript-eslint/eslint-plugin":"^8.66.0","@typescript-eslint/parser":"^8.66.0",ajv:"^8.20.0",eslint:"^9.39.5",prettier:"^3.9.6",typescript:"^5.9.3","typescript-eslint":"^8.66.0"},overrides:{"brace-expansion":"^1.1.18","fast-uri":"^3.1.5",picomatch:"^4.0.5"},engines:{node:">=22.0.0"},publishConfig:{access:"public"}}});function P($,Z,z,Q,X){if(Q==="m")throw TypeError("Private method is not writable");if(Q==="a"&&!X)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!X:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return Q==="a"?X.call($,z):X?X.value=z:Z.set($,z),z}function D($,Z,z,Q){if(z==="a"&&!Q)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!Q:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return z==="m"?Q:z==="a"?Q.call($):Q?Q.value:Z.get($)}var l2=()=>{};var a9=function(){let{crypto:$}=globalThis;if($?.randomUUID)return a9=$.randomUUID.bind($),$.randomUUID();let Z=new Uint8Array(1),z=$?()=>$.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(Q)=>(+Q^z()&15>>+Q/4).toString(16))};function d2($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var A4=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var b,L0,P0,L6,g$,h$,f$,u$,m$,c$,p$,l$,d$;var c0=g(()=>{b=class b extends Error{};L0=class L0 extends b{constructor($,Z,z,Q,X){super(`${L0.makeMessage($,Z,z)}`);this.status=$,this.headers=Q,this.requestID=Q?.get("request-id"),this.error=Z,this.type=X??null}static makeMessage($,Z,z){let Q=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):z;if($&&Q)return`${$} ${Q}`;if($)return`${$} status code (no body)`;if(Q)return Q;return"(no status code or body)"}static generate($,Z,z,Q){if(!$||!Q)return new L6({message:z,cause:A4(Z)});let X=Z,J=X?.error?.type;if($===400)return new h$($,X,z,Q,J);if($===401)return new f$($,X,z,Q,J);if($===403)return new u$($,X,z,Q,J);if($===404)return new m$($,X,z,Q,J);if($===409)return new c$($,X,z,Q,J);if($===422)return new p$($,X,z,Q,J);if($===429)return new l$($,X,z,Q,J);if($>=500)return new d$($,X,z,Q,J);return new L0($,X,z,Q,J)}};P0=class P0 extends L0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};L6=class L6 extends L0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};g$=class g$ extends L6{constructor({message:$}={}){super({message:$??"Request timed out."})}};h$=class h$ extends L0{};f$=class f$ extends L0{};u$=class u$ extends L0{};m$=class m$ extends L0{};c$=class c$ extends L0{};p$=class p$ extends L0{};l$=class l$ extends L0{};d$=class d$ extends L0{}});function qZ($){if(typeof $!=="object")return{};return $??{}}function $z($){if(!$)return!0;for(let Z in $)return!1;return!0}function _V($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var YS,CV=($)=>{return YS.test($)},t9=($)=>(t9=Array.isArray,t9($)),e9,FV=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new b(`${$} must be an integer`);if(Z<0)throw new b(`${$} must be a positive integer`);return Z},KZ=($)=>{try{return JSON.parse($)}catch(Z){return}};var t6=g(()=>{c0();YS=/^[a-z][a-z0-9+.-]*:/i,e9=t9});var PV=($)=>new Promise((Z)=>setTimeout(Z,$));var N6="0.91.1";function WS(){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 GS(){if(typeof navigator>"u"||!navigator)return null;let $=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:Z,pattern:z}of $){let Q=z.exec(navigator.userAgent);if(Q){let X=Q[1]||0,J=Q[2]||0,Y=Q[3]||0;return{browser:Z,version:`${X}.${J}.${Y}`}}}return null}var SV=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},US=()=>{let $=WS();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":N6,"X-Stainless-OS":wV(Deno.build.os),"X-Stainless-Arch":EV(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":N6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if($==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":N6,"X-Stainless-OS":wV(globalThis.process.platform??"unknown"),"X-Stainless-Arch":EV(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=GS();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":N6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Z.browser}`,"X-Stainless-Runtime-Version":Z.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":N6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},EV=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},wV=($)=>{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"},jV,xV=()=>{return jV??(jV=US())};var Zz=()=>{};function kV(){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 zz(...$){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 BZ($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return zz({start(){},async pull(z){let{done:Q,value:X}=await Z.next();if(Q)z.close();else z.enqueue(X)},async cancel(){await Z.return?.()}})}function R4($){if($[Symbol.asyncIterator])return $;let Z=$.getReader();return{async next(){try{let z=await Z.read();if(z?.done)Z.releaseLock();return z}catch(z){throw Z.releaseLock(),z}},async return(){let z=Z.cancel();return Z.releaseLock(),await z,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function bV($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),z=Z.cancel();Z.releaseLock(),await z}var yV=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function vV($){return Object.entries($).filter(([Z,z])=>typeof z<"u").map(([Z,z])=>{if(typeof z==="string"||typeof z==="number"||typeof z==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent(z)}`;if(z===null)return`${encodeURIComponent(Z)}=`;throw new b(`Cannot stringify type ${typeof z}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}var gV=g(()=>{c0()});function uV($){let Z=0;for(let X of $)Z+=X.length;let z=new Uint8Array(Z),Q=0;for(let X of $)z.set(X,Q),Q+=X.length;return z}function C4($){let Z;return(hV??(Z=new globalThis.TextEncoder,hV=Z.encode.bind(Z)))($)}function Qz($){let Z;return(fV??(Z=new globalThis.TextDecoder,fV=Z.decode.bind(Z)))($)}var hV,fV;class D6{constructor(){r0.set(this,void 0),s0.set(this,void 0),P(this,r0,new Uint8Array,"f"),P(this,s0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?C4($):$;P(this,r0,uV([D(this,r0,"f"),Z]),"f");let z=[],Q;while((Q=qS(D(this,r0,"f"),D(this,s0,"f")))!=null){if(Q.carriage&&D(this,s0,"f")==null){P(this,s0,Q.index,"f");continue}if(D(this,s0,"f")!=null&&(Q.index!==D(this,s0,"f")+1||Q.carriage)){z.push(Qz(D(this,r0,"f").subarray(0,D(this,s0,"f")-1))),P(this,r0,D(this,r0,"f").subarray(D(this,s0,"f")),"f"),P(this,s0,null,"f");continue}let X=D(this,s0,"f")!==null?Q.preceding-1:Q.preceding,J=Qz(D(this,r0,"f").subarray(0,X));z.push(J),P(this,r0,D(this,r0,"f").subarray(Q.index),"f"),P(this,s0,null,"f")}return z}flush(){if(!D(this,r0,"f").length)return[];return this.decode(`
|
|
166
|
+
`)}}function qS($,Z){for(let X=Z??0;X<$.length;X++){if($[X]===10)return{preceding:X,index:X+1,carriage:!1};if($[X]===13)return{preceding:X,index:X+1,carriage:!0}}return null}function mV($){for(let Q=0;Q<$.length-1;Q++){if($[Q]===10&&$[Q+1]===10)return Q+2;if($[Q]===13&&$[Q+1]===13)return Q+2;if($[Q]===13&&$[Q+1]===10&&Q+3<$.length&&$[Q+2]===13&&$[Q+3]===10)return Q+4}return-1}var r0,s0;var Xz=g(()=>{l2();r0=new WeakMap,s0=new WeakMap;D6.NEWLINE_CHARS=new Set([`
|
|
167
|
+
`,"\r"]);D6.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function _4(){}function MZ($,Z,z){if(!Z||LZ[$]>LZ[z])return _4;else return Z[$].bind(Z)}function F0($){let Z=$.logger,z=$.logLevel??"off";if(!Z)return KS;let Q=cV.get(Z);if(Q&&Q[0]===z)return Q[1];let X={error:MZ("error",Z,z),warn:MZ("warn",Z,z),info:MZ("info",Z,z),debug:MZ("debug",Z,z)};return cV.set(Z,[z,X]),X}var LZ,Jz=($,Z,z)=>{if(!$)return;if(_V(LZ,$))return $;F0(z).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(LZ))}`);return},KS,cV,i2=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([Z,z])=>[Z,Z.toLowerCase()==="x-api-key"||Z.toLowerCase()==="authorization"||Z.toLowerCase()==="cookie"||Z.toLowerCase()==="set-cookie"?"***":z]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var NZ=g(()=>{t6();LZ={off:0,error:200,warn:300,info:400,debug:500};KS={error:_4,warn:_4,info:_4,debug:_4},cV=new WeakMap});async function*BS($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new b("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new b("Attempted to iterate over a response with no body")}let z=new pV,Q=new D6,X=R4($.body);for await(let J of MS(X))for(let Y of Q.decode(J)){let W=z.decode(Y);if(W)yield W}for(let J of Q.flush()){let Y=z.decode(J);if(Y)yield Y}}async function*MS($){let Z=new Uint8Array;for await(let z of $){if(z==null)continue;let Q=z instanceof ArrayBuffer?new Uint8Array(z):typeof z==="string"?C4(z):z,X=new Uint8Array(Z.length+Q.length);X.set(Z),X.set(Q,Z.length),Z=X;let J;while((J=mV(Z))!==-1)yield Z.slice(0,J),Z=Z.slice(J)}if(Z.length>0)yield Z}class pV{constructor(){this.event=null,this.data=[],this.chunks=[]}decode($){if($.endsWith("\r"))$=$.substring(0,$.length-1);if(!$){if(!this.event&&!this.data.length)return null;let X={event:this.event,data:this.data.join(`
|
|
168
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],X}if(this.chunks.push($),$.startsWith(":"))return null;let[Z,z,Q]=LS($,":");if(Q.startsWith(" "))Q=Q.substring(1);if(Z==="event")this.event=Q;else if(Z==="data")this.data.push(Q);return null}}function LS($,Z){let z=$.indexOf(Z);if(z!==-1)return[$.substring(0,z),Z,$.substring(z+Z.length)];return[$,"",""]}var F4,o0;var Yz=g(()=>{l2();c0();Xz();t6();NZ();c0();o0=class o0{constructor($,Z,z){this.iterator=$,F4.set(this,void 0),this.controller=Z,P(this,F4,z,"f")}static fromSSEResponse($,Z,z){let Q=!1,X=z?F0(z):console;async function*J(){if(Q)throw new b("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of BS($,Z)){if(W.event==="completion")try{yield JSON.parse(W.data)}catch(U){throw X.error("Could not parse message into JSON:",W.data),X.error("From chunk:",W.raw),U}if(W.event==="message_start"||W.event==="message_delta"||W.event==="message_stop"||W.event==="content_block_start"||W.event==="content_block_delta"||W.event==="content_block_stop"||W.event==="message"||W.event==="user.message"||W.event==="user.interrupt"||W.event==="user.tool_confirmation"||W.event==="user.custom_tool_result"||W.event==="agent.message"||W.event==="agent.thinking"||W.event==="agent.tool_use"||W.event==="agent.tool_result"||W.event==="agent.mcp_tool_use"||W.event==="agent.mcp_tool_result"||W.event==="agent.custom_tool_use"||W.event==="agent.thread_context_compacted"||W.event==="session.status_running"||W.event==="session.status_idle"||W.event==="session.status_rescheduled"||W.event==="session.status_terminated"||W.event==="session.error"||W.event==="session.deleted"||W.event==="span.model_request_start"||W.event==="span.model_request_end")try{yield JSON.parse(W.data)}catch(U){throw X.error("Could not parse message into JSON:",W.data),X.error("From chunk:",W.raw),U}if(W.event==="ping")continue;if(W.event==="error"){let U=KZ(W.data)??W.data,G=U?.error?.type;throw new L0(void 0,U,void 0,$.headers,G)}}Y=!0}catch(W){if(d2(W))return;throw W}finally{if(!Y)Z.abort()}}return new o0(J,Z,z)}static fromReadableStream($,Z,z){let Q=!1;async function*X(){let Y=new D6,W=R4($);for await(let U of W)for(let G of Y.decode(U))yield G;for(let U of Y.flush())yield U}async function*J(){if(Q)throw new b("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of X()){if(Y)continue;if(W)yield JSON.parse(W)}Y=!0}catch(W){if(d2(W))return;throw W}finally{if(!Y)Z.abort()}}return new o0(J,Z,z)}[(F4=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],Z=[],z=this.iterator(),Q=(X)=>{return{next:()=>{if(X.length===0){let J=z.next();$.push(J),Z.push(J)}return X.shift()}}};return[new o0(()=>Q($),this.controller,D(this,F4,"f")),new o0(()=>Q(Z),this.controller,D(this,F4,"f"))]}toReadableStream(){let $=this,Z;return zz({async start(){Z=$[Symbol.asyncIterator]()},async pull(z){try{let{value:Q,done:X}=await Z.next();if(X)return z.close();let J=C4(JSON.stringify(Q)+`
|
|
169
|
+
`);z.enqueue(J)}catch(Q){z.error(Q)}},async cancel(){await Z.return?.()}})}}});async function DZ($,Z){let{response:z,requestLogID:Q,retryOfRequestLogID:X,startTime:J}=Z,Y=await(async()=>{if(Z.options.stream){if(F0($).debug("response",z.status,z.url,z.headers,z.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(z,Z.controller);return o0.fromSSEResponse(z,Z.controller)}if(z.status===204)return null;if(Z.options.__binaryResponse)return z;let U=z.headers.get("content-type")?.split(";")[0]?.trim();if(U?.includes("application/json")||U?.endsWith("+json")){if(z.headers.get("content-length")==="0")return;let q=await z.json();return Wz(q,z)}return await z.text()})();return F0($).debug(`[${Q}] response parsed`,i2({retryOfRequestLogID:X,url:z.url,status:z.status,body:Y,durationMs:Date.now()-J})),Y}function Wz($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var Uz=g(()=>{Yz();NZ()});var P4,O6;var OZ=g(()=>{l2();Uz();O6=class O6 extends Promise{constructor($,Z,z=DZ){super((Q)=>{Q(null)});this.responsePromise=Z,this.parseResponse=z,P4.set(this,void 0),P(this,P4,$,"f")}_thenUnwrap($){return new O6(D(this,P4,"f"),this.responsePromise,async(Z,z)=>Wz($(await this.parseResponse(Z,z),z),z.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,Z]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:Z,request_id:Z.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(($)=>this.parseResponse(D(this,P4,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};P4=new WeakMap});var IZ,Gz,E4,T2,Z0;var G0=g(()=>{l2();c0();Uz();OZ();t6();Gz=class Gz{constructor($,Z,z,Q){IZ.set(this,void 0),P(this,IZ,$,"f"),this.options=Q,this.response=Z,this.body=z}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new b("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await D(this,IZ,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(IZ=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};E4=class E4 extends O6{constructor($,Z,z){super($,Z,async(Q,X)=>new z(Q,X.response,await DZ(Q,X),X.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};T2=class T2 extends Gz{constructor($,Z,z,Q){super($,Z,z,Q);this.data=z.data||[],this.has_more=z.has_more||!1,this.first_id=z.first_id||null,this.last_id=z.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let Z=this.first_id;if(!Z)return null;return{...this.options,query:{...qZ(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...qZ(this.options.query),after_id:$}}}};Z0=class Z0 extends Gz{constructor($,Z,z,Q){super($,Z,z,Q);this.data=z.data||[],this.next_page=z.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let $=this.next_page;if(!$)return null;return{...this.options,query:{...qZ(this.options.query),page:$}}}}});function e6($,Z,z){return Hz(),new File($,Z??"unknown_file",z)}function w4($,Z){let z=typeof $==="object"&&$!==null&&(("name"in $)&&$.name&&String($.name)||("url"in $)&&$.url&&String($.url)||("filename"in $)&&$.filename&&String($.filename)||("path"in $)&&$.path&&String($.path))||"";return Z?z.split(/[\\/]/).pop()||void 0:z}function DS($){let Z=typeof $==="function"?$:$.fetch,z=lV.get(Z);if(z)return z;let Q=(async()=>{try{let X="Response"in Z?Z.Response:(await Z("data:,")).constructor,J=new FormData;if(J.toString()===await new X(J).text())return!1;return!0}catch{return!0}})();return lV.set(Z,Q),Q}var Hz=()=>{if(typeof File>"u"){let{process:$}=globalThis,Z=typeof $?.versions?.node==="string"&&parseInt($.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(Z?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}},qz=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",i$=async($,Z,z=!0)=>{return{...$,body:await OS($.body,Z,z)}},lV,OS=async($,Z,z=!0)=>{if(!await DS(Z))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let Q=new FormData;return await Promise.all(Object.entries($||{}).map(([X,J])=>Vz(Q,X,J,z))),Q},IS=($)=>$ instanceof Blob&&("name"in $),Vz=async($,Z,z,Q)=>{if(z===void 0)return;if(z==null)throw TypeError(`Received null for "${Z}"; to pass null in FormData, you must use the string 'null'`);if(typeof z==="string"||typeof z==="number"||typeof z==="boolean")$.append(Z,String(z));else if(z instanceof Response){let X={},J=z.headers.get("Content-Type");if(J)X={type:J};$.append(Z,e6([await z.blob()],w4(z,Q),X))}else if(qz(z))$.append(Z,e6([await new Response(BZ(z)).blob()],w4(z,Q)));else if(IS(z))$.append(Z,e6([z],w4(z,Q),{type:z.type}));else if(Array.isArray(z))await Promise.all(z.map((X)=>Vz($,Z+"[]",X,Q)));else if(typeof z==="object")await Promise.all(Object.entries(z).map(([X,J])=>Vz($,`${Z}[${X}]`,J,Q)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${z} instead`)};var n$=g(()=>{lV=new WeakMap});async function j4($,Z,z){if(Hz(),$=await $,Z||(Z=w4($,!0)),TS($)){if($ instanceof File&&Z==null&&z==null)return $;return e6([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...z})}if(AS($)){let X=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),e6(await Kz(X),Z,z)}let Q=await Kz($);if(!z?.type){let X=Q.find((J)=>typeof J==="object"&&("type"in J)&&J.type);if(typeof X==="string")z={...z,type:X}}return e6(Q,Z,z)}async function Kz($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(dV($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(qz($))for await(let z of $)Z.push(...await Kz(z));else{let z=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${z?`; constructor: ${z}`:""}${RS($)}`)}return Z}function RS($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((z)=>`"${z}"`).join(", ")}]`}var dV=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",TS=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&dV($),AS=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var iV=g(()=>{n$();n$()});var Bz=g(()=>{iV()});var nV=()=>{};class m{constructor($){this._client=$}}function*_S($){if(!$)return;if(rV in $){let{values:Q,nulls:X}=$;yield*Q.entries();for(let J of X)yield[J,null];return}let Z=!1,z;if($ instanceof Headers)z=$.entries();else if(e9($))z=$;else Z=!0,z=Object.entries($??{});for(let Q of z){let X=Q[0];if(typeof X!=="string")throw TypeError("expected header name to be a string");let J=e9(Q[1])?Q[1]:[Q[1]],Y=!1;for(let W of J){if(W===void 0)continue;if(Z&&!Y)Y=!0,yield[X,null];yield[X,W]}}}var rV,O=($)=>{let Z=new Headers,z=new Set;for(let Q of $){let X=new Set;for(let[J,Y]of _S(Q)){let W=J.toLowerCase();if(!X.has(W))Z.delete(J),X.add(W);if(Y===null)Z.delete(J),z.add(W);else Z.append(J,Y),z.delete(W)}}return{[rV]:!0,values:Z,nulls:z}};var X0=g(()=>{t6();rV=Symbol.for("brand.privateNullableHeaders")});function oV($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var sV,FS=($=oV)=>function(z,...Q){if(z.length===1)return z[0];let X=!1,J=[],Y=z.reduce((V,H,q)=>{if(/[?#]/.test(H))X=!0;let K=Q[q],L=(X?encodeURIComponent:$)(""+K);if(q!==Q.length&&(K==null||typeof K==="object"&&K.toString===Object.getPrototypeOf(Object.getPrototypeOf(K.hasOwnProperty??sV)??sV)?.toString))L=K+"",J.push({start:V.length+H.length,length:L.length,error:`Value of type ${Object.prototype.toString.call(K).slice(8,-1)} is not a valid path parameter`});return V+H+(q===Q.length?"":L)},""),W=Y.split(/[?#]/,1)[0],U=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,G;while((G=U.exec(W))!==null)J.push({start:G.index,length:G[0].length,error:`Value "${G[0]}" can't be safely passed as a path parameter`});if(J.sort((V,H)=>V.start-H.start),J.length>0){let V=0,H=J.reduce((q,K)=>{let L=" ".repeat(K.start-V),B="^".repeat(K.length);return V=K.start+K.length,q+L+B},"");throw new b(`Path parameters result in path with invalid segments:
|
|
170
|
+
${J.map((q)=>q.error).join(`
|
|
171
171
|
`)}
|
|
172
172
|
${Y}
|
|
173
|
-
${V}`)}return Y},C;var U0=v(()=>{_0();TY=Object.freeze(Object.create(null)),C=X_(AY)});var Z6;var I5=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 A4($){return typeof $==="object"&&$!==null&&X6 in $}function T5($,Z){let X=new Set;if($){for(let z of $)if(A4(z))X.add(z[X6])}if(Z)for(let z of Z){if(A4(z))X.add(z[X6]);if(Array.isArray(z.content)){for(let J of z.content)if(A4(J))X.add(J[X6])}}return Array.from(X)}function R4($,Z){let X=T5($,Z);if(X.length===0)return{};return{"x-stainless-helper":X.join(", ")}}function RY($){if(A4($))return{"x-stainless-helper":$[X6]};return{}}var X6;var z6=v(()=>{X6=Symbol("anthropic.sdk.stainlessHelper")});var J6;var A5=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",r0,{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()},RY(z.file),Z?.headers])},this._client))}}});var Q6;var R5=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",r0,{query:z,...Z,headers:D([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var Y6;var _5=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 C5=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 P5=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 E5=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 a1;var w5=v(()=>{P5();P5();E5();E5();z0();e();U0();a1=class a1 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])})}};a1.Memories=U6;a1.MemoryVersions=q6});var m$=v(()=>{_0()});var _4;var S5=v(()=>{_4={"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 _Y($){return $?.output_format??$?.output_config?.format}function j5($,Z,X){let z=_Y(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 x5($,Z,X)}function x5($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=K_(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 K_($,Z){let X=_Y($);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 b5=v(()=>{_0()});var H_=($)=>{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 $},B_=($)=>{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 $},M_=($)=>{let Z="";return $.map((X)=>{switch(X.type){case"string":Z+='"'+X.value+'"';break;default:Z+=X.value;break}}),Z},F4=($)=>JSON.parse(M_(B_(c$(H_($)))));var k5=()=>{};var y5=v(()=>{V5()});function EY($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function wY($){}var h0,S1,l$,G6,C4,V6,K6,P4,H6,G1,B6,E4,w4,o1,S4,j4,M6,v5,FY,x4,g5,f5,h5,CY,PY="__json_buf",O6;var SY=v(()=>{W1();k5();m$();y5();b5();O6=class O6{constructor($,Z){h0.add(this),this.messages=[],this.receivedMessages=[],S1.set(this,void 0),l$.set(this,null),this.controller=new AbortController,G6.set(this,void 0),C4.set(this,()=>{}),V6.set(this,()=>{}),K6.set(this,void 0),P4.set(this,()=>{}),H6.set(this,()=>{}),G1.set(this,{}),B6.set(this,!1),E4.set(this,!1),w4.set(this,!1),o1.set(this,!1),S4.set(this,void 0),j4.set(this,void 0),M6.set(this,void 0),x4.set(this,(X)=>{if(w(this,E4,!0,"f"),U1(X))X=new O0;if(X instanceof O0)return w(this,w4,!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,C4,X,"f"),w(this,V6,z,"f")}),"f"),w(this,K6,new Promise((X,z)=>{w(this,P4,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,S4,"f")}get request_id(){return N(this,j4,"f")}async withResponse(){w(this,o1,!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,x4,"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",g5).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",f5).call(this,W);if(Y.controller.signal?.aborted)throw new O0;N(this,h0,"m",h5).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;w(this,S4,$,"f"),w(this,j4,$?.headers.get("request-id"),"f"),N(this,C4,"f").call(this,$),this._emit("connect")}get ended(){return N(this,B6,"f")}get errored(){return N(this,E4,"f")}get aborted(){return N(this,w4,"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,o1,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){w(this,o1,!0,"f"),await N(this,K6,"f")}get currentMessage(){return N(this,S1,"f")}async finalMessage(){return await this.done(),N(this,h0,"m",v5).call(this)}async finalText(){return await this.done(),N(this,h0,"m",FY).call(this)}_emit($,...Z){if(N(this,B6,"f"))return;if($==="end")w(this,B6,!0,"f"),N(this,P4,"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,o1,"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,o1,"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,h0,"m",v5).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",g5).call(this),this._connected(null);let J=x0.fromReadableStream($,this.controller);for await(let Q of J)N(this,h0,"m",f5).call(this,Q);if(J.controller.signal?.aborted)throw new O0;N(this,h0,"m",h5).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(S1=new WeakMap,l$=new WeakMap,G6=new WeakMap,C4=new WeakMap,V6=new WeakMap,K6=new WeakMap,P4=new WeakMap,H6=new WeakMap,G1=new WeakMap,B6=new WeakMap,E4=new WeakMap,w4=new WeakMap,o1=new WeakMap,S4=new WeakMap,j4=new WeakMap,M6=new WeakMap,x4=new WeakMap,h0=new WeakSet,v5=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},FY=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(" ")},g5=function(){if(this.ended)return;w(this,S1,void 0,"f")},f5=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}case"compaction_delta":{if(z.type==="compaction"&&z.content)this._emit("compaction",z.content);break}default:wY(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(j5(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}},h5=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"),j5(Z,N(this,l$,"f"),{logger:N(this,M6,"f")})},CY=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&&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)try{Q.input=F4(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,x4,"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: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 d$;var b4=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 jY=1e5,xY=`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
|
+
${H}`)}return Y},C;var N0=g(()=>{c0();sV=Object.freeze(Object.create(null)),C=FS(oV)});var S4;var Mz=g(()=>{G0();X0();N0();S4=class S4 extends m{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/environments?beta=true",{body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(C`/v1/environments/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(C`/v1/environments/${$}?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/environments?beta=true",Z0,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(C`/v1/environments/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(C`/v1/environments/${$}/archive?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});function TZ($){return typeof $==="object"&&$!==null&&x4 in $}function Lz($,Z){let z=new Set;if($){for(let Q of $)if(TZ(Q))z.add(Q[x4])}if(Z)for(let Q of Z){if(TZ(Q))z.add(Q[x4]);if(Array.isArray(Q.content)){for(let X of Q.content)if(TZ(X))z.add(X[x4])}}return Array.from(z)}function AZ($,Z){let z=Lz($,Z);if(z.length===0)return{};return{"x-stainless-helper":z.join(", ")}}function aV($){if(TZ($))return{"x-stainless-helper":$[x4]};return{}}var x4;var k4=g(()=>{x4=Symbol("anthropic.sdk.stainlessHelper")});var b4;var Nz=g(()=>{G0();X0();k4();n$();N0();b4=class b4 extends m{list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/files?beta=true",T2,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(C`/v1/files/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}download($,Z={},z){let{betas:Q}=Z??{};return this._client.get(C`/v1/files/${$}/content?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},z?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},z){let{betas:Q}=Z??{};return this._client.get(C`/v1/files/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}upload($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/files?beta=true",i$({body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},aV(Q.file),Z?.headers])},this._client))}}});var y4;var Dz=g(()=>{G0();X0();N0();y4=class y4 extends m{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(C`/v1/models/${$}?beta=true`,{...z,headers:O([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models?beta=true",T2,{query:Q,...Z,headers:O([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var v4;var Oz=g(()=>{G0();X0();N0();v4=class v4 extends m{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/user_profiles?beta=true",{body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(C`/v1/user_profiles/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(C`/v1/user_profiles/${$}?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/user_profiles?beta=true",Z0,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},z){let{betas:Q}=Z??{};return this._client.post(C`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}}});var g4;var Iz=g(()=>{G0();X0();N0();g4=class g4 extends m{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(C`/v1/agents/${$}/versions?beta=true`,Z0,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var r$;var Tz=g(()=>{Iz();Iz();G0();X0();N0();r$=class r$ extends m{constructor(){super(...arguments);this.versions=new g4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/agents?beta=true",{body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.get(C`/v1/agents/${$}?beta=true`,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(C`/v1/agents/${$}?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/agents?beta=true",Z0,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(C`/v1/agents/${$}/archive?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};r$.Versions=g4});var h4;var Az=g(()=>{G0();X0();N0();h4=class h4 extends m{create($,Z,z){let{view:Q,betas:X,...J}=Z;return this._client.post(C`/v1/memory_stores/${$}/memories?beta=true`,{query:{view:Q},body:J,...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(C`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:J,...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{memory_store_id:Q,view:X,betas:J,...Y}=Z;return this._client.post(C`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{view:X},body:Y,...z,headers:O([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(C`/v1/memory_stores/${$}/memories?beta=true`,Z0,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{memory_store_id:Q,expected_content_sha256:X,betas:J}=Z;return this._client.delete(C`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{expected_content_sha256:X},...z,headers:O([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var f4;var Rz=g(()=>{G0();X0();N0();f4=class f4 extends m{retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(C`/v1/memory_stores/${Q}/memory_versions/${$}?beta=true`,{query:J,...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(C`/v1/memory_stores/${$}/memory_versions?beta=true`,Z0,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}redact($,Z,z){let{memory_store_id:Q,betas:X}=Z;return this._client.post(C`/v1/memory_stores/${Q}/memory_versions/${$}/redact?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var $$;var Cz=g(()=>{Az();Az();Rz();Rz();G0();X0();N0();$$=class $$ extends m{constructor(){super(...arguments);this.memories=new h4(this._client),this.memoryVersions=new f4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/memory_stores?beta=true",{body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(C`/v1/memory_stores/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(C`/v1/memory_stores/${$}?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/memory_stores?beta=true",Z0,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(C`/v1/memory_stores/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(C`/v1/memory_stores/${$}/archive?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};$$.Memories=h4;$$.MemoryVersions=f4});var s$=g(()=>{c0()});var RZ;var _z=g(()=>{RZ={"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 tV($){return $?.output_format??$?.output_config?.format}function Fz($,Z,z){let Q=tV(Z);if(!Z||!("parse"in(Q??{})))return{...$,content:$.content.map((X)=>{if(X.type==="text"){let J=Object.defineProperty({...X},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(J,"parsed",{get(){return z.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return X}),parsed_output:null};return Pz($,Z,z)}function Pz($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=vS(Z,J.text);if(Q===null)Q=Y;let W=Object.defineProperty({...J},"parsed_output",{value:Y,enumerable:!1});return Object.defineProperty(W,"parsed",{get(){return z.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),Y},enumerable:!1})}return J});return{...$,content:X,parsed_output:Q}}function vS($,Z){let z=tV($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new b(`Failed to parse structured output: ${Q}`)}}var Ez=g(()=>{c0()});var gS=($)=>{let Z=0,z=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"){Z++;continue}if(Q==="{"){z.push({type:"brace",value:"{"}),Z++;continue}if(Q==="}"){z.push({type:"brace",value:"}"}),Z++;continue}if(Q==="["){z.push({type:"paren",value:"["}),Z++;continue}if(Q==="]"){z.push({type:"paren",value:"]"}),Z++;continue}if(Q===":"){z.push({type:"separator",value:":"}),Z++;continue}if(Q===","){z.push({type:"delimiter",value:","}),Z++;continue}if(Q==='"'){let W="",U=!1;Q=$[++Z];while(Q!=='"'){if(Z===$.length){U=!0;break}if(Q==="\\"){if(Z++,Z===$.length){U=!0;break}W+=Q+$[Z],Q=$[++Z]}else W+=Q,Q=$[++Z]}if(Q=$[++Z],!U)z.push({type:"string",value:W});continue}if(Q&&/\s/.test(Q)){Z++;continue}let J=/[0-9]/;if(Q&&J.test(Q)||Q==="-"||Q==="."){let W="";if(Q==="-")W+=Q,Q=$[++Z];while(Q&&J.test(Q)||Q===".")W+=Q,Q=$[++Z];z.push({type:"number",value:W});continue}let Y=/[a-z]/i;if(Q&&Y.test(Q)){let W="";while(Q&&Y.test(Q)){if(Z===$.length)break;W+=Q,Q=$[++Z]}if(W=="true"||W=="false"||W==="null")z.push({type:"name",value:W});else{Z++;continue}continue}Z++}return z},o$=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),o$($);break;case"number":let z=Z.value[Z.value.length-1];if(z==="."||z==="-")return $=$.slice(0,$.length-1),o$($);case"string":let Q=$[$.length-2];if(Q?.type==="delimiter")return $=$.slice(0,$.length-1),o$($);else if(Q?.type==="brace"&&Q.value==="{")return $=$.slice(0,$.length-1),o$($);break;case"delimiter":return $=$.slice(0,$.length-1),o$($);break}return $},hS=($)=>{let Z=[];if($.map((z)=>{if(z.type==="brace")if(z.value==="{")Z.push("}");else Z.splice(Z.lastIndexOf("}"),1);if(z.type==="paren")if(z.value==="[")Z.push("]");else Z.splice(Z.lastIndexOf("]"),1)}),Z.length>0)Z.reverse().map((z)=>{if(z==="}")$.push({type:"brace",value:"}"});else if(z==="]")$.push({type:"paren",value:"]"})});return $},fS=($)=>{let Z="";return $.map((z)=>{switch(z.type){case"string":Z+='"'+z.value+'"';break;default:Z+=z.value;break}}),Z},CZ=($)=>JSON.parse(fS(hS(o$(gS($)))));var wz=()=>{};var jz=g(()=>{Yz()});function zH($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function QH($){}var W2,I6,a$,u4,_Z,m4,c4,FZ,p4,n2,l4,PZ,EZ,Z$,wZ,jZ,d4,Sz,eV,SZ,xz,kz,bz,$H,ZH="__json_buf",i4;var XH=g(()=>{l2();wz();s$();jz();Ez();i4=class i4{constructor($,Z){W2.add(this),this.messages=[],this.receivedMessages=[],I6.set(this,void 0),a$.set(this,null),this.controller=new AbortController,u4.set(this,void 0),_Z.set(this,()=>{}),m4.set(this,()=>{}),c4.set(this,void 0),FZ.set(this,()=>{}),p4.set(this,()=>{}),n2.set(this,{}),l4.set(this,!1),PZ.set(this,!1),EZ.set(this,!1),Z$.set(this,!1),wZ.set(this,void 0),jZ.set(this,void 0),d4.set(this,void 0),SZ.set(this,(z)=>{if(P(this,PZ,!0,"f"),d2(z))z=new P0;if(z instanceof P0)return P(this,EZ,!0,"f"),this._emit("abort",z);if(z instanceof b)return this._emit("error",z);if(z instanceof Error){let Q=new b(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new b(String(z)))}),P(this,u4,new Promise((z,Q)=>{P(this,_Z,z,"f"),P(this,m4,Q,"f")}),"f"),P(this,c4,new Promise((z,Q)=>{P(this,FZ,z,"f"),P(this,p4,Q,"f")}),"f"),D(this,u4,"f").catch(()=>{}),D(this,c4,"f").catch(()=>{}),P(this,a$,$,"f"),P(this,d4,Z?.logger??console,"f")}get response(){return D(this,wZ,"f")}get request_id(){return D(this,jZ,"f")}async withResponse(){P(this,Z$,!0,"f");let $=await D(this,u4,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new i4(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new i4(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return P(X,a$,{...Z,stream:!0},"f"),X._run(()=>X._createMessage($,{...Z,stream:!0},{...z,headers:{...z?.headers,"X-Stainless-Helper-Method":"stream"}})),X}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},D(this,SZ,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,z){let Q=z?.signal,X;if(Q){if(Q.aborted)this.controller.abort();X=this.controller.abort.bind(this.controller),Q.addEventListener("abort",X)}try{D(this,W2,"m",xz).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let W of Y)D(this,W2,"m",kz).call(this,W);if(Y.controller.signal?.aborted)throw new P0;D(this,W2,"m",bz).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;P(this,wZ,$,"f"),P(this,jZ,$?.headers.get("request-id"),"f"),D(this,_Z,"f").call(this,$),this._emit("connect")}get ended(){return D(this,l4,"f")}get errored(){return D(this,PZ,"f")}get aborted(){return D(this,EZ,"f")}abort(){this.controller.abort()}on($,Z){return(D(this,n2,"f")[$]||(D(this,n2,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=D(this,n2,"f")[$];if(!z)return this;let Q=z.findIndex((X)=>X.listener===Z);if(Q>=0)z.splice(Q,1);return this}once($,Z){return(D(this,n2,"f")[$]||(D(this,n2,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(P(this,Z$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){P(this,Z$,!0,"f"),await D(this,c4,"f")}get currentMessage(){return D(this,I6,"f")}async finalMessage(){return await this.done(),D(this,W2,"m",Sz).call(this)}async finalText(){return await this.done(),D(this,W2,"m",eV).call(this)}_emit($,...Z){if(D(this,l4,"f"))return;if($==="end")P(this,l4,!0,"f"),D(this,FZ,"f").call(this);let z=D(this,n2,"f")[$];if(z)D(this,n2,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!D(this,Z$,"f")&&!z?.length)Promise.reject(Q);D(this,m4,"f").call(this,Q),D(this,p4,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!D(this,Z$,"f")&&!z?.length)Promise.reject(Q);D(this,m4,"f").call(this,Q),D(this,p4,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",D(this,W2,"m",Sz).call(this))}async _fromReadableStream($,Z){let z=Z?.signal,Q;if(z){if(z.aborted)this.controller.abort();Q=this.controller.abort.bind(this.controller),z.addEventListener("abort",Q)}try{D(this,W2,"m",xz).call(this),this._connected(null);let X=o0.fromReadableStream($,this.controller);for await(let J of X)D(this,W2,"m",kz).call(this,J);if(X.controller.signal?.aborted)throw new P0;D(this,W2,"m",bz).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(I6=new WeakMap,a$=new WeakMap,u4=new WeakMap,_Z=new WeakMap,m4=new WeakMap,c4=new WeakMap,FZ=new WeakMap,p4=new WeakMap,n2=new WeakMap,l4=new WeakMap,PZ=new WeakMap,EZ=new WeakMap,Z$=new WeakMap,wZ=new WeakMap,jZ=new WeakMap,d4=new WeakMap,SZ=new WeakMap,W2=new WeakSet,Sz=function(){if(this.receivedMessages.length===0)throw new b("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},eV=function(){if(this.receivedMessages.length===0)throw new b("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new b("stream ended without producing a content block with type=text");return Z.join(" ")},xz=function(){if(this.ended)return;P(this,I6,void 0,"f")},kz=function(Z){if(this.ended)return;let z=D(this,W2,"m",$H).call(this,Z);switch(this._emit("streamEvent",Z,z),Z.type){case"content_block_delta":{let Q=z.content.at(-1);switch(Z.delta.type){case"text_delta":{if(Q.type==="text")this._emit("text",Z.delta.text,Q.text||"");break}case"citations_delta":{if(Q.type==="text")this._emit("citation",Z.delta.citation,Q.citations??[]);break}case"input_json_delta":{if(zH(Q)&&Q.input)this._emit("inputJson",Z.delta.partial_json,Q.input);break}case"thinking_delta":{if(Q.type==="thinking")this._emit("thinking",Z.delta.thinking,Q.thinking);break}case"signature_delta":{if(Q.type==="thinking")this._emit("signature",Q.signature);break}case"compaction_delta":{if(Q.type==="compaction"&&Q.content)this._emit("compaction",Q.content);break}default:QH(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(Fz(z,D(this,a$,"f"),{logger:D(this,d4,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{P(this,I6,z,"f");break}case"content_block_start":case"message_delta":break}},bz=function(){if(this.ended)throw new b("stream has ended, this shouldn't happen");let Z=D(this,I6,"f");if(!Z)throw new b("request ended without sending any chunks");return P(this,I6,void 0,"f"),Fz(Z,D(this,a$,"f"),{logger:D(this,d4,"f")})},$H=function(Z){let z=D(this,I6,"f");if(Z.type==="message_start"){if(z)throw new b(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new b(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return z;case"message_delta":if(z.container=Z.delta.container,z.stop_reason=Z.delta.stop_reason,z.stop_sequence=Z.delta.stop_sequence,z.usage.output_tokens=Z.usage.output_tokens,z.context_management=Z.context_management,Z.usage.input_tokens!=null)z.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)z.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)z.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)z.usage.server_tool_use=Z.usage.server_tool_use;if(Z.usage.iterations!=null)z.usage.iterations=Z.usage.iterations;return z;case"content_block_start":return z.content.push(Z.content_block),z;case"content_block_delta":{let Q=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,text:(Q.text||"")+Z.delta.text};break}case"citations_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,citations:[...Q.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(Q&&zH(Q)){let X=Q[ZH]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,ZH,{value:X,enumerable:!1,writable:!0}),X)try{J.input=CZ(X)}catch(Y){let W=new b(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${X}`);D(this,SZ,"f").call(this,W)}z.content[Z.index]=J}break}case"thinking_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,thinking:Q.thinking+Z.delta.thinking};break}case"signature_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,signature:Z.delta.signature};break}case"compaction_delta":{if(Q?.type==="compaction")z.content[Z.index]={...Q,content:(Q.content||"")+Z.delta.content};break}default:QH(Z.delta)}return z}case"content_block_stop":return z}},Symbol.asyncIterator)](){let $=[],Z=[],z=!1;return this.on("streamEvent",(Q)=>{let X=Z.shift();if(X)X.resolve(Q);else $.push(Q)}),this.on("end",()=>{z=!0;for(let Q of Z)Q.resolve(void 0);Z.length=0}),this.on("abort",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),this.on("error",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),{next:async()=>{if(!$.length){if(z)return{value:void 0,done:!0};return new Promise((X,J)=>Z.push({resolve:X,reject:J})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new o0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var t$;var xZ=g(()=>{t$=class t$ extends Error{constructor($){let Z=typeof $==="string"?$:$.map((z)=>{if(z.type==="text")return z.text;return`[${z.type}]`}).join(" ");super(Z);this.name="ToolError",this.content=$}}});var JH=1e5,YH=`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,98 +192,139 @@ 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(L_.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=_4[J.model]??void 0;Q=this._client.calculateNonstreamingTimeout(J.max_tokens,W)}let Y=R4(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)=>x5(X,$,{logger:this._client.logger??console}))}stream($,Z){return O6.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 D6(this._client,$,Z)}};x1.Batches=I6;x1.BetaToolRunner=D6;x1.ToolError=d$});var T6;var p5=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 i5=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 e1;var n5=v(()=>{p5();p5();i5();i5();z0();e();U0();e1=class e1 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])})}};e1.Events=T6;e1.Resources=A6});var R6;var r5=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 s5=v(()=>{r5();r5();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 _6;var a5=v(()=>{z0();e();U0();_6=class _6 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 o5=v(()=>{a5();a5();z0();e();U0();r$=class r$ extends h{constructor(){super(...arguments);this.credentials=new _6(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=_6});var L0;var t5=v(()=>{I5();I5();A5();A5();R5();R5();_5();_5();C5();C5();w5();w5();d5();d5();n5();n5();s5();s5();o5();o5();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 e1(this._client),this.vaults=new r$(this._client),this.memoryStores=new a1(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=e1;L0.Vaults=r$;L0.MemoryStores=a1;L0.Files=J6;L0.Skills=n$;L0.UserProfiles=Y6});var s$;var e5=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 gY($){return $?.output_config?.format}function $9($,Z,X){let z=gY(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 Z9($,Z,X)}function Z9($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=P_(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 P_($,Z){let X=gY($);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 X9=v(()=>{_0()});function mY($){return $.type==="tool_use"||$.type==="server_tool_use"}function cY($){}var u0,b1,a$,F6,k4,C6,P6,y4,E6,K1,w6,v4,g4,$$,f4,h4,S6,z9,fY,J9,Q9,Y9,W9,hY,uY="__json_buf",j6;var lY=v(()=>{W1();m$();y5();k5();X9();j6=class j6{constructor($,Z){u0.add(this),this.messages=[],this.receivedMessages=[],b1.set(this,void 0),a$.set(this,null),this.controller=new AbortController,F6.set(this,void 0),k4.set(this,()=>{}),C6.set(this,()=>{}),P6.set(this,void 0),y4.set(this,()=>{}),E6.set(this,()=>{}),K1.set(this,{}),w6.set(this,!1),v4.set(this,!1),g4.set(this,!1),$$.set(this,!1),f4.set(this,void 0),h4.set(this,void 0),S6.set(this,void 0),J9.set(this,(X)=>{if(w(this,v4,!0,"f"),U1(X))X=new O0;if(X instanceof O0)return w(this,g4,!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,F6,new Promise((X,z)=>{w(this,k4,X,"f"),w(this,C6,z,"f")}),"f"),w(this,P6,new Promise((X,z)=>{w(this,y4,X,"f"),w(this,E6,z,"f")}),"f"),N(this,F6,"f").catch(()=>{}),N(this,P6,"f").catch(()=>{}),w(this,a$,$,"f"),w(this,S6,Z?.logger??console,"f")}get response(){return N(this,f4,"f")}get request_id(){return N(this,h4,"f")}async withResponse(){w(this,$$,!0,"f");let $=await N(this,F6,"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,J9,"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,u0,"m",Q9).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,u0,"m",Y9).call(this,W);if(Y.controller.signal?.aborted)throw new O0;N(this,u0,"m",W9).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;w(this,f4,$,"f"),w(this,h4,$?.headers.get("request-id"),"f"),N(this,k4,"f").call(this,$),this._emit("connect")}get ended(){return N(this,w6,"f")}get errored(){return N(this,v4,"f")}get aborted(){return N(this,g4,"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,$$,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){w(this,$$,!0,"f"),await N(this,P6,"f")}get currentMessage(){return N(this,b1,"f")}async finalMessage(){return await this.done(),N(this,u0,"m",z9).call(this)}async finalText(){return await this.done(),N(this,u0,"m",fY).call(this)}_emit($,...Z){if(N(this,w6,"f"))return;if($==="end")w(this,w6,!0,"f"),N(this,y4,"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,$$,"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,$$,"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,u0,"m",z9).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,u0,"m",Q9).call(this),this._connected(null);let J=x0.fromReadableStream($,this.controller);for await(let Q of J)N(this,u0,"m",Y9).call(this,Q);if(J.controller.signal?.aborted)throw new O0;N(this,u0,"m",W9).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(b1=new WeakMap,a$=new WeakMap,F6=new WeakMap,k4=new WeakMap,C6=new WeakMap,P6=new WeakMap,y4=new WeakMap,E6=new WeakMap,K1=new WeakMap,w6=new WeakMap,v4=new WeakMap,g4=new WeakMap,$$=new WeakMap,f4=new WeakMap,h4=new WeakMap,S6=new WeakMap,J9=new WeakMap,u0=new WeakSet,z9=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},fY=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(" ")},Q9=function(){if(this.ended)return;w(this,b1,void 0,"f")},Y9=function(Z){if(this.ended)return;let X=N(this,u0,"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}default:cY(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage($9(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}},W9=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"),$9(Z,N(this,a$,"f"),{logger:N(this,S6,"f")})},hY=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&&mY(z)){let J=z[uY]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,uY,{value:J,enumerable:!1,writable:!0}),J)Q.input=F4(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:cY(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 U9=v(()=>{z0();e();c5();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",r0,{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 Z$,dY,w_;var q9=v(()=>{e();z6();lY();X9();U9();U9();S5();Z$=class Z$ extends h{constructor(){super(...arguments);this.batches=new x6(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 UH(){let $,Z;return{promise:new Promise((Q,X)=>{$=Q,Z=X}),resolve:$,reject:Z}}async function uS($,Z=$.messages.at(-1),z){if(!Z||Z.role!=="assistant"||!Z.content||typeof Z.content==="string")return null;let Q=Z.content.filter((J)=>J.type==="tool_use");if(Q.length===0)return null;return{role:"user",content:await Promise.all(Q.map(async(J)=>{let Y=$.tools.find((W)=>("name"in W?W.name:W.mcp_server_name)===J.name);if(!Y||!("run"in Y))return{type:"tool_result",tool_use_id:J.id,content:`Error: Tool '${J.name}' not found`,is_error:!0};try{let W=J.input;if("parse"in Y&&Y.parse)W=Y.parse(W);let U=await Y.run(W,{toolUseBlock:J,signal:z?.signal});return{type:"tool_result",tool_use_id:J.id,content:U}}catch(W){return{type:"tool_result",tool_use_id:J.id,content:W instanceof t$?W.content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}var n4,e$,z$,A0,p0,a0,r2,T6,r4,WH,yz,s4;var vz=g(()=>{l2();xZ();c0();X0();k4();s4=class s4{constructor($,Z,z){n4.add(this),this.client=$,e$.set(this,!1),z$.set(this,!1),A0.set(this,void 0),p0.set(this,void 0),a0.set(this,void 0),r2.set(this,void 0),T6.set(this,void 0),r4.set(this,0),P(this,A0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let X=["BetaToolRunner",...Lz(Z.tools,Z.messages)].join(", ");if(P(this,p0,{...z,headers:O([{"x-stainless-helper":X},z?.headers])},"f"),P(this,T6,UH(),"f"),Z.compactionControl?.enabled)console.warn('Anthropic: The `compactionControl` parameter is deprecated and will be removed in a future version. Use server-side compaction instead by passing `edits: [{ type: "compact_20260112" }]` in the params passed to `toolRunner()`. See https://platform.claude.com/docs/en/build-with-claude/compaction')}async*[(e$=new WeakMap,z$=new WeakMap,A0=new WeakMap,p0=new WeakMap,a0=new WeakMap,r2=new WeakMap,T6=new WeakMap,r4=new WeakMap,n4=new WeakSet,WH=async function(){let Z=D(this,A0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let z=0;if(D(this,a0,"f")!==void 0)try{let U=await D(this,a0,"f");z=U.usage.input_tokens+(U.usage.cache_creation_input_tokens??0)+(U.usage.cache_read_input_tokens??0)+U.usage.output_tokens}catch{return!1}let Q=Z.contextTokenThreshold??JH;if(z<Q)return!1;let X=Z.model??D(this,A0,"f").params.model,J=Z.summaryPrompt??YH,Y=D(this,A0,"f").params.messages;if(Y[Y.length-1].role==="assistant"){let U=Y[Y.length-1];if(Array.isArray(U.content)){let G=U.content.filter((V)=>V.type!=="tool_use");if(G.length===0)Y.pop();else U.content=G}}let W=await this.client.beta.messages.create({model:X,messages:[...Y,{role:"user",content:[{type:"text",text:J}]}],max_tokens:D(this,A0,"f").params.max_tokens},{signal:D(this,p0,"f").signal,headers:O([D(this,p0,"f").headers,{"x-stainless-helper":"compaction"}])});if(W.content[0]?.type!=="text")throw new b("Expected text response for compaction");return D(this,A0,"f").params.messages=[{role:"user",content:W.content}],!0},Symbol.asyncIterator)](){var $;if(D(this,e$,"f"))throw new b("Cannot iterate over a consumed stream");P(this,e$,!0,"f"),P(this,z$,!0,"f"),P(this,r2,void 0,"f");try{while(!0){let Z;try{if(D(this,A0,"f").params.max_iterations&&D(this,r4,"f")>=D(this,A0,"f").params.max_iterations)break;P(this,z$,!1,"f"),P(this,r2,void 0,"f"),P(this,r4,($=D(this,r4,"f"),$++,$),"f"),P(this,a0,void 0,"f");let{max_iterations:z,compactionControl:Q,...X}=D(this,A0,"f").params;if(X.stream)Z=this.client.beta.messages.stream({...X},D(this,p0,"f")),P(this,a0,Z.finalMessage(),"f"),D(this,a0,"f").catch(()=>{}),yield Z;else P(this,a0,this.client.beta.messages.create({...X,stream:!1},D(this,p0,"f")),"f"),yield D(this,a0,"f");if(!await D(this,n4,"m",WH).call(this)){if(!D(this,z$,"f")){let{role:W,content:U}=await D(this,a0,"f");D(this,A0,"f").params.messages.push({role:W,content:U})}let Y=await D(this,n4,"m",yz).call(this,D(this,A0,"f").params.messages.at(-1));if(Y)D(this,A0,"f").params.messages.push(Y);else if(!D(this,z$,"f"))break}}finally{if(Z)Z.abort()}}if(!D(this,a0,"f"))throw new b("ToolRunner concluded without a message from the server");D(this,T6,"f").resolve(await D(this,a0,"f"))}catch(Z){throw P(this,e$,!1,"f"),D(this,T6,"f").promise.catch(()=>{}),D(this,T6,"f").reject(Z),P(this,T6,UH(),"f"),Z}}setMessagesParams($){if(typeof $==="function")D(this,A0,"f").params=$(D(this,A0,"f").params);else D(this,A0,"f").params=$;P(this,z$,!0,"f"),P(this,r2,void 0,"f")}setRequestOptions($){if(typeof $==="function")P(this,p0,$(D(this,p0,"f")),"f");else P(this,p0,{...D(this,p0,"f"),...$},"f")}async generateToolResponse($=D(this,p0,"f").signal){let Z=await D(this,a0,"f")??this.params.messages.at(-1);if(!Z)return null;return D(this,n4,"m",yz).call(this,Z,$)}done(){return D(this,T6,"f").promise}async runUntilDone(){if(!D(this,e$,"f"))for await(let $ of this);return this.done()}get params(){return D(this,A0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};yz=async function(Z,z=D(this,p0,"f").signal){if(D(this,r2,"f")!==void 0)return D(this,r2,"f");return P(this,r2,uS(D(this,A0,"f").params,Z,{...D(this,p0,"f"),signal:z}),"f"),D(this,r2,"f")}});var $1;var gz=g(()=>{c0();Xz();$1=class $1{constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new D6;for await(let Z of this.iterator)for(let z of $.decode(Z))yield JSON.parse(z);for(let Z of $.flush())yield JSON.parse(Z)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new b("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new b("Attempted to iterate over a response with no body")}return new $1(R4($.body),Z)}}});var o4;var hz=g(()=>{G0();X0();gz();s$();N0();o4=class o4 extends m{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/messages/batches?beta=true",{body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(C`/v1/messages/batches/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",T2,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(C`/v1/messages/batches/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}cancel($,Z={},z){let{betas:Q}=Z??{};return this._client.post(C`/v1/messages/batches/${$}/cancel?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}async results($,Z={},z){let Q=await this.retrieve($);if(!Q.results_url)throw new b(`No batch \`results_url\`; Has it finished processing? ${Q.processing_status} - ${Q.id}`);let{betas:X}=Z??{};return this._client.get(Q.results_url,{...z,headers:O([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((J,Y)=>$1.fromResponse(Y.response,Y.controller))}}});function VH($){if(!$.output_format)return $;if($.output_config?.format)throw new b("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...z}=$;return{...z,output_config:{...$.output_config,format:Z}}}var GH,cS,A6;var fz=g(()=>{s$();_z();X0();k4();Ez();XH();vz();xZ();hz();hz();vz();xZ();GH={"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"},cS=["claude-mythos-preview","claude-opus-4-6"];A6=class A6 extends m{constructor(){super(...arguments);this.batches=new o4(this._client)}create($,Z){let z=VH($),{betas:Q,...X}=z;if(X.model in GH)console.warn(`The model '${X.model}' is deprecated and will reach end-of-life on ${GH[X.model]}
|
|
196
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(cS.includes(X.model)&&X.thinking&&X.thinking.type==="enabled")console.warn(`Using Claude with ${X.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let J=this._client._options.timeout;if(!X.stream&&J==null){let W=RZ[X.model]??void 0;J=this._client.calculateNonstreamingTimeout(X.max_tokens,W)}let Y=AZ(X.tools,X.messages);return this._client.post("/v1/messages?beta=true",{body:X,timeout:J??600000,...Z,headers:O([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},Y,Z?.headers]),stream:z.stream??!1})}parse($,Z){return Z={...Z,headers:O([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((z)=>Pz(z,$,{logger:this._client.logger??console}))}stream($,Z){return i4.createMessage(this,$,Z)}countTokens($,Z){let z=VH($),{betas:Q,...X}=z;return this._client.post("/v1/messages/count_tokens?beta=true",{body:X,...Z,headers:O([{"anthropic-beta":[...Q??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new s4(this._client,$,Z)}};A6.Batches=o4;A6.BetaToolRunner=s4;A6.ToolError=t$});var a4;var uz=g(()=>{G0();X0();N0();a4=class a4 extends m{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(C`/v1/sessions/${$}/events?beta=true`,Z0,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}send($,Z,z){let{betas:Q,...X}=Z;return this._client.post(C`/v1/sessions/${$}/events?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}stream($,Z={},z){let{betas:Q}=Z??{};return this._client.get(C`/v1/sessions/${$}/events/stream?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers]),stream:!0})}}});var t4;var mz=g(()=>{G0();X0();N0();t4=class t4 extends m{retrieve($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.get(C`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{session_id:Q,betas:X,...J}=Z;return this._client.post(C`/v1/sessions/${Q}/resources/${$}?beta=true`,{body:J,...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(C`/v1/sessions/${$}/resources?beta=true`,Z0,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.delete(C`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}add($,Z,z){let{betas:Q,...X}=Z;return this._client.post(C`/v1/sessions/${$}/resources?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var Q$;var cz=g(()=>{uz();uz();mz();mz();G0();X0();N0();Q$=class Q$ extends m{constructor(){super(...arguments);this.events=new a4(this._client),this.resources=new t4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/sessions?beta=true",{body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(C`/v1/sessions/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(C`/v1/sessions/${$}?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/sessions?beta=true",Z0,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(C`/v1/sessions/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(C`/v1/sessions/${$}/archive?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};Q$.Events=a4;Q$.Resources=t4});var e4;var pz=g(()=>{G0();X0();n$();N0();e4=class e4 extends m{create($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.post(C`/v1/skills/${$}/versions?beta=true`,i$({body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])},this._client))}retrieve($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.get(C`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(C`/v1/skills/${$}/versions?beta=true`,Z0,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}delete($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.delete(C`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}}});var Z1;var lz=g(()=>{pz();pz();G0();X0();n$();N0();Z1=class Z1 extends m{constructor(){super(...arguments);this.versions=new e4(this._client)}create($={},Z){let{betas:z,...Q}=$??{};return this._client.post("/v1/skills?beta=true",i$({body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(C`/v1/skills/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/skills?beta=true",Z0,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(C`/v1/skills/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}};Z1.Versions=e4});var $8;var dz=g(()=>{G0();X0();N0();$8=class $8 extends m{create($,Z,z){let{betas:Q,...X}=Z;return this._client.post(C`/v1/vaults/${$}/credentials?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.get(C`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{vault_id:Q,betas:X,...J}=Z;return this._client.post(C`/v1/vaults/${Q}/credentials/${$}?beta=true`,{body:J,...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(C`/v1/vaults/${$}/credentials?beta=true`,Z0,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.delete(C`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.post(C`/v1/vaults/${Q}/credentials/${$}/archive?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var z1;var iz=g(()=>{dz();dz();G0();X0();N0();z1=class z1 extends m{constructor(){super(...arguments);this.credentials=new $8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/vaults?beta=true",{body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(C`/v1/vaults/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(C`/v1/vaults/${$}?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/vaults?beta=true",Z0,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(C`/v1/vaults/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(C`/v1/vaults/${$}/archive?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};z1.Credentials=$8});var x0;var nz=g(()=>{Mz();Mz();Nz();Nz();Dz();Dz();Oz();Oz();Tz();Tz();Cz();Cz();fz();fz();cz();cz();lz();lz();iz();iz();x0=class x0 extends m{constructor(){super(...arguments);this.models=new y4(this._client),this.messages=new A6(this._client),this.agents=new r$(this._client),this.environments=new S4(this._client),this.sessions=new Q$(this._client),this.vaults=new z1(this._client),this.memoryStores=new $$(this._client),this.files=new b4(this._client),this.skills=new Z1(this._client),this.userProfiles=new v4(this._client)}};x0.Models=y4;x0.Messages=A6;x0.Agents=r$;x0.Environments=S4;x0.Sessions=Q$;x0.Vaults=z1;x0.MemoryStores=$$;x0.Files=b4;x0.Skills=Z1;x0.UserProfiles=v4});var Q1;var rz=g(()=>{X0();Q1=class Q1 extends m{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/complete",{body:Q,timeout:this._client._options.timeout??600000,...Z,headers:O([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function HH($){return $?.output_config?.format}function sz($,Z,z){let Q=HH(Z);if(!Z||!("parse"in(Q??{})))return{...$,content:$.content.map((X)=>{if(X.type==="text")return Object.defineProperty({...X},"parsed_output",{value:null,enumerable:!1});return X}),parsed_output:null};return oz($,Z,z)}function oz($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=aS(Z,J.text);if(Q===null)Q=Y;return Object.defineProperty({...J},"parsed_output",{value:Y,enumerable:!1})}return J});return{...$,content:X,parsed_output:Q}}function aS($,Z){let z=HH($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new b(`Failed to parse structured output: ${Q}`)}}var az=g(()=>{c0()});function MH($){return $.type==="tool_use"||$.type==="server_tool_use"}function LH($){}var U2,R6,X1,Z8,kZ,z8,Q8,bZ,X8,s2,J8,yZ,vZ,X$,gZ,hZ,Y8,tz,qH,ez,$Q,ZQ,zQ,KH,BH="__json_buf",W8;var NH=g(()=>{l2();s$();jz();wz();az();W8=class W8{constructor($,Z){U2.add(this),this.messages=[],this.receivedMessages=[],R6.set(this,void 0),X1.set(this,null),this.controller=new AbortController,Z8.set(this,void 0),kZ.set(this,()=>{}),z8.set(this,()=>{}),Q8.set(this,void 0),bZ.set(this,()=>{}),X8.set(this,()=>{}),s2.set(this,{}),J8.set(this,!1),yZ.set(this,!1),vZ.set(this,!1),X$.set(this,!1),gZ.set(this,void 0),hZ.set(this,void 0),Y8.set(this,void 0),ez.set(this,(z)=>{if(P(this,yZ,!0,"f"),d2(z))z=new P0;if(z instanceof P0)return P(this,vZ,!0,"f"),this._emit("abort",z);if(z instanceof b)return this._emit("error",z);if(z instanceof Error){let Q=new b(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new b(String(z)))}),P(this,Z8,new Promise((z,Q)=>{P(this,kZ,z,"f"),P(this,z8,Q,"f")}),"f"),P(this,Q8,new Promise((z,Q)=>{P(this,bZ,z,"f"),P(this,X8,Q,"f")}),"f"),D(this,Z8,"f").catch(()=>{}),D(this,Q8,"f").catch(()=>{}),P(this,X1,$,"f"),P(this,Y8,Z?.logger??console,"f")}get response(){return D(this,gZ,"f")}get request_id(){return D(this,hZ,"f")}async withResponse(){P(this,X$,!0,"f");let $=await D(this,Z8,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new W8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new W8(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return P(X,X1,{...Z,stream:!0},"f"),X._run(()=>X._createMessage($,{...Z,stream:!0},{...z,headers:{...z?.headers,"X-Stainless-Helper-Method":"stream"}})),X}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},D(this,ez,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,z){let Q=z?.signal,X;if(Q){if(Q.aborted)this.controller.abort();X=this.controller.abort.bind(this.controller),Q.addEventListener("abort",X)}try{D(this,U2,"m",$Q).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let W of Y)D(this,U2,"m",ZQ).call(this,W);if(Y.controller.signal?.aborted)throw new P0;D(this,U2,"m",zQ).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;P(this,gZ,$,"f"),P(this,hZ,$?.headers.get("request-id"),"f"),D(this,kZ,"f").call(this,$),this._emit("connect")}get ended(){return D(this,J8,"f")}get errored(){return D(this,yZ,"f")}get aborted(){return D(this,vZ,"f")}abort(){this.controller.abort()}on($,Z){return(D(this,s2,"f")[$]||(D(this,s2,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=D(this,s2,"f")[$];if(!z)return this;let Q=z.findIndex((X)=>X.listener===Z);if(Q>=0)z.splice(Q,1);return this}once($,Z){return(D(this,s2,"f")[$]||(D(this,s2,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(P(this,X$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){P(this,X$,!0,"f"),await D(this,Q8,"f")}get currentMessage(){return D(this,R6,"f")}async finalMessage(){return await this.done(),D(this,U2,"m",tz).call(this)}async finalText(){return await this.done(),D(this,U2,"m",qH).call(this)}_emit($,...Z){if(D(this,J8,"f"))return;if($==="end")P(this,J8,!0,"f"),D(this,bZ,"f").call(this);let z=D(this,s2,"f")[$];if(z)D(this,s2,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!D(this,X$,"f")&&!z?.length)Promise.reject(Q);D(this,z8,"f").call(this,Q),D(this,X8,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!D(this,X$,"f")&&!z?.length)Promise.reject(Q);D(this,z8,"f").call(this,Q),D(this,X8,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",D(this,U2,"m",tz).call(this))}async _fromReadableStream($,Z){let z=Z?.signal,Q;if(z){if(z.aborted)this.controller.abort();Q=this.controller.abort.bind(this.controller),z.addEventListener("abort",Q)}try{D(this,U2,"m",$Q).call(this),this._connected(null);let X=o0.fromReadableStream($,this.controller);for await(let J of X)D(this,U2,"m",ZQ).call(this,J);if(X.controller.signal?.aborted)throw new P0;D(this,U2,"m",zQ).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(R6=new WeakMap,X1=new WeakMap,Z8=new WeakMap,kZ=new WeakMap,z8=new WeakMap,Q8=new WeakMap,bZ=new WeakMap,X8=new WeakMap,s2=new WeakMap,J8=new WeakMap,yZ=new WeakMap,vZ=new WeakMap,X$=new WeakMap,gZ=new WeakMap,hZ=new WeakMap,Y8=new WeakMap,ez=new WeakMap,U2=new WeakSet,tz=function(){if(this.receivedMessages.length===0)throw new b("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},qH=function(){if(this.receivedMessages.length===0)throw new b("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new b("stream ended without producing a content block with type=text");return Z.join(" ")},$Q=function(){if(this.ended)return;P(this,R6,void 0,"f")},ZQ=function(Z){if(this.ended)return;let z=D(this,U2,"m",KH).call(this,Z);switch(this._emit("streamEvent",Z,z),Z.type){case"content_block_delta":{let Q=z.content.at(-1);switch(Z.delta.type){case"text_delta":{if(Q.type==="text")this._emit("text",Z.delta.text,Q.text||"");break}case"citations_delta":{if(Q.type==="text")this._emit("citation",Z.delta.citation,Q.citations??[]);break}case"input_json_delta":{if(MH(Q)&&Q.input)this._emit("inputJson",Z.delta.partial_json,Q.input);break}case"thinking_delta":{if(Q.type==="thinking")this._emit("thinking",Z.delta.thinking,Q.thinking);break}case"signature_delta":{if(Q.type==="thinking")this._emit("signature",Q.signature);break}default:LH(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(sz(z,D(this,X1,"f"),{logger:D(this,Y8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{P(this,R6,z,"f");break}case"content_block_start":case"message_delta":break}},zQ=function(){if(this.ended)throw new b("stream has ended, this shouldn't happen");let Z=D(this,R6,"f");if(!Z)throw new b("request ended without sending any chunks");return P(this,R6,void 0,"f"),sz(Z,D(this,X1,"f"),{logger:D(this,Y8,"f")})},KH=function(Z){let z=D(this,R6,"f");if(Z.type==="message_start"){if(z)throw new b(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new b(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return z;case"message_delta":if(z.stop_reason=Z.delta.stop_reason,z.stop_sequence=Z.delta.stop_sequence,z.usage.output_tokens=Z.usage.output_tokens,Z.usage.input_tokens!=null)z.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)z.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)z.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)z.usage.server_tool_use=Z.usage.server_tool_use;return z;case"content_block_start":return z.content.push({...Z.content_block}),z;case"content_block_delta":{let Q=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,text:(Q.text||"")+Z.delta.text};break}case"citations_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,citations:[...Q.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(Q&&MH(Q)){let X=Q[BH]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,BH,{value:X,enumerable:!1,writable:!0}),X)J.input=CZ(X);z.content[Z.index]=J}break}case"thinking_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,thinking:Q.thinking+Z.delta.thinking};break}case"signature_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,signature:Z.delta.signature};break}default:LH(Z.delta)}return z}case"content_block_stop":return z}},Symbol.asyncIterator)](){let $=[],Z=[],z=!1;return this.on("streamEvent",(Q)=>{let X=Z.shift();if(X)X.resolve(Q);else $.push(Q)}),this.on("end",()=>{z=!0;for(let Q of Z)Q.resolve(void 0);Z.length=0}),this.on("abort",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),this.on("error",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),{next:async()=>{if(!$.length){if(z)return{value:void 0,done:!0};return new Promise((X,J)=>Z.push({resolve:X,reject:J})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new o0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var U8;var QQ=g(()=>{G0();X0();gz();s$();N0();U8=class U8 extends m{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",T2,{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 z=await this.retrieve($);if(!z.results_url)throw new b(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);return this._client.get(z.results_url,{...Z,headers:O([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,X)=>$1.fromResponse(X.response,X.controller))}}});var J$,DH,eS;var XQ=g(()=>{X0();k4();NH();az();QQ();QQ();_z();J$=class J$ extends m{constructor(){super(...arguments);this.batches=new U8(this._client)}create($,Z){if($.model in DH)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${DH[$.model]}
|
|
197
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(eS.includes($.model)&&$.thinking&&$.thinking.type==="enabled")console.warn(`Using Claude with ${$.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let z=this._client._options.timeout;if(!$.stream&&z==null){let X=RZ[$.model]??void 0;z=this._client.calculateNonstreamingTimeout($.max_tokens,X)}let Q=AZ($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:z??600000,...Z,headers:O([Q,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((z)=>oz(z,$,{logger:this._client.logger??console}))}stream($,Z){return W8.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};DH={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026","claude-opus-4-0":"June 15th, 2026","claude-opus-4-20250514":"June 15th, 2026","claude-sonnet-4-0":"June 15th, 2026","claude-sonnet-4-20250514":"June 15th, 2026"},eS=["claude-mythos-preview","claude-opus-4-6"];J$.Batches=U8});var J1;var JQ=g(()=>{G0();X0();N0();J1=class J1 extends m{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(C`/v1/models/${$}`,{...z,headers:O([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models",T2,{query:Q,...Z,headers:O([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var OH=g(()=>{nz();rz();XQ();JQ();nV()});var G8=($)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[$]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.($)?.trim()||void 0;return};class Y0{constructor({baseURL:$=G8("ANTHROPIC_BASE_URL"),apiKey:Z=G8("ANTHROPIC_API_KEY")??null,authToken:z=G8("ANTHROPIC_AUTH_TOKEN")??null,...Q}={}){YQ.add(this),fZ.set(this,void 0);let X={apiKey:Z,authToken:z,...Q,baseURL:$||"https://api.anthropic.com"};if(!X.dangerouslyAllowBrowser&&SV())throw new b(`It looks like you're running in a browser-like environment.
|
|
198
198
|
|
|
199
199
|
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
200
200
|
If you understand the risks and have appropriate mitigations in place,
|
|
201
201
|
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
202
202
|
|
|
203
203
|
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
204
|
-
`);this.baseURL=J.baseURL,this.timeout=J.timeout??K9.DEFAULT_TIMEOUT,this.logger=J.logger??console;let Q="warn";this.logLevel=Q,this.logLevel=G5(J.logLevel,"ClientOptions.logLevel",this)??G5(b6("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??Q,this.fetchOptions=J.fetchOptions,this.maxRetries=J.maxRetries??2,this.fetch=J.fetch??QY(),w(this,u4,WY,"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 UY($)}getUserAgent(){return`${this.constructor.name}/JS ${P1}`}defaultIdempotencyKey(){return`stainless-node-retry-${X5()}`}makeStatusError($,Z,X,z){return W0.generate($,Z,X,z)}buildURL($,Z,X){let z=!N(this,V9,"m",iY).call(this)&&X||this.baseURL,J=aQ($)?new URL($):new URL(z+(z.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),Q=this.defaultQuery(),Y=Object.fromEntries(J.searchParams);if(!Q5(Q)||!Q5(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 YY(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=B4(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 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)tQ("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))}:{},...JY(),...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:M4($)};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,u4,"f").call(this,{body:$,headers:X})}}var V9,K9,u4,iY,H9="\\n\\nHuman:",B9="\\n\\nAssistant:",k1;var M9=v(()=>{W1();r1();Y5();qY();_0();z0();D5();pY();I4();e5();G9();t5();q9();Y5();e();L4();r1();K9=X0,u4=new WeakMap,V9=new WeakSet,iY=function(){return this.baseURL!=="https://api.anthropic.com"};X0.Anthropic=K9;X0.HUMAN_PROMPT=H9;X0.AI_PROMPT=B9;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 Z$(this),this.models=new o$(this),this.beta=new L0(this)}};k1.Completions=s$;k1.Messages=Z$;k1.Models=o$;k1.Beta=L0});var nY={};w9(nY,{toFile:()=>$6,default:()=>k1,UnprocessableEntityError:()=>y$,RateLimitError:()=>v$,PermissionDeniedError:()=>x$,PagePromise:()=>t2,NotFoundError:()=>b$,InternalServerError:()=>g$,HUMAN_PROMPT:()=>H9,ConflictError:()=>k$,BaseAnthropic:()=>X0,BadRequestError:()=>S$,AuthenticationError:()=>j$,AnthropicError:()=>k,Anthropic:()=>k1,APIUserAbortError:()=>O0,APIPromise:()=>w1,APIError:()=>W0,APIConnectionTimeoutError:()=>w$,APIConnectionError:()=>C1,AI_PROMPT:()=>B9});var rY=v(()=>{M9();D5();I4();M9();z0();_0()});var i9=PW(p9(),1),{program:lF,createCommand:dF,createArgument:pF,createOption:iF,CommanderError:nF,InvalidArgumentError:rF,InvalidOptionArgumentError:sF,Command:n9,Argument:aF,Option:oF,Help:tF}=i9.default;import{readFileSync as Qz,writeFileSync as MN,existsSync as zz}from"fs";import{join as Jz,dirname as Yz,basename as ON}from"path";import{execFileSync as NN}from"child_process";var xO=a3(),bO=M2(),kO=k3(),UZ=O2(),yO=Z2(),T1=i(),vO=O1(),gO=J0(),fO=L1(),hO=D1(),NP=_8(),uO=QZ(),mO=YZ(),cO=WZ(),E8=Zz(),Xz=e$();var lO=xO.Composer,dO=bO.Document,pO=kO.Schema,iO=UZ.YAMLError,nO=UZ.YAMLParseError,rO=UZ.YAMLWarning,sO=yO.Alias,aO=T1.isAlias,oO=T1.isCollection,tO=T1.isDocument,eO=T1.isMap,$N=T1.isNode,ZN=T1.isPair,XN=T1.isScalar,zN=T1.isSeq,JN=vO.Pair,QN=gO.Scalar,YN=fO.YAMLMap,WN=hO.YAMLSeq;var UN=uO.Lexer,qN=mO.LineCounter,GN=cO.Parser,D0=E8.parse,VN=E8.parseAllDocuments,KN=E8.parseDocument,A2=E8.stringify,HN=Xz.visit,BN=Xz.visitAsync;function m($){let Z=Qz($,"utf-8");return D0(Z)}function qZ($){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){MN($,qZ(Z),"utf-8")}function u($){return Qz($,"utf-8")}function Wz($){return D0($)}function f($=process.cwd()){let Z=["project.faf",".faf"];for(let z of Z){let J=Jz($,z);if(zz(J))return J}let X=Yz($);if(X!==$)for(let z of Z){let J=Jz(X,z);if(zz(J))return J}return null}function B$($,Z=process.cwd()){return NN("git",["-C",Yz($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+ON($)}l();var M$=[{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 d0($){return $.indicator}function A1($){for(let Z of M$)if($>=Z.threshold)return Z;return M$[M$.length-1]}var VZ=null;function _2(){if(VZ)return VZ;try{let $=C0("faf-scoring-kernel");return VZ=$,$}catch{throw Error(`faf-scoring-kernel not installed.
|
|
204
|
+
`);this.baseURL=X.baseURL,this.timeout=X.timeout??WQ.DEFAULT_TIMEOUT,this.logger=X.logger??console;let J="warn";this.logLevel=J,this.logLevel=Jz(X.logLevel,"ClientOptions.logLevel",this)??Jz(G8("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=X.fetchOptions,this.maxRetries=X.maxRetries??2,this.fetch=X.fetch??kV(),P(this,fZ,yV,"f"),this._options=X,this.apiKey=typeof Z==="string"?Z:null,this.authToken=z}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders($){return O([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return O([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return O([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return vV($)}getUserAgent(){return`${this.constructor.name}/JS ${N6}`}defaultIdempotencyKey(){return`stainless-node-retry-${a9()}`}makeStatusError($,Z,z,Q){return L0.generate($,Z,z,Q)}buildURL($,Z,z){let Q=!D(this,YQ,"m",IH).call(this)&&z||this.baseURL,X=CV($)?new URL($):new URL(Q+(Q.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),J=this.defaultQuery(),Y=Object.fromEntries(X.searchParams);if(!$z(J)||!$z(Y))Z={...Y,...J,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))X.search=this.stringifyQuery(Z);return X.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new b("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options:z}){}get($,Z){return this.methodRequest("get",$,Z)}post($,Z){return this.methodRequest("post",$,Z)}patch($,Z){return this.methodRequest("patch",$,Z)}put($,Z){return this.methodRequest("put",$,Z)}delete($,Z){return this.methodRequest("delete",$,Z)}methodRequest($,Z,z){return this.request(Promise.resolve(z).then((Q)=>{return{method:$,path:Z,...Q}}))}request($,Z=null){return new O6(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,z){let Q=await $,X=Q.maxRetries??this.maxRetries;if(Z==null)Z=X;await this.prepareOptions(Q);let{req:J,url:Y,timeout:W}=await this.buildRequest(Q,{retryCount:X-Z});await this.prepareRequest(J,{url:Y,options:Q});let U="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),G=z===void 0?"":`, retryOf: ${z}`,V=Date.now();if(F0(this).debug(`[${U}] sending request`,i2({retryOfRequestLogID:z,method:Q.method,url:Y,options:Q,headers:J.headers})),Q.signal?.aborted)throw new P0;let H=new AbortController,q=await this.fetchWithTimeout(Y,J,W,H).catch(A4),K=Date.now();if(q instanceof globalThis.Error){let N=`retrying, ${Z} attempts remaining`;if(Q.signal?.aborted)throw new P0;let T=d2(q)||/timed? ?out/i.test(String(q)+("cause"in q?String(q.cause):""));if(Z)return F0(this).info(`[${U}] connection ${T?"timed out":"failed"} - ${N}`),F0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (${N})`,i2({retryOfRequestLogID:z,url:Y,durationMs:K-V,message:q.message})),this.retryRequest(Q,Z,z??U);if(F0(this).info(`[${U}] connection ${T?"timed out":"failed"} - error; no more retries left`),F0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (error; no more retries left)`,i2({retryOfRequestLogID:z,url:Y,durationMs:K-V,message:q.message})),T)throw new g$;throw new L6({cause:q})}let L=[...q.headers.entries()].filter(([N])=>N==="request-id").map(([N,T])=>", "+N+": "+JSON.stringify(T)).join(""),B=`[${U}${G}${L}] ${J.method} ${Y} ${q.ok?"succeeded":"failed"} with status ${q.status} in ${K-V}ms`;if(!q.ok){let N=await this.shouldRetry(q);if(Z&&N){let k=`retrying, ${Z} attempts remaining`;return await bV(q.body),F0(this).info(`${B} - ${k}`),F0(this).debug(`[${U}] response error (${k})`,i2({retryOfRequestLogID:z,url:q.url,status:q.status,headers:q.headers,durationMs:K-V})),this.retryRequest(Q,Z,z??U,q.headers)}let T=N?"error; no more retries left":"error; not retryable";F0(this).info(`${B} - ${T}`);let w=await q.text().catch((k)=>A4(k).message),j=KZ(w),x=j?void 0:w;throw F0(this).debug(`[${U}] response error (${T})`,i2({retryOfRequestLogID:z,url:q.url,status:q.status,headers:q.headers,message:x,durationMs:Date.now()-V})),this.makeStatusError(q.status,j,x,q.headers)}return F0(this).info(B),F0(this).debug(`[${U}] response start`,i2({retryOfRequestLogID:z,url:q.url,status:q.status,headers:q.headers,durationMs:K-V})),{response:q,options:Q,controller:H,requestLogID:U,retryOfRequestLogID:z,startTime:V}}getAPIList($,Z,z){return this.requestAPIList(Z,z&&"then"in z?z.then((Q)=>({method:"get",path:$,...Q})):{method:"get",path:$,...z})}requestAPIList($,Z){let z=this.makeRequest(Z,null,void 0);return new E4(this,z,$)}async fetchWithTimeout($,Z,z,Q){let{signal:X,method:J,...Y}=Z||{},W=this._makeAbort(Q);if(X)X.addEventListener("abort",W,{once:!0});let U=setTimeout(W,z),G=globalThis.ReadableStream&&Y.body instanceof globalThis.ReadableStream||typeof Y.body==="object"&&Y.body!==null&&Symbol.asyncIterator in Y.body,V={signal:Q.signal,...G?{duplex:"half"}:{},method:"GET",...Y};if(J)V.method=J.toUpperCase();try{return await this.fetch.call(void 0,$,V)}finally{clearTimeout(U)}}async shouldRetry($){let Z=$.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,Z,z,Q){let X,J=Q?.get("retry-after-ms");if(J){let W=parseFloat(J);if(!Number.isNaN(W))X=W}let Y=Q?.get("retry-after");if(Y&&!X){let W=parseFloat(Y);if(!Number.isNaN(W))X=W*1000;else X=Date.parse(Y)-Date.now()}if(X===void 0){let W=$.maxRetries??this.maxRetries;X=this.calculateDefaultRetryTimeoutMillis(Z,W)}return await PV(X),this.makeRequest($,Z-1,z)}calculateDefaultRetryTimeoutMillis($,Z){let X=Z-$,J=Math.min(0.5*Math.pow(2,X),8),Y=1-Math.random()*0.25;return J*Y*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new b("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let z={...$},{method:Q,path:X,query:J,defaultBaseURL:Y}=z,W=this.buildURL(X,J,Y);if("timeout"in z)FV("timeout",z.timeout);z.timeout=z.timeout??this.timeout;let{bodyHeaders:U,body:G}=this.buildBody({options:z}),V=await this.buildHeaders({options:$,method:Q,bodyHeaders:U,retryCount:Z});return{req:{method:Q,headers:V,...z.signal&&{signal:z.signal},...globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"},...G&&{body:G},...this.fetchOptions??{},...z.fetchOptions??{}},url:W,timeout:z.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:z,retryCount:Q}){let X={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();X[this.idempotencyHeader]=$.idempotencyKey}let J=O([X,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(Q),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...xV(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,z,$.headers]);return this.validateHeaders(J),J.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let z=O([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&z.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:BZ($)};else if(typeof $==="object"&&z.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery($)};else return D(this,fZ,"f").call(this,{body:$,headers:z})}}var YQ,WQ,fZ,IH,UQ="\\n\\nHuman:",GQ="\\n\\nAssistant:",C6;var VQ=g(()=>{l2();t6();Zz();gV();c0();G0();Bz();OH();OZ();rz();JQ();nz();XQ();Zz();X0();NZ();t6();WQ=Y0,fZ=new WeakMap,YQ=new WeakSet,IH=function(){return this.baseURL!=="https://api.anthropic.com"};Y0.Anthropic=WQ;Y0.HUMAN_PROMPT=UQ;Y0.AI_PROMPT=GQ;Y0.DEFAULT_TIMEOUT=600000;Y0.AnthropicError=b;Y0.APIError=L0;Y0.APIConnectionError=L6;Y0.APIConnectionTimeoutError=g$;Y0.APIUserAbortError=P0;Y0.NotFoundError=m$;Y0.ConflictError=c$;Y0.RateLimitError=l$;Y0.BadRequestError=h$;Y0.AuthenticationError=f$;Y0.InternalServerError=d$;Y0.PermissionDeniedError=u$;Y0.UnprocessableEntityError=p$;Y0.toFile=j4;C6=class C6 extends Y0{constructor(){super(...arguments);this.completions=new Q1(this),this.messages=new J$(this),this.models=new J1(this),this.beta=new x0(this)}};C6.Completions=Q1;C6.Messages=J$;C6.Models=J1;C6.Beta=x0});var TH={};_Q(TH,{toFile:()=>j4,default:()=>C6,UnprocessableEntityError:()=>p$,RateLimitError:()=>l$,PermissionDeniedError:()=>u$,PagePromise:()=>E4,NotFoundError:()=>m$,InternalServerError:()=>d$,HUMAN_PROMPT:()=>UQ,ConflictError:()=>c$,BaseAnthropic:()=>Y0,BadRequestError:()=>h$,AuthenticationError:()=>f$,AnthropicError:()=>b,Anthropic:()=>C6,APIUserAbortError:()=>P0,APIPromise:()=>O6,APIError:()=>L0,APIConnectionTimeoutError:()=>g$,APIConnectionError:()=>L6,AI_PROMPT:()=>GQ});var AH=g(()=>{VQ();Bz();OZ();VQ();G0();c0()});var cQ=Xq(mQ(),1),{program:Ak,createCommand:Rk,createArgument:Ck,createOption:_k,CommanderError:Fk,InvalidArgumentError:Pk,InvalidOptionArgumentError:Ek,Command:pQ,Argument:wk,Option:jk,Help:Sk}=cQ.default;import{lstatSync as rY}from"fs";import{join as dY,dirname as D5,basename as lA,resolve as T$}from"path";import{execFileSync as dA}from"child_process";var GT=r7(),VT=F1(),HT=x7(),Y3=P1(),qT=q1(),X6=o(),KT=e2(),BT=B0(),MT=Z6(),LT=z6(),ob=$5(),NT=Q3(),DT=X3(),OT=J3(),X5=aJ(),tJ=V1();var IT=GT.Composer,J5=VT.Document,TT=HT.Schema,AT=Y3.YAMLError,Y5=Y3.YAMLParseError,RT=Y3.YAMLWarning,CT=qT.Alias,j2=X6.isAlias,x6=X6.isCollection,_T=X6.isDocument,H0=X6.isMap,q2=X6.isNode,FT=X6.isPair,I0=X6.isScalar,S2=X6.isSeq,PT=KT.Pair,ET=BT.Scalar,D$=MT.YAMLMap,k1=LT.YAMLSeq;var wT=NT.Lexer,jT=DT.LineCounter,ST=OT.Parser,d0=X5.parse,xT=X5.parseAllDocuments,k6=X5.parseDocument,b1=X5.stringify,kT=tJ.visit,bT=tJ.visitAsync;import{accessSync as eJ,closeSync as W5,constants as $Y,fchmodSync as ZY,fchownSync as yT,fsyncSync as zY,lstatSync as y1,mkdirSync as QY,mkdtempSync as vT,openSync as V3,readdirSync as gT,readFileSync as H3,readlinkSync as hT,realpathSync as fT,renameSync as uT,rmSync as XY,statSync as U5,unlinkSync as JY,writeFileSync as YY}from"fs";import{randomBytes as mT}from"crypto";import{tmpdir as WY}from"os";import{basename as J6,dirname as b6,isAbsolute as UY,join as Y6,relative as GY,resolve as k2,sep as VY}from"path";class y extends Error{reason;path;onWrite;constructor($,Z,z,Q={}){super(z,Q.cause===void 0?void 0:{cause:Q.cause});this.name="SafePathError",this.reason=$,this.path=Z,this.onWrite=Q.onWrite===!0}}var E0=Object.freeze({claude:"CLAUDE.md",agents:"AGENTS.md",gemini:"GEMINI.md",cursorrules:".cursorrules",copilot:"copilot-instructions.md",memory:"MEMORY.md",llms:"llms.txt"}),cT=new Set(Object.values(E0).map(($)=>$.toLowerCase())),pT=($,Z)=>$.toLowerCase()===Z.toLowerCase(),W3=($)=>cT.has($.toLowerCase());function v1($){return $.split(/[\\/]/).some((Z)=>Z.toLowerCase()===".git")}var lT=/\.fafm?$/i,dT=/^[a-z][a-z0-9-]*$/,x2=($)=>fT.native($),W6=($)=>$?.code;function G5($,Z){let z=GY($,Z);return z===""||z!==".."&&!z.startsWith(`..${VY}`)&&!UY(z)}function HY($){try{return hT($)}catch{return"?"}}function iT($,Z,z,Q){let X;try{X=x2(z)}catch(J){let Y=W6(J);if(Y==="ENOENT"||Y==="ELOOP"||Y==="ENOTDIR")throw new y("dangling",Z,`${Z} is a link to ${HY(z)}, which does not exist. faf does not create files through a link — refused.`);throw J}if(!G5($,X))throw new y("outside",Z,`${Z} is a link to ${X}, outside ${$} — refused.`);if(v1(X)&&!(Q.inGit&&b6(X)===$))throw new y("git",Z,`${Z} is a link to ${X}, inside .git/ — refused.`);if(!U5(X).isFile())throw new y("not-a-file",Z,`${Z} is a link to ${X}, which is not a regular file — refused.`);return nT(Z,X,Q.read),X}function nT($,Z,z){let Q=J6($),X=J6(Z),J=W3(Q)&&W3(X);if(z&&!lT.test(X)&&!J){let Y=W3(Q)?"a .faf or .fafm file, nor another AI context file":"a .faf or .fafm file";throw new y("not-faf",$,`${$} is a link to ${Z}, which is not ${Y} — refused.`)}if(!z&&!pT(Q,X)&&!J)throw new y("other-file",$,`${$} is a link to ${Z}, a file with another name — refused (faf follows a link only to a file of the same name, or from one AI context file to another).`)}function rT($,Z,z,Q){if(J6(k2($))!=="hooks"||!dT.test(J6(Z)))throw new y("git",Z,`${Z} is not a git hook in a hooks folder — refused.`);if(Q!==z)throw new y("git",Z,`${Z} is not directly in the hooks folder ${z} — refused.`)}function sT($,Z,z){if(J6($)!=="config"||z!==Z)throw new y("git",$,`${$} is not the git config file directly in ${Z} — refused.`)}function d($,Z,z={}){let Q=x2(k2($)),X=k2($,Z),J=x2(b6(X));if(!G5(Q,J))throw new y("outside",X,`${X} is in ${J}, outside ${Q} — refused.`);let Y=z.allowGitHooks===!0,W=z.allowGitConfig===!0;if(Y)rT($,X,Q,J);if(W)sT(X,Q,J);let U=Y6(J,J6(X));if(v1(U)&&!Y&&!W)throw new y("git",X,U===X?`${X} is inside .git/ — refused.`:`${X} resolves to ${U}, inside .git/ — refused.`);let G;try{G=y1(U)}catch(V){if(W6(V)==="ENOENT")return U;throw V}if(G.isSymbolicLink())return iT(Q,X,U,{read:z.read===!0,inGit:Y||W});if(!G.isFile())throw new y("not-a-file",X,`${X} is not a regular file — refused.`);return x2(U)}var oT=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function aT($,Z){if(!($.length>=2&&($[0]===255&&$[1]===254||$[0]===254&&$[1]===255)))try{return oT.decode($)}catch{}throw new y("not-utf8",Z,`${Z} is not UTF-8 — faf left it unchanged`)}function J0($){return aT(H3($),$)}function h0($){try{return H3($)}catch(Z){if(W6(Z)==="ENOENT")return null;throw Z}}function tT($){try{let Z=U5($);return{mode:Z.mode&511,perm:Z.mode&4095,uid:Z.uid,gid:Z.gid}}catch(Z){if(W6(Z)==="ENOENT")return;throw Z}}class b2 extends Error{path;constructor($,Z,z={}){super(Z,{cause:z.cause});this.path=$}}var U3=($)=>new y("changed",$,`${$} changed on disk while faf was writing — not written; original kept`,{onWrite:!0});function q3($,Z,z){if(Z!==void 0){let X=h0($),J=Z===null?null:typeof Z==="string"?Buffer.from(Z,"utf-8"):Buffer.from(Z);if(!(X===null||J===null?X===J:X.equals(J)))throw U3($)}if(!z)return;let Q;try{Q=U5($)}catch(X){if(W6(X)==="ENOENT")return;throw X}if((Q.mode&4095)!==z.perm)throw U3($);try{eJ($,$Y.W_OK)}catch{throw U3($)}}function eT($,Z){if(process.platform!=="win32")try{yT($,Z.uid,Z.gid)}catch{}ZY($,Z.mode)}function $A($){if(process.platform==="win32")return;try{let Z=V3($,"r");try{zY(Z)}finally{W5(Z)}}catch{}}function ZA($,Z,z,Q){if($.fd=V3($.path,"wx",Q??z?.mode??438),$.created=!0,YY($.fd,Z),z)eT($.fd,z);if(Q!==void 0)ZY($.fd,Q);zY($.fd),W5($.fd),$.fd=void 0}function zA($){if($.fd!==void 0)try{W5($.fd)}catch{}if($.created)try{JY($.path)}catch{}}function QA($,Z,z){let Q=b6($),X={path:Y6(Q,`.${J6($).slice(0,100)}.${process.pid}.${mT(6).toString("hex")}.faf-tmp`),created:!1},J=tT($);try{if(J)eJ($,$Y.W_OK);ZA(X,Z,J,z.mode),q3($,z.expect,J),uT(X.path,$)}catch(Y){if(zA(X),Y instanceof y)throw Y;let W=W6(Y)??(Y instanceof Error?Y.message:String(Y));throw new b2($,`${$}: not written${J?"; original kept":""} (${W})`,{cause:Y})}$A(Q)}function XA($){return $ instanceof y&&!$.onWrite?new y($.reason,$.path,$.message,{onWrite:!0}):$}function a($,Z,z={}){let Q=k2($),X;try{X=d(z.root??b6(Q),Q,{allowGitHooks:z.allowGitHooks,allowGitConfig:z.allowGitConfig})}catch(J){throw XA(J)}return QA(X,Z,z),X}function C2($,Z,z){let Q=k2($),X=z.root??b6(Q),J=d(X,Q),Y=h0(J);if(z.expect!==void 0)q3(J,z.expect,void 0);if(Y!==null&&z.force!==!0&&!z.owns(Y))throw new y("not-owned",Q,`${Q} has no ${z.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});return a(J,Z,{root:X,expect:Y})}function w0($,Z=$){let z=k2($);QY(z,{recursive:!0});let Q=x2(z),X=k2(z,Z),J=GY(z,X);if(J===".."||J.startsWith(`..${VY}`)||UY(J))throw new y("outside",X,`${X} is outside ${Q} — refused.`,{onWrite:!0});let Y=Q;for(let W of J.split(/[\\/]/).filter(Boolean)){let U=Y6(Y,W);if(v1(U))throw new y("git",X,`${X} runs through ${U}, inside .git/ — refused.`,{onWrite:!0});Y=JA(Q,X,U)}return Y}function JA($,Z,z){let Q;try{Q=y1(z)}catch(J){if(W6(J)!=="ENOENT")throw J;return QY(z),z}let X=z;if(Q.isSymbolicLink()){try{X=x2(z)}catch{throw new y("dangling",Z,`${z} is a link to ${HY(z)}, which does not exist. faf does not create folders through a link — refused.`,{onWrite:!0})}if(!G5($,X))throw new y("outside",Z,`${z} is a link to ${X}, outside ${$} — refused.`,{onWrite:!0});if(v1(X))throw new y("git",Z,`${z} is a link to ${X}, inside .git/ — refused.`,{onWrite:!0})}if(!U5(X).isDirectory())throw new y("not-a-file",Z,`${z} is not a folder — refused.`,{onWrite:!0});return X}function qY($,Z){let z=k2($),Q=x2(k2(Z.root??b6(z))),X=x2(b6(z));if(!G5(Q,X))throw new y("outside",z,`${z} is in ${X}, outside ${Q} — refused.`,{onWrite:!0});let J=Y6(X,J6(z));if(v1(J))throw new y("git",z,`${z} is inside .git/ — refused.`,{onWrite:!0});let Y;try{Y=y1(J)}catch(W){if(W6(W)==="ENOENT")return!1;throw W}if(!Y.isFile())throw new y("not-a-file",z,`${z} is not a regular file faf wrote — left as it is.`,{onWrite:!0});return q3(J,Z.expect,void 0),JY(J),!0}var G3=new Set,KY=".faf-temp",BY="faf made this temp folder; `faf clear` removes it.\n";function V5($){let Z=x2(vT(Y6(WY(),$)));G3.add(Z);let z=V3(Y6(Z,KY),"wx",420);try{YY(z,BY)}finally{W5(z)}return Z}function H5($){if(!G3.has($))throw Error(`${$} is not a temp folder faf made — not removed`);XY($,{recursive:!0,force:!0}),G3.delete($)}function YA($){let Z=Y6($,KY);try{if(!y1(Z).isFile())return!1;return H3(Z,"utf-8")===BY}catch{return!1}}var WA=($)=>$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function MY($){let Z=WY(),z=typeof process.getuid==="function"?process.getuid():void 0,Q=new RegExp(`^${WA($)}[A-Za-z0-9]{6}$`),X=0;for(let J of gT(Z)){if(!Q.test(J))continue;let Y=Y6(Z,J);try{let W=y1(Y);if(!W.isDirectory()||z!==void 0&&W.uid!==z||!YA(Y))continue;XY(Y,{recursive:!0,force:!0}),X++}catch{}}return X}function $0($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function y6($){if(Array.isArray($))return`a list (${$.length} item${$.length===1?"":"s"})`;if($===null||$===void 0)return"empty";if(typeof $==="string"){let Z=$.length>40?`${$.slice(0,40)}…`:$;return`a string (${JSON.stringify(Z)})`}if(typeof $==="object")return"a mapping";return`a ${typeof $} (${String($)})`}function g1($,Z){if($===null||$===void 0)return{};if(!$0($))throw new y("not-yaml",Z,`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${y6($)}. `+"faf left it unchanged — fix it by hand.");return $}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"}],U6=new Map(z0.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),Jy=new Map(z0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),Yy=new Map(z0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function h1($,Z){let z=(X)=>{let J=X.split("."),Y=$;for(let W of J)if(Y&&typeof Y==="object"&&W in Y)Y=Y[W];else return;return Y},Q=z(Z.path);if(Q!==void 0)return Q;if(Z.canonical)return z(Z.canonical);return}var Wy=z0.filter(($)=>$.index<=21);var K3=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","n/a","not applicable"]);var f1="slotignored";function O$($){return typeof $==="string"&&$.trim()!==""&&W0($)}function W0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return K3.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var I$="no classifying signals — fallback",UA=new Set(["stack.css_framework","stack.ui_library","stack.database","stack.connection","stack.hosting"]);function g6($,Z){if(typeof $!=="string"||!Object.prototype.hasOwnProperty.call(v6,$))return null;if(!v6[$].includes(Z.category))return!1;return!($==="framework"&&UA.has(Z.path))}var v6={documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],cli:["project","human","universal"],library:["project","human","universal"],sdk:["project","human","universal"],wasm:["project","human","universal"],html:["project","human","universal"],"server-card":["project","human","universal"],frontend:["project","frontend","human","universal"],website:["project","frontend","human","universal"],mobile:["project","frontend","human","universal"],app:["project","frontend","human","universal"],extension:["project","frontend","human","universal"],mcp:["project","backend","human","universal"],backend:["project","backend","universal","human"],"data-science":["project","backend","human","universal"],fullstack:["project","frontend","backend","universal","human"],svelte:["project","frontend","backend","universal","human"],framework:["project","frontend","backend","universal","human"],"monorepo-root":["project","human","enterprise_infra","enterprise_app","enterprise_ops"],mcpaas:["project","backend","universal","human","enterprise_app","enterprise_ops"],saas:["project","frontend","backend","universal","human","enterprise_app"],enterprise:["project","frontend","backend","universal","human","enterprise_infra","enterprise_app","enterprise_ops"]};var TY=new Set(["tag:yaml.org,2002:int","tag:yaml.org,2002:float"]);function LY($){return typeof $==="object"&&$.collection===void 0}function GA($,Z){let z=$.source;if(typeof z!=="string"||z.includes(`
|
|
205
|
+
`)||typeof $.value!=="number")return;let Q=Z.find((J)=>J.default===!0&&J.test?.test(z));if(!Q||!TY.has(Q.tag))return;let X;try{X=Q.resolve(z,()=>{return},{})}catch{return}return Object.is(I0(X)?X.value:X,$.value)?z:void 0}function VA($){let Z=$.filter(LY);return $.map((z)=>{if(!LY(z)||!TY.has(z.tag)||!z.stringify)return z;let Q=z.stringify;return{...z,stringify:(X,J,Y,W)=>GA(X,Z)??Q(X,J,Y,W)}})}var q5={keepSourceTokens:!0,customTags:VA};function HA($,Z){let z=/^( *)[^\s#-][^#]*?:[ \t]*(?:#.*)?$/.exec($),Q=/^( *)(\S)/.exec(Z);if(!z||!Q||Q[2]==="#")return{};let X=Q[1].length-z[1].length;if(Q[2]==="-")return X>=0?{indentSeq:X>0}:{};return X>=1&&X<=8?{indent:X}:{}}function qA($){let Z=$.split(/\r?\n/),z,Q;for(let X=0;X+1<Z.length;X++){let J=HA(Z[X],Z[X+1]);z??=J.indent,Q??=J.indentSeq}return{indent:z??2,indentSeq:Q??!0}}function D3($,Z){let z=k6($,q5);if(z.errors.length>0){let Q=z.errors[0].message.split(`
|
|
206
|
+
`)[0];throw Error(`${Z}: not valid YAML (${Q}) — faf left it unchanged.`,{cause:z.errors[0]})}return z}function h6($,Z,z,Q){$.edits.push({start:Z,end:z,text:Q,seq:$.edits.length})}function u1($,Z){return $.lastIndexOf(`
|
|
207
|
+
`,Z-1)+1}function AY($,Z){if(Z>0&&$[Z-1]===`
|
|
208
|
+
`)return Z;let z=$.indexOf(`
|
|
209
|
+
`,Z);return z<0?$.length:z+1}function NY($,Z){let z=Z;if($[z-1]===`
|
|
210
|
+
`){if(z--,$[z-1]==="\r")z--}return z}function K2($){return $!==null&&$!==void 0}function f0($){let Z=q2($)?$.range:void 0;return Z?[Z[0],Z[1],Z[2]]:void 0}function RY($,Z){let z=f0($),Q=f0(Z);return!!z&&!!Q&&z[0]===Q[0]&&z[1]===Q[1]&&z[2]===Q[2]&&$.constructor===Z.constructor}function CY($){if(I0($))return $.type==="BLOCK_LITERAL"||$.type==="BLOCK_FOLDED";return x6($)&&!$.flow}function K5($,Z){return $.anchor===Z.anchor&&$.tag===Z.tag&&$.comment===Z.comment&&$.commentBefore===Z.commentBefore&&!!$.spaceBefore===!!Z.spaceBefore}function _Y($,Z){return Object.is($.value,Z.value)&&$.type===Z.type&&$.format===Z.format&&$.minFractionDigits===Z.minFractionDigits&&K5($,Z)}function FY($,Z,z,Q){let X=new J5(void 0,q5);X.contents=Z(X);let Y=X.toString($.piece).replace(/\n+$/,"").slice(z),W=Y.startsWith(" ")&&!Y.includes(`
|
|
211
|
+
`),U=" ".repeat(Q),G=Y.replace(/\n(?=.)/g,`
|
|
212
|
+
${U}`).replace(/\n/g,$.eol);return{inline:W,text:W?Y.slice(1):G}}function M3($,Z,z){return FY($,(Q)=>{let X=new D$;return X.items.push(Q.createPair("k",Z)),X},2,z)}function KA($,Z,z){let Q=FY($,()=>{let X=new k1;return X.items.push(Z),X},1,z);if(Q.inline)return Q;return Q.text.startsWith(" ")?{inline:!1,text:Q.text.slice(1)}:null}function BA($){if(!q2($)||!K2($.comment))return $;let Z=$.clone();return Z.comment=void 0,Z}function MA($,Z){if(!q2($)||!q2(Z))return Z;let z=$,Q=Z;if(!z.anchor&&!z.tag||z.anchor!==Q.anchor||z.tag!==Q.tag)return Z;let X=Z.clone();return X.anchor=void 0,X.tag=void 0,X}function LA($,Z){let z=f0(Z);if(!z)return-1;let Q=z[2];while($[Q]===" "||$[Q]==="\t")Q++;return $[Q]===":"?Q+1:-1}function NA($,Z,z){let Q=$[Z-1]===" "||$[Z-1]==="\t"?"":" ",X=$[Z]==="#"?" ":"";return`${Q}${z}${X}`}function DY($,Z,z,Q,X=!1){let J=f0(Z);if(!J||Q.kind==="root")return null;let Y=Z.comment,W=q2(z)?z.comment:void 0,U=!K2(Y)||Y===W,G=U?BA(z):z,V=X?G:MA(Z,G),H=Q.kind==="value"?M3($,V,Q.col):KA($,V,Q.col);return H?{range:J,keepTail:U,newComment:W,piece:H}:null}function DA($,Z,z,Q){if(!Q)return NY($,AY($,z[2]));return CY(Z)?NY($,z[1]):z[1]}function m1($,Z,z,Q,X){let J=DY($,Z,z,Q);if(!J)return!1;let Y=DA($.src,Z,J.range,J.keepTail);if(J.piece.inline&&(!CY(Z)||Q.kind==="item"))return OA($,J,Y,Q,X),!0;let W=J.keepTail?Z.comment:J.newComment;if(X!==void 0||K2(W))return!1;let U=Q.kind==="value"?DY($,Z,z,Q,!0):J;return U!==null&&IA($,U.range[0],Y,U.piece,Q)}function OA($,Z,z,Q,X){let[J,Y]=Z.range,U=J===Y&&Q.kind==="value"?NA($.src,J,Z.piece.text):Z.piece.text;h6($,J,z,U+(X===void 0?"":` #${X}`))}function IA($,Z,z,Q,X){if(X.kind==="item")return h6($,Z,z,Q.text),!0;if(X.kind!=="value")return!1;let J=LA($.src,X.key);if(J<0)return!1;return h6($,J,z,Q.inline?` ${Q.text}`:Q.text),!0}function TA($,Z){return K5({...$,comment:void 0},{...Z,comment:void 0})}function AA($,Z){if(K2($.comment)||typeof Z.comment!=="string")return;return Z.comment.includes(`
|
|
213
|
+
`)?void 0:Z.comment}function RA($,Z,z,Q){if(_Y(Z,z))return!0;if(!TA(Z,z))return!1;let X=AA(Z,z);if(Z.comment!==z.comment&&X===void 0)return!1;return m1($,Z,z,Q,X)}function CA($,Z,z,Q){if(!K5(Z,z)||!!Z.flow!==!!z.flow)return!1;if(Z.flow)return M3($,Z,0).text===M3($,z,0).text||m1($,Z,z,Q);if(z.items.length===0)return m1($,Z,z,Q);return H0(Z)?EA($,Z,z):jA($,Z,z)}function O3($,Z,z,Q){if(!RY(Z,z))return m1($,Z,z,Q);if(I0(Z))return RA($,Z,z,Q);if(j2(Z))return j2(z)&&Z.source===z.source&&K5(Z,z)||m1($,Z,z,Q);if(!x6(Z)||!x6(z))return!1;return CA($,Z,z,Q)}function PY($,Z){return Z-u1($,Z)}function I3($,Z,z){let Q=$.slice(u1($,Z),Z);return z?/^ *- +$/.test(Q)||/^ *$/.test(Q):/^ *$/.test(Q)}function L3($){return q2($)&&(K2($.commentBefore)||!!$.spaceBefore)}function T3($,Z,z){let Q=f0(Z)??f0(z);return Q?AY($.src,Q[2]):-1}function EY($,Z,z){let Q=new J5(void 0,q5);Q.contents=Z;let X=" ".repeat(z);return Q.toString($.piece).replace(/\n+$/,"").split(`
|
|
214
|
+
`).map((Y)=>Y?X+Y:Y).join($.eol)+$.eol}function _A($,Z,z){let Q=Z===$.src.length&&Z>0&&!$.src.endsWith(`
|
|
215
|
+
`);h6($,Z,Z,Q?$.eol+z.slice(0,-$.eol.length):z)}function wY($,Z,z,Q,X,J){let Y=z;if(Y<0){let W=f0(Z);if(!W||L3(Z)||!I3($.src,W[0],J))return!1;Y=u1($.src,W[0])}return _A($,Y,EY($,Q,X)),!0}function FA($,Z,z){let Q=u1($,z),X=Z,J=K2(X.commentBefore),Y=!!X.spaceBefore;while(Q>0){let W=u1($,Q-1),U=$.slice(W,Q).trim();if(J&&U.startsWith("#"))Q=W;else if(Y&&U==="")Q=W,Y=!1;else break}return Q}function jY($,Z,z,Q){let X=f0(Z);if(!X||!I3($.src,X[0],Q))return!1;let J=T3($,z,Z);if(J<0)return!1;return h6($,FA($.src,Z,X[0]),J,""),!0}function SY($,Z){let z=new Map,Q=(X)=>{let J=f0(X);return J?J.join(":"):void 0};return $.forEach((X,J)=>{let Y=Q(Z(X));if(Y!==void 0&&!z.has(Y))z.set(Y,J)}),(X)=>{let J=Q(Z(X)),Y=J===void 0?void 0:z.get(J);return Y!==void 0&&RY(Z($[Y]),Z(X))?Y:-1}}function PA($,Z){return I0($)&&I0(Z)?_Y($,Z):$===Z}function EA($,Z,z){let Q=Z.items[0]?.key,X=f0(Q);if(!X)return!1;let J=PY($.src,X[0]),Y=new Set,W=(H,q)=>{if(H.length===0)return!0;let K=new D$;K.items.push(...H);let L=q<0?-1:T3($,Z.items[q].value,Z.items[q].key);return wY($,Q,L,K,J,!1)},U=SY(Z.items,(H)=>H.key),G=-1,V=[];for(let H of z.items){let q=U(H);if(q<0){V.push(H);continue}if(q<=G||!W(V,G)||!PA(Z.items[q].key,H.key))return!1;if(V=[],!O3($,Z.items[q].value,H.value,{kind:"value",key:Z.items[q].key,col:J}))return!1;Y.add(q),G=q}if(!W(V,G))return!1;return Z.items.every((H,q)=>Y.has(q)||wA($,Z,q))}function wA($,Z,z){let Q=Z.items[z],X=f0(Q.key);if(!X)return!1;if(I3($.src,X[0],!1))return jY($,Q.key,Q.value,!1);let J=Z.items[z+1],Y=f0(J?.key);if(z!==0||!Y||L3(Q.key)||L3(J.key))return!1;return h6($,X[0],Y[0],""),!0}function jA($,Z,z){let Q=f0(Z);if(!Q||Z.items.length===0)return!1;let X=PY($.src,Q[0]),J=new Set,Y=(V,H)=>{if(V.length===0)return!0;let q=new k1;q.items.push(...V);let K=H<0?-1:T3($,Z.items[H]);return wY($,Z.items[0],K,q,X,!0)},W=SY(Z.items,(V)=>V),U=-1,G=[];for(let V of z.items){let H=W(V);if(H<0){G.push(V);continue}if(H<=U||!Y(G,U))return!1;if(G=[],!O3($,Z.items[H],V,{kind:"item",col:X}))return!1;J.add(H),U=H}if(!Y(G,U))return!1;return Z.items.every((V,H)=>J.has(H)||jY($,V,V,!0))}function SA($,Z){let z=[...Z].sort((J,Y)=>Y.start-J.start||Y.end-J.end||Y.seq-J.seq),Q=$,X=1/0;for(let J of z){if(J.end>X)return null;Q=Q.slice(0,J.start)+J.text+Q.slice(J.end),X=J.start}return Q}function xA($,Z,z){if(!H0(z)&&!S2(z))return!1;let Q=$.src.length>0&&!$.src.endsWith(`
|
|
216
|
+
`)?$.eol:"",X=Z.commentBefore?$.eol:"";return h6($,$.src.length,$.src.length,Q+X+EY($,z,0)),!0}function kA($,Z,z){if(Z.commentBefore!==z.commentBefore||Z.comment!==z.comment)return!1;let Q=Z.contents,X=z.contents;if(!K2(Q))return!K2(X)||xA($,Z,X);return K2(X)&&O3($,Q,X,{kind:"root"})}function bA($,Z,z,Q,X){let J={src:$,eol:Q,edits:[],piece:X};if(!kA(J,Z,z))return null;return SA($,J.edits)}var OY=($)=>$.replace(/^[ \t]*\n/gm,"");function yA($,Z,z,Q){let X=k6($,q5);if(X.errors.length>0||!q0(X.toJS(),Z.toJS()))return!1;let J=X.toString(Q);return J===z||OY(J)===OY(z)}function B5($,Z,z="YAML"){let{text:Q,changed:X}=vA($,Z,z);return{text:Q,changed:X}}function vA($,Z,z="YAML"){let Q=$.startsWith("\uFEFF")?"\uFEFF":"",X=$.slice(Q.length),J=D3(X,z),Y=gA(J);Z(Y);let W={text:$,changed:!1,spliced:!1};if(q0(Y.toJS(),J.toJS()))return W;let U={lineWidth:0,...qA(X)},G=Y.toString(U);if(G===J.toString(U))return W;let V=X.includes(`\r
|
|
217
|
+
`)?`\r
|
|
218
|
+
`:`
|
|
219
|
+
`,H=bA(X,J,Y,V,{...U,verifyAliasOrder:!1}),q=H!==null&&yA(H,Y,G,U),K=q&&H!==null?H:G.replace(/\r?\n/g,V);return{text:Q+K,changed:Q+K!==$,spliced:q}}function gA($){let Z=$.clone();if($.directives&&Z.directives)Z.directives.docEnd=$.directives.docEnd;return Z}function q0($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>q0(z,Z[Q]));if($0($)&&$0(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&q0($[Q],Z[Q]))}return!1}function p1($){let Z=I0($.key)?$.key.value:$.key;return typeof Z==="string"||typeof Z==="number"||typeof Z==="boolean"?String(Z):void 0}function G6($,Z){return $.items.find((z)=>p1(z)===Z)}function xY($,Z){return q2(Z)?Z.toJS($):Z}function hA($,Z,z,Q){return Q.keepAliases===!0&&j2(Z)||q0(xY($,Z),z)}function M5($,Z,z,Q={}){if(hA($,Z,z,Q))return Z;if($0(z)&&H0(Z))return uA($,Z,z,Q),Z;if(Array.isArray(z)&&S2(Z))return pA($,Z,z,Q),Z;if(!$0(z)&&!Array.isArray(z)&&I0(Z))return Z.value=z,Z;return fA(Z,$.createNode(z))}function fA($,Z){if(!I0($)&&!j2($))return Z;let z=$,Q=Z;if(x6(Z)&&Z.items.length>0&&!Z.flow)return Q.commentBefore=B3(Q.commentBefore,z.commentBefore,z.comment),Z;if(x6(Z))Z.flow=!0;return Q.comment=B3(Q.comment??z.comment),Q.commentBefore=B3(Q.commentBefore??z.commentBefore),Z}function B3(...$){let Z=$.filter(K2);return Z.length>0?Z.join(`
|
|
220
|
+
`):void 0}function uA($,Z,z,Q={}){for(let[X,J]of Object.entries(z)){if(J===void 0)continue;let Y=G6(Z,X);if(Y)Y.value=M5($,Y.value,J,Q);else Z.items.push($.createPair(X,J))}if(!Q.prune)return;Z.items=Z.items.filter((X)=>{let J=p1(X);return J===void 0||z[J]!==void 0})}function A3($,Z,z,Q){let X=$0(z)?z:{};for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let W=G6(Z,J);if(!W)Z.items.push($.createPair(J,Y));else if(Object.prototype.hasOwnProperty.call(X,J)&&q0(X[J],Y))continue;else if($0(Y)&&$0(X[J])&&H0(W.value))A3($,W.value,X[J],Y);else W.value=M5($,W.value,Y,{keepAliases:!0})}}function c1($,Z,z){if(j2($))z.push({path:[...Z],node:$});else if(H0($))for(let Q of $.items){let X=p1(Q);if(X!==void 0)c1(Q.value,[...Z,X],z)}else if(S2($))$.items.forEach((Q,X)=>c1(Q,[...Z,X],z))}function IY($,Z){let z=$;for(let Q of Z)if(Array.isArray(z)&&typeof Q==="number")z=z[Q];else if($0(z)&&typeof Q==="string")z=z[Q];else return;return z}function kY($,Z,z){let Q=[];return c1($.contents,[],Q),Q.filter(({path:X,node:J})=>{let Y=IY(Z,X);return Y!==void 0&&!q0(IY(z,X),Y)&&!q0(J.toJS($),Y)}).map(({path:X,node:J})=>({path:X.join("."),alias:`*${J.source}`}))}function bY($,Z){let z=$.contents;for(let X=0;X<Z.length-1&&z!==void 0;X++)z=mA(z,Z[X]);let Q=Z[Z.length-1];if(H0(z)&&typeof Q==="string"){let X=G6(z,Q);return X?{node:X.value,put:(J)=>(X.value=J,!0)}:null}if(S2(z)&&typeof Q==="number"&&Q<z.items.length){let X=z,J=X.items[Q];return{node:J,put:(Y)=>f0(J)===void 0?(X.items[Q]=Y,!0):!1}}return null}function mA($,Z){if(H0($)&&typeof Z==="string")return G6($,Z)?.value;if(S2($)&&typeof Z==="number")return $.items[Z];return}function yY($,Z){let z=[];c1($.contents,[],z);let Q=[];for(let{path:X,node:J}of z){let Y=bY(Z,X);if(!Y||j2(Y.node)&&Y.node.source===J.source)continue;if(!Y.put(J.clone()))continue;Q.push({path:X.join("."),alias:`*${J.source}`})}return Q}function N3($,Z,z,Q){if(!q2($)||j2($))return;let X=$.anchor;if(X&&z.has(X))Q.push({path:[...Z],node:$});if(H0($))for(let J of $.items){let Y=p1(J);if(Y!==void 0)N3(J.value,[...Z,Y],z,Q)}else if(S2($))$.items.forEach((J,Y)=>N3(J,[...Z,Y],z,Q))}function vY($,Z){let z=[];c1($.contents,[],z);let Q=new Set(z.map((Y)=>Y.node.source));if(Q.size===0)return[];let X=[];N3($.contents,[],Q,X);let J=[];for(let{path:Y,node:W}of X){let U=bY(Z,Y);if(!U)continue;let G=W.anchor;if(q2(U.node)&&U.node.anchor===G&&q0(W.toJS($),U.node.toJS(Z))||!U.put(W.clone()))continue;J.push({path:Y.join("."),alias:`&${G}`,kind:"anchor"})}return J}function cA($,Z){let z=$.length,Q=Z.length,X=Array.from({length:z+1},()=>Array(Q+1).fill(0));for(let Y=z-1;Y>=0;Y--)for(let W=Q-1;W>=0;W--)X[Y][W]=q0($[Y],Z[W])?X[Y+1][W+1]+1:Math.max(X[Y+1][W],X[Y][W+1]);let J=[];for(let Y=0,W=0;Y<z&&W<Q;)if(q0($[Y],Z[W]))J.push([Y,W]),Y++,W++;else if(X[Y+1][W]>=X[Y][W+1])Y++;else W++;return J}function pA($,Z,z,Q){let X=Z.items,J=X.map((G)=>xY($,G)),Y=[],W=0,U=0;for(let[G,V]of[...cA(J,z),[X.length,z.length]]){for(;W<G&&U<V;W++,U++)Y.push(M5($,X[W],z[U],Q));for(;U<V;U++)Y.push($.createNode(z[U]));if(G<X.length)Y.push(X[G]);W=G+1,U=V+1}Z.items=Y}function l1($,Z,z,Q){if(q0(z,Q))return Z;if(!$0(z)||!$0(Q)||!H0(Z))return M5($,Z,Q);let X=new Set(Object.keys(z).filter((J)=>!(J in Q)||Q[J]===void 0));Z.items=Z.items.filter((J)=>{let Y=p1(J);return Y===void 0||!X.has(Y)});for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let W=G6(Z,J);if(!W)Z.items.push($.createPair(J,Y));else if(!q0(z[J],Y))W.value=l1($,W.value,z[J],Y)}return Z}function gY($,Z,z){let Q=$.contents;if(Q===null||Q===void 0)$.contents=new D$,Q=$.contents;if(!H0(Q))throw Error(`${z}: the document is not a mapping — faf left it unchanged.`);let X=Q;for(let J of Z){let Y=G6(X,J);if(Y&&H0(Y.value)){X=Y.value;continue}if(Y&&!uY(Y.value))throw Error(`${z}: ${J} is not a mapping — faf left it unchanged.`);let W=new D$;if(Y)Y.value=fY(Y.value,W);else X.items.push($.createPair(J,W));X=W}return X}function L5($,Z,z,Q,X){if(q0(z,Q))return;let J=gY($,Z.slice(0,-1),X),Y=Z[Z.length-1],W=G6(J,Y);if(Q===void 0)J.items=J.items.filter((U)=>U!==W);else if(!W)J.items.push($.createPair(Y,Q));else W.value=l1($,W.value,z,Q)}function hY($,Z,z){let Q=gY($,Z.slice(0,-1),z),X=Z[Z.length-1],J=G6(Q,X);if(J&&S2(J.value))return J.value;if(J&&!uY(J.value))throw Error(`${z}: ${Z.join(".")} is not a list — faf left it unchanged.`);let Y=new k1;if(J)J.value=fY(J.value,Y);else Q.items.push($.createPair(X,Y));return Y}function fY($,Z){if(!I0($))return Z;let z=[$.commentBefore,$.comment].filter(K2);if(z.length>0)Z.commentBefore=z.join(`
|
|
221
|
+
`);return Z}function uY($){if($===null||$===void 0)return!0;return I0($)&&($.value===null||$.value===void 0)}var R3=new WeakMap;function d1($){return typeof $==="object"&&$!==null?R3.get($):void 0}function N5($,Z){R3.set($,Z)}function mY($,Z){let z=d1($);if(z)R3.set(Z,z);return Z}var cY=new WeakSet;function pY($){return cY.add($),$}function lY($){return typeof $==="object"&&$!==null&&cY.has($)}function O5($){let Z=T$($);return d(D5(Z),Z,{read:!0})}function C3($){if($ instanceof Y5)return $;let Z=$?.cause;return Z instanceof Y5?Z:null}function _3($,Z){let z=Z.message.split(`
|
|
222
|
+
`)[0].replace(/ at line \d+, column \d+:?\s*$/,"").replace(/:\s*$/,""),Q=Z.linePos?.[0]?.line,X=T$($);return new y("not-yaml",X,`${X} is not valid YAML (${z}${Q===void 0?"":`, line ${Q}`}) — faf left it unchanged`,{cause:Z})}function n($,Z){try{return Z()}catch(z){if(z instanceof y)throw z;let Q=(z instanceof Error?z.message:String(z)).split(`
|
|
223
|
+
`)[0].trim(),X=T$($);throw new y("not-yaml",X,`${X}: faf's scoring kernel could not read it (${Q}) — faf left it unchanged`,{cause:z})}}function r($){let Z=O5($),z=J0(Z),Q;try{Q=d0(z)}catch(J){let Y=C3(J);if(Y)throw _3($,Y);throw J}let X=g1(Q,$);return N5(X,{real:Z,text:z}),X}function F3($){let Z=$._meta,z={...$};delete z._meta;let Q=b1(z,{lineWidth:0});if(Z?.found&&Z.found.length>0){let X=Z.found.join(" + ");Q=Q.replace(/^(\s+type:\s+\S+)(\s*)$/m,(J,Y,W)=>{if(W.includes("#"))return J;return`${Y} # found: ${X}`})}return Q}function iA($,Z,z,Q,X=!1){let J=O5($),Y=J0(J),W=[],U;try{U=B5(Y,(G)=>{sY(G,$);let V=G.clone();if(Z(G),W=yY(V,G),X)W=[...W,...vY(V,G)];if(Q)W=[...W,...Q(G,V.toJS()).filter((H)=>!W.some((q)=>q.path===H.path))]},$)}catch(G){let V=C3(G);if(V)throw _3($,V);throw G}if(!U.changed)return{written:!1,text:Y,keptAliases:W};return a($,U.text,{expect:z&&z.real===J?z.text:Y}),{written:!0,text:U.text,keptAliases:W}}function u0($){if($.kind==="anchor")return`${$.path} holds an anchor (${$.alias}) that an alias reads — faf left it as written`;return`${$.path} is an alias (${$.alias}) — faf left it as written`}function iY($){try{return rY($),!0}catch{return!1}}function nA($){let Z=$.getIn(["project","type"],!0);return I0(Z)?Z.value:Z}function sY($,Z){let z=$.contents;if(z!==null&&z!==void 0&&!H0(z))throw new y("not-yaml",T$(Z),`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${y6($.toJS())}. faf left it unchanged — fix it by hand.`)}function rA($,Z,z){sY($,z);let Q=$.contents,X=H0(Q)&&Q.items.some((V)=>I0(V.key)&&V.key.value==="_meta"),{_meta:J,...Y}=Z,W=nA($),U=H0(Q)?$.toJS():{},G=H0(Q)?Q:$.createNode({});if($.contents=G,A3($,G,U,X?{...Z}:Y),!X)oA($,J?.found,W)}function sA($,Z){let z=$.contents;if(H0(z)&&z.items.some((J)=>I0(J.key)&&J.key.value==="_meta"))return Z;let{_meta:Q,...X}=Z;return X}function oA($,Z,z){if(!Z||Z.length===0||!W0(z))return;let Q=$.getIn(["project","type"],!0);if(I0(Q)&&!W0(Q.value)&&(Q.comment===null||Q.comment===void 0))Q.comment=` found: ${Z.join(" + ")}`}function K0($,Z,z={}){if(!z.replace&&iY($)){let W=iA($,(U)=>rA(U,Z,$),d1(Z),(U,G)=>kY(U,sA(U,Z),G),lY(Z));N5(Z,{real:O5($),text:W.text});for(let U of W.keptAliases??[])z.onAliasKept?.(U);return W.written}let Q=T$($),X=F3(Z),J=iY($)?h0(d(D5(Q),Q)):null,Y=a($,X,{expect:J});return N5(Z,{real:Y,text:X}),!0}function c($){return J0(O5($))}function $2($,Z){let z;try{z=d0($)}catch(Q){let X=C3(Q);if(Z!==void 0&&X)throw _3(Z,X);throw Q}return Z===void 0?z:g1(z,Z)}function nY($,Z){let z;try{z=rY(Z)}catch{return!1}if(!z.isSymbolicLink()&&!z.isFile())return!1;return d($,T$(Z),{read:!0}),!0}function f($=process.cwd()){let Z=["project.faf",".faf"];for(let Q of Z){let X=dY($,Q);if(nY($,X))return X}let z=D5($);if(z!==$)for(let Q of Z){let X=dY(z,Q);if(nY(z,X))return X}return null}function A$($,Z=process.cwd()){return dA("git",["-C",D5($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+lA($)}p();var R$=[{name:"TROPHY",indicator:`${R0("✪")} ${R0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${R0(A("★"))} ${R0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${I("◆")} ${I("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${I5("◇")} ${I5("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 B2($){return $.indicator}function V6($){for(let Z of R$)if($>=Z.threshold)return Z;return R$[R$.length-1]}var E3=null;function n1(){if(E3)return E3;try{let $=l0("faf-scoring-kernel");return E3=$,$}catch{throw Error(`faf-scoring-kernel not installed.
|
|
205
224
|
|
|
206
225
|
Run: npm install faf-scoring-kernel
|
|
207
|
-
`)}}function
|
|
208
|
-
|
|
209
|
-
Run 'faf init' to create one.`),process.exit(2);let z=u(X),J=Q0(z);if(Z.json){let Q=m(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(`${d0(J.tier)} ${A(`${J.score}%`)}`);return}Y0(J,X,Z.verbose)}import{existsSync as cI}from"fs";import{join as ZJ}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"}],O$=new Map(Z0.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),iP=new Map(Z0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),nP=new Map(Z0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function F2($,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 rP=Z0.filter(($)=>$.index<=21);var HZ=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","n/a","not applicable"]);function E0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return HZ.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var N$={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 F,readFileSync as t0,readdirSync as TZ}from"fs";import{join as R}from"path";var Lz=[{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 Dz,readFileSync as bN,readdirSync as kN}from"fs";import{join as BZ}from"path";var L$={version:2,_doc:"SINGLE SOURCE of Dart/Flutter detection KNOWLEDGE (A+B hybrid, the Truth-is-faf-cli spec). faf-cli imports this directly; faf-python-sdk vendors a synced copy (phase 2); MCPs compose it. Bolster Dart/Flutter by editing THIS file. Logic stays in dart.ts. Refreshed 2026-08-01 (knowledge v2) — community receipt on top of 6.13.0 Dart Edition.",flutterDeps:["flutter"],mcpDeps:["dart_mcp","mcp_server","mcp_dart","dart_mcp_server","mcp","dart_mcpserver"],serverFrameworks:[["serverpod","Serverpod"],["dart_frog","Dart Frog"],["conduit","Conduit"],["angel3_framework","Angel3"],["alfred","Alfred"],["shelf","Shelf"],["jaspr","Jaspr"],["relic","Relic"]],stateManagement:[["flutter_riverpod","Riverpod"],["hooks_riverpod","Riverpod"],["riverpod_annotation","Riverpod"],["riverpod","Riverpod"],["flutter_bloc","Bloc"],["bloc","Bloc"],["provider","Provider"],["get","GetX"],["flutter_mobx","MobX"],["mobx","MobX"],["signals","Signals"],["flutter_hooks","Hooks"]],routing:[["go_router","go_router"],["auto_route","auto_route"],["beamer","Beamer"],["routemaster","Routemaster"]]};var yN=L$.flutterDeps,vN=L$.mcpDeps,gN=L$.serverFrameworks,fN=L$.stateManagement,hN=L$.routing;function uN($){let Z=new Set,X=!1;for(let z of $.split(`
|
|
210
|
-
`)){if(/^(dependencies|dev_dependencies|dependency_overrides):\s*$/.test(
|
|
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 Rz($,Z){let X=Z.toLowerCase();for(let z of $)if(z===X||z.startsWith(`${X}/`))return!0;return!1}function Tz($,Z){let X;for(let z of Z){if(!Rz($,z[0]))continue;if(!X||z[0].length>X[0].length)X=z}return X}function nN($,Z){let X;for(let z of Z){if(!Rz($,z))continue;if(!X||z.length>X.length)X=z}return X}function rN($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function sN($){let Z=k8($,"cmd");if(!MZ(Z))return!1;try{for(let X of Iz(Z)){let z=k8(Z,X);try{if(cN(z).isDirectory()){if(Iz(z).some((Q)=>Q.endsWith(".go")))return!0}else if(X.endsWith(".go"))return!0}catch{}}}catch{}return!1}function aN($){let Z=k8($,"main.go");if(!MZ(Z))return!1;try{let X=Az(Z,"utf-8");return/^package\s+main\b/m.test(X)}catch{return!1}}function y8($){let Z=k8($,"go.mod");if(!MZ(Z))return null;let X;try{X=Az(Z,"utf-8")}catch{return null}let z=rN(X),J=iN(X),Q=nN(J,lN),Y=Tz(J,dN),W=Tz(J,pN),U=sN($),q=aN($),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 tN,readFileSync as eN,readdirSync as $L}from"fs";import{join as ZL}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 XL=c1.mcpPackages.map(($)=>$.toLowerCase()),zL=c1.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),JL=c1.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),QL=c1.grpcServerPackages.map(($)=>$.toLowerCase()),YL=c1.specializedSdks,_z=c1.baseSdk.toLowerCase();function WL($){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 OZ($,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(!OZ($,z))continue;if(!X||z.length>X[0].length)X=[z,J]}return X}function UL($){let Z;for(let X of XL){if(!OZ($,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 qL($){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 v8($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function GL($,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 VL($,Z){let X=Z.replace(/\.csproj$/i,""),{sdk:z,packages:J,frameworkRefs:Q,outputType:Y}=$,W,U="",q,G=UL(J),V=qL(z),K=Fz(J,JL),H=Fz(J,zL),L=QL.some((O)=>OZ(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()===_z||z.toLowerCase().startsWith(`${_z}/`))q=`${Z} (C# class library)`}return{appType:W,projectName:X,targetFramework:$.targetFramework,sdk:z||"Microsoft.NET.Sdk",framework:U,found:q}}function D$($){if(!tN($))return[];try{return $L($).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}catch{return[]}}function g8($){let Z=D$($);if(Z.length===0)return null;let X=null,z=999;for(let J of Z){let Q=ZL($,J),Y;try{Y=eN(Q,"utf-8")}catch{continue}let W=WL(Y),U=VL(W,J),q=GL(U.appType,U.framework);if(!X||q<z)X=U,z=q}return X}import{existsSync as l1,readFileSync as HL,readdirSync as BL,statSync as ML}from"fs";import{join as v0}from"path";var p0={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 OL=p0.mcpArtifacts.map(($)=>$.toLowerCase()),NL=p0.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),LL=p0.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),DL=p0.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),NE=p0.androidPlugins.map(($)=>$.toLowerCase()),IL=p0.kmpPlugins.map(($)=>$.toLowerCase()),TL=p0.jvmKotlinPlugins.map(($)=>$.toLowerCase()),AL=p0.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),RL=p0.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),_L=p0.libraryPlugins.map(($)=>$.toLowerCase()),FL=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function NZ($){return FL.some((Z)=>l1(v0($,Z)))}function P2($){try{return HL($,"utf-8")}catch{return null}}function CL($){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 PL($){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 CL(X)}function EL($){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 wL($,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 SL($,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 Ez($){let Z=($.match(/<packaging>\s*([^<]+?)\s*<\/packaging>/i)?.[1]||"jar").trim().toLowerCase(),X=new Set,z=$.match(/<parent>([\s\S]*?)<\/parent>/i);if(z){let Y=z[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),W=z[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(Y&&W)X.add(`${Y}:${W}`.toLowerCase())}let J=new Set;for(let Y of $.matchAll(/<dependency>([\s\S]*?)<\/dependency>/gi)){let W=Y[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),U=Y[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(W&&U)J.add(`${W}:${U}`.toLowerCase())}let Q=[];for(let Y of $.matchAll(/<module>\s*([^<]+?)\s*<\/module>/gi))Q.push(Y[1].trim());return{packaging:Z,parents:X,artifacts:J,modules:Q}}function z1($,Z){let X=Z.toLowerCase();if($.has(X))return!0;for(let z of $)if(z===X||z.endsWith(`.${X}`)||z===X.replace(/^org\.gradle\./,""))return!0;return!1}function C2($,Z,X){let z;for(let[J,Q]of Z){let Y=!1;if(X==="plugin")Y=z1($,J);else if(Y=$.has(J)||[...$].some((W)=>W===J||W.startsWith(`${J}:`)||W.startsWith(`${J}.`)),!Y&&X==="artifact")Y=[...$].some((W)=>W===J||W.startsWith(`${J}`));if(!Y)continue;if(!z||J.length>z[0].length)z=[J,Q]}return z}function jL($){let Z;for(let X of OL)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 wz($){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=BL(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(ML(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 xL($){let Z=[],X=$.plugins,z=$.artifacts,J=IL.some((b)=>z1(X,b))||$.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=jL(z),U=C2(X,NL,"plugin"),q=C2($.parents,LL,"parent"),G=C2(z,DL,"artifact"),V=C2(X,AL,"plugin"),K=C2(z,RL,"artifact"),H=_L.some((b)=>z1(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||TL.some((b)=>z1(X,b))||J)j="Kotlin";let S=[...new Set(Z)];return{appType:B,framework:O,facets:S,found:T,buildTool:$.buildTool,mainLanguage:j}}function bL($,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 Cz($,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=wL(W,X),q=SL(W,X),G=wz(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 Pz($,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}=Ez(J),U=wz(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(!NZ($))return null;let Z=PL($),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?EL(z):[],Q=Cz($,"",Z);if(Q)X.push(Q);for(let q of J){let G=Cz($,q,Z);if(G)X.push(G)}let Y=Pz($,"");if(Y){X.push(Y);let q=P2(v0($,"pom.xml"));if(q){let{modules:G}=Ez(q);for(let V of G){let K=Pz($,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=xL(q),V=bL(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 yL,readdirSync as f8,statSync as vL}from"fs";import{join as i0}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 gL=w2.mcpGems.map(($)=>$.toLowerCase()),fL=w2.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),Sz=w2.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),hL=w2.railsLayoutFiles;function uL($){return j2(i0($,"Gemfile"))||j2(i0($,"gems.rb"))||mL($)}function mL($){try{return f8($).some((Z)=>Z.endsWith(".gemspec"))}catch{return!1}}function S2($){try{return yL($,"utf-8")}catch{return null}}function cL($){let Z=new Set;for(let X of $.split(`
|
|
213
|
-
`)){let z
|
|
214
|
-
`)){let
|
|
215
|
-
`)){let
|
|
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 GD($,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 xz($,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 bz($,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 VD($){let Z=$.map((X)=>X.toLowerCase());return eL.some((X)=>Z.includes(X))}function KD($){let Z=!1,X=!1,z;for(let J of IZ($)){let Q=b2($,J,"project.pbxproj"),Y=kz(Q);if(!Y)continue;for(let W of JD)if(Y.includes(W))Z=!0,z=W;for(let W of QD)if(Y.includes(W)){if(X=!0,!z)z=W}}return{hasApplication:Z,hasTool:X,hit:z}}function HD($){for(let Z of YD)if(DZ(b2($,Z)))return Z;return}function k2($){if(!WD($))return null;let Z=b2($,"Package.swift"),X=DZ(Z),z=IZ($),J=z.length>0,Q=null;if(X){let n=kz(Z);if(n)Q=UD(n)}let Y=J?KD($):{hasApplication:!1,hasTool:!1},W=HD($),U=Q?.packageUrls??[],q=Q?.productNames??[],G=GD(U,tL),V=VD(q),K=xz(U,$D),H=bz(q,ZD),L=xz(U,XD),B=bz(q,zD),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,c="",_;if(O)if(x="mcp",c="MCP",V)_="Package.swift + product MCP (Swift MCP)";else _=`Package.swift + ${G} (Swift MCP)`;else if(T)if(x="backend",c=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(b)x="app",c="",_=`${z[0]} + ${Y.hit||"application"} (Swift app)`;else if(S||j&&!T&&!O)if(x="cli",c=B?.[1]||L?.[1]||"",B)_=`Package.swift + product ${B[1]} (Swift CLI)`;else if(L)_=`Package.swift + ${L[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:c,packageManager:y,found:_}}function BD($){let Z=R($,"Cargo.toml");if(!F(Z))return null;try{let z=t0(Z,"utf-8").match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return z?z[1]:null}catch{return null}}function MD($){let Z=R($,"Cargo.toml");if(!F(Z))return!1;try{let X=t0(Z,"utf-8");return/^\s*\[\[bin\]\]/m.test(X)}catch{return!1}}function OD($,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=BD($);if(X&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(X))return`Cargo.toml name "${X}" → sdk`;return null}function ND($){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(!F(z))continue;try{let J=JSON.parse(t0(z,"utf-8"));if(typeof J.manifest_version==="number")return`${X} manifest_version ${J.manifest_version} (browser extension)`}catch{}}return null}function LD($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,X=R($,"pyproject.toml");if(F(X))try{let Q=t0(X,"utf-8").match(Z);if(Q)return`pyproject.toml depends on ${Q[1]}`}catch{}let z=R($,"requirements.txt");if(F(z))try{let Q=t0(z,"utf-8").match(Z);if(Q)return`requirements.txt contains ${Q[1]}`}catch{}return null}function DD($,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(F(R($,"ios"))&&F(R($,"android")))return"ios/ + android/ dirs";return null}function ID($,Z){let X=R($,"Cargo.toml");if(F(X))try{let J=t0(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(F(z))try{let J=t0(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 TD($,Z){if(!F(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 AD($,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 RD($,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 _D($,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 FD($,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 CD($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||F(R($,"pnpm-workspace.yaml"))))return null;return"private workspace + multi-package"}var PD=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"]),yz=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,ED=new Set(["frontend","backend","database","css","ui","state"]);function wD($){if(F(R($,"pyproject.toml"))||F(R($,"manage.py"))||F(R($,"setup.py"))||u8($,"requirements*.txt"))return!0;if(F(R($,"go.mod")))return!0;if(F(R($,"Cargo.toml")))return!0;if(F(R($,"Gemfile")))return!0;if(F(R($,"pom.xml"))||u8($,"build.gradle*"))return!0;if(D$($).length>0)return!0;let Z=_1($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function m8($){let Z;try{Z=TZ($,{withFileTypes:!0})}catch{return[]}let X=[];for(let z of Z){if(!z.isDirectory()||z.name.startsWith(".")||PD.has(z.name))continue;let J=R($,z.name);if(!wD(J))continue;let Q=l8(J);if(Q==="Unknown")continue;let Y=c8(J).filter((G)=>ED.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||yz.test(Q),hasFramework:!!q,appRoot:F(R(J,"manage.py"))||F(R(J,"config.ru"))||F(R(J,"bin/rails"))||F(R(J,"artisan"))})}return X}function SD($,Z){if(Z?.workspaces||F(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 vz($){let Z=m8($);if(Z.length<2)return null;let X=(Y)=>(Y.appRoot?2:0)+(yz.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 _1($){let Z=R($,"package.json");if(!F(Z))return null;try{return JSON.parse(t0(Z,"utf-8"))}catch{return null}}function u8($,Z){if(!Z.includes("*"))return F(R($,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=R($,...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 jD($,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(!F(z))return!1;return t0(z,"utf-8").toLowerCase().includes($.key.toLowerCase())}catch{return!1}}default:return!1}}function c8($){let Z=_1($);return Lz.map((X)=>{let J=X.signals.filter((Q)=>jD(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=_1($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(F(R($,"tsconfig.json")))return"TypeScript";if(F(R($,"Cargo.toml")))return"Rust";if(F(R($,"go.mod")))return"Go";if(D$($).length>0)return"C#";if(F(R($,"pyproject.toml"))||F(R($,"setup.py")))return"Python";if(F(R($,"Gemfile")))return"Ruby";if(NZ($)){let X=E2($);if(X)return X.mainLanguage==="Java/Kotlin"?"Kotlin":X.mainLanguage;return"Java"}if(F(R($,"Package.swift")))return"Swift";if(F(R($,"build.zig")))return"Zig";if(F(R($,"pubspec.yaml")))return"Dart";if(Z)return"JavaScript";return"Unknown"}function gz($){let Z=_1($),X=c8($),z=[],J=AD($,Z);if(J)return z.push(J),{type:"documentation",found:z};let Q=OD($,Z);if(Q)return z.push(Q),{type:"sdk",found:z};let Y=ND($);if(Y)return z.push(Y),{type:"extension",found:z};let W=FD($,Z,X);if(W)return z.push(W),{type:"mcpaas",found:z};let U=_D($,Z);if(U)return z.push(U),{type:"saas",found:z};let q=ID($,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=DD($,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(MD($))return z.push("Cargo.toml [[bin]]"),{type:"cli",found:z};if(F(R($,"build.zig"))){if(z.push("build.zig"),F(R($,"src/main.zig")))return z.push("src/main.zig"),{type:"cli",found:z};if(F(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&&(F(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||F(R($,"pnpm-workspace.yaml")))&&b&&y)return z.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:z};let x=CD($,Z);if(x)return z.push(x),{type:"monorepo-root",found:z};let c=RD($,Z,X);if(c)return z.push(c),{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 A0=LD($);if(A0)return z.push(A0),{type:"data-science",found:z};let P=TD($,Z);if(P)return z.push(P),{type:"html",found:z};let d=SD($,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 fz($){if(F(R($,"bunfig.toml")))return"Bun";if(F(R($,"deno.json"))||F(R($,"deno.jsonc")))return"Deno";if(_1($))return"Node.js";if(F(R($,"Cargo.toml")))return"Rust";if(F(R($,"go.mod")))return"Go";if(D$($).length>0)return".NET";if(F(R($,"pubspec.yaml")))return"Dart";return"Unknown"}function hz($){if(F(R($,"pubspec.yaml")))return"pub";if(F(R($,"go.mod")))return"go modules";if(D$($).length>0)return"NuGet";if(F(R($,"pom.xml")))return"maven";if(F(R($,"build.gradle"))||F(R($,"build.gradle.kts"))||F(R($,"settings.gradle"))||F(R($,"settings.gradle.kts")))return"gradle";if(F(R($,"bun.lockb"))||F(R($,"bun.lock")))return"bun";if(F(R($,"pnpm-lock.yaml")))return"pnpm";if(F(R($,"yarn.lock")))return"yarn";if(F(R($,"package-lock.json")))return"npm";return"npm"}function uz($){if(F(R($,".github/workflows")))return"GitHub Actions";if(F(R($,".gitlab-ci.yml")))return"GitLab CI";if(F(R($,".circleci")))return"CircleCI";if(F(R($,"Jenkinsfile")))return"Jenkins";return null}function mz($){if(F(R($,"vercel.json")))return"Vercel";if(F(R($,"netlify.toml")))return"Netlify";if(F(R($,"wrangler.toml")))return"Cloudflare";if(F(R($,"Dockerfile")))return"Docker";if(F(R($,"fly.toml")))return"Fly.io";if(F(R($,"render.yaml")))return"Render";return null}function cz($){let Z=R($,"svelte.config.js");if(!F(Z))return null;try{let z=t0(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 lz($){let Z=_1($);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(F(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)=>F(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=F(R($,"bun.lock"))||F(R($,"bun.lockb"))?"bun run":"npm run";X[z]=`${J} ${z}`}}if(F(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(F(R($,"build.zig"))){if(!X.build)X.build="zig build";if(!X.test)X.test="zig build test"}if(F(R($,"go.mod"))){if(!X.build)X.build="go build ./...";if(!X.test)X.test="go test ./..."}if(F(R($,"pyproject.toml"))||F(R($,"pytest.ini"))){if(!X.test)X.test="pytest"}return X}function dz($,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(F(R($,"bunfig.toml")))J.push("Bun");else if(F(R($,"deno.json"))||F(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 AZ($){let Z=_1($),X=c8($),z=gz($),J=z.type,Q=z.found.some((s)=>s.startsWith("polyglot:")),Y=Q&&vz($)||l8($),W=fz($),U=hz($),q=uz($),G=mz($),V=lz($),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=N$[J]||N$.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",c=x?cz($):null,_=x&&X.some((s)=>s.slug==="sveltekit"),n=new Set(["css_framework","ui_library","database","connection","hosting"]),p={},A0=Z0.filter((s)=>s.path.startsWith("stack."));for(let s of A0){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?_?"SvelteKit":O?.name??"":O?.name??"";break;case"api_type":p[t]=_?"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&&c)p[t]=c;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 m0=dz($,Z,X,Q?l8($):Y);if(Q){for(let s of m8($))for(let t of[s.language,s.topFramework])if(t&&!m0.includes(t))m0.push(t)}let P9=d8($),E9=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(m0.length>0)g6.tech_stack=m0;if(P9.length>0)g6.key_files=P9;if(Object.keys(E9).length>0)g6.commands=E9;return g6}import{existsSync as bD,readFileSync as kD}from"fs";import{join as yD}from"path";var pz={MIN_LENGTH:8,MAX_LENGTH:280},xD=[/^(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 n0($){let Z=$.trim();if(Z.length<pz.MIN_LENGTH)return!1;if(Z.length>pz.MAX_LENGTH)return!1;if(xD.some((X)=>X.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
|
|
217
|
-
`).length>4)return!1;return!0}function
|
|
218
|
-
`),
|
|
219
|
-
`)}function
|
|
220
|
-
`),
|
|
221
|
-
`),
|
|
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 _Z($){let Z=nD($,"Cargo.toml");if(!pD(Z))return{};let X;try{X=iD(Z,"utf-8")}catch{return{}}let z=rD(X,"description");if(z&&n0(z))return{project:{goal:z}};return{}}import{readFileSync as sD,readdirSync as aD}from"fs";import{join as iz}from"path";var oD=[{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"}],tD=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function eD($){let Z=[],X=(z,J)=>{let Q;try{Q=aD(z,{withFileTypes:!0})}catch{return}for(let Y of Q)if(Y.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(Y.name))Z.push(iz(z,Y.name));else if(Y.isDirectory()&&J>0&&!Y.name.startsWith(".")&&!tD.has(Y.name))X(iz(z,Y.name),J-1)};return X($,1),Z}function y2($){return[...$].join(" · ")}function FZ($){let Z=eD($);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=sD(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 oD)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 i8,readFileSync as $I,readdirSync as ZI}from"fs";import{join as v2}from"path";var XI=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),zI=[{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 CZ($,Z){for(let X of Z){let z=$.find((J)=>X.test(J));if(z)return z}return null}function JI($){let Z=[$];try{for(let X of ZI($,{withFileTypes:!0}))if(X.isDirectory()&&!X.name.startsWith(".")&&!XI.has(X.name))Z.push(v2($,X.name))}catch{}return Z}function QI($){let Z=0;if(i8(v2($,"manage.py"))||i8(v2($,"pyproject.toml"))||i8(v2($,"Gemfile")))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function PZ($){let Z=[];for(let z of JI($)){let J=z===$,Q=J?"":`cd ${z.slice($.length+1)} && `;for(let Y of zI){let W=v2(z,Y.file);if(!i8(W))continue;let U;try{U=$I(W,"utf-8")}catch{continue}let q=Y.targets(U);if(q.length===0)continue;let G={},V=CZ(q,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),K=CZ(q,[/^build$/i,/^compile$/i,/^build/i]),H=CZ(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:QI(z)),commands:G})}}let X=Z.sort((z,J)=>J.score-z.score)[0];return X?{commands:X.commands}:{}}import{existsSync as YI}from"fs";import{join as WI}from"path";var UI=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function EZ($){for(let Z of UI)if(YI(WI($,Z)))return{security:{secrets:".env",example:Z}};return{}}function qI($,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 wZ($){return[RZ($),_Z($),FZ($),PZ($),EZ($)].reduce(qI,{})}import{existsSync as GI,readdirSync as nz,readFileSync as VI}from"fs";import{join as jZ,dirname as KI,extname as HI,resolve as BI}from"path";var SZ={"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 MI=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),OI=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),NI={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"]},LI=[["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 DI($,Z){for(let[X,z]of LI)if(X in $)return z;return Z.length>0?"framework":"config"}function II($){try{let Z=JSON.parse(VI($,"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 TI($){let Z=[],X=BI($),z=GI(jZ($,".git")),J=new Set;for(let Q=0;Q<10;Q++){let Y;try{Y=nz(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=SZ[U];if(!q)continue;if(U==="manifest.json"&&II(jZ(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=KI(X);if(W===X)break;X=W}return Z}function AI($){let Z=[];for(let X of rz($,2,{count:0})){let z=SZ[`*${X}`],J=z?.slots?.mainLanguage;if(J)Z.push({slots:{mainLanguage:J},priority:z.priority,frameworks:z.frameworks})}return Z}function RI($){let Z=[...TI($),...AI($)],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:DI(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 xZ($){let{slotFills:Z}=RI($),X={};for(let[z,J]of Object.entries(Z)){let Q=NI[z];if(!Q||!J)continue;let[Y,W]=Q;if(Y==="project")(X.project??={})[W]=J;else(X.stack??={})[W]=J}return X}function rz($,Z,X){let z=new Set;if(Z<0||X.count>400)return z;let J;try{J=nz($,{withFileTypes:!0})}catch{return z}for(let Q of J){if(X.count++>400)break;if(!Q.isDirectory()){let Y=HI(Q.name);if(OI.has(Y))z.add(Y);continue}if(MI.has(Q.name)||Q.name.startsWith("."))continue;for(let Y of rz(jZ($,Q.name),Z-1,X))z.add(Y)}return z}import{existsSync as sz,readFileSync as az}from"fs";import{join as oz}from"path";var N0=($,Z,X)=>({value:$,source:Z,confidence:X});function _I($,Z={}){let X=Z.toolingRoot?null:FI($),z=CI($),J={},Q=(Y,W)=>{if(W)J[Y]=W};return Q("what",wI(X,z)),Q("who",SI(z)),Q("why",jI(z)),Q("where",xI(X,z)),Q("when",bI(z)),Q("how",kI(X,z)),J}function bZ($,Z={}){let X=_I($,Z),z={};return Object.keys(X).forEach((J)=>{let Q=X[J];if(Q)z[J]=Q.value}),z}function FI($){let Z=oz($,"package.json");if(!sz(Z))return null;try{return JSON.parse(az(Z,"utf-8"))}catch{return null}}function CI($){let Z=oz($,"README.md");if(!sz(Z))return"";let X;try{X=az(Z,"utf-8")}catch{return""}return X.replace(/<!--[\s\S]*?-->/g,"").split(`
|
|
223
|
-
`).filter((
|
|
224
|
-
`).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function
|
|
225
|
-
`,"
|
|
226
|
-
run ${A("'faf go'")} to fill empty slots`))}
|
|
227
|
-
run ${A("'faf go'")} to reach ✪ Trophy`))}import{existsSync as
|
|
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
|
|
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 e8,statSync as LJ}from"fs";import{join as DJ,dirname as KT}from"path";import{readFileSync as WT,existsSync as UT,statSync as kS}from"fs";import{join as KJ}from"path";import{readFileSync as ZT,writeFileSync as o8,existsSync as XT}from"fs";var WJ="<!-- faf:start -->",UJ="<!-- faf:end -->",zT="<!-- faf: ";function qJ($){return $.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter((Z,X,z)=>Z!==""||X<z.length-1)??[]}var GJ=($)=>$.replace(/\r?\n$|\r$/,""),JT=($)=>$.startsWith("```")||$.startsWith("~~~");function QJ($,Z,X,z){let J=0,Q=!1,Y=-1;for(let W of qJ($)){let U=GJ(W),q=J===0&&U.charCodeAt(0)===65279?1:0,G=U.slice(q),V=G.trimEnd();if(Y===-1){if(z&&JT(G.trim()))Q=!Q;else if(!Q&&V===Z)Y=J+q}else if(V===X)return{start:Y,end:J+U.length};J+=W.length}return null}function YJ($,Z){return qJ($).some((X)=>GJ(X).replace(/^\uFEFF/,"").trimEnd()===Z)}function QT($,Z=WJ,X=UJ){return QJ($,Z,X,!0)??QJ($,Z,X,!1)}function g0($,Z,X=WJ,z=UJ){let J=`${X}
|
|
230
|
-
${Z.
|
|
231
|
-
${
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
`)}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
`)
|
|
249
|
-
`)}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
226
|
+
`)}}var w3=($)=>$.startsWith("\uFEFF")?$.slice(1):$;function C0($){return JSON.parse(n1().score_faf(w3($)))}function aY($){return n1().validate_faf(w3($))}function T5($){return n1().compile_fafb(w3($))}function tY($){return JSON.parse(n1().decompile_fafb($))}function eY(){return n1().sdk_version()}var $W=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function ZW($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function zW($){let Z=$.match(/^about:\s*\n((?:[ \t]+.*\n?)*)/m);if(!Z)return null;let z=Z[1]??"",Q=z.match(/^[ \t]+represents:\s*(\S+)\s*$/m);if(!Q)return null;let X=Q[1],J=z.match(/^[ \t]+source_score:\s*(\d+)\s*$/m),Y=-1;if(J){let W=parseInt(J[1],10);if(W>=0&&W<=100)Y=W}return{represents:X,sourceScore:Y}}function j3($){return $.unknown?"unknown (—)":`${$.score}%`}function j0($){return{score:$.score,tier:V6($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function M0($){let Z=zW($);if(Z){let z=Z.sourceScore;return{score:z,tier:z>=0?V6(z):R$[R$.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Z.represents,...z<0?{unknown:!0}:{}}}return j0(C0($))}function tA($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)?X[Q]:void 0}function S3($){try{let Z=k6($,{logLevel:"error"}).getIn(["project","type"],!0);return I0(Z)&&typeof Z.comment==="string"&&Z.comment.includes(I$)}catch{return!1}}function eA($,Z,z,Q,X){if(z===!0||z===null&&Q)return`${$} says '${Z}' — this app-type needs it, so it counts as empty until filled.`;if(z===!1&&X)return`${$} says '${Z}' — this app-type doesn't use it; faf auto marks it slotignored (N/A).`;return null}function $R($){try{let Z=k6($,{logLevel:"error"});if(Z.errors.length>0)return null;let z=Z.toJS();return $0(z)?z:null}catch{return null}}function A5($,Z,z={}){let Q=$R($);if(Q===null)return[];let X=$0(Q.project)&&!S3($)?Q.project.type:void 0,J=[];for(let Y of z0){let W=tA(Q,Y.path);if(Z.slots[Y.path]!=="empty"||!O$(W))continue;let U=v6.library.includes(Y.category),G=eA(Y.path,String(W).trim(),g6(X,Y),U,z.outOfType!==!1);if(G!==null)J.push(G)}return J}p();p();import{existsSync as ZR,readFileSync as zR}from"fs";import{join as QW}from"path";import{homedir as QR}from"os";var XR=95,JR=30,YR=3,x3=QW(QR(),".config","faf"),k3=QW(x3,"star-nudge"),WR="github.com/Wolfe-Jam/faf-cli";function UR($){if($.score<XR)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??YR))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??JR)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function GR(){try{if(!ZR(k3))return{shown:0,lastShownMs:null};let $=zR(k3,"utf-8").trim();if($.startsWith("{")){let z=JSON.parse($),Q=z.last?Date.parse(z.last):NaN;return{shown:Number.isFinite(z.shown)?Number(z.shown):0,lastShownMs:Number.isFinite(Q)?Q:null}}let Z=Date.parse($);return{shown:1,lastShownMs:Number.isFinite(Z)?Z:null}}catch{return{shown:0,lastShownMs:null}}}function VR($){let Z=new TextDecoder().decode($).trim();try{let z=JSON.parse(Z);return typeof z==="object"&&z!==null&&Object.keys(z).every((Q)=>Q==="shown"||Q==="last")}catch{return/^\d{4}-\d{2}-\d{2}T[\d:.]+Z$/.test(Z)}}function HR($,Z){try{w0(x3),C2(k3,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}),{root:x3,owns:VR,mark:"faf star-nudge state"})}catch{}}function XW($){let Z=Date.now(),z=GR();if(!UR({score:$,isTTY:Boolean(process.stdout.isTTY),isCI:Boolean(process.env.CI),optedOut:Boolean(process.env.FAF_NO_NUDGE),shownCount:z.shown,lastShownMs:z.lastShownMs,nowMs:Z}))return;console.log(""),console.log(` ${R0("★")} ${M("Enjoying faf-cli? A star helps others find it:")} ${WR}`),HR(z.shown,Z)}function _0($,Z,z=!1,Q=[]){if($.unknown){let Y=$.represents?`about-repo for ${$.represents}`:"about-repo";console.log(`${M("—")} ${A("unknown")} ${M(`${Y} — no about.source_score`)} ${M("—")} ${Z}`);return}let X=B2($.tier),J=A(`${$.score}%`);if(console.log(`${X} ${J} ${M(`${$.populated}/${$.active} slots`)} ${M("—")} ${Z}`),$.tier.name==="TROPHY")console.log(M(" Trophy. AI never has to guess."));else if($.empty>0){let Y=Object.entries($.slots).filter(([,V])=>V==="empty").map(([V])=>V),W=Y.slice(0,3).join(", "),U=Y.length>3?`, +${Y.length-3} more`:"",G=$.empty===1?"slot":"slots";console.log(M(` ${$.empty} ${G} from Trophy: ${W}${U}`))}if(qR(Q),z)console.log(""),KR($);XW($.score)}function qR($){for(let Z of $)console.log(M(` ${Z}`))}function KR($){for(let[Z,z]of Object.entries($.slots)){let Q=z==="populated"?I("●"):z==="slotignored"?M("—"):M("○");console.log(` ${Q} ${z==="slotignored"?M(`${Z}: N/A`):Z}`)}}p();function R5($,Z={}){let z=$??f();if(!z)console.error(`Error: project.faf not found
|
|
227
|
+
|
|
228
|
+
Run 'faf init' to create one.`),process.exit(2);let Q=c(z);$2(Q,z);let X=n(z,()=>M0(Q));if(Z.json){let J=r(z),Y={faf_version:J.faf_version??"unknown",project:J.project?.name??"unknown",source:z,...X};console.log(JSON.stringify(Y,null,2));return}if(Z.status){console.log(X.unknown?`— ${A(j3(X))}`:`${B2(X.tier)} ${A(j3(X))}`);return}_0(X,z,Z.verbose,A5(Q,X))}import{existsSync as VP}from"fs";import{join as $U}from"path";var H6="3.0";import{existsSync as S,readFileSync as N2,readdirSync as m3}from"fs";import{join as E}from"path";var JW=[{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 YW,readFileSync as MR,readdirSync as LR}from"fs";import{join as b3}from"path";var C$={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 NR=C$.flutterDeps,DR=C$.mcpDeps,OR=C$.serverFrameworks,IR=C$.stateManagement,TR=C$.routing;function AR($){let Z=new Set,z=!1;for(let Q of $.split(`
|
|
229
|
+
`)){if(/^(dependencies|dev_dependencies|dependency_overrides):\s*$/.test(Q)){z=!0;continue}if(/^\S/.test(Q))z=!1;if(z){let X=Q.match(/^\s{2}([a-zA-Z0-9_]+):/);if(X)Z.add(X[1].toLowerCase())}}return Z}function C5($){let Z=b3($,"pubspec.yaml");if(!YW(Z))return null;let z;try{z=MR(Z,"utf-8")}catch{return null}let Q=AR(z),X=(j)=>Q.has(j.toLowerCase()),J=NR.some(X)||/^flutter:\s*$/m.test(z)||/\bsdk:\s*flutter\b/.test(z),Y=DR.find(X),W=OR.find(([j])=>X(j)),U=IR.find(([j])=>X(j)),G=U?U[1]:"",V=TR.find(([j])=>X(j)),H=V?V[1]:"",q=X("flutter_test")?"flutter_test":X("test")?"test":"",K=/^executables:\s*$/m.test(z),L=!1;try{L=LR(b3($,"bin")).some((j)=>j.endsWith(".dart"))}catch{}let B=K||L,N,T="",w;if(J)if(T="Flutter",YW(b3($,"lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(z))N="mobile",w="pubspec.yaml (Flutter app)";else N="library",w="pubspec.yaml (Flutter package)";else if(Y)N="mcp",w=`pubspec.yaml + ${Y} (Dart MCP server)`;else if(W)N="backend",T=W[1],w=`pubspec.yaml + ${W[0]} (Dart backend)`;else if(B)N="cli",w=K?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else N="library",w="pubspec.yaml (Dart package)";return{appType:N,isFlutter:J,framework:T,stateManagement:G,routing:H,testing:q,found:w}}import{existsSync as y3,readFileSync as GW,readdirSync as WW,statSync as CR}from"fs";import{join as F5}from"path";var _5={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 _R=_5.mcpModules,FR=_5.serverFrameworks,PR=_5.cliFrameworks;function ER($){let Z=new Set,z=!1;for(let Q of $.split(`
|
|
230
|
+
`)){let X=Q.replace(/\/\/.*$/,"").trim();if(!X)continue;if(/^require\s*\(\s*$/.test(X)){z=!0;continue}if(z){if(X===")"){z=!1;continue}let Y=X.match(/^(\S+)/);if(Y)Z.add(Y[1].toLowerCase());continue}let J=X.match(/^require\s+(\S+)/);if(J&&J[1]!=="(")Z.add(J[1].toLowerCase())}return Z}function VW($,Z){let z=Z.toLowerCase();for(let Q of $)if(Q===z||Q.startsWith(`${z}/`))return!0;return!1}function UW($,Z){let z;for(let Q of Z){if(!VW($,Q[0]))continue;if(!z||Q[0].length>z[0].length)z=Q}return z}function wR($,Z){let z;for(let Q of Z){if(!VW($,Q))continue;if(!z||Q.length>z.length)z=Q}return z}function jR($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function SR($){let Z=F5($,"cmd");if(!y3(Z))return!1;try{for(let z of WW(Z)){let Q=F5(Z,z);try{if(CR(Q).isDirectory()){if(WW(Q).some((J)=>J.endsWith(".go")))return!0}else if(z.endsWith(".go"))return!0}catch{}}}catch{}return!1}function xR($){let Z=F5($,"main.go");if(!y3(Z))return!1;try{let z=GW(Z,"utf-8");return/^package\s+main\b/m.test(z)}catch{return!1}}function P5($){let Z=F5($,"go.mod");if(!y3(Z))return null;let z;try{z=GW(Z,"utf-8")}catch{return null}let Q=jR(z),X=ER(z),J=wR(X,_R),Y=UW(X,FR),W=UW(X,PR),U=SR($),G=xR($),V,H="",q;if(J)V="mcp",q=`go.mod + ${J} (Go MCP server)`;else if(Y)V="backend",H=Y[1],q=`go.mod + ${Y[0]} (Go backend)`;else if(W)V="cli",H=W[1],q=`go.mod + ${W[0]} (Go CLI)`;else if(U)V="cli",q="go.mod + cmd/ (Go CLI layout)";else if(G&&!Y)V="cli",q="go.mod + main.go package main (Go CLI)";else V="library",q="go.mod (Go module)";return{appType:V,modulePath:Q,framework:H,found:q}}import{existsSync as bR,readFileSync as yR,readdirSync as vR}from"fs";import{join as gR}from"path";var f6={version:1,_doc:"SINGLE SOURCE of C# /.NET detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Bolster C# by editing THIS file. Logic stays in csharp.ts. Content-aware: .csproj alone ≠ type — Sdk first, then props/packages. Kill line: .csproj alone ≠ type. 2026-08-01 initial.",mcpPackages:["ModelContextProtocol","ModelContextProtocol.AspNetCore","ModelContextProtocol.Core","ModelContextProtocol.Extensions.Tasks","ModelContextProtocol.Extensions.Apps"],cliPackages:[["System.CommandLine","System.CommandLine"],["Spectre.Console.Cli","Spectre.Console"],["Spectre.Console","Spectre.Console"],["McMaster.Extensions.CommandLineUtils","McMaster"]],testPackages:[["Microsoft.NET.Test.Sdk","VSTest"],["xunit.v3","xUnit"],["xunit","xUnit"],["NUnit","NUnit"],["MSTest.TestFramework","MSTest"],["MSTest","MSTest"]],grpcServerPackages:["Grpc.AspNetCore"],specializedSdks:[["Microsoft.NET.Sdk.Web","web","ASP.NET Core"],["Microsoft.NET.Sdk.Worker","worker","Worker"],["Microsoft.NET.Sdk.BlazorWebAssembly","blazor-wasm","Blazor WebAssembly"],["Microsoft.NET.Sdk.Razor","razor-lib","Razor Class Library"],["MSTest.Sdk","test","MSTest"],["Aspire.AppHost.Sdk","aspire","Aspire AppHost"]],baseSdk:"Microsoft.NET.Sdk"};var hR=f6.mcpPackages.map(($)=>$.toLowerCase()),fR=f6.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),uR=f6.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),mR=f6.grpcServerPackages.map(($)=>$.toLowerCase()),cR=f6.specializedSdks,HW=f6.baseSdk.toLowerCase();function pR($){let Z=$.match(/<Project\b[^>]*\bSdk\s*=\s*"([^"/]+)(?:\/[^"]*)?"/i),z=$.match(/<Sdk\b[^>]*\bName\s*=\s*"([^"]+)"/i),Q=(Z?.[1]||z?.[1]||"").trim(),X=($.match(/<OutputType>\s*([^<]+?)\s*<\/OutputType>/i)?.[1]||"").trim(),J=$.match(/<TargetFramework>\s*([^<]+?)\s*<\/TargetFramework>/i)?.[1],W=($.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i)?.[1]||J||"").trim(),U=/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test($),G=/<UseMaui>\s*true\s*<\/UseMaui>/i.test($),V=/<UseWPF>\s*true\s*<\/UseWPF>/i.test($),H=/<UseWindowsForms>\s*true\s*<\/UseWindowsForms>/i.test($),q=new Set;for(let L of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))q.add(L[1].toLowerCase());for(let L of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))q.add(L[1].toLowerCase());let K=new Set;for(let L of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))K.add(L[1].toLowerCase());return{sdk:Q,outputType:X,targetFramework:W,isTestProject:U,useMaui:G,useWpf:V,useWindowsForms:H,packages:q,frameworkRefs:K}}function v3($,Z){let z=Z.toLowerCase();if($.has(z))return!0;for(let Q of $)if(Q===z||Q.startsWith(`${z}.`))return!0;return!1}function qW($,Z){let z;for(let[Q,X]of Z){if(!v3($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function lR($){let Z;for(let z of hR){if(!v3($,z))continue;if(!Z||z.length>Z.length)Z=z}for(let z of $)if(z==="modelcontextprotocol"||z.startsWith("modelcontextprotocol.")){if(!Z||z.length>Z.length)Z=z}return Z}function dR($){let Z=$.toLowerCase();if(!Z)return;let z;for(let Q of cR){let X=Q[0].toLowerCase();if(Z===X||Z.startsWith(`${X}/`)){if(!z||X.length>z[0].length)z=Q}}return z}function E5($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function iR($,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 nR($,Z){let z=Z.replace(/\.csproj$/i,""),{sdk:Q,packages:X,frameworkRefs:J,outputType:Y}=$,W,U="",G,V=lR(X),H=dR(Q),q=qW(X,uR),K=qW(X,fR),L=mR.some((N)=>v3(X,N)),B=J.has("microsoft.aspnetcore.app");if(V)W="mcp",U="MCP",G=`${Z} + ${V} (C# MCP server)`;else if($.isTestProject||H?.[1]==="test"||q)W="library",U=q?.[1]||(H?.[1]==="test"?H[2]:"Test"),G=`${Z} + test (${U})`;else if($.useMaui)W="mobile",U="MAUI",G=`${Z} + UseMaui (MAUI)`;else if($.useWpf||$.useWindowsForms)W="backend",U=$.useWpf&&$.useWindowsForms?"WPF+WinForms":$.useWpf?"WPF":"Windows Forms",G=`${Z} + ${U}`;else if(H?.[1]==="web")W="backend",U=L?"gRPC":H[2],G=`${Z} + Sdk=${H[0]}${L?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(H?.[1]==="worker")W="backend",U=H[2],G=`${Z} + Sdk=${H[0]} (Worker)`;else if(H?.[1]==="blazor-wasm")W="backend",U=H[2],G=`${Z} + Sdk=${H[0]} (Blazor WASM)`;else if(H?.[1]==="aspire")W="backend",U=H[2],G=`${Z} + Sdk=${H[0]} (Aspire)`;else if(H?.[1]==="razor-lib")W="library",U=H[2],G=`${Z} + Sdk=${H[0]} (Razor class library)`;else if(B&&E5(Y))W="backend",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(B&&!E5(Y))W="library",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(K&&(E5(Y)||!Y))W="cli",U=K[1],G=`${Z} + ${K[0]} (C# CLI)`;else if(E5(Y))W="cli",G=`${Z} + OutputType=Exe (C# console)`;else{W="library";let N=Q?` Sdk=${Q}`:"";if(G=`${Z}${N} (C# class library)`.replace(" Sdk=Microsoft.NET.Sdk",""),!Q||Q.toLowerCase()===HW||Q.toLowerCase().startsWith(`${HW}/`))G=`${Z} (C# class library)`}return{appType:W,projectName:z,targetFramework:$.targetFramework,sdk:Q||"Microsoft.NET.Sdk",framework:U,found:G}}function _$($){if(!bR($))return[];try{return vR($).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}catch{return[]}}function w5($){let Z=_$($);if(Z.length===0)return null;let z=null,Q=999;for(let X of Z){let J=gR($,X),Y;try{Y=yR(J,"utf-8")}catch{continue}let W=pR(Y),U=nR(W,X),G=iR(U.appType,U.framework);if(!z||G<Q)z=U,Q=G}return z}import{existsSync as u6,readFileSync as sR,readdirSync as oR,statSync as aR}from"fs";import{join as z2}from"path";var M2={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 tR=M2.mcpArtifacts.map(($)=>$.toLowerCase()),eR=M2.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),$C=M2.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),ZC=M2.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),Dv=M2.androidPlugins.map(($)=>$.toLowerCase()),zC=M2.kmpPlugins.map(($)=>$.toLowerCase()),QC=M2.jvmKotlinPlugins.map(($)=>$.toLowerCase()),XC=M2.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),JC=M2.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),YC=M2.libraryPlugins.map(($)=>$.toLowerCase()),WC=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function g3($){return WC.some((Z)=>u6(z2($,Z)))}function s1($){try{return sR($,"utf-8")}catch{return null}}function UC($){let Z=new Map,z=new Map,Q="";for(let X of $.split(`
|
|
231
|
+
`)){let J=X.replace(/#.*$/,"").trim();if(!J)continue;let Y=J.match(/^\[([^\]]+)\]$/);if(Y){Q=Y[1].trim().toLowerCase();continue}let W=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bid\s*=\s*"([^"]+)"/);if(W&&(Q==="plugins"||Q.endsWith(".plugins"))){Z.set(W[1].replace(/-/g,".").toLowerCase(),W[2].toLowerCase()),Z.set(W[1].toLowerCase(),W[2].toLowerCase());continue}let U=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bmodule\s*=\s*"([^"]+)"/);if(U&&(Q==="libraries"||Q.endsWith(".libraries"))){let H=U[1].toLowerCase();z.set(H,U[2].toLowerCase()),z.set(H.replace(/-/g,"."),U[2].toLowerCase());continue}let G=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bgroup\s*=\s*"([^"]+)"[^}]*\bname\s*=\s*"([^"]+)"/);if(G&&(Q==="libraries"||Q.endsWith(".libraries"))){let H=`${G[2]}:${G[3]}`.toLowerCase(),q=G[1].toLowerCase();z.set(q,H),z.set(q.replace(/-/g,"."),H);continue}let V=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(V){let H=V[1].toLowerCase(),q=V[2];if(Q==="plugins"||Q.endsWith(".plugins")){let K=q.split(":")[0].toLowerCase();Z.set(H,K),Z.set(H.replace(/-/g,"."),K)}else if(Q==="libraries"||Q.endsWith(".libraries")){let K=q.split(":");if(K.length>=2){let L=`${K[0]}:${K[1]}`.toLowerCase();z.set(H,L),z.set(H.replace(/-/g,"."),L)}}}}return{plugins:Z,libraries:z}}function GC($){let Z=z2($,"gradle","libs.versions.toml");if(!u6(Z))return{plugins:new Map,libraries:new Map};let z=s1(Z);if(!z)return{plugins:new Map,libraries:new Map};return UC(z)}function VC($){let Z=[];for(let z of $.matchAll(/include\s*\(\s*([^)]+)\)/g))for(let Q of z[1].split(",")){let X=Q.replace(/['":\s]/g,"").replace(/^:/,"");if(X)Z.push(X.replace(/:/g,"/"))}for(let z of $.matchAll(/include\s+((?:['"][^'"]+['"]\s*,?\s*)+)/g))for(let Q of z[1].split(",")){let X=Q.replace(/['":\s]/g,"").replace(/^:/,"");if(X)Z.push(X.replace(/:/g,"/"))}for(let z of $.matchAll(/project\s*\(\s*["']:([^"']+)["']\s*\)\s*\.projectDir\s*=\s*file\s*\(\s*["']([^"']+)["']\s*\)/g))Z.push(z[2].replace(/^\.\//,""));return[...new Set(Z)]}function HC($,Z){let z=new Set;for(let Q of $.matchAll(/\bid\s*\(\s*["']([^"']+)["']\s*\)/g))z.add(Q[1].toLowerCase());for(let Q of $.matchAll(/\bid\s+['"]([^'"]+)['"]/g))z.add(Q[1].toLowerCase());for(let Q of $.matchAll(/plugins\s*\{([\s\S]*?)\}/g))for(let X of Q[1].split(/[\n;]/)){let J=X.replace(/\/\/.*$/,"").trim();if(!J||J.startsWith("id")||J.startsWith("kotlin")||J.startsWith("alias"))continue;let Y=J.match(/^`([a-zA-Z0-9.-]+)`$/)||J.match(/^([a-zA-Z][a-zA-Z0-9.-]*)$/);if(Y)z.add(Y[1].toLowerCase())}for(let Q of $.matchAll(/\bkotlin\s*\(\s*["']([^"']+)["']\s*\)/g)){let X=Q[1].toLowerCase();if(X==="jvm")z.add("org.jetbrains.kotlin.jvm");else if(X==="multiplatform")z.add("org.jetbrains.kotlin.multiplatform");else if(X==="android")z.add("org.jetbrains.kotlin.android");else z.add(`org.jetbrains.kotlin.${X}`)}for(let Q of $.matchAll(/libs\.plugins\.([A-Za-z0-9_.]+)/g)){let X=Q[1].toLowerCase(),J=Z.plugins.get(X)||Z.plugins.get(X.replace(/\./g,"-"))||Z.plugins.get(X.replace(/-/g,"."));if(J)z.add(J);else if(X.includes("spring")&&X.includes("boot"))z.add("org.springframework.boot")}for(let Q of $.matchAll(/apply\s+plugin\s*:\s*['"]([^'"]+)['"]/g))z.add(Q[1].toLowerCase());return z}function qC($,Z){let z=new Set;for(let Q of $.matchAll(/["']([A-Za-z0-9_.-]+:[A-Za-z0-9_.-]+)(?::[^"']+)?["']/g))z.add(Q[1].toLowerCase());for(let Q of $.matchAll(/libs\.([A-Za-z0-9_.]+)/g)){let X=Q[1].toLowerCase();if(X.startsWith("plugins."))continue;let J=[X,X.replace(/\./g,"-"),X.replace(/-/g,".")];for(let Y of J){let W=Z.libraries.get(Y);if(W){z.add(W.includes(":")?W.split(":").slice(0,2).join(":"):W);break}}}return z}function MW($){let Z=($.match(/<packaging>\s*([^<]+?)\s*<\/packaging>/i)?.[1]||"jar").trim().toLowerCase(),z=new Set,Q=$.match(/<parent>([\s\S]*?)<\/parent>/i);if(Q){let Y=Q[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),W=Q[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(Y&&W)z.add(`${Y}:${W}`.toLowerCase())}let X=new Set;for(let Y of $.matchAll(/<dependency>([\s\S]*?)<\/dependency>/gi)){let W=Y[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),U=Y[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(W&&U)X.add(`${W}:${U}`.toLowerCase())}let J=[];for(let Y of $.matchAll(/<module>\s*([^<]+?)\s*<\/module>/gi))J.push(Y[1].trim());return{packaging:Z,parents:z,artifacts:X,modules:J}}function y2($,Z){let z=Z.toLowerCase();if($.has(z))return!0;for(let Q of $)if(Q===z||Q.endsWith(`.${z}`)||Q===z.replace(/^org\.gradle\./,""))return!0;return!1}function r1($,Z,z){let Q;for(let[X,J]of Z){let Y=!1;if(z==="plugin")Y=y2($,X);else if(Y=$.has(X)||[...$].some((W)=>W===X||W.startsWith(`${X}:`)||W.startsWith(`${X}.`)),!Y&&z==="artifact")Y=[...$].some((W)=>W===X||W.startsWith(`${X}`));if(!Y)continue;if(!Q||X.length>Q[0].length)Q=[X,J]}return Q}function KC($){let Z;for(let z of tR)for(let Q of $){if(Q===z||Q.startsWith(`${z}:`)||Q.startsWith(z.replace(/:mcp$/,":"))){if(!Z||z.length>Z.length)Z=z}if(Q.startsWith("io.modelcontextprotocol")||Q.includes("spring-ai-starter-mcp")||Q.includes("spring-ai-mcp")){if(!Z||Q.length>Z.length)Z=Q}}return Z}function LW($){let Z=new Set,z=!1,Q=!1,X=[z2($,"src"),z2($,"src","main")],J=(Y,W)=>{if(W>4||!u6(Y))return;let U;try{U=oR(Y)}catch{return}for(let G of U){if(G==="androidMain"||G==="commonMain"||G==="jvmMain"||G==="iosMain")Z.add(G);let V=z2(Y,G);try{if(aR(V).isDirectory())J(V,W+1);else if(G.endsWith(".kt")||G.endsWith(".kts"))z=!0;else if(G.endsWith(".java"))Q=!0}catch{}}};for(let Y of X)J(Y,0);return{kotlin:z,java:Q,hints:Z}}function BC($){let Z=[],z=$.plugins,Q=$.artifacts,X=zC.some((x)=>y2(z,x))||$.sourceHints.has("commonMain"),J=y2(z,"com.android.application"),Y=y2(z,"com.android.library")||y2(z,"com.android.kotlin.multiplatform.library");if(J||Y)Z.push("android");if(X)Z.push("multiplatform");let W=KC(Q),U=r1(z,eR,"plugin"),G=r1($.parents,$C,"parent"),V=r1(Q,ZC,"artifact"),H=r1(z,XC,"plugin"),q=r1(Q,JC,"artifact"),K=YC.some((x)=>y2(z,x)),L=$.packaging==="pom",B,N="",T;if(J)B="mobile",N=X?"Android+KMP":"Android",T=`${$.path||"root"} + com.android.application (${N})`;else if(W)B="mcp",N="MCP",Z.push("mcp"),T=`${$.path||"root"} + ${W} (JVM MCP server)`;else if(U||G||V){B="backend",N=U?.[1]||G?.[1]||V?.[1]||"JVM";let x=U?.[0]||G?.[0]||V?.[0]||"web";T=`${$.path||"root"} + ${x} (JVM backend)`}else if(X&&!Y)B="library",N="Kotlin Multiplatform",T=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(Y)B="library",N=X?"Android+KMP":"Android",T=`${$.path||"root"} + android library (${N})`;else if(q||$.hasApplicationPlugin&&($.hasMainClass||H)||H&&$.hasMainClass)B="cli",N=q?.[1]||"application",T=q?`${$.path||"root"} + ${q[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!K)B="cli",N="application",T=`${$.path||"root"} + application plugin (JVM CLI)`;else if(L)B="library",T=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{B="library";let x=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(T=`${$.path||"root"} (${x} library)`,K)T=`${$.path||"root"} + java-library (JVM library)`}let w="Java";if($.kotlinSources&&$.javaSources)w="Java/Kotlin";else if($.kotlinSources||QC.some((x)=>y2(z,x))||X)w="Kotlin";let j=[...new Set(Z)];return{appType:B,framework:N,facets:j,found:T,buildTool:$.buildTool,mainLanguage:w}}function MC($,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 KW($,Z,z){let Q=Z?z2($,Z):$,X=z2(Q,"build.gradle.kts"),J=z2(Q,"build.gradle"),Y=u6(X)?X:u6(J)?J:null;if(!Y)return null;let W=s1(Y);if(!W)return null;let U=HC(W,z),G=qC(W,z),V=LW(Q),H=/mainClass\s*[.=]/.test(W)||/mainClassName\s*=/.test(W)||/Main-Class/.test(W),q=y2(U,"application")||y2(U,"org.gradle.application");return{path:Z||"build.gradle",plugins:U,artifacts:G,packaging:"jar",parents:new Set,hasMainClass:H,hasApplicationPlugin:q,sourceHints:V.hints,kotlinSources:V.kotlin||Y.endsWith(".kts"),javaSources:V.java,buildTool:"gradle"}}function BW($,Z){let z=Z?z2($,Z):$,Q=z2(z,"pom.xml");if(!u6(Q))return null;let X=s1(Q);if(!X)return null;let{packaging:J,parents:Y,artifacts:W}=MW(X),U=LW(z);return{path:Z?`${Z}/pom.xml`:"pom.xml",plugins:new Set,artifacts:W,packaging:J,parents:Y,hasMainClass:/<mainClass>/.test(X),hasApplicationPlugin:!1,sourceHints:U.hints,kotlinSources:U.kotlin,javaSources:U.java,buildTool:"maven"}}function o1($){if(!g3($))return null;let Z=GC($),z=[],Q=null;for(let G of["settings.gradle.kts","settings.gradle"]){let V=z2($,G);if(u6(V)){Q=s1(V);break}}let X=Q?VC(Q):[],J=KW($,"",Z);if(J)z.push(J);for(let G of X){let V=KW($,G,Z);if(V)z.push(V)}let Y=BW($,"");if(Y){z.push(Y);let G=s1(z2($,"pom.xml"));if(G){let{modules:V}=MW(G);for(let H of V){let q=BW($,H);if(q)z.push(q)}}}if(z.length===0&&Q)return{appType:"library",framework:"",buildTool:"gradle",mainLanguage:"Java/Kotlin",facets:[],found:"settings.gradle (Gradle multi-project root)"};if(z.length===0)return null;let W=null,U=999;for(let G of z){let V=BC(G),H=MC(V.appType,V.facets);if(!W||H<U)W={appType:V.appType,framework:V.framework,buildTool:V.buildTool,mainLanguage:V.mainLanguage,facets:V.facets,found:V.found},U=H}if(W&&X.length>0&&!W.found.includes("multi-project"));return W}import{existsSync as e1,readFileSync as NC,readdirSync as j5,statSync as DC}from"fs";import{join as L2}from"path";var a1={version:1,_doc:"SINGLE SOURCE of Ruby detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Kill line: Gemfile alone ≠ Rails. Content-aware: gem names + light layout. 2026-08-03 initial (post-intel ruby-edition).",mcpGems:["mcp","fast-mcp","fast_mcp","rails-mcp-server","rails_mcp_server","ruby-mcp-client","ruby_mcp_client","ruby_llm-mcp","ruby_llm_mcp"],webGems:[["rails","Rails"],["railties","Rails"],["sinatra","Sinatra"],["sinatra-contrib","Sinatra"],["roda","Roda"],["grape","Grape"],["hanami","Hanami"],["hanami-controller","Hanami"],["rack","Rack"]],cliGems:[["thor","Thor"],["gli","GLI"],["commander","Commander"],["slop","Slop"]],railsLayoutFiles:["config/application.rb","config/routes.rb","bin/rails","config/environment.rb"]};var OC=a1.mcpGems.map(($)=>$.toLowerCase()),IC=a1.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),NW=a1.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),TC=a1.railsLayoutFiles;function AC($){return e1(L2($,"Gemfile"))||e1(L2($,"gems.rb"))||RC($)}function RC($){try{return j5($).some((Z)=>Z.endsWith(".gemspec"))}catch{return!1}}function t1($){try{return NC($,"utf-8")}catch{return null}}function CC($){let Z=new Set;for(let z of $.split(`
|
|
232
|
+
`)){let Q=z.replace(/#.*$/,"").trim();if(!Q)continue;let X=Q.match(/^\s*gem\s+['"]([^'"]+)['"]/i)||Q.match(/^\s*gem\s+:([A-Za-z0-9_.-]+)/i);if(X)Z.add(X[1].toLowerCase())}return Z}function _C($){let Z=new Set,z=!1;for(let Q of $.split(`
|
|
233
|
+
`)){let X=Q.replace(/\r$/,"");if(/^\s*specs:\s*$/.test(X)){z=!0;continue}if(z){if(/^[A-Z]/.test(X)||X.startsWith("PLATFORMS")||X.startsWith("DEPENDENCIES")||X.startsWith("BUNDLED")||X.startsWith("RUBY VERSION")||X.startsWith("CHECKSUMS")){z=!1;continue}let J=X.match(/^\s{2,}([a-zA-Z0-9_.-]+)\s*\(/);if(J)Z.add(J[1].toLowerCase())}}return Z}function FC($){let Z=new Set;for(let z of $.split(`
|
|
234
|
+
`)){let X=z.replace(/#.*$/,"").match(/add_(?:runtime_|development_)?dependency\s*\(?\s*['"]([^'"]+)['"]/i);if(X)Z.add(X[1].toLowerCase())}return Z}function PC($){let Z=new Set,z=[];for(let X of["Gemfile","gems.rb"]){let J=L2($,X),Y=t1(J);if(Y){for(let W of CC(Y))Z.add(W);z.push(X)}}let Q=t1(L2($,"Gemfile.lock"))||t1(L2($,"gems.locked"));if(Q){for(let X of _C(Q))Z.add(X);z.push("Gemfile.lock")}try{for(let X of j5($)){if(!X.endsWith(".gemspec"))continue;let J=t1(L2($,X));if(J){for(let Y of FC(J))Z.add(Y);z.push(X)}}}catch{}return{gems:Z,sources:z}}function $4($,Z){let z=Z.toLowerCase();if($.has(z))return!0;return!1}function h3($,Z){let z;for(let[Q,X]of Z){if(!$4($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function EC($){let Z;for(let z of OC)if($4($,z)&&(!Z||z.length>Z.length))Z=z;return Z}function DW($){for(let Z of TC)if(e1(L2($,Z)))return Z;return}function wC($,Z){let z=h3(Z,NW);if(z)return{hit:!0,why:z[0]};try{for(let X of j5($)){if(!X.endsWith(".gemspec"))continue;let J=t1(L2($,X));if(J&&/executables\s*=/.test(J)&&!/executables\s*=\s*\[\s*\]/.test(J))return{hit:!0,why:`${X} executables`}}}catch{}let Q=L2($,"bin");if(e1(Q))try{let J=j5(Q).filter((Y)=>{if(Y==="setup"||Y==="console"||Y==="rake")return!1;try{return DC(L2(Q,Y)).isFile()}catch{return!1}}).filter((Y)=>Y!=="rails");if(J.length>0&&!$4(Z,"rails")&&!DW($))return{hit:!0,why:`bin/${J[0]}`}}catch{}return{hit:!1,why:""}}function S5($){if(!AC($))return null;let{gems:Z,sources:z}=PC($),Q=z[0]||"Gemfile",X=z.some((N)=>N==="Gemfile"||N==="gems.rb"||N.includes("lock"))?"bundler":"rubygems",J=EC(Z),Y=h3(Z,IC),W=DW($),U=$4(Z,"rails")||$4(Z,"railties"),G=wC($,Z),V=e1(L2($,"config.ru")),H=U||!!W,q=Y&&Y[1]!=="Rails"&&!(Y[0]==="rack"&&!V)?Y:void 0,K,L="",B;if(J)K="mcp",L="MCP",B=`${Q} + gem ${J} (Ruby MCP)`;else if(H)if(K="backend",L="Rails",U&&W)B=`${Q} + rails + ${W} (Rails)`;else if(U)B=`${Q} + gem rails (Rails)`;else B=`${W} (Rails layout)`;else if(q)K="backend",L=q[1],B=`${Q} + gem ${q[0]} (Ruby backend)`;else if(G.hit)K="cli",L=h3(Z,NW)?.[1]||"",B=`${Q} + ${G.why} (Ruby CLI)`;else K="library",B=`${Q} (Ruby library)`;return{appType:K,framework:L,packageManager:X,found:B}}import{existsSync as f3,readFileSync as SC,readdirSync as xC,statSync as kC}from"fs";import{join as Z4}from"path";var _2={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 bC=_2.mcpPackageUrls.map(($)=>$.toLowerCase()),yC=_2.mcpProducts.map(($)=>$.toLowerCase()),vC=_2.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),gC=_2.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),hC=_2.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),fC=_2.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),uC=_2.appProductTypes,mC=_2.cliProductTypes,cC=_2.vaporLayoutFiles;function pC($){return f3(Z4($,"Package.swift"))||u3($).length>0}function u3($){try{return xC($).filter((Z)=>{if(!Z.endsWith(".xcodeproj"))return!1;try{return kC(Z4($,Z)).isDirectory()}catch{return!1}})}catch{return[]}}function TW($){try{return SC($,"utf-8")}catch{return null}}function lC($){let Z=dC($),z=Z.toLowerCase(),Q=[],X=/\.package\s*\(\s*url\s*:\s*"([^"]+)"/gi,J;while((J=X.exec(Z))!==null)Q.push(J[1]);let Y=/\.package\s*\(\s*url\s*:\s*'([^']+)'/gi;while((J=Y.exec(Z))!==null)Q.push(J[1]);let W=[],U=/\.product\s*\(\s*name\s*:\s*"([^"]+)"/gi;while((J=U.exec(Z))!==null)W.push(J[1]);let G=/\.product\s*\(\s*name\s*:\s*'([^']+)'/gi;while((J=G.exec(Z))!==null)W.push(J[1]);let V=/\.library\s*\(/.test(z),H=/\.executable\s*\(/.test(z),q=/\.plugin\s*\(/.test(z)&&!V&&!H?!0:/\bproducts\s*:\s*\[[\s\S]*?\.plugin\s*\(/.test(z),K=/\.executabletarget\s*\(/.test(z),L=/\.target\s*\(/.test(z)&&!K?!0:(z.match(/\.target\s*\(/g)||[]).length>(z.match(/\.executabletarget\s*\(/g)||[]).length+(z.match(/\.testtarget\s*\(/g)||[]).length;return{packageUrls:Q,productNames:W,hasLibraryProduct:V,hasExecutableProduct:H,hasPluginProduct:!!q,hasExecutableTarget:K,hasLibraryTarget:L}}function dC($){let Z="",z=0;while(z<$.length){if($[z]==='"'||$[z]==="'"){let Q=$[z];Z+=Q,z++;while(z<$.length){if($[z]==="\\"&&z+1<$.length){Z+=$[z]+$[z+1],z+=2;continue}if(Z+=$[z],$[z]===Q){z++;break}z++}continue}if($[z]==="/"&&$[z+1]==="/"){z+=2;while(z<$.length&&$[z]!==`
|
|
235
|
+
`)z++;continue}if($[z]==="/"&&$[z+1]==="*"){z+=2;while(z<$.length&&!($[z]==="*"&&$[z+1]==="/"))z++;z+=2;continue}Z+=$[z],z++}return Z}function iC($,Z){let z=$.map((X)=>X.toLowerCase()),Q;for(let X of Z)for(let J of z)if(J.includes(X)&&(!Q||X.length>Q.length))Q=X;return Q}function OW($,Z){let z=$.map((X)=>X.toLowerCase()),Q;for(let[X,J]of Z)for(let Y of z)if(Y.includes(X)&&(!Q||X.length>Q[0].length))Q=[X,J];return Q}function IW($,Z){let z=$.map((X)=>X.toLowerCase()),Q;for(let[X,J]of Z)if(z.includes(X)&&(!Q||X.length>Q[0].length))Q=[X,J];return Q}function nC($){let Z=$.map((z)=>z.toLowerCase());return yC.some((z)=>Z.includes(z))}function rC($){let Z=!1,z=!1,Q;for(let X of u3($)){let J=Z4($,X,"project.pbxproj"),Y=TW(J);if(!Y)continue;for(let W of uC)if(Y.includes(W))Z=!0,Q=W;for(let W of mC)if(Y.includes(W)){if(z=!0,!Q)Q=W}}return{hasApplication:Z,hasTool:z,hit:Q}}function sC($){for(let Z of cC)if(f3(Z4($,Z)))return Z;return}function z4($){if(!pC($))return null;let Z=Z4($,"Package.swift"),z=f3(Z),Q=u3($),X=Q.length>0,J=null;if(z){let u=TW(Z);if(u)J=lC(u)}let Y=X?rC($):{hasApplication:!1,hasTool:!1},W=sC($),U=J?.packageUrls??[],G=J?.productNames??[],V=iC(U,bC),H=nC(G),q=OW(U,vC),K=IW(G,gC),L=OW(U,hC),B=IW(G,fC),N=!!(V||H),T=!!(q||K||W),w=!!(J?.hasExecutableProduct||J?.hasExecutableTarget),j=!!(L||B),x=Y.hasApplication,v=z&&X?"spm+xcode":z?"spm":"xcode",k,l="",R;if(N)if(k="mcp",l="MCP",H)R="Package.swift + product MCP (Swift MCP)";else R=`Package.swift + ${V} (Swift MCP)`;else if(T)if(k="backend",l=K?.[1]||q?.[1]||(W?"Vapor":""),K)R=`Package.swift + product ${K[1]} (Swift backend)`;else if(q)R=`Package.swift + ${q[1]} (Swift backend)`;else R=`${W} (Swift backend layout)`;else if(x)k="app",l="",R=`${Q[0]} + ${Y.hit||"application"} (Swift app)`;else if(j||w&&!T&&!N)if(k="cli",l=B?.[1]||L?.[1]||"",B)R=`Package.swift + product ${B[1]} (Swift CLI)`;else if(L)R=`Package.swift + ${L[1]} (Swift CLI)`;else if(J?.hasExecutableProduct)R="Package.swift + .executable product (Swift CLI)";else R="Package.swift + .executableTarget (Swift CLI)";else if(Y.hasTool&&!z)k="cli",R=`${Q[0]} + tool productType (Swift CLI)`;else if(z)if(k="library",J?.hasLibraryProduct)R="Package.swift + .library product (Swift library)";else R="Package.swift (Swift library)";else k="library",R=`${Q[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:k,framework:l,packageManager:v,found:R}}function oC($){let Z=E($,"Cargo.toml");if(!S(Z))return null;try{let Q=N2(Z,"utf-8").match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return Q?Q[1]:null}catch{return null}}function aC($){let Z=E($,"Cargo.toml");if(!S(Z))return!1;try{let z=N2(Z,"utf-8");return/^\s*\[\[bin\]\]/m.test(z)}catch{return!1}}function tC($,Z){if(Z?.keywords?.some((Q)=>/^sdk(?:\s|-|$)|-sdk$/i.test(Q)))return'package.json keywords contains "sdk"';if(Z?.name&&/(?:^|[-_/])sdk(?:[-_/]|$)/i.test(Z.name))return`package.json name "${Z.name}" → sdk`;let z=oC($);if(z&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(z))return`Cargo.toml name "${z}" → sdk`;return null}function eC($){let Z=["manifest.json","public/manifest.json","src/manifest.json","app/manifest.json","extension/manifest.json","dist/manifest.json"];for(let z of Z){let Q=E($,z);if(!S(Q))continue;try{let X=JSON.parse(N2(Q,"utf-8"));if(typeof X.manifest_version==="number")return`${z} manifest_version ${X.manifest_version} (browser extension)`}catch{}}return null}function $_($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,z=E($,"pyproject.toml");if(S(z))try{let J=N2(z,"utf-8").match(Z);if(J)return`pyproject.toml depends on ${J[1]}`}catch{}let Q=E($,"requirements.txt");if(S(Q))try{let J=N2(Q,"utf-8").match(Z);if(J)return`requirements.txt contains ${J[1]}`}catch{}return null}function Z_($,Z){let z=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let Q of z)if(Z.dependencies?.[Q]||Z.devDependencies?.[Q])return`${Q} dependency`}if(S(E($,"ios"))&&S(E($,"android")))return"ios/ + android/ dirs";return null}function z_($,Z){let z=E($,"Cargo.toml");if(S(z))try{let X=N2(z,"utf-8");if(/crate-type\s*=\s*\[[^\]]*"cdylib"/.test(X))return'Cargo.toml crate-type = ["cdylib"]';if(/wasm-bindgen|wasm-pack/i.test(X))return"Cargo.toml wasm-bindgen/wasm-pack"}catch{}let Q=E($,"build.zig");if(S(Q))try{let X=N2(Q,"utf-8");if(/\.wasm\b|wasm32|setOutputFormat\(\.wasm/i.test(X))return"build.zig wasm target"}catch{}if(Z?.keywords?.some((X)=>/^wasm(?:-|$)|webassembly/i.test(X)))return'package.json keywords contains "wasm"';return null}function Q_($,Z){if(!S(E($,"index.html")))return null;if(Z?.dependencies||Z?.devDependencies){let z={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((X)=>z[X]))return null}return"index.html (vanilla, no frontend framework)"}function X_($,Z){if(Z?.name&&/specification|^@.*\/spec/i.test(Z.name))return`package name "${Z.name}" → documentation`;if(Z?.keywords?.some((z)=>/^(specification|format-spec|standard)$/i.test(z)))return'package keywords contains "specification"';if(Z?.bin)return null;if(Z?.files&&Z.files.length>0){let z=/^(dist|src|lib|build|bin)(\/|$)|\/(dist|src|lib|build|bin)(\/|$)|(\.|\/)(js|ts|tsx|jsx|mjs|cjs|py|rs|go)$/,Q=Z.files.some((J)=>z.test(J)),X=Z.files.some((J)=>/\.(md|MD)$|examples?\//.test(J)||J==="README.md"||J==="docs"||J==="docs/");if(!Q&&X)return"package.json files = docs/examples only (no source)"}return null}function J_($,Z,z){let Q=z.find((X)=>X.slug==="astro"||X.slug==="gatsby");if(Q)return`${Q.name} (static-site framework)`;if(Z?.keywords?.some((X)=>/^(website|marketing|landing|brochure|portfolio)$/i.test(X)))return'package keywords contains "website"/"marketing"/"landing"';return null}function Y_($,Z){if(!Z)return null;let z={...Z.dependencies??{},...Z.devDependencies??{}},Q=["@clerk/nextjs","@clerk/clerk-react","next-auth","@auth/core","auth0","@auth0/nextjs-auth0"],X=["stripe","@stripe/stripe-js","lemonsqueezy"],J=Q.some((W)=>z[W]),Y=X.some((W)=>z[W]);if(J&&Y)return"auth + payment dependencies";return null}function W_($,Z,z){if(Z?.keywords?.some((J)=>/mcpaas/i.test(J)))return'package keywords contains "mcpaas"';if(Z?.name&&/mcpaas/i.test(Z.name))return`package name "${Z.name}" → mcpaas`;let Q=z.some((J)=>J.slug==="mcp"),X=z.some((J)=>J.category==="database");if(Q&&X&&Z?.dependencies&&Object.keys(Z.dependencies).length>10)return"MCP + database + complex deps (platform shape)";return null}function U_($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||S(E($,"pnpm-workspace.yaml"))))return null;return"private workspace + multi-package"}var G_=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"]),AW=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,V_=new Set(["frontend","backend","database","css","ui","state"]);function H_($){if(S(E($,"pyproject.toml"))||S(E($,"manage.py"))||S(E($,"setup.py"))||x5($,"requirements*.txt"))return!0;if(S(E($,"go.mod")))return!0;if(S(E($,"Cargo.toml")))return!0;if(S(E($,"Gemfile")))return!0;if(S(E($,"pom.xml"))||x5($,"build.gradle*"))return!0;if(_$($).length>0)return!0;let Z=D2($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function k5($){let Z;try{Z=m3($,{withFileTypes:!0})}catch{return[]}let z=[];for(let Q of Z){if(!Q.isDirectory()||Q.name.startsWith(".")||G_.has(Q.name))continue;let X=E($,Q.name);if(!H_(X))continue;let J=y5(X);if(!J)continue;let Y=b5(X).filter((V)=>V_.has(V.category)),W=Y.find((V)=>V.category==="frontend"),U=Y.find((V)=>V.category==="backend"),G=W??U??Y[0]??null;z.push({name:Q.name,language:J,topFramework:G?.name??null,frontend:!!W,backend:!!U||AW.test(J),hasFramework:!!G,appRoot:S(E(X,"manage.py"))||S(E(X,"config.ru"))||S(E(X,"bin/rails"))||S(E(X,"artisan"))})}return z}function q_($,Z){if(Z?.workspaces||S(E($,"pnpm-workspace.yaml")))return null;let z=k5($),Q=new Set(z.map((X)=>X.language));if(z.length<2||Q.size<2)return null;if(!z.some((X)=>X.frontend)||!z.some((X)=>X.backend))return null;return`polyglot: ${z.map((X)=>`${X.name}/ (${X.language})`).join(", ")}`}function RW($){let Z=k5($);if(Z.length<2)return null;let z=(Y)=>(Y.appRoot?2:0)+(AW.test(Y.language)?2:0)+(Y.hasFramework?1:0)+(Y.frontend?0.5:0),Q=[...Z].sort((Y,W)=>z(W)-z(Y)),X=new Set,J=[];for(let Y of Q){if(X.has(Y.language))continue;X.add(Y.language);let W=Y.frontend?"frontend":Y.backend?"backend":"service";J.push(Y.topFramework?`${Y.language} (${Y.topFramework} · ${W})`:`${Y.language} (${W})`)}return J.join("; ")}function D2($){let Z=E($,"package.json");if(!S(Z))return null;try{return JSON.parse(N2(Z,"utf-8"))}catch{return null}}function x5($,Z){if(!Z.includes("*"))return S(E($,Z));let z=Z.split("/");if(z.length===1){let W=Z.split("*")[0];try{return m3($).some((U)=>U.startsWith(W))}catch{return!1}}let Q=E($,...z.slice(0,-1)),X=z[z.length-1],J=X.split("*")[0],Y=X.split("*")[1]||"";try{return m3(Q).some((W)=>W.startsWith(J)&&W.endsWith(Y))}catch{return!1}}function K_($,Z,z){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return x5(z,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!x5(z,$.pattern))return!1;try{let Q=E(z,$.pattern);if(!S(Q))return!1;return N2(Q,"utf-8").toLowerCase().includes($.key.toLowerCase())}catch{return!1}}default:return!1}}function b5($){let Z=D2($);return JW.map((z)=>{let X=z.signals.filter((J)=>K_(J,Z,$)).length/z.signals.length;return{name:z.name,slug:z.slug,category:z.category,confidence:X}}).filter((z)=>z.confidence>0).sort((z,Q)=>Q.confidence-z.confidence)}function y5($){let Z=D2($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(S(E($,"tsconfig.json")))return"TypeScript";if(S(E($,"Cargo.toml")))return"Rust";if(S(E($,"go.mod")))return"Go";if(_$($).length>0)return"C#";if(S(E($,"pyproject.toml"))||S(E($,"setup.py")))return"Python";if(S(E($,"Gemfile")))return"Ruby";if(g3($)){let z=o1($);if(z)return z.mainLanguage==="Java/Kotlin"?"Kotlin":z.mainLanguage;return"Java"}if(S(E($,"Package.swift")))return"Swift";if(S(E($,"build.zig")))return"Zig";if(S(E($,"pubspec.yaml")))return"Dart";if(Z)return"JavaScript";return""}function CW($){let Z=D2($),z=b5($),Q=[],X=X_($,Z);if(X)return Q.push(X),{type:"documentation",found:Q};let J=tC($,Z);if(J)return Q.push(J),{type:"sdk",found:Q};let Y=eC($);if(Y)return Q.push(Y),{type:"extension",found:Q};let W=W_($,Z,z);if(W)return Q.push(W),{type:"mcpaas",found:Q};let U=Y_($,Z);if(U)return Q.push(U),{type:"saas",found:Q};let G=z_($,Z);if(G)return Q.push(G),{type:"wasm",found:Q};let V=C5($);if(V)return Q.push(V.found),{type:V.appType,found:Q};let H=P5($);if(H)return Q.push(H.found),{type:H.appType,found:Q};let q=w5($);if(q)return Q.push(q.found),{type:q.appType,found:Q};let K=o1($);if(K)return Q.push(K.found),{type:K.appType,found:Q};let L=S5($);if(L)return Q.push(L.found),{type:L.appType,found:Q};let B=z4($);if(B)return Q.push(B.found),{type:B.appType,found:Q};let N=Z_($,Z);if(N)return Q.push(N),{type:"mobile",found:Q};if(z.some((t)=>t.slug==="mcp"))return Q.push("MCP SDK signal"),{type:"mcp",found:Q};if(Z?.bin)return Q.push("package.json bin"),{type:"cli",found:Q};if(aC($))return Q.push("Cargo.toml [[bin]]"),{type:"cli",found:Q};if(S(E($,"build.zig"))){if(Q.push("build.zig"),S(E($,"src/main.zig")))return Q.push("src/main.zig"),{type:"cli",found:Q};if(S(E($,"src/root.zig")))return Q.push("src/root.zig"),{type:"library",found:Q}}let w=z.some((t)=>t.slug==="svelte"||t.slug==="sveltekit");if(Z?.private===!0&&(S(E($,"pnpm-workspace.yaml"))||Z?.workspaces!==void 0)&&w)return Q.push("private workspace","Svelte"),{type:"framework",found:Q};if(w)return Q.push("Svelte/SvelteKit"),{type:"svelte",found:Q};let x=z.some((t)=>t.category==="frontend"),v=z.some((t)=>t.category==="backend");if(Z?.private&&(Z.workspaces||S(E($,"pnpm-workspace.yaml")))&&x&&v)return Q.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:Q};let k=U_($,Z);if(k)return Q.push(k),{type:"monorepo-root",found:Q};let l=J_($,Z,z);if(l)return Q.push(l),{type:"website",found:Q};if(z.some((t)=>t.slug==="nextjs"||t.slug==="nuxt"))return Q.push(z.find((t)=>t.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:Q};let u=z.some((t)=>t.category==="frontend"),D0=z.some((t)=>t.category==="backend");if(u&&D0)return Q.push("frontend framework","backend framework"),{type:"fullstack",found:Q};if(u)return Q.push("frontend framework"),{type:"frontend",found:Q};if(D0)return Q.push("backend framework"),{type:"backend",found:Q};let k0=$_($);if(k0)return Q.push(k0),{type:"data-science",found:Q};let _=Q_($,Z);if(_)return Q.push(_),{type:"html",found:Q};let i=q_($,Z);if(i)return Q.push(i),{type:"fullstack",found:Q};if(Z?.main&&!Z?.bin)return Q.push("package.json main (no bin)"),{type:"library",found:Q};return Q.push(I$),{type:"library",found:Q}}function _W($){if(S(E($,"bunfig.toml")))return"Bun";if(S(E($,"deno.json"))||S(E($,"deno.jsonc")))return"Deno";if(D2($))return"Node.js";if(S(E($,"Cargo.toml")))return"Rust";if(S(E($,"go.mod")))return"Go";if(_$($).length>0)return".NET";if(S(E($,"pubspec.yaml")))return"Dart";return""}var B_=new Set(["npm","pnpm","yarn","bun"]);function M_($){let Z=D2($)?.packageManager;if(typeof Z!=="string")return"";let z=/^([a-z]+)@/i.exec(Z.trim())?.[1]?.toLowerCase()??"";return B_.has(z)?z:""}function L_($){if(S(E($,"pubspec.yaml")))return"pub";if(S(E($,"go.mod")))return"go modules";if(_$($).length>0)return"NuGet";if(S(E($,"pom.xml")))return"maven";return["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"].some((z)=>S(E($,z)))?"gradle":""}var N_=[["bun.lockb","bun"],["bun.lock","bun"],["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"]];function FW($){return L_($)||M_($)||(N_.find(([Z])=>S(E($,Z)))?.[1]??"")}function PW($){if(S(E($,".github/workflows")))return"GitHub Actions";if(S(E($,".gitlab-ci.yml")))return"GitLab CI";if(S(E($,".circleci")))return"CircleCI";if(S(E($,"Jenkinsfile")))return"Jenkins";return null}function EW($){if(S(E($,"vercel.json")))return"Vercel";if(S(E($,"netlify.toml")))return"Netlify";if(S(E($,"wrangler.toml")))return"Cloudflare";if(S(E($,"fly.toml")))return"Fly.io";if(S(E($,"render.yaml")))return"Render";return null}function wW($){let Z=E($,"svelte.config.js");if(!S(Z))return null;try{let Q=N2(Z,"utf-8").match(/@sveltejs\/adapter-(\w+)/);if(Q){let X=Q[1];switch(X){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 X}}return null}catch{return null}}function jW($){let Z=D2($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return"Vite";if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(S(E($,"tsconfig.json"))&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function v5($){return["package.json","Cargo.toml","pyproject.toml","go.mod","build.zig","build.zig.zon","src/index.ts","src/index.js","src/main.ts","src/cli.ts","src/main.rs","src/lib.rs","src/main.zig","src/root.zig","src/__init__.py","main.py","__main__.py","main.go","cmd/main.go","README.md","SPECIFICATION.md","BINARY-FORMAT.md","tsconfig.json","wrangler.toml","vercel.json"].filter((z)=>S(E($,z)))}function g5($,Z){let z={};if(Z?.scripts){for(let Q of["build","test","lint","dev","start"])if(Z.scripts[Q]){let X=S(E($,"bun.lock"))||S(E($,"bun.lockb"))?"bun run":"npm run";z[Q]=`${X} ${Q}`}}if(S(E($,"Cargo.toml"))){if(!z.build)z.build="cargo build --release";if(!z.test)z.test="cargo test";if(!z.lint&&D_($))z.lint="cargo clippy"}if(S(E($,"build.zig"))){if(!z.build)z.build="zig build";if(!z.test&&/\.step\(\s*"test"/.test(c3($,"build.zig")))z.test="zig build test"}if(S(E($,"go.mod"))){if(!z.build)z.build="go build ./...";if(!z.test)z.test="go test ./..."}if(!z.test&&O_($))z.test="pytest";return z}function c3($,Z){try{return N2(E($,Z),"utf-8")}catch{return""}}function D_($){if(S(E($,"clippy.toml"))||S(E($,".clippy.toml")))return!0;return/^\s*\[(workspace\.)?lints\.clippy\]/m.test(c3($,"Cargo.toml"))}function O_($){if(S(E($,"pytest.ini"))||S(E($,"conftest.py")))return!0;return["pyproject.toml","setup.cfg","tox.ini"].some((Z)=>/\bpytest\b/.test(c3($,Z)))}function SW($,Z,z,Q){let X=[];if(Q&&Q!=="Unknown")X.push(Q);let J=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let Y of z)if(J.has(Y.category))X.push(Y.name);if(S(E($,"bunfig.toml")))X.push("Bun");else if(S(E($,"deno.json"))||S(E($,"deno.jsonc")))X.push("Deno");if(X.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let W of Y)if(!X.some((U)=>U.toLowerCase().includes(W.toLowerCase())))X.push(W)}return X}function I_($){let Z=$?.dependencies?.svelte??$?.devDependencies?.svelte,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?NaN:Number(z)}function xW($){return p3($).data}function p3($){let Z=D2($),z=b5($),Q=CW($),X=Q.type,J=Q.found.some((s)=>s.startsWith("polyglot:")),Y=J&&RW($)||y5($),W=_W($),U=FW($),G=PW($),V=EW($),H=jW($),q=z.find((s)=>s.category==="frontend"),K=z.find((s)=>s.category==="css"),L=z.find((s)=>s.category==="ui"),B=z.find((s)=>s.category==="state"),N=z.find((s)=>s.category==="backend"),T=z.find((s)=>s.category==="database"),w=(s)=>g6(X,s)??g6("library",s)===!0,j=X==="framework",x=z.some((s)=>s.slug==="svelte"||s.slug==="sveltekit"),v=j&&x?"svelte":j?null:null,k=X==="svelte"||v==="svelte",l=k?wW($):null,R=k&&z.some((s)=>s.slug==="sveltekit"),u={},D0=z0.filter((s)=>s.path.startsWith("stack."));for(let s of D0){let Q0=s.path.replace("stack.","");switch(Q0){case"frontend":u[Q0]=q?.name??"";break;case"css_framework":u[Q0]=K?.name??"";break;case"ui_library":u[Q0]=L?.name??"";break;case"state_management":u[Q0]=B?.name??(k&&I_(Z)>=5?"Runes":"");break;case"backend":u[Q0]=k?R?"SvelteKit":N?.name??"":N?.name??"";break;case"api_type":u[Q0]=R?"Server Routes":"";break;case"runtime":u[Q0]=W;break;case"database":u[Q0]=T?.name??"";break;case"connection":u[Q0]=T?.name??"";break;case"hosting":if(k&&l)u[Q0]=l;else u[Q0]=V??"";break;case"build":u[Q0]=R?"Vite":H??"";break;case"cicd":u[Q0]=G??"";break;case"package_manager":u[Q0]=U;break;default:u[Q0]="";break}}let k0={};for(let s of D0){let Q0=s.path.replace("stack.","");k0[Q0]=w(s)?u[Q0]:"slotignored"}let _={},i=z0.filter((s)=>s.path.startsWith("monorepo."));for(let s of i){let Q0=s.path.replace("monorepo.","");if(!w(s))_[Q0]="slotignored";else _[Q0]=""}let t={name:Z?.name??$.split("/").pop()??"project",goal:J?"":Z?.description??"",main_language:Y,type:X};if(j&&v)t.framework=v;let G2=SW($,Z,z,J?y5($):Y);if(J){for(let s of k5($))for(let Q0 of[s.language,s.topFramework])if(Q0&&!G2.includes(Q0))G2.push(Q0)}let RQ=v5($),CQ=g5($,Z),K8={faf_version:H6,project:t,stack:k0,human_context:{who:"",what:J?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:_,_meta:{found:Q.found}};if(G2.length>0)K8.tech_stack=G2;if(RQ.length>0)K8.key_files=RQ;if(Object.keys(CQ).length>0)K8.commands=CQ;return{data:K8,facts:u}}import{existsSync as A_,readFileSync as R_}from"fs";import{join as C_}from"path";var kW={MIN_LENGTH:8,MAX_LENGTH:280},T_=[/^(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 O2($){let Z=$.trim();if(Z.length<kW.MIN_LENGTH)return!1;if(Z.length>kW.MAX_LENGTH)return!1;if(T_.some((z)=>z.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
|
|
236
|
+
`).length>4)return!1;return!0}function __($){let Z=$.split(`
|
|
237
|
+
`),z=0;while(z<Z.length&&/^(#\s|$)/.test(Z[z].trim()))z++;while(z<Z.length){let Q=Z[z].trim();if(/^\[!\[/.test(Q)){z++;continue}if(/^!\[/.test(Q)){z++;continue}if(/^<img\s/i.test(Q)){z++;continue}if(Q===""){z++;continue}break}return Z.slice(z).join(`
|
|
238
|
+
`)}function F_($){let z=__($).split(`
|
|
239
|
+
`),Q=[];for(let X of z){let J=X.trim();if(J===""){if(Q.length>0)break;continue}if(/^(#|>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(J))break;if(/^\*\*[^*]+\*\*\s*$/.test(J)&&Q.length===0)continue;Q.push(J)}if(Q.length===0)return null;return Q.join(" ").trim()}function m6($,Z){let z=$.split(`
|
|
240
|
+
`),Q=0;while(Q<z.length){let J=z[Q].trim().match(/^(#{1,6})\s+(.+)$/);if(J&&Z.test(J[2])){let Y=J[1].length,W=[];Q++;while(Q<z.length){let U=z[Q].trim(),G=U.match(/^(#{1,6})\s+/);if(G&&G[1].length<=Y)break;if(U===""){if(W.length>0)break;Q++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(U))break;W.push(U),Q++}if(W.length===0)return null;return W.join(" ").trim()}Q++}return null}function P_($){let Z=m6($,/^(use\s+cases?|goal)\b/i);if(Z&&O2(Z))return Z;let z=F_($);if(z&&O2(z))return z;return}function E_($){let Z=m6($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&O2(Z))return Z;return}function w_($){let Z=m6($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&O2(Z))return Z;return}function j_($){let Z=m6($,/^(why|motivation|problem|rationale)\b/i);if(Z&&O2(Z))return Z;return}function S_($){let Z=m6($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&O2(Z))return Z;return}function x_($){let Z=m6($,/^(status|history|timeline|since|launched)\b/i);if(Z&&O2(Z))return Z;return}function k_($){let Z=m6($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&O2(Z))return Z;return}function l3($){let Z=["README.md","README.MD","Readme.md","readme.md"],z=null;for(let K of Z){let L=C_($,K);if(A_(L)){z=L;break}}if(!z)return{};let Q;try{Q=R_(z,"utf-8")}catch{return{}}Q=Q.replace(/<!--[\s\S]*?-->/g,"");let X={},J=P_(Q);if(J)X.project={goal:J};let Y={},W=E_(Q);if(W)Y.what=W;let U=w_(Q);if(U)Y.who=U;let G=j_(Q);if(G)Y.why=G;let V=S_(Q);if(V)Y.where=V;let H=x_(Q);if(H)Y.when=H;let q=k_(Q);if(q)Y.how=q;if(Object.keys(Y).length>0)X.human_context=Y;return X}import{existsSync as b_,readFileSync as y_}from"fs";import{join as v_}from"path";function g_($,Z){let z=$.split(`
|
|
241
|
+
`),Q=!1;for(let X of z){let J=X.trim();if(/^\[/.test(J)){Q=J==="[package]";continue}if(!Q)continue;let Y=J.match(new RegExp(`^${Z}\\s*=\\s*(.+)$`));if(Y){let W=Y[1].trim();W=W.replace(/\s*#.*$/,"").trim();let U=W.match(/^"((?:[^"\\]|\\.)*)"$/)||W.match(/^'((?:[^'\\]|\\.)*)'$/);if(U)return U[1];return W}}return null}function d3($){let Z=v_($,"Cargo.toml");if(!b_(Z))return{};let z;try{z=y_(Z,"utf-8")}catch{return{}}let Q=g_(z,"description");if(Q&&O2(Q))return{project:{goal:Q}};return{}}import{readFileSync as h_,readdirSync as f_}from"fs";import{join as bW}from"path";var u_=[{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"}],m_=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function c_($){let Z=[],z=(Q,X)=>{let J;try{J=f_(Q,{withFileTypes:!0})}catch{return}for(let Y of J)if(Y.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(Y.name))Z.push(bW(Q,Y.name));else if(Y.isDirectory()&&X>0&&!Y.name.startsWith(".")&&!m_.has(Y.name))z(bW(Q,Y.name),X-1)};return z($,1),Z}function Q4($){return[...$].join(" · ")}function i3($){let Z=c_($);if(Z.length===0)return{};let z={database:new Set,cache:new Set,search:new Set,storage:new Set,runtime:new Set};for(let X of Z){let J;try{J=h_(X,"utf-8")}catch{continue}for(let Y of J.matchAll(/^\s*image:\s*["']?([^\s"'#]+)/gm)){let W=Y[1].toLowerCase(),U=W.replace(/:[^/]*$/,"").split("/").pop()??W,G=W.replace(/:[^/]*$/,"");for(let{re:V,slot:H,label:q}of u_)if(V.test(U)||V.test(G))z[H].add(q)}}let Q={};if(z.database.size)Q.database=Q4(z.database);if(z.cache.size)Q.cache=Q4(z.cache);if(z.search.size)Q.search=Q4(z.search);if(z.storage.size)Q.storage=Q4(z.storage);if(z.runtime.size)Q.runtime=`Docker Compose (${Q4(z.runtime)})`;if(Object.keys(Q).length===0&&!z.runtime.size)return{stack:{hosting:"Docker Compose"}};return Q.hosting="Docker Compose",{stack:Q}}import{existsSync as h5,readFileSync as p_,readdirSync as l_}from"fs";import{join as X4}from"path";var d_=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),i_=[{file:"Makefile",runner:"make",targets:($)=>[...$.matchAll(/^([a-zA-Z][\w-]*)\s*:(?!=)/gm)].map((Z)=>Z[1])},{file:"justfile",runner:"just",targets:($)=>[...$.matchAll(/^([a-zA-Z][\w-]*)\s*(?:\([^)]*\))?\s*:/gm)].map((Z)=>Z[1])},{file:"Taskfile.yml",runner:"task",targets:($)=>{let Z=$.indexOf("tasks:");if(Z===-1)return[];return[...$.slice(Z).matchAll(/^\s{2}([a-zA-Z][\w-]*):/gm)].map((z)=>z[1])}}];function n3($,Z){for(let z of Z){let Q=$.find((X)=>z.test(X));if(Q)return Q}return null}function n_($){let Z=[$];try{for(let z of l_($,{withFileTypes:!0}))if(z.isDirectory()&&!z.name.startsWith(".")&&!d_.has(z.name))Z.push(X4($,z.name))}catch{}return Z}function r_($){let Z=0;if(h5(X4($,"manage.py"))||h5(X4($,"pyproject.toml"))||h5(X4($,"Gemfile")))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function r3($){let Z=[];for(let Q of n_($)){let X=Q===$,J=X?"":`cd ${Q.slice($.length+1)} && `;for(let Y of i_){let W=X4(Q,Y.file);if(!h5(W))continue;let U;try{U=p_(W,"utf-8")}catch{continue}let G=Y.targets(U);if(G.length===0)continue;let V={},H=n3(G,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),q=n3(G,[/^build$/i,/^compile$/i,/^build/i]),K=n3(G,[/^check-all$/i,/^check$/i,/^lint$/i,/^lint/i,/^fmt$/i,/^format$/i]);if(H)V.test=`${J}${Y.runner} ${H}`;if(q)V.build=`${J}${Y.runner} ${q}`;if(K)V.lint=`${J}${Y.runner} ${K}`;if(Object.keys(V).length===0)continue;Z.push({score:Object.keys(V).length+(X?10:r_(Q)),commands:V})}}let z=Z.sort((Q,X)=>X.score-Q.score)[0];return z?{commands:z.commands}:{}}import{existsSync as s_}from"fs";import{join as o_}from"path";var a_=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function s3($){for(let Z of a_)if(s_(o_($,Z)))return{security:{secrets:".env",example:Z}};return{}}function t_($,Z){let z={project:{...Z.project??{},...$.project??{}},human_context:{...Z.human_context??{},...$.human_context??{}},stack:{...Z.stack??{},...$.stack??{}},commands:{...Z.commands??{},...$.commands??{}},security:{...Z.security??{},...$.security??{}}};for(let Q of["project","human_context","stack","commands","security"])if(z[Q]&&Object.keys(z[Q]).length===0)delete z[Q];return z}function o3($){return[l3($),d3($),i3($),r3($),s3($)].reduce(t_,{})}import{readdirSync as yW,readFileSync as e_,statSync as vW}from"fs";import{join as f5,extname as $F,resolve as ZF}from"path";var a3={"package.json":{frameworks:["Node.js","JavaScript","TypeScript"],slots:{packageManager:"npm/yarn/pnpm",mainLanguage:"JavaScript/TypeScript"},priority:35,intelligence:"ultra-high"},"README.md":{frameworks:[],slots:{},priority:25,intelligence:"high"},"requirements.txt":{frameworks:["Python"],slots:{packageManager:"pip",mainLanguage:"Python"},priority:35,intelligence:"ultra-high"},Pipfile:{frameworks:["Python"],slots:{packageManager:"pipenv",mainLanguage:"Python"},priority:35,intelligence:"ultra-high"},"pyproject.toml":{frameworks:["Python"],slots:{mainLanguage:"Python",runtime:"Python"},priority:36,intelligence:"ultra-high"},Gemfile:{frameworks:["Ruby"],slots:{packageManager:"bundler",mainLanguage:"Ruby"},priority:35,intelligence:"ultra-high"},"Gemfile.lock":{frameworks:["Ruby"],slots:{packageManager:"bundler",mainLanguage:"Ruby"},priority:34,intelligence:"high"},"composer.json":{frameworks:["PHP","Laravel","Symfony"],slots:{packageManager:"composer",mainLanguage:"PHP"},priority:35,intelligence:"ultra-high"},"Cargo.toml":{frameworks:["Rust"],slots:{packageManager:"cargo",mainLanguage:"Rust",buildTool:"cargo"},priority:36,intelligence:"ultra-high"},"go.mod":{frameworks:["Go"],slots:{packageManager:"go modules",mainLanguage:"Go",buildTool:"go build"},priority:36,intelligence:"ultra-high"},"Package.swift":{frameworks:["Swift"],slots:{packageManager:"spm",mainLanguage:"Swift",buildTool:"swift build"},priority:36,intelligence:"ultra-high"},"*.csproj":{frameworks:["C#",".NET"],slots:{packageManager:"NuGet",mainLanguage:"C#",buildTool:"dotnet"},priority:36,intelligence:"ultra-high"},"pubspec.yaml":{frameworks:["Dart"],slots:{packageManager:"pub",mainLanguage:"Dart"},priority:35,intelligence:"ultra-high"},"pom.xml":{frameworks:["Java"],slots:{packageManager:"maven",mainLanguage:"Java",buildTool:"maven"},priority:35,intelligence:"ultra-high"},"build.gradle":{frameworks:["Java","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Java",buildTool:"gradle"},priority:35,intelligence:"ultra-high"},"settings.gradle":{frameworks:["Java","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Java",buildTool:"gradle"},priority:34,intelligence:"high"},"settings.gradle.kts":{frameworks:["Kotlin","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Kotlin",buildTool:"gradle"},priority:34,intelligence:"high"},"next.config.js":{frameworks:["Next.js"],slots:{framework:"Next.js",buildTool:"Next.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"next.config.mjs":{frameworks:["Next.js"],slots:{framework:"Next.js",buildTool:"Next.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"next.config.ts":{frameworks:["Next.js 13+"],slots:{framework:"Next.js 13+",buildTool:"Next.js",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.js":{frameworks:["Nuxt 2"],slots:{framework:"Nuxt 2",buildTool:"Nuxt",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.ts":{frameworks:["Nuxt 3"],slots:{framework:"Nuxt 3",buildTool:"Nuxt",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"svelte.config.js":{frameworks:["SvelteKit"],slots:{framework:"SvelteKit",buildTool:"Vite",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"angular.json":{frameworks:["Angular"],slots:{framework:"Angular",buildTool:"Angular CLI",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"manifest.json":{frameworks:["Chrome Extension","Browser Extension"],slots:{framework:"Chrome Extension",runtime:"Chrome/Browser",mainLanguage:"JavaScript",hosting:"Chrome Web Store",apiType:"Chrome APIs"},priority:35,intelligence:"ultra-high",confirmWith:["popup.html","background.js","content.js"]},"vue.config.js":{frameworks:["Vue"],slots:{framework:"Vue",buildTool:"Vue CLI",mainLanguage:"JavaScript"},priority:30,intelligence:"high"},"remix.config.js":{frameworks:["Remix"],slots:{framework:"Remix",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"gatsby-config.js":{frameworks:["Gatsby"],slots:{framework:"Gatsby",buildTool:"Gatsby",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"gatsby-config.ts":{frameworks:["Gatsby"],slots:{framework:"Gatsby",buildTool:"Gatsby",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"astro.config.mjs":{frameworks:["Astro"],slots:{framework:"Astro",buildTool:"Vite",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"redwood.toml":{frameworks:["RedwoodJS"],slots:{framework:"RedwoodJS",buildTool:"Webpack",mainLanguage:"JavaScript/TypeScript",server:"Node.js",database:"Prisma"},priority:30,intelligence:"high"},"blitz.config.ts":{frameworks:["Blitz.js"],slots:{framework:"Blitz.js",buildTool:"Next.js",mainLanguage:"TypeScript",server:"Node.js",database:"Prisma"},priority:30,intelligence:"high"},"qwik.config.ts":{frameworks:["Qwik"],slots:{framework:"Qwik",buildTool:"Vite",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"manage.py":{frameworks:["Django"],slots:{framework:"Django",backend:"Django",mainLanguage:"Python",server:"Django",apiType:"Django Views"},priority:30,intelligence:"high"},artisan:{frameworks:["Laravel"],slots:{framework:"Laravel",backend:"Laravel",mainLanguage:"PHP",server:"PHP",apiType:"Laravel Routes"},priority:30,intelligence:"high"},"mix.exs":{frameworks:["Phoenix","Elixir"],slots:{framework:"Phoenix",backend:"Phoenix",mainLanguage:"Elixir",server:"BEAM"},priority:30,intelligence:"high"},"nest-cli.json":{frameworks:["NestJS"],slots:{framework:"NestJS",backend:"NestJS",mainLanguage:"TypeScript",server:"Node.js",apiType:"REST API"},priority:30,intelligence:"high"},"strapi.config.js":{frameworks:["Strapi"],slots:{backend:"Strapi",apiType:"REST API",server:"Node.js"},priority:30,intelligence:"high"},Dockerfile:{frameworks:["Docker"],slots:{},priority:30,intelligence:"high"},"docker-compose.yml":{frameworks:["Docker Compose"],slots:{hosting:"Docker"},priority:30,intelligence:"high"},"docker-compose.yaml":{frameworks:["Docker Compose"],slots:{hosting:"Docker"},priority:30,intelligence:"high"},"kubernetes.yml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes"},priority:30,intelligence:"high"},"k8s.yaml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes"},priority:30,intelligence:"high"},"vercel.json":{frameworks:["Vercel"],slots:{hosting:"Vercel",cicd:"Vercel"},priority:30,intelligence:"high"},"netlify.toml":{frameworks:["Netlify"],slots:{hosting:"Netlify",cicd:"Netlify"},priority:30,intelligence:"high"},"render.yaml":{frameworks:["Render"],slots:{hosting:"Render",cicd:"Render"},priority:30,intelligence:"high"},"fly.toml":{frameworks:["Fly.io"],slots:{hosting:"Fly.io",cicd:"Fly.io"},priority:30,intelligence:"high"},"railway.json":{frameworks:["Railway"],slots:{hosting:"Railway",cicd:"Railway"},priority:30,intelligence:"high"},"railway.toml":{frameworks:["Railway"],slots:{hosting:"Railway",cicd:"Railway"},priority:30,intelligence:"high"},"app.yaml":{frameworks:["Google App Engine"],slots:{hosting:"Google Cloud",cicd:"Google Cloud"},priority:30,intelligence:"high"},Procfile:{frameworks:["Heroku"],slots:{hosting:"Heroku",cicd:"Heroku"},priority:30,intelligence:"high"},"vite.config.js":{frameworks:["Vite"],slots:{buildTool:"Vite"},priority:25,intelligence:"medium"},"vite.config.ts":{frameworks:["Vite"],slots:{buildTool:"Vite",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"webpack.config.js":{frameworks:["Webpack"],slots:{buildTool:"Webpack"},priority:25,intelligence:"medium"},"rollup.config.js":{frameworks:["Rollup"],slots:{buildTool:"Rollup"},priority:25,intelligence:"medium"},"esbuild.config.js":{frameworks:["esbuild"],slots:{buildTool:"esbuild"},priority:25,intelligence:"medium"},"parcel.config.js":{frameworks:["Parcel"],slots:{buildTool:"Parcel"},priority:25,intelligence:"medium"},"snowpack.config.js":{frameworks:["Snowpack"],slots:{buildTool:"Snowpack"},priority:25,intelligence:"medium"},"tsconfig.json":{frameworks:["TypeScript"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"jsconfig.json":{frameworks:["JavaScript"],slots:{mainLanguage:"JavaScript"},priority:20,intelligence:"medium"},"babel.config.js":{frameworks:["Babel"],slots:{buildTool:"Babel"},priority:20,intelligence:"medium"},".babelrc":{frameworks:["Babel"],slots:{buildTool:"Babel"},priority:20,intelligence:"medium"},"jest.config.js":{frameworks:["Jest"],slots:{},priority:25,intelligence:"medium"},"jest.config.ts":{frameworks:["Jest"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"vitest.config.ts":{frameworks:["Vitest"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"cypress.config.js":{frameworks:["Cypress"],slots:{},priority:25,intelligence:"medium"},"playwright.config.ts":{frameworks:["Playwright"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"karma.conf.js":{frameworks:["Karma"],slots:{},priority:20,intelligence:"medium"},"mocha.opts":{frameworks:["Mocha"],slots:{},priority:20,intelligence:"medium"},".rspec":{frameworks:["RSpec"],slots:{mainLanguage:"Ruby"},priority:25,intelligence:"medium"},"pytest.ini":{frameworks:["Pytest"],slots:{mainLanguage:"Python"},priority:25,intelligence:"medium"},"phpunit.xml":{frameworks:["PHPUnit"],slots:{mainLanguage:"PHP"},priority:25,intelligence:"medium"},"schema.prisma":{frameworks:["Prisma"],slots:{database:"Prisma ORM",connection:"Prisma"},priority:25,intelligence:"medium"},"drizzle.config.ts":{frameworks:["Drizzle"],slots:{database:"Drizzle ORM",connection:"Drizzle",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"ormconfig.js":{frameworks:["TypeORM"],slots:{database:"TypeORM",connection:"TypeORM"},priority:25,intelligence:"medium"},"knexfile.js":{frameworks:["Knex.js"],slots:{database:"Knex.js",connection:"Knex.js"},priority:25,intelligence:"medium"},"sequelize.config.js":{frameworks:["Sequelize"],slots:{database:"Sequelize",connection:"Sequelize"},priority:25,intelligence:"medium"},"alembic.ini":{frameworks:["Alembic"],slots:{database:"Alembic",mainLanguage:"Python"},priority:25,intelligence:"medium"},".github/workflows":{frameworks:["GitHub Actions"],slots:{cicd:"GitHub Actions"},priority:25,intelligence:"medium"},".gitlab-ci.yml":{frameworks:["GitLab CI"],slots:{cicd:"GitLab CI"},priority:25,intelligence:"medium"},Jenkinsfile:{frameworks:["Jenkins"],slots:{cicd:"Jenkins"},priority:25,intelligence:"medium"},".circleci/config.yml":{frameworks:["CircleCI"],slots:{cicd:"CircleCI"},priority:25,intelligence:"medium"},".travis.yml":{frameworks:["Travis CI"],slots:{cicd:"Travis CI"},priority:25,intelligence:"medium"},"azure-pipelines.yml":{frameworks:["Azure DevOps"],slots:{cicd:"Azure DevOps"},priority:25,intelligence:"medium"},"bitbucket-pipelines.yml":{frameworks:["Bitbucket Pipelines"],slots:{cicd:"Bitbucket Pipelines"},priority:25,intelligence:"medium"},"tailwind.config.js":{frameworks:["Tailwind CSS"],slots:{cssFramework:"Tailwind CSS"},priority:20,intelligence:"medium"},"tailwind.config.ts":{frameworks:["Tailwind CSS"],slots:{cssFramework:"Tailwind CSS",mainLanguage:"TypeScript"},priority:20,intelligence:"medium"},"postcss.config.js":{frameworks:["PostCSS"],slots:{cssFramework:"PostCSS"},priority:20,intelligence:"medium"},"uno.config.ts":{frameworks:["UnoCSS"],slots:{cssFramework:"UnoCSS",mainLanguage:"TypeScript"},priority:20,intelligence:"medium"},"styled-components.config.js":{frameworks:["styled-components"],slots:{cssFramework:"styled-components",uiLibrary:"styled-components"},priority:20,intelligence:"medium"},"emotion.config.js":{frameworks:["Emotion"],slots:{cssFramework:"Emotion",uiLibrary:"Emotion"},priority:20,intelligence:"medium"},"metro.config.js":{frameworks:["React Native"],slots:{framework:"React Native",mainLanguage:"JavaScript"},priority:25,intelligence:"medium"},"expo.config.js":{frameworks:["Expo"],slots:{framework:"React Native",buildTool:"Expo"},priority:25,intelligence:"medium"},"app.json":{frameworks:["React Native","Expo"],slots:{framework:"React Native"},priority:20,intelligence:"medium",confirmWith:["expo"]},"capacitor.config.ts":{frameworks:["Capacitor"],slots:{framework:"Capacitor",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"ionic.config.json":{frameworks:["Ionic"],slots:{framework:"Ionic",uiLibrary:"Ionic"},priority:25,intelligence:"medium"},"nx.json":{frameworks:["Nx"],slots:{buildTool:"Nx"},priority:25,intelligence:"medium"},"turbo.json":{frameworks:["Turborepo"],slots:{buildTool:"Turborepo"},priority:25,intelligence:"medium"},"lerna.json":{frameworks:["Lerna"],slots:{buildTool:"Lerna"},priority:25,intelligence:"medium"},"rush.json":{frameworks:["Rush"],slots:{buildTool:"Rush"},priority:25,intelligence:"medium"},"pnpm-workspace.yaml":{frameworks:["pnpm workspaces"],slots:{packageManager:"pnpm",buildTool:"pnpm workspaces"},priority:25,intelligence:"medium"},"*.svelte":{frameworks:["Svelte","SvelteKit"],slots:{framework:"Svelte"},priority:15,intelligence:"low"},"*.vue":{frameworks:["Vue"],slots:{framework:"Vue"},priority:15,intelligence:"low"},"*.jsx":{frameworks:["React"],slots:{framework:"React",mainLanguage:"JavaScript"},priority:15,intelligence:"low"},"*.ts":{frameworks:["TypeScript"],slots:{mainLanguage:"TypeScript"},priority:15,intelligence:"low"},"*.tsx":{frameworks:["React","TypeScript"],slots:{framework:"React",mainLanguage:"TypeScript"},priority:15,intelligence:"low"},"*.py":{frameworks:["Python"],slots:{mainLanguage:"Python"},priority:15,intelligence:"low"},"*.rb":{frameworks:["Ruby"],slots:{mainLanguage:"Ruby"},priority:15,intelligence:"low"},"*.php":{frameworks:["PHP"],slots:{mainLanguage:"PHP"},priority:15,intelligence:"low"},"*.java":{frameworks:["Java"],slots:{mainLanguage:"Java"},priority:15,intelligence:"low"},"*.kt":{frameworks:["Kotlin"],slots:{mainLanguage:"Kotlin"},priority:15,intelligence:"low"},"*.swift":{frameworks:["Swift"],slots:{mainLanguage:"Swift"},priority:15,intelligence:"low"},"*.go":{frameworks:["Go"],slots:{mainLanguage:"Go"},priority:15,intelligence:"low"},"*.rs":{frameworks:["Rust"],slots:{mainLanguage:"Rust"},priority:15,intelligence:"low"},"*.dart":{frameworks:["Flutter","Dart"],slots:{mainLanguage:"Dart"},priority:15,intelligence:"low"},"*.ex":{frameworks:["Elixir"],slots:{mainLanguage:"Elixir"},priority:15,intelligence:"low"},"*.exs":{frameworks:["Elixir"],slots:{mainLanguage:"Elixir"},priority:15,intelligence:"low"},"*.scala":{frameworks:["Scala"],slots:{mainLanguage:"Scala"},priority:15,intelligence:"low"},"*.clj":{frameworks:["Clojure"],slots:{mainLanguage:"Clojure"},priority:15,intelligence:"low"},"*.lua":{frameworks:["Lua"],slots:{mainLanguage:"Lua"},priority:15,intelligence:"low"},"*.r":{frameworks:["R"],slots:{mainLanguage:"R"},priority:15,intelligence:"low"},"*.R":{frameworks:["R"],slots:{mainLanguage:"R"},priority:15,intelligence:"low"},"*.jl":{frameworks:["Julia"],slots:{mainLanguage:"Julia"},priority:15,intelligence:"low"},"*.nim":{frameworks:["Nim"],slots:{mainLanguage:"Nim"},priority:15,intelligence:"low"},"*.zig":{frameworks:["Zig"],slots:{mainLanguage:"Zig"},priority:15,intelligence:"low"},"build.zig":{frameworks:["Zig"],slots:{packageManager:"Zig Package Manager",mainLanguage:"Zig",buildTool:"zig build",build:"zig build"},priority:35,intelligence:"ultra-high"},"openapi.json":{frameworks:["OpenAPI"],slots:{apiType:"REST API"},priority:30,intelligence:"high"},"openapi.yaml":{frameworks:["OpenAPI"],slots:{apiType:"REST API"},priority:30,intelligence:"high"},"swagger.json":{frameworks:["Swagger"],slots:{apiType:"REST API"},priority:30,intelligence:"high"},"graphql.schema":{frameworks:["GraphQL"],slots:{apiType:"GraphQL"},priority:30,intelligence:"high"},"schema.graphql":{frameworks:["GraphQL"],slots:{apiType:"GraphQL"},priority:30,intelligence:"high"},".graphqlconfig":{frameworks:["GraphQL"],slots:{apiType:"GraphQL"},priority:25,intelligence:"medium"},"redux.config.js":{frameworks:["Redux"],slots:{stateManagement:"Redux"},priority:20,intelligence:"medium"},"mobx.config.js":{frameworks:["MobX"],slots:{stateManagement:"MobX"},priority:20,intelligence:"medium"},"vuex.config.js":{frameworks:["Vuex"],slots:{stateManagement:"Vuex",framework:"Vue"},priority:20,intelligence:"medium"},"pinia.config.js":{frameworks:["Pinia"],slots:{stateManagement:"Pinia",framework:"Vue"},priority:20,intelligence:"medium"},"zustand.config.js":{frameworks:["Zustand"],slots:{stateManagement:"Zustand"},priority:20,intelligence:"medium"},".eslintrc.js":{frameworks:["ESLint"],slots:{},priority:15,intelligence:"low"},".eslintrc.json":{frameworks:["ESLint"],slots:{},priority:15,intelligence:"low"},".prettierrc":{frameworks:["Prettier"],slots:{},priority:15,intelligence:"low"},".prettierrc.json":{frameworks:["Prettier"],slots:{},priority:15,intelligence:"low"},"biome.json":{frameworks:["Biome"],slots:{},priority:15,intelligence:"low"},".editorconfig":{frameworks:["EditorConfig"],slots:{},priority:10,intelligence:"low"},"serverless.yml":{frameworks:["Serverless Framework"],slots:{hosting:"AWS Lambda/Azure/GCP",backend:"Serverless",apiType:"API Gateway"},priority:30,intelligence:"high"},"serverless.yaml":{frameworks:["Serverless Framework"],slots:{hosting:"AWS Lambda/Azure/GCP",backend:"Serverless",apiType:"API Gateway"},priority:30,intelligence:"high"},"sam.yaml":{frameworks:["AWS SAM"],slots:{hosting:"AWS Lambda",backend:"AWS SAM",cicd:"AWS SAM CLI"},priority:30,intelligence:"high"},"template.yaml":{frameworks:["AWS SAM","CloudFormation"],slots:{hosting:"AWS",backend:"AWS SAM/CloudFormation",cicd:"AWS"},priority:25,intelligence:"medium",confirmWith:["samconfig.toml"]},"amplify.yml":{frameworks:["AWS Amplify"],slots:{hosting:"AWS Amplify",backend:"AWS Amplify",cicd:"AWS Amplify"},priority:30,intelligence:"high"},Podfile:{frameworks:["CocoaPods","Swift"],slots:{packageManager:"CocoaPods",mainLanguage:"Swift/Objective-C"},priority:30,intelligence:"high"},"build.gradle.kts":{frameworks:["Kotlin","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Kotlin",buildTool:"gradle"},priority:35,intelligence:"ultra-high"},"*.ipynb":{frameworks:["Jupyter","Python"],slots:{mainLanguage:"Python",framework:"Jupyter Notebook"},priority:30,intelligence:"high"},MLproject:{frameworks:["MLflow"],slots:{mainLanguage:"Python",backend:"MLflow"},priority:30,intelligence:"high"},"dvc.yaml":{frameworks:["DVC","Data Version Control"],slots:{mainLanguage:"Python",cicd:"DVC Pipelines"},priority:30,intelligence:"high"},"dvc.lock":{frameworks:["DVC"],slots:{},priority:20,intelligence:"medium"},"wrangler.toml":{frameworks:["Cloudflare Workers","Cloudflare"],slots:{hosting:"Cloudflare Workers",backend:"Cloudflare Workers",runtime:"V8 Isolates"},priority:30,intelligence:"high"},"deno.json":{frameworks:["Deno"],slots:{runtime:"Deno",mainLanguage:"TypeScript",packageManager:"Deno"},priority:30,intelligence:"high"},"bun.lockb":{frameworks:["Bun"],slots:{runtime:"Bun",packageManager:"Bun",mainLanguage:"TypeScript/JavaScript"},priority:30,intelligence:"high"},"codecov.yml":{frameworks:["Codecov"],slots:{},priority:25,intelligence:"high"},"dependabot.yml":{frameworks:["Dependabot","GitHub"],slots:{},priority:25,intelligence:"high"},"renovate.json":{frameworks:["Renovate"],slots:{},priority:25,intelligence:"high"},Makefile:{frameworks:["Make","GNU Make"],slots:{buildTool:"Make"},priority:30,intelligence:"high"},"CMakeLists.txt":{frameworks:["CMake","C","C++"],slots:{buildTool:"CMake",mainLanguage:"C/C++"},priority:30,intelligence:"high"},"meson.build":{frameworks:["Meson","C","C++"],slots:{buildTool:"Meson",mainLanguage:"C/C++"},priority:30,intelligence:"high"},"*.c":{frameworks:["C"],slots:{mainLanguage:"C"},priority:30,intelligence:"high"},"*.cpp":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:30,intelligence:"high"},"*.cc":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:30,intelligence:"high"},"*.cxx":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:25,intelligence:"high"},"*.h":{frameworks:["C","C++"],slots:{mainLanguage:"C/C++"},priority:25,intelligence:"high"},"*.hpp":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:25,intelligence:"high"},"*.hxx":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:20,intelligence:"medium"},".env":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.example":{frameworks:[],slots:{},priority:25,intelligence:"high"},".env.local":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.development":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.production":{frameworks:[],slots:{},priority:20,intelligence:"medium"},"skaffold.yaml":{frameworks:["Skaffold","Kubernetes"],slots:{hosting:"Kubernetes",cicd:"Skaffold"},priority:30,intelligence:"high"},"Chart.yaml":{frameworks:["Helm","Kubernetes"],slots:{hosting:"Kubernetes"},priority:30,intelligence:"high"},"values.yaml":{frameworks:["Helm","Kubernetes"],slots:{hosting:"Kubernetes"},priority:25,intelligence:"high",confirmWith:["Chart.yaml"]},"pulumi.yaml":{frameworks:["Pulumi"],slots:{cicd:"Pulumi"},priority:30,intelligence:"high"},"Pulumi.yaml":{frameworks:["Pulumi"],slots:{cicd:"Pulumi"},priority:30,intelligence:"high"},"terragrunt.hcl":{frameworks:["Terragrunt","Terraform"],slots:{cicd:"Terragrunt"},priority:30,intelligence:"high"},"ansible.yml":{frameworks:["Ansible"],slots:{cicd:"Ansible"},priority:30,intelligence:"high"},"playbook.yml":{frameworks:["Ansible"],slots:{cicd:"Ansible"},priority:25,intelligence:"high"},"*.cs":{frameworks:["C#",".NET","Unity"],slots:{mainLanguage:"C#"},priority:30,intelligence:"high"},"*.m":{frameworks:["Objective-C","iOS"],slots:{mainLanguage:"Objective-C"},priority:25,intelligence:"high"},".nvmrc":{frameworks:["Node.js","nvm"],slots:{runtime:"Node.js"},priority:25,intelligence:"high"},".tool-versions":{frameworks:["asdf"],slots:{},priority:25,intelligence:"high"},".ruby-version":{frameworks:["Ruby","rbenv"],slots:{mainLanguage:"Ruby",runtime:"Ruby"},priority:25,intelligence:"high"},".python-version":{frameworks:["Python","pyenv"],slots:{mainLanguage:"Python",runtime:"Python"},priority:25,intelligence:"high"},".dockerignore":{frameworks:["Docker"],slots:{},priority:20,intelligence:"medium"},".gitattributes":{frameworks:["Git"],slots:{},priority:15,intelligence:"low"},".npmrc":{frameworks:["npm","Node.js"],slots:{packageManager:"npm"},priority:20,intelligence:"medium"},"sonar-project.properties":{frameworks:["SonarQube","SonarCloud"],slots:{},priority:25,intelligence:"high"},"*.fs":{frameworks:["F#",".NET"],slots:{mainLanguage:"F#"},priority:25,intelligence:"high"},"*.mm":{frameworks:["Objective-C++","iOS","macOS"],slots:{mainLanguage:"Objective-C++"},priority:25,intelligence:"high"},"build.zig.zon":{frameworks:["Zig"],slots:{mainLanguage:"Zig",packageManager:"Zig Package Manager",buildTool:"zig build"},priority:35,intelligence:"ultra-high"},"gleam.toml":{frameworks:["Gleam","BEAM","Erlang"],slots:{mainLanguage:"Gleam",runtime:"BEAM",packageManager:"Gleam"},priority:30,intelligence:"high"},"bunfig.toml":{frameworks:["Bun"],slots:{runtime:"Bun",packageManager:"Bun",buildTool:"Bun"},priority:30,intelligence:"high"},"mise.toml":{frameworks:["mise"],slots:{},priority:25,intelligence:"high"},".mise.toml":{frameworks:["mise"],slots:{},priority:25,intelligence:"high"},"manifest.toml":{frameworks:["Flox","Nix"],slots:{},priority:25,intelligence:"high",confirmWith:[".flox"]},justfile:{frameworks:["Just"],slots:{buildTool:"Just"},priority:25,intelligence:"high"},".pre-commit-config.yaml":{frameworks:["pre-commit"],slots:{},priority:25,intelligence:"high"},"CLAUDE.md":{frameworks:["Claude Code"],slots:{},priority:30,intelligence:"high",confirmWith:[".claude"]}};var zF=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),QF=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),XF={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"]},JF=[["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 YF($,Z){for(let[z,Q]of JF)if(z in $)return Q;return Z.length>0?"framework":"config"}function WF($){try{let Z=JSON.parse(e_($,"utf-8")),z=["background","content_scripts","action","browser_action","permissions"].some((Q)=>(Q in Z));if(typeof Z.manifest_version==="number"&&z)return"chrome";return"other"}catch{return"other"}}function UF($,Z){if(Z.isFile())return!0;if(!Z.isSymbolicLink())return!1;try{return vW(f5($,Z.name)).isFile()}catch{return!1}}function GF($,Z){if(Z.isDirectory())return!0;if(!Z.isSymbolicLink())return!1;try{return vW(f5($,Z.name)).isDirectory()}catch{return!1}}function VF($){let Z=[],z=ZF($),Q=new Set,X;try{X=yW(z,{withFileTypes:!0})}catch{return Z}for(let J of X){let Y=J.name;if(Y.endsWith(".xcodeproj")?!GF(z,J):!UF(z,J))continue;if(Y.toLowerCase().endsWith(".csproj")){let U=w5(z);if(U){let G={mainLanguage:"C#",packageManager:"NuGet",buildTool:"dotnet"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="mobile"&&U.framework)G.framework=U.framework;if(U.targetFramework)G.runtime=U.targetFramework;let V=U.framework?[U.framework,"C#",".NET"]:["C#",".NET"];Z.push({slots:G,priority:36,frameworks:V,fileName:Y})}continue}if(Y.endsWith(".xcodeproj")){let U=z4(z);if(U){let G={mainLanguage:"Swift",packageManager:U.packageManager==="spm"?"spm":"Xcode",buildTool:U.packageManager.includes("spm")?"swift build":"xcodebuild"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="app"&&U.framework)G.framework=U.framework;let V=U.framework?[U.framework,"Swift"]:["Swift"];Z.push({slots:G,priority:36,frameworks:V,fileName:Y})}continue}let W=a3[Y];if(!W)continue;if(Y==="manifest.json"&&WF(f5(z,Y))!=="chrome")continue;if(Y==="pubspec.yaml"){let U=C5(z);if(U){let G={mainLanguage:"Dart",packageManager:"pub"};if(U.isFlutter){if(G.framework="Flutter",U.stateManagement)G.stateManagement=U.stateManagement}else if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="mcp")G.apiType="MCP";Z.push({slots:G,priority:W.priority,frameworks:U.isFlutter?["Flutter","Dart"]:["Dart"],fileName:Y});continue}}if(Y==="go.mod"){let U=P5(z);if(U){let G={mainLanguage:"Go",packageManager:"go modules",buildTool:"go build"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";let V=U.framework?[U.framework,"Go"]:["Go"];Z.push({slots:G,priority:W.priority,frameworks:V,fileName:Y});continue}}if(Y==="Gemfile"||Y==="Gemfile.lock"||Y==="gems.rb"){let U=S5(z);if(U){let G={mainLanguage:"Ruby",packageManager:U.packageManager};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";let V=U.framework?[U.framework,"Ruby"]:["Ruby"];Z.push({slots:G,priority:W.priority??35,frameworks:V,fileName:Y});continue}}if(Y==="Package.swift"){let U=z4(z);if(U){let G={mainLanguage:"Swift",packageManager:U.packageManager==="xcode"?"Xcode":"spm",buildTool:"swift build"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="app"&&U.framework)G.framework=U.framework;let V=U.framework?[U.framework,"Swift"]:["Swift"];Z.push({slots:G,priority:W.priority??36,frameworks:V,fileName:Y});continue}}if(Y==="pom.xml"||Y==="build.gradle"||Y==="build.gradle.kts"||Y==="settings.gradle"||Y==="settings.gradle.kts"){if(Q.has(z))continue;Q.add(z);let U=o1(z);if(U){let G={mainLanguage:U.mainLanguage==="Java/Kotlin"?"Kotlin":U.mainLanguage,packageManager:U.buildTool==="maven"?"maven":"gradle",buildTool:U.buildTool};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="mobile")G.framework=U.framework||"Android";if(U.facets.includes("multiplatform"))G.framework=U.framework||"Kotlin Multiplatform";let V=U.framework?[U.framework,"JVM",U.mainLanguage==="Kotlin"?"Kotlin":"Java"]:["JVM",U.mainLanguage==="Kotlin"?"Kotlin":"Java"];Z.push({slots:G,priority:W.priority??35,frameworks:V,fileName:Y});continue}}Z.push({slots:W.slots||{},priority:W.priority,frameworks:W.frameworks,fileName:Y})}return Z}function HF($){let Z=[];for(let z of gW($,2,{count:0})){let Q=a3[`*${z}`],X=Q?.slots?.mainLanguage;if(X)Z.push({slots:{mainLanguage:X},priority:Q.priority,frameworks:Q.frameworks})}return Z}function qF($){let Z=[...VF($),...HF($)],z={},Q={},X=new Set;for(let G of Z){G.frameworks.forEach((V)=>X.add(V));for(let[V,H]of Object.entries(G.slots))if(H&&!H.includes("/")&&(!(V in z)||G.priority>Q[V]))z[V]=H,Q[V]=G.priority}let J=new Map;for(let G of Z){if(!G.fileName)continue;if(!J.has(G.fileName))J.set(G.fileName,{fileName:G.fileName,category:YF(G.slots,G.frameworks),priority:G.priority})}let Y=[...J.values()].sort((G,V)=>V.priority-G.priority||G.fileName.localeCompare(V.fileName)),W=[];if(z.mainLanguage)W.push(z.mainLanguage.toLowerCase());if(z.framework)W.push(z.framework.toLowerCase());let U=W.length>0?W.join("-"):"unknown-stack";return{slotFills:z,frameworks:[...X],confirmedCount:Z.length,discoveredFormats:Y,stackSignature:U}}function t3($){let{slotFills:Z}=qF($),z={};for(let[Q,X]of Object.entries(Z)){let J=XF[Q];if(!J||!X)continue;let[Y,W]=J;if(Y==="project")(z.project??={})[W]=X;else(z.stack??={})[W]=X}return z}function gW($,Z,z){let Q=new Set;if(Z<0||z.count>400)return Q;let X;try{X=yW($,{withFileTypes:!0})}catch{return Q}for(let J of X){if(z.count++>400)break;if(!J.isDirectory()){let Y=$F(J.name);if(QF.has(Y))Q.add(Y);continue}if(zF.has(J.name)||J.name.startsWith("."))continue;for(let Y of gW(f5($,J.name),Z-1,z))Q.add(Y)}return Q}import{existsSync as hW,readFileSync as fW}from"fs";import{join as uW}from"path";var S0=($,Z,z)=>({value:$,source:Z,confidence:z});function KF($,Z={}){let z=Z.toolingRoot?null:BF($),Q=MF($),X={},J=(Y,W)=>{if(W)X[Y]=W};return J("what",DF(z,Q)),J("who",OF(Q)),J("why",IF(Q)),J("where",TF(z,Q)),J("when",AF(Q)),J("how",RF(z,Q)),X}function e3($,Z={}){let z=KF($,Z),Q={};return Object.keys(z).forEach((X)=>{let J=z[X];if(J)Q[X]=J.value}),Q}function BF($){let Z=uW($,"package.json");if(!hW(Z))return null;try{return JSON.parse(fW(Z,"utf-8"))}catch{return null}}function MF($){let Z=uW($,"README.md");if(!hW(Z))return"";let z;try{z=fW(Z,"utf-8")}catch{return""}return z.replace(/<!--[\s\S]*?-->/g,"").split(`
|
|
242
|
+
`).filter((Q)=>!/^\s*\[!\[/.test(Q)&&!/^\s*!\[/.test(Q)).join(`
|
|
243
|
+
`).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function c6($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function LF($){if(!$)return 0;return($.match(/\[[^\]]*\]\([^)]*\)/g)??[]).join("").length/$.length}function F$($,Z){let z=new RegExp(`##?\\s+(${Z})\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n##?|$)`,"i"),Q=$.match(z);if(!Q||!Q[2]||Q[2].trim().length<=20||LF(Q[2])>0.4)return null;return{body:c6(Q[2]),heading:Q[1].trim()}}function NF($){let Z=$.trim();if(/^>/.test(Z))return!0;if(/\b(nightly (release|build)|pre-?release|work[-\s]in[-\s]progress|rough edges|early (access|testing|preview)|use at your own risk|not (yet )?production[-\s]?ready|expect (rough|breaking)|experimental release)\b/i.test(Z))return!0;let z=Z.split(/[·|]/).map((Q)=>Q.trim()).filter(Boolean);if(z.length>=3&&z.every((Q)=>Q.length<=24))return!0;return!1}function J4($,Z,z=30){for(let Q of Z){let X=$.match(Q);if(X&&X[1]&&X[1].trim().length>=z)return c6(X[1])}return null}function DF($,Z){if($?.description&&$.description.length>20)return S0(c6($.description),"package.json:description",0.95);let z=F$(Z,"Purpose|What|About|Overview|Description");if(z)return S0(z.body,`README:## ${z.heading}`,0.8);let Q=Z.split(/\n\s*\n/).map((J)=>J.replace(/\s+/g," ").trim()).find((J)=>J.length>30&&!J.startsWith("#")&&!NF(J));if(Q)return S0(c6(Q),"README:first-paragraph",0.5);let X=J4(Z,[/(?:core|main|primary)\s+(?:problem|challenge)(?:\s+is)?\s*:?\s*([^.\n]{30,})/i,/solves?\s+(?:the\s+)?(?:problem\s+of\s+)?([^.\n]{30,})/i]);return X?S0(X,"README:problem-heuristic",0.6):null}function OF($){let Z=F$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return S0(Z.body,`README:## ${Z.heading}`,0.8);let z=J4($,[/\b(?:designed|built|made)\s+for\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i,/\bfor\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i],8);return z?S0(z,"README:audience-heuristic",0.6):null}function IF($){let Z=F$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return S0(Z.body,`README:## ${Z.heading}`,0.8);let z=J4($,[/(?:our\s+|the\s+)?(?:mission|purpose|goal)\s+is\s+([^.\n]{30,})/i,/\b(?:mission|purpose|goal)\s*:\s*([^.\n]{30,})/i,/(?:built|created|designed)\s+(?:because|to)\s+([^.\n]{30,})/i]);return z?S0(z,"README:mission-heuristic",0.6):null}function TF($,Z){let z=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(z)return S0(c6(z.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return S0(c6($.homepage),"package.json:homepage",0.9);let Q=J4(Z,[/\b(?:deployed|hosted|available|published)\s+(?:on|at|via)\s+([^.\n]{3,80})/i],3);return Q?S0(Q,"README:deploy-heuristic",0.6):null}function AF($){let Z=F$($,"Timeline|Status|Release|Roadmap");if(Z)return S0(Z.body,`README:## ${Z.heading}`,0.8);let z=J4($,[/\b(production\s+since\s+[^.\n]{4,60})/i,/\b((?:in\s+)?(?:production|beta|alpha|development)\s+since\s+[^.\n]{4,60})/i,/\bsince\s+((?:[A-Z][a-z]+\s+)?\d{4}[^.\n]{0,40})/],4);return z?S0(z,"README:since-heuristic",0.6):null}function RF($,Z){let z=$?.scripts?Object.keys($.scripts):[],Q=["start","dev","build"].filter((Y)=>z.includes(Y));if(Q.length)return S0(c6(Q.map((Y)=>`npm run ${Y}`).join(", ")),"package.json:scripts",0.9);let X=F$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(X)return S0(X.body,`README:## ${X.heading}`,0.8);let J=F$(Z,"Architecture|Approach|How it works|Methodology|How");return J?S0(J.body,`README:## ${J.heading}`,0.7):null}function P$($){let Z=xW($),z=o3($),Q={};if(z.stack)Q.stack=z.stack;if(z.commands)Q.commands=z.commands;if(z.security)Q.security=z.security;let X={};if(z.project)X.project=z.project;if(z.human_context)X.human_context=z.human_context;let J=q6(q6(Q,Z),X);xF(J);let W=(Z._meta?.found??[]).some((G)=>G.startsWith("polyglot:")),U=q6(J,t3($));return q6(U,{human_context:e3($,{toolingRoot:W})})}function cW($,Z){let z=SF(g1(Z,"updateExistingFaf: the existing .faf")),{data:Q,facts:X}=p3($),J=Q,Y=q6(z,o3($)),W=q6(Y,J),U=q6(W,t3($)),G=FF(q6(U,{human_context:e3($)}),z),V=PF(CF(Z,z,J)?EF(mW(G,z),z,X):mW(G,z),z);return pY(mY(Z,V))}function CF($,Z,z){if(!W0(m0(Z,"project.type"))){let X=d1($)?.text;return X===void 0||!S3(X)}return!(z._meta?.found??[]).includes(I$)}function $9($){return $.canonical?[$.path,$.canonical]:[$.path]}function m0($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)?X[Q]:void 0}function p6($,Z,z){let[Q,X]=Z.split("."),J=$[Q];if(!$0(J))return;if(z===void 0?!(X in J):J[X]===z)return;let Y={...J};if(z===void 0)delete Y[X];else Y[X]=z;$[Q]=Y}var l6=($)=>typeof $==="string"&&$.trim()===f1;function _F($,Z){let z=Z.map((Q)=>m0($,Q));return z.some(l6)&&z.every((Q)=>W0(Q)||l6(Q))}function mW($,Z){let z={...$};for(let Q of z0){let X=$9(Q);if(!_F(Z,X))continue;for(let J of X){let Y=m0(Z,J);if(m0(z,J)!==Y)p6(z,J,Y)}}return z}function d6($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)&&Object.prototype.hasOwnProperty.call(X,Q)}function FF($,Z){let z={...$};for(let Q of z0){if(!Q.canonical||!d6(Z,Q.canonical)||d6(Z,Q.path))continue;let X=m0(z,Q.path);p6(z,Q.path,void 0);let J=m0(z,Q.canonical);if(u5(X)&&W0(J))p6(z,Q.canonical,X)}return z}function PF($,Z){let z={...$};for(let Q of z0){if(!Q.canonical||!d6(Z,Q.canonical)||d6(Z,Q.path))continue;let X=m0(z,Q.canonical);if(u5(X)||l6(X))p6(z,Q.path,X)}return z}function EF($,Z,z={}){let Q=$.project,X=$0(Q)?Q.type:void 0,J={...$};for(let Y of z0){if(Y.category==="human"||Y.category==="project")continue;let W=g6(X,Y);if(W===null)return $;if(W)wF(J,Z,Y,Y.path.startsWith("stack.")?z[Y.path.slice(6)]:void 0);else jF(J,Y)}return J}function wF($,Z,z,Q){let X=$9(z);for(let Y of X)if(l6(m0($,Y))&&!l6(m0(Z,Y)))p6($,Y,d6(Z,Y)?m0(Z,Y):"");if(!u5(Q))return;let J=X.filter((Y)=>d6($,Y));if(J.some((Y)=>!W0(m0($,Y))))return;for(let Y of J.length>0?J:[z.path])p6($,Y,Q)}function jF($,Z){let z=$9(Z).filter((X)=>d6($,X)),Q=(X)=>!W0(m0($,X))&&!l6(m0($,X));if(z.some(Q))return;for(let X of z.length>0?z:[Z.path])if(W0(m0($,X)))p6($,X,f1)}function SF($){let Z=$.project;if(Z===null||Z===void 0||$0(Z)||Array.isArray(Z))return $;return{...$,project:{name:String(Z)}}}function xF($){let Z=$.project?.type??"library",z=v6[Z]||v6.library;for(let Q of z0){if(z.includes(Q.category))continue;let[X,J]=Q.path.split(".");if(X==="stack"&&$.stack)$.stack[J]="slotignored";if(X==="monorepo"&&$.monorepo)$.monorepo[J]="slotignored"}}function q6($,Z){return pW($,Z,"")}function kF($){let Z=U6.get($);return Z!==void 0&&Z.category!=="human"}function u5($){if(typeof $==="number"||typeof $==="boolean")return!0;return typeof $==="string"&&$.trim()!==""&&!W0($)&&!l6($)}function bF($,Z){return kF($)&&u5(Z)}function pW($,Z,z){let Q={...$};for(let[X,J]of Object.entries(Z)){let Y=Q[X],W=z?`${z}.${X}`:X;if(W==="_meta"&&Y!==void 0)continue;if(O$(Y)){if(bF(W,J))Q[X]=J;continue}if(W0(Y))Q[X]=J;else if($0(J)&&$0(Y))Q[X]=pW(Y,J,W)}return Q}import{existsSync as lW,lstatSync as yF}from"fs";import{join as vF,basename as gF}from"path";import{createHash as hF}from"crypto";var I2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($),K6=($)=>typeof $==="number"&&Number.isFinite($),v2=($)=>typeof $==="string",fF=/^v?\d+\.\d+\.\d+$/,uF=new Set(["birth","doubled","peak","current"]);function nW($){return I2($)&&v2($.version)&&fF.test($.version)&&K6($.score)}var mF=($)=>I2($)&&K6($.birthDNA)&&v2($.born),cF=($)=>Array.isArray($)&&$.length>0&&$.every(nW),pF=($)=>I2($)&&K6($.score)&&v2($.version),lF=($)=>I2($)&&Array.isArray($.milestones)&&$.milestones.every(I2);function dW($){return I2($)&&mF($.birthCertificate)&&cF($.versions)&&pF($.current)&&lF($.growth)}function Z9($){try{return yF($),!0}catch{return!1}}var z9=($)=>`${JSON.stringify($,null,2)}
|
|
244
|
+
`,dF=new Set(["version","score","lastSync"]),iF=new Set(["type","score","date","version","label","emoji"]),iW=($,Z)=>Object.keys($).every((z)=>Z.has(z)),Q9={birth:{label:"Birth",emoji:"\uD83D\uDC23"},doubled:{label:"Doubled",emoji:"2️⃣"},peak:{label:"Peak",emoji:"\uD83C\uDFD4️"},current:{label:"Current",emoji:"\uD83D\uDCCD"}},rW=($)=>$.growth.milestones.filter((Z)=>Z.type==="peak"||Z.type==="current"),sW=($)=>iW($.current,dF)&&rW($).every((Z)=>iW(Z,iF)),nF=($)=>rW($).every((Z)=>Z.label===Q9[Z.type].label&&Z.emoji===Q9[Z.type].emoji);function rF($){return sW($)&&nF($)}var sF=".faf-dna is not in faf's shape: faf reads it and leaves it as it is.",oF=".faf-dna is not exactly as faf wrote it (hand formatting, key order, a repeated key or a number JSON cannot hold exactly): faf reads it and leaves it as it is.",aF=".faf-dna has a key of yours in an entry faf would replace (current, or the peak or current milestone): faf reads it and leaves it as it is.",tF=".faf-dna has a label or emoji of yours on a milestone faf would replace (the peak or current one): faf reads it and leaves it as it is.",eF=".faf-dna has no birth certificate faf can read: faf leaves it as it is.";function $P($){if(!Array.isArray($))return[];return $.filter((Z)=>I2(Z)&&v2(Z.type)&&uF.has(Z.type)&&K6(Z.score))}var i6=($,Z="")=>v2($)?$:Z;function ZP($,Z){if(!Array.isArray($))return[];return $.filter(nW).map((z)=>({version:z.version,timestamp:i6(z.timestamp),score:z.score,changes:Array.isArray(z.changes)?z.changes.filter(v2):[],growth:K6(z.growth)?z.growth:z.score-Z}))}function zP($,Z,z,Q){return{version:i6($.version,Z?.version??"v1.0.0"),score:K6($.score)?$.score:Z?.score??z,lastSync:i6($.lastSync,Q)}}function QP($){if(!I2($)||!I2($.birthCertificate)||!K6($.birthCertificate.birthDNA))return null;let Z=$.birthCertificate,z=Z.birthDNA,Q=i6(Z.born),X=ZP($.versions,z),J=zP(I2($.current)?$.current:{},X[X.length-1],z,Q),Y=I2($.growth)?$.growth:{};return{birthCertificate:{born:Q,birthDNA:z,birthDNASource:Z.birthDNASource==="legacy"?"legacy":"init",projectDNA:i6(Z.projectDNA),certificate:i6(Z.certificate)},versions:X,current:J,growth:{totalGrowth:J.score-z,daysActive:K6(Y.daysActive)?Y.daysActive:0,milestones:$P(Array.isArray(Y.milestones)?Y.milestones:$.milestones)},lastModified:i6($.lastModified,Q),format:"faf-dna-v1"}}class g2{projectPath;dnaPath;dna=null;own=!1;text;reason=null;sawNoFile=!1;constructor($){this.projectPath=$,this.dnaPath=vF($,".faf-dna")}exists(){let $=lW(this.dnaPath);if(!$&&!Z9(this.dnaPath))this.sawNoFile=!0;return $}birth($){if(!Z9(this.dnaPath))this.sawNoFile=!0;let Z=new Date().toISOString();return this.own=!0,this.dna={birthCertificate:{born:Z,birthDNA:$,birthDNASource:"init",projectDNA:this.generateProjectDNA(),certificate:this.generateCertificate()},versions:[{version:"v1.0.0",timestamp:Z,score:$,changes:["Birth — initial context"],growth:0}],current:{version:"v1.0.0",score:$,lastSync:Z},growth:{totalGrowth:0,daysActive:0,milestones:[{type:"birth",score:$,date:Z,version:"v1.0.0",label:"Birth",emoji:"\uD83D\uDC23"}]},lastModified:Z,format:"faf-dna-v1"},this.save(),this.dna}isFafShape(){return this.load()!==null&&this.own}readOnlyReason(){return this.load(),this.own?null:this.reason}recordGrowth($,Z){if(!this.dna&&!this.load())return null;if(!this.own)return null;let z=this.dna;if($===z.current.score)return z;let Q=new Date().toISOString(),X=z.birthCertificate.birthDNA,J=$-X,Y=this.incrementVersion(z.versions[z.versions.length-1].version);return z.versions.push({version:Y,timestamp:Q,score:$,changes:Z,growth:J}),z.current={version:Y,score:$,lastSync:Q},z.growth.totalGrowth=J,z.growth.daysActive=this.daysSince(z.birthCertificate.born),this.updateMilestones($,Y,Q),this.save(),z}getJourney(){if(!this.dna&&!this.load())return"";let $=this.dna,Z=$.birthCertificate.birthDNA,z=$.growth.milestones.find((J)=>J.type==="peak"),Q=$.current.score,X=`${Z}%`;if(z&&z.score!==Z){if(X+=` → ${z.score}%`,Q<z.score)X+=` ← ${Q}%`}else if(Q!==Z)X+=` → ${Q}%`;return X}getBirthDNADisplay(){if(!this.dna&&!this.load())return null;let $=this.dna;return{current:$.current.score,birthDNA:$.birthCertificate.birthDNA,growth:$.current.score-$.birthCertificate.birthDNA,born:v2($.birthCertificate.born)?$.birthCertificate.born:""}}getLog(){if(!this.dna&&!this.load())return[];return this.dna.versions.map(($)=>{let Z=$.growth>50?"\uD83D\uDE80":$.growth>20?"\uD83D\uDCC8":"\uD83D\uDCCA",z=v2($.timestamp)?$.timestamp.split("T")[0]:"",Q=Array.isArray($.changes)?$.changes.filter(v2).join(", "):"";return`${$.version} — ${$.score}% ${Z} (${z}) ${Q}`})}load(){if(this.dna)return this.dna;if(!lW(this.dnaPath)){if(!Z9(this.dnaPath))this.sawNoFile=!0;return null}let $=this.read();if($===null)return null;let{text:Z,raw:z}=$;if(dW(z)&&z9(z)===Z&&rF(z))this.own=!0,this.reason=null,this.dna=z;else this.own=!1,this.dna=QP(z),this.reason=!this.dna?eF:!dW(z)?sF:z9(z)!==Z?oF:sW(z)?tF:aF;return this.text=Z,this.dna}read(){let $;try{$=J0(d(this.projectPath,".faf-dna"))}catch(Z){return this.reason=Z instanceof Error?Z.message:String(Z),null}try{return{text:$,raw:JSON.parse($)}}catch{return this.reason=".faf-dna is not JSON: faf leaves it as it is.",null}}save(){if(!this.dna)return;this.dna.lastModified=new Date().toISOString();let $=z9(this.dna),Z=this.text??(this.sawNoFile?null:h0(d(this.projectPath,".faf-dna")));a(this.dnaPath,$,{root:this.projectPath,expect:Z}),this.text=$,this.sawNoFile=!1}generateProjectDNA(){return hF("sha256").update([this.projectPath,Date.now().toString(),Math.random().toString(36)].join(":")).digest("hex").substring(0,16)}generateCertificate(){let $=new Date().getFullYear(),Z=Math.random().toString(36).substring(2,6).toUpperCase(),z=gF(this.projectPath).replace(/[^A-Z0-9]/gi,"").toUpperCase().substring(0,8).padEnd(4,"X");return`FAF-${$}-${z}-${Z}`}incrementVersion($){let[Z,z,Q]=$.replace("v","").split(".").map(Number);return`v${Z}.${z}.${Q+1}`}daysSince($){return Math.floor((Date.now()-new Date($).getTime())/86400000)}updateMilestones($,Z,z){if(!this.dna)return;let Q=this.dna.growth.milestones,X=(U)=>Q.some((G)=>G.type===U),J=(U)=>Q.push({type:U,score:$,date:z,version:Z,...Q9[U]});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!X("doubled"))J("doubled");let Y=Q.find((U)=>U.type==="peak");if(!Y||$>Y.score){if(Y)Q.splice(Q.indexOf(Y),1);J("peak")}let W=Q.findIndex((U)=>U.type==="current");if(W>=0)Q.splice(W,1);J("current")}}p();p();import{statSync as oW}from"fs";import{homedir as XP}from"os";import{parse as JP,resolve as aW}from"path";function tW($,Z){try{let z=oW($,{bigint:!0}),Q=oW(Z,{bigint:!0});return z.isDirectory()&&z.ino!==0n&&z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function YP($){let Z=aW($),z=aW(XP()),Q=JP(Z).root;if(Z===z)return"home";if(Z===Q||Z==="/"||/^[A-Za-z]:[\\/]?$/.test(Z))return"root";if(tW(Z,z))return"home";if(tW(Z,Q))return"root";return null}function E$($=process.cwd(),Z="faf"){let z=YP($);if(z===null)return;let Q=z==="home"?"your home directory (~)":"the filesystem root";console.error(`${I("faf")}: ${Q} is not a project.`),console.error(""),console.error(` ${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)}import{statSync as WP}from"fs";import{dirname as UP,resolve as eW}from"path";function GP($,Z){if($.reason==="not-utf8"||$.reason==="changed"||$.reason==="not-yaml"||$.reason==="unplaceable")return"";if($.reason==="not-owned")return Z&&!$.message.includes("--force")?" Use --force to replace it.":"";return $.onWrite?" Nothing was written to it.":" Nothing was read from or written to it."}function w$($){return $ instanceof y||$ instanceof b2}function B6($,Z){return $ instanceof y?`faf: ${$.message}${GP($,Z)}`:`faf: ${$.message}`}function Q2($){if($===void 0)return;let Z=UP(eW($)),z;try{z=WP(Z).isDirectory()?null:"is not a folder"}catch(Q){let X=Q?.code;if(X!=="ENOENT"&&X!=="ENOTDIR")throw Q;z="does not exist"}if(z!==null)throw new b2(eW($),`${Z} ${z} — nothing written`)}function X9($={}){E$(process.cwd(),"faf init");let Z=process.cwd(),z=$.output?$.output.endsWith(".faf")?$.output:$U(Z,$.output):$U(Z,"project.faf");if(VP(z)&&!$.force)console.error(`project.faf already exists. Use ${A("--force")} to overwrite.`),process.exit(1);Q2($.output);let Q=P$(Z);K0(z,Q,{replace:$.force===!0});let X=c(z),J=n(z,()=>M0(X)),Y=new g2(Z);if(!Y.exists()||$.force)Y.birth(J.score);if(console.log(`${I("created")} ${z}`),_0(J,z),console.log(M(` \uD83E\uDDEC Birth DNA ${J.score}% — your journey starts here (faf dna)`)),J.score<100)console.log(M(`
|
|
245
|
+
run ${A("'faf go'")} to fill empty slots`))}p();function m5($){let Z=$.readOnlyReason();if(Z)console.error(`faf: ${Z}`)}function ZU(){let $=new g2(process.cwd());if(!$.load()){let Y=$.readOnlyReason();console.error(Y?`${A("×")} ${Y}`:`${A("×")} No FAF DNA found. Run ${A("'faf init'")} to start your journey.`),process.exit(1)}let Z=$.getJourney(),z=$.getBirthDNADisplay(),Q=z.born.split("T")[0]||"unknown";console.log(),console.log(R0(A("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${I(A(Z))}`),console.log(),console.log(M(` Birth DNA ${z.birthDNA}% (born ${Q}) · current ${z.current}% · growth ${z.growth>=0?"+":""}${z.growth}%`));let X=$.readOnlyReason();if(X)console.log(M(` ${X} ${A("'faf init --force'")} starts a fresh lineage.`));let J=$.getLog();if(J.length>1){console.log(),console.log(M(" history:"));for(let Y of J)console.log(M(` ${Y}`))}console.log()}import{existsSync as HP}from"fs";import{join as qP}from"path";p();function c5(){E$(process.cwd(),"faf auto");let $=process.cwd(),Z=qP($,"project.faf");if(HP(Z)){let J=r(Z);n(Z,()=>C0(c(Z)));let Y=[],W=K0(Z,cW($,J),{onAliasKept:(U)=>Y.push(u0(U))});console.log(`${W?I("updated"):M("unchanged")} ${Z}`);for(let U of Y)console.log(M(` ${U}`))}else K0(Z,P$($)),console.log(`${I("created")} ${Z}`);let z=c(Z),Q=n(Z,()=>j0(C0(z))),X=new g2($);if(X.exists())X.recordGrowth(Q.score,["faf auto"]),m5(X);if(_0(Q,Z,!1,A5(z,Q,{outOfType:!1})),Q.score<100)console.log(M(`
|
|
246
|
+
run ${A("'faf go'")} to reach ✪ Trophy`))}import{existsSync as IP}from"fs";import{join as TP}from"path";var j$="(terse — 3-4 words)",KP=[{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? ${j$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${j$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${j$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${j$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${j$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${j$}`,header:"How",type:"text",required:!0}],BP=[{path:"project.main_language",question:"What is the primary programming language?",header:"Language",type:"select",required:!0,options:[{label:"TypeScript",value:"TypeScript",description:"JavaScript with types"},{label:"JavaScript",value:"JavaScript",description:"Vanilla JS or Node.js"},{label:"Python",value:"Python",description:"Python 3.x"},{label:"Rust",value:"Rust",description:"Systems programming"},{label:"Go",value:"Go",description:"Golang"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.frontend",question:"What frontend framework does it use?",header:"Frontend",type:"select",required:!1,options:[{label:"React",value:"React",description:"React.js"},{label:"Vue",value:"Vue",description:"Vue.js"},{label:"Svelte",value:"Svelte",description:"Svelte/SvelteKit"},{label:"Next.js",value:"Next.js",description:"React framework"},{label:"None",value:"None",description:"No frontend"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.backend",question:"What backend framework does it use?",header:"Backend",type:"select",required:!1,options:[{label:"Express",value:"Express",description:"Node.js Express"},{label:"Fastify",value:"Fastify",description:"Node.js Fastify"},{label:"Django",value:"Django",description:"Python Django"},{label:"FastAPI",value:"FastAPI",description:"Python FastAPI"},{label:"None",value:"None",description:"No backend"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.database",question:"What database does it use?",header:"Database",type:"select",required:!1,options:[{label:"PostgreSQL",value:"PostgreSQL",description:"Postgres"},{label:"MySQL",value:"MySQL",description:"MySQL/MariaDB"},{label:"SQLite",value:"SQLite",description:"Embedded SQL"},{label:"MongoDB",value:"MongoDB",description:"Document store"},{label:"None",value:"None",description:"No database"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.runtime",question:"What runtime does it run on?",header:"Runtime",type:"text",required:!1},{path:"stack.hosting",question:"Where is it hosted or distributed?",header:"Hosting",type:"text",required:!1},{path:"stack.build",question:"What is the build tool?",header:"Build",type:"text",required:!1},{path:"stack.cicd",question:"What CI/CD does it use?",header:"CI/CD",type:"text",required:!1}],p5=[...KP,...BP],MP=new Map(p5.map(($)=>[$.path,$])),jh=Object.fromEntries(p5.map(($)=>[$.path,$]));function l5($){let Z=MP.get($);if(Z)return Z.question;let z=U6.get($)??z0.find((Q)=>Q.canonical===$);return z?`${z.description}?`.replace(/\?\?$/,"?"):`${$}?`}function Y9($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||W0(Z)}return!1}function LP($,Z){let z=$;for(let Q of Z.split("."))if(z&&typeof z==="object"&&Q in z)z=z[Q];else return;return z}function NP($){if($==="project.goal")return!0;return U6.get($)?.category==="human"}function DP($,Z=Y9){let z=[],Q=[];for(let X of p5){let J=LP($,X.path);if(J==="slotignored")continue;if(!Z(J))continue;(NP(X.path)?z:Q).push(X.path)}return{human:z,sourceable:Q}}function OP($,Z,z=Y9){let Q=DP(Z,z),X;if($>=100||Q.human.length===0&&Q.sourceable.length===0)X="done";else if(Q.sourceable.length>0)X="can-source";else X="needs-human";let J=X==="needs-human"?J9(Q):[];return{status:X,score:$,gaps:Q,ask:J}}function J9($){return $.human.map((Z)=>({path:Z,question:l5(Z)}))}function zU($,Z={}){let z=Math.max(1,Z.maxRounds??5),Q=Z.isEmpty??Y9,X=[],J=0;for(let W=0;W<=z;W++){let U=$.read();if(!U)return{status:"no-faf",score:0,rounds:J,history:X,ask:[]};let G=$.score(U.yaml);X.push(G);let V=OP(G,U.data,Q);if(V.status==="done")return{status:"done",score:G,rounds:J,history:X,ask:[]};if(V.status==="needs-human")return{status:"needs-human",score:G,rounds:J,history:X,ask:V.ask};if(X.length>=2&&G<=X[X.length-2])return V.gaps.human.length?{status:"needs-human",score:G,rounds:J,history:X,ask:J9(V.gaps)}:{status:"stuck",score:G,rounds:J,history:X,ask:[]};if(J>=z)return{status:"capped",score:G,rounds:J,history:X,ask:J9(V.gaps)};$.runAuto(),J++}return{status:"capped",score:X[X.length-1]??0,rounds:J,history:X,ask:[]}}p();function QU($={}){let Z=process.cwd(),z=TP(Z,"project.faf"),Q=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;AP(zU({read:()=>IP(z)?{data:r(z),yaml:c(z)}:{data:{},yaml:""},score:(J)=>J?n(z,()=>j0(C0(J))).score:0,runAuto:()=>c5()},{maxRounds:Q}))}function AP($){if($.history.length>1)console.log(M(`
|
|
247
|
+
climb: ${$.history.join("% → ")}%`));switch(console.log(""),$.status){case"done":console.log(`${I("done")} — ✪ 100% AI-readiness. The .faf is complete.`);break;case"needs-human":{let Z=$.ask.length;console.log(`${A("Sourced everything detection can.")} ${Z} question${Z===1?"":"s"} only you can answer:`);for(let z of $.ask)console.log(` ${M("•")} ${z.question}`);console.log(M(`
|
|
248
|
+
Answer with ${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 HE}from"fs";import{join as PU,dirname as qE}from"path";import{existsSync as nP,statSync as ah}from"fs";import{join as BU}from"path";import{dirname as GU,resolve as VU}from"path";var JU=100;var RP="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",CP=[/^<(script|pre|style|textarea)(?=\s|>|$)/i,/^<!--/,/^<\?/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp(`^</?(?:${RP})(?=\\s|/?>|$)`,"i"),new RegExp(`^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*/?>|</[A-Za-z][A-Za-z0-9-]*\\s*>)\\s*$`,"i")],_P=[/<\/(?:script|pre|style|textarea)>/i,/-->/,/\?>/,/>/,/\]\]>/],FP=["","-->","?>",">","]]>"],PP=/[#`~*+_=<>0-9-]/,EP=/(\d{1,9})([.)])/y,wP=/#{1,6}(?:[ \t]+|$)/y,jP=/`{3,}(?!.*`)|~{3,}/y,SP=/(?:`{3,}|~{3,})(?=[ \t]*$)/y,xP=/(?:=+|-+)[ \t]*$/y,kP=/[^ \t\f\v\r\n]/;function Y4($,Z,z){return $.lastIndex=z,$.exec(Z)}var bP=($)=>$==="quote"||$==="list"||$==="item";function yP($){let Z=new Uint8Array($.length),z="*-_",Q=[0,0,0],X=[!0,!0,!0];for(let J=$.length-1;J>=0;J--){let Y=$[J],W=Y===" "||Y==="\t";for(let G=0;G<3;G++)if(Y==="*-_"[G])Q[G]++;else if(!W)X[G]=!1;let U="*-_".indexOf(Y);Z[J]=U>=0&&X[U]&&Q[U]>=3?1:0}return Z}var S$=($)=>$===" "||$==="\t";function vP($,Z){if($==="document"||$==="quote"||$==="item")return Z!=="item";return $==="list"&&Z==="item"}var XU=($)=>$==="paragraph"||$==="code"||$==="html";function gP($){if($.kind==="list"||$.kind==="item")return{...$,list:{...$.list}};if($.kind==="code")return{...$,fence:$.fence&&{...$.fence}};return{...$}}class h2{containers;stack=[{kind:"document"}];ln="";offset=0;column=0;nextNonspace=0;nextNonspaceColumn=0;indent=0;indented=!1;blank=!1;allClosed=!0;matched=0;htmlStarted=!1;hiddenIn=null;scannedFrom=-1;breaks=null;deep=!1;limit=-1;overflow=-1;starts;constructor($=!0){this.containers=$;this.starts=[()=>this.startQuote(),()=>this.startHeading(),()=>this.startFence(),(Z)=>this.startHtml(Z),(Z)=>this.startSetext(Z),()=>this.startBreak(),(Z)=>this.startItem(Z),()=>this.startIndentedCode()]}clone(){let $=new h2(this.containers);return $.stack=this.stack.map(gP),$.deep=this.deep,$}overflowAt($,Z){let z=this.clone();return z.limit=Z,z.line($),z.overflow}get tooDeep(){return this.deep}line($){if(this.deep)return null;this.ln=$,this.offset=0,this.column=0,this.blank=!1,this.htmlStarted=!1,this.hiddenIn=null,this.scannedFrom=-1,this.breaks=null;let Z=this.continueContainers();if(Z<0)return this.hiddenIn;let z=this.openBlocks(Z);if(this.deep)return null;if(!this.allClosed&&!this.blank&&this.tip.kind==="paragraph")return null;return this.closeUnmatched(),this.addText(z),this.hiddenIn}closer(){if(this.stack.length!==2)return null;let $=this.stack[1];if($.kind==="code")return $.fence?$.fence.char.repeat($.fence.len):null;if($.kind!=="html"||$.type>5)return null;return $.type===1?`</${$.tag}>`:FP[$.type-1]}get tip(){return this.stack[this.stack.length-1]}continueContainers(){let $=this.stack.length-1,Z=0;while(Z<$){this.findNextNonspace();let z=this.continues(this.stack[Z+1],Z+1);if(z===2)return-1;if(z===1)break;Z++}return this.allClosed=Z===$,this.matched=Z,Z}openBlocks($){let Z=this.stack[$],z=Z.kind!=="paragraph"&&XU(Z.kind);while(!z&&!this.deep){this.findNextNonspace();let Q=this.nextNonspace;if(!this.indented&&!PP.test(this.ln.charAt(Q)))break;let X=0;for(let J of this.starts)if(X=J(Z),X!==0)break;if(X===0)break;this.noteOverflow(Q,X),Z=this.tip,z=X===2}if(!z)this.advanceNextNonspace();return Z}noteOverflow($,Z){if(Z===1&&this.limit>=0&&this.overflow<0&&this.stack.length-1>this.limit)this.overflow=$}addText($){if($.kind==="code")this.hiddenIn=$.fence?"code fence":"indented code";else if($.kind==="html")this.addHtmlLine($);else if(!XU($.kind)&&this.offset<this.ln.length&&!this.blank)this.addChild({kind:"paragraph"})}addHtmlLine($){if($.type>5)return;let Z=_P[$.type-1].test(this.ln.slice(this.offset));if(!(this.htmlStarted&&$.type===2&&Z))this.hiddenIn=$.type===1?`<${$.tag}>`:$.type===2?"comment":"html";if(Z)this.stack.pop()}continues($,Z){switch($.kind){case"quote":return this.continueQuote();case"item":return this.continueItem($);case"code":return $.fence?this.continueFence($.fence,Z):this.continueIndentedCode();default:return this.continueOther($)}}continueOther($){if($.kind==="heading"||$.kind==="break")return 1;return($.kind==="paragraph"||$.kind==="html"&&$.type>=6)&&this.blank?1:0}continueQuote(){if(this.indented||this.ch!==">")return 1;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),S$(this.ln[this.offset]))this.advanceOffset(1,!0);return 0}continueItem($){let Z=$.list.markerOffset+$.list.padding;if(this.blank){if(!$.hasChild)return 1;this.advanceNextNonspace()}else if(this.indent>=Z)this.advanceOffset(Z,!0);else return 1;return 0}continueFence($,Z){let z=this.indent<=3&&this.ch===$.char?Y4(SP,this.ln,this.nextNonspace):null;if(z&&z[0].length>=$.len)return this.stack.length=Z,this.hiddenIn="code fence",2;for(let Q=$.offset;Q>0&&S$(this.ln[this.offset]);Q--)this.advanceOffset(1,!0);return 0}continueIndentedCode(){if(this.indent>=4)this.advanceOffset(4,!0);else if(this.blank)this.advanceNextNonspace();else return 1;return 0}get ch(){return this.ln.charAt(this.nextNonspace)}breakAhead(){return this.breaks??=yP(this.ln),this.breaks[this.nextNonspace]===1}startQuote(){if(!this.containers||this.indented||this.ch!==">")return 0;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),S$(this.ln[this.offset]))this.advanceOffset(1,!0);return this.closeUnmatched(),this.addChild({kind:"quote"}),1}startHeading(){if(this.indented||this.ch!=="#"||!Y4(wP,this.ln,this.nextNonspace))return 0;return this.closeUnmatched(),this.addChild({kind:"heading"}),this.offset=this.ln.length,2}startFence(){let $=this.ch,Z=this.indented||$!=="`"&&$!=="~"?null:Y4(jP,this.ln,this.nextNonspace);if(!Z)return 0;return this.closeUnmatched(),this.addChild({kind:"code",fence:{char:Z[0][0],len:Z[0].length,offset:this.indent}}),this.advanceNextNonspace(),this.advanceOffset(Z[0].length,!1),2}startHtml($){if(this.indented||this.ch!=="<")return 0;let Z=!this.allClosed&&!this.blank&&this.tip.kind==="paragraph",z=$.kind!=="paragraph"&&!Z,Q=this.ln.slice(this.nextNonspace);for(let X=1;X<=(z?7:6);X++){let J=CP[X-1].exec(Q);if(J)return this.closeUnmatched(),this.addChild({kind:"html",type:X,tag:X===1?J[1].toLowerCase():""}),this.htmlStarted=!0,2}return 0}startSetext($){let Z=this.ch;if(this.indented||$.kind!=="paragraph"||Z!=="="&&Z!=="-"||!Y4(xP,this.ln,this.nextNonspace))return 0;return this.closeUnmatched(),this.stack[this.stack.length-1]={kind:"heading"},this.offset=this.ln.length,2}startBreak(){if(this.indented||!this.breakAhead())return 0;return this.closeUnmatched(),this.addChild({kind:"break"}),this.offset=this.ln.length,2}startItem($){if(!this.containers||this.indented&&$.kind!=="list")return 0;let Z=this.listMarker($);if(!Z)return 0;this.closeUnmatched();let z=this.tip;if(z.kind!=="list"||z.list.bullet!==Z.bullet||z.list.delimiter!==Z.delimiter)this.addChild({kind:"list",list:Z});return this.addChild({kind:"item",list:Z,hasChild:!1}),1}startIndentedCode(){if(!this.indented||this.tip.kind==="paragraph"||this.blank)return 0;return this.advanceOffset(4,!0),this.closeUnmatched(),this.addChild({kind:"code",fence:null}),2}listMarker($){if(this.indent>=4)return null;let Z=this.markerAt($);if(!Z)return null;let z=this.indent;return this.advanceNextNonspace(),this.advanceOffset(Z.width,!0),{...Z.kind,markerOffset:z,padding:this.paddingAfter(Z.width)}}markerAt($){let Z=$.kind==="paragraph",z=this.markerKind(Z);if(!z)return null;let Q=this.ln[this.nextNonspace+z.width];if(!(Q===void 0||S$(Q)))return null;if(Z&&!kP.test(this.ln.slice(this.nextNonspace+z.width)))return null;return z}markerKind($){let Z=this.ch;if(Z==="*"||Z==="+"||Z==="-")return{width:1,kind:{bullet:Z,delimiter:null}};let z=Z>="0"&&Z<="9"?Y4(EP,this.ln,this.nextNonspace):null;if(!z||$&&Number(z[1])!==1)return null;return{width:z[0].length,kind:{bullet:null,delimiter:z[2]}}}paddingAfter($){let Z=this.column,z=this.offset;do this.advanceOffset(1,!0);while(this.column-Z<5&&S$(this.ln[this.offset]));let Q=this.column-Z;if(Q>=1&&Q<5&&this.ln[this.offset]!==void 0)return $+Q;if(this.column=Z,this.offset=z,S$(this.ln[this.offset]))this.advanceOffset(1,!0);return $+1}addChild($){while(!vP(this.tip.kind,$.kind))this.stack.pop();if(this.tip.hasChild=!0,this.stack.push($),bP($.kind)&&this.stack.length-1>100)this.deep=!0}closeUnmatched(){if(!this.allClosed)this.stack.length=this.matched+1,this.allClosed=!0}findNextNonspace(){let $=this.ln,Z=this.offset,z=this.column;if(this.scannedFrom!==-1&&this.offset>=this.scannedFrom&&this.offset<=this.nextNonspace)Z=this.nextNonspace,z=this.nextNonspaceColumn;else{this.scannedFrom=this.offset;for(;Z<$.length;Z++)if($[Z]===" ")z++;else if($[Z]==="\t")z+=4-z%4;else break}this.blank=Z>=$.length,this.nextNonspace=Z,this.nextNonspaceColumn=z,this.indent=z-this.column,this.indented=this.indent>=4}advanceNextNonspace(){this.offset=this.nextNonspace,this.column=this.nextNonspaceColumn}advanceOffset($,Z){let z=$;while(z>0&&this.offset<this.ln.length){if(this.ln[this.offset]!=="\t"){this.offset++,this.column++,z--;continue}let Q=4-this.column%4,X=Z&&Q>z;this.column+=X?z:Q,this.offset+=X?0:1,z-=Z?Math.min(Q,z):1}}}var f2="<!-- faf:start -->",u2="<!-- faf:end -->",YU="\uFEFF";function n6($){return $.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter((Z,z,Q)=>Z!==""||z<Q.length-1)??[]}var X2=($)=>$.replace(/\r?\n$|\r$/,""),HU=($)=>X2($).replace(/^\uFEFF/,"").trimEnd();function*qU($){let Z=0;for(let z of n6($)){let Q=X2(z),X=Z===0&&Q.charCodeAt(0)===65279?1:0;yield{offset:Z,from:Z+X,to:Z+Q.length,content:Q.slice(X)},Z+=z.length}}function hP($,Z,z,Q){let X=$.some((Y)=>Y.start!==-1)&&Q(Z.content),J=z(Z.content);for(let Y of $)if(Y.start!==-1&&X)Y.found={start:Y.start,end:Z.to};else if(J)Y.start=Z.from}function W9($,Z,z){let[Q,X]=[new h2(!0),new h2(!1)].map((J)=>({reader:J,start:-1,found:null}));for(let J of qU($)){let Y=[Q,X].map((U)=>U.reader.line(J.content));if(Q.reader.tooDeep)return null;let W=[Q,X].filter((U,G)=>Y[G]===null);if(W.length>0)hP(W,J,Z,z);if(Q.found||X.found)return Q.found&&X.found&&Q.found.start===X.found.start?Q.found:null}return null}var WU=($)=>(Z)=>Z===$;function U4($,Z=f2,z=u2){return W9($,WU(Z),WU(z))}function UU($,Z){let z=[];for(let Q of[!0,!1]){let X=new h2(Q);for(let J of n6($))X.line(X2(J));if(X.clone().line(Z)!==null)z.push(X.closer())}return z}var fP=16;function uP($){let Z=new h2(!0);return $.map((z)=>{let Q=Z.overflowAt(X2(z),fP),X=z;if(Q>=0){let J=/^\d{1,9}(?=[.)])/.exec(z.slice(Q)),Y=J?Q+J[0].length:Q;X=`${z.slice(0,Y)}\\${z.slice(Y)}`}return Z.line(X2(X)),X})}function mP($,Z,z){let X=uP(n6($).map((Y)=>{let W=HU(Y);return W===Z||W===z?` ${Y}`:Y})).join(""),J=UU(X,z);while(J.length>0&&J[0]!==null){let Y=`${X}
|
|
249
|
+
${J[0]}`,W=UU(Y,z);if(W.length>=J.length)break;X=Y,J=W}return X}function cP($,Z,z){let Q=$.slice(Z.length+1,$.length-z.length-1),X=n6(Q).map((J)=>X2(J)===""?`>${J}`:`> ${J}`).join("");return`${Z}
|
|
250
|
+
${X}
|
|
251
|
+
${z}`}function W4($,Z,z,Q=f2,X=u2,J="the file"){let Y=(U)=>{let G=`${$}${U}${z}`,V=U4(G,Q,X);return V&&V.start===$.length&&V.end===$.length+U.length?G:null},W=Y(Z)??Y(cP(Z,Q,X));if(W===null)throw new y("unplaceable",J,`${J}: faf could not place its block where the next run finds it again — faf left it unchanged`,{onWrite:!0});return W}function U9($,Z=f2,z=u2){return`${Z}
|
|
252
|
+
${mP($.trim(),Z,z)}
|
|
253
|
+
${z}`}function d5($,Z,z=f2,Q=u2,X){if($===null)return W4("",Z,`
|
|
254
|
+
`,z,Q,X);let J=U4($,z,Q);if(J)return W4($.slice(0,J.start),Z,$.slice(J.end),z,Q,X);let Y=$.startsWith(YU)?YU:"";return W4(Y,Z,`
|
|
255
|
+
|
|
256
|
+
${$.slice(Y.length)}`,z,Q,X)}function M6($){try{return J0($)}catch(Z){if(Z.code==="ENOENT")return null;throw Z}}function J2($,Z,z=f2,Q=u2,X={}){let J=U9(Z,z,Q),Y=VU($),W=X.root??GU(Y),U=d(W,Y),G=M6(U);a(U,d5(G,J,z,Q,Y),{root:W,expect:G})}var pP="<!-- faf:";function lP($){if($==="code fence")return"a code fence";if($==="indented code")return"an indented code block";if($==="comment")return"an HTML comment";return $==="html"?"an HTML block":`a ${$} block`}function dP($,Z){let z=[new h2(!0),new h2(!1)],Q=!1;for(let{content:X}of qU($)){if(Q){if(X===Z)return"too deep";continue}let[J,Y]=z.map((U)=>U.line(X));Q=z[0].tooDeep;let W=J??Y;if(X===Z&&(Q||W!==null))return Q?"too deep":W}return null}function G9($,Z,z=f2,Q=u2){if(Z===null||U4(Z,z,Q))return null;let X=HU(n6(Z)[0]??"");if(X.startsWith(pP)&&X!==z&&X!==Q)return`${$}: faf's block is now on top; the old faf text below it is left as you had it — delete it by hand if you no longer want it.`;let J=dP(Z,z);if(J===null)return null;if(J==="too deep")return`${$}: faf's block is now on top; the file nests more than ${JU} lists or quotes before an older faf block, so faf did not read that far — the older block is left as you had it; delete it by hand if you no longer want it.`;return`${$}: faf's block is now on top; an older faf block below sits inside ${lP(J)} and is left as you had it — delete it by hand if you no longer want it.`}function i5($,Z,z=f2,Q=u2,X={}){try{let J=VU($);return G9(Z,M6(d(X.root??GU(J),J)),z,Q)}catch{return null}}var iP=new Set(["API","CI","CD","MCP","CLI","SDK","UI","UX","AI","ML","DB","ORM","OS","HTTP","HTTPS","REST","RPC","JSON","YAML","XML","SQL","CSS","HTML","AWS","GCP","CDN","DNS","JWT","ID","IP","URL","URI","TS","JS"]);function V9($){return $.split("_").map((Z)=>{if(!Z)return Z;let z=Z.toUpperCase();return iP.has(z)?z:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function U0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function b0($){let Z=U6.get($);if(Z?.label)return Z.label;let z=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return V9(z)}var H9=E0.claude,rP="STATUS: SYNC ACTIVE";function MU($){let Z=BU($,H9);if(!nP(Z))return null;return J0(d($,H9))}function LU($,Z){J2(BU($,H9),Z)}function m2($,Z={}){let z=String($.project?.name??"").trim(),Q=String($.project?.main_language??"").trim(),X=String($.project?.type??"").trim(),J=String($.project?.goal??"").trim(),Y=`<!-- faf: ${[z,Q,X,J].join(" | ")} -->`,W=[];if(Z.doc)W.push(`doc=${Z.doc}`);else W.push(`claim=${Z.claim??"project.faf"}`);if(typeof Z.score==="number")W.push(`score=${Z.score}`);if(W.push(`family=${Z.family??"FAF"}`),Z.siblings&&Z.siblings.length>0)W.push(`siblings=${Z.siblings.join(",")}`);let U=`<!-- faf: ${W.join(" | ")} -->`;return`${Y}
|
|
257
|
+
${U}`}function NU($){let Z=[],z=$.project?.name??"Project",Q=$.project?.main_language??"",X=$.project?.goal??"";if(Z.push(m2($)),Z.push(""),Z.push(`# CLAUDE.md — ${z}`),Z.push(""),X)Z.push("## What This Is"),Z.push(""),Z.push(X),Z.push("");let J=$.stack??{},Y=[];if(Q)Y.push(`**Language:** ${Q}`);for(let[G,V]of Object.entries(J))if(V&&V!=="slotignored"&&String(V).trim())Y.push(`**${b0(`stack.${G}`)}:** ${V}`);if(Y.length>0){Z.push("## Stack"),Z.push("");for(let G of Y)Z.push(`- ${G}`);Z.push("")}let W=$.human_context??{},U=[["who",W.who],["what",W.what],["why",W.why],["where",W.where],["when",W.when],["how",W.how]].filter(([,G])=>G&&String(G).trim()).map(([G,V])=>`- **${b0(`human_context.${G}`)}:** ${V}`);if(U.length>0)Z.push("## Context"),Z.push(""),Z.push(...U),Z.push("");return Z.push("---"),Z.push(""),Z.push(`*${rP} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
|
|
258
|
+
`)}function KU($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function n5($){let Z={project:{}},z=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(z)Z.project.name=KU(z[1].trim());if(!Z.project.name){let J=$.match(/\*\*Name:\*\*\s*(.+)/);if(J)Z.project.name=KU(J[1].trim())}let Q=$.match(/## What This Is\s*\n\s*\n(.+)/);if(Q)Z.project.goal=Q[1].trim();if(!Z.project.goal){let J=$.match(/\*\*What Building:\*\*\s*(.+)/);if(J)Z.project.goal=J[1].trim()}let X=$.match(/\*\*Language:\*\*\s*(.+)/);if(X)Z.project.main_language=X[1].trim();if(!Z.project.main_language){let J=$.match(/\*\*Main Language:\*\*\s*(.+)/);if(J)Z.project.main_language=J[1].trim()}return Z}import{existsSync as Xf,lstatSync as CU,readFileSync as s5,realpathSync as q9,statSync as sP}from"fs";import{homedir as oP}from"os";import{basename as aP,dirname as K9,join as c2,resolve as r6}from"path";var DU=200,OU=200,IU=12,tP="# Project Context (from project.faf)",eP="*This section is managed by tri-sync.";function $E($){let Z=0;for(let z=0;z<$.length;z++)Z=(Z<<5)-Z+$.charCodeAt(z)|0;return Z}function ZE($){let Z=$.replace(/[^a-zA-Z0-9]/g,"-");if(Z.length<=DU)return Z;return`${Z.slice(0,DU)}-${Math.abs($E($)).toString(36)}`}function _U($){try{let Z=CU($);if(Z.isSymbolicLink()){let z=sP($);return z.isDirectory()||z.isFile()}return Z.isDirectory()||Z.isFile()}catch{return!1}}function TU($){try{return CU($).isFile()}catch{return!1}}function zE($){let Z=$;for(;;){if(_U(c2(Z,".git")))return Z;let z=K9(Z);if(z===Z)return null;Z=z}}function QE($){let Z;try{Z=s5(c2($,".git"),"utf-8").trim()}catch{return $}try{if(!Z.startsWith("gitdir:"))return $;let z=r6($,Z.slice(7).trim()),Q=c2(z,"commondir");if(!TU(Q))return $;let X=r6(z,s5(Q,"utf-8").trim());if(r6(K9(z))!==c2(X,"worktrees"))return $;let J=c2(z,"gitdir");if(!TU(J))return $;let Y=s5(J,"utf-8").trim();if(q9(r6(z,Y))!==c2(q9($),".git"))return $;if(aP(X)!==".git")return _U(c2(X,".git"))?$:X;return K9(X)}catch{return $}}function XE($){let Z=r6($);try{Z=q9.native(Z)}catch{}let z=zE(Z);return(z?QE(z):Z).normalize("NFC")}function JE($,Z={}){if(Z.memoryDir)return r6(Z.memoryDir);let z=Z.configDir||process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR||process.env.CLAUDE_CONFIG_DIR||c2(oP(),".claude");return c2(r6(z),"projects",ZE(XE($)),"memory").normalize("NFC")}var YE=new Set(["target_user","core_problem","mission_purpose"]),WE=["who","what","why","where","when","how"];function UE($){let Z=$.project??{},z=[["Goal",Z.goal],["Language",Z.main_language],["Type",Z.type]],Q=$.human_context??{},X=Array.isArray($.key_files)?$.key_files:[];return["## Project context — from project.faf","",`- **Name:** ${U0(Z.name)?Z.name:"Project"}`,...z.filter(([,Y])=>U0(Y)).map(([Y,W])=>`- **${Y}:** ${W}`),...r5("Stack",Object.entries($.stack??{}).filter(([Y,W])=>!YE.has(Y)&&U0(W)).map(([Y,W])=>`- **${b0(`stack.${Y}`)}:** ${W}`)),...r5("Context",WE.filter((Y)=>U0(Q[Y])).map((Y)=>`- **${b0(`human_context.${Y}`)}:** ${Q[Y]}`)),...r5("Commands",Object.entries($.commands??{}).filter(([,Y])=>U0(Y)).slice(0,IU).map(([Y,W])=>`- ${Y}: \`${W}\``)),...r5("Key files",X.filter(U0).slice(0,IU).map((Y)=>`- ${Y}`)),"","*faf keeps this block in step with project.faf. Everything outside it is Claude's own and is kept as written.*"].join(`
|
|
259
|
+
`)}function r5($,Z){return Z.length>0?["",`### ${$}`,...Z]:[]}function GE($){return W9($,(Z)=>Z.trimEnd()===tP,(Z)=>Z.startsWith(eP))}function AU($){if($==="")return 0;let Z=$.match(/\r\n|\r|\n/g)?.length??0;return/(\r\n|\r|\n)$/.test($)?Z:Z+1}function VE($,Z,z){if($===null)return{text:d5(null,Z,void 0,void 0,z),action:"created",head:"",tail:""};let Q=U4($),X=Q??GE($);if(X){let Y=$.slice(0,X.start),W=$.slice(X.end);return{text:W4(Y,Z,W,void 0,void 0,z),action:Q?"updated":"migrated",head:Y,tail:W}}let J=$.startsWith("\uFEFF")?"\uFEFF":"";return{text:d5($,Z,void 0,void 0,z),action:"added",head:J,tail:$.slice(J.length)}}function RU($){return $>OU?[`MEMORY.md is ${$} lines. Claude Code loads the first ${OU}; lines after that are kept in the file but not loaded.`]:[]}function FU($,Z,z={}){let Q=JE($,z);w0(Q);let X=d(Q,E0.memory),J=M6(X),Y=VE(J,U9(UE(Z)),X);if(Y.text===J){let q=AU(J);return{path:X,action:"unchanged",written:!1,preserved:!0,lines:q,warnings:RU(q)}}let W=a(X,Y.text,{root:Q,expect:J}),U=s5(W,"utf-8"),G=U===Y.text&&U.startsWith(Y.head)&&U.endsWith(Y.tail),V=AU(U),H=Y.action==="added"?G9(E0.memory,J):null;return{path:W,action:Y.action,written:!0,preserved:G,lines:V,warnings:[...H?[H]:[],...RU(V)]}}p();function G4(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function B9($={}){let Z=process.cwd(),z=f(Z);if(!z)console.error(`Error: project.faf not found
|
|
260
|
+
|
|
261
|
+
Run 'faf init' to create one.`),process.exit(2);let Q=PU(Z,"CLAUDE.md"),X=$.direction??"auto";if(X==="auto")EU(z,Q,Z);else if(X==="push")wU(z,Z);else if(X==="pull")KE(z,Q);if(G4())jU(z,Z);if($.watch)console.log(M("watching for changes... (Ctrl+C to stop)")),ME(z,Q,Z)}function EU($,Z,z){wU($,z)}function wU($,Z){let z=r($),Q=NU(z),X=i5(PU(Z,"CLAUDE.md"),"CLAUDE.md");if(LU(Z,Q),console.log(`${I("◆")} sync .faf → CLAUDE.md`),X)console.log(M(` ${X}`));let J=n($,()=>j0(C0(c($))));_0(J,$)}function KE($,Z){let z=r($),Q=n($,()=>j0(C0(c($))));if(Q.tier.name!=="TROPHY")console.error(`${A("×")} sync --pull blocked: requires ✪ Trophy (currently ${Q.score}%)`),console.error(M(" MD → .faf backfill only runs at 100%. Reach Trophy with 'faf go', then retry.")),process.exit(1);let X=MU(qE(Z));if(!X){console.error("CLAUDE.md not found.");return}let J=n5(X);if(J.project?.name)z.project={...z.project,name:J.project.name};if(J.project?.goal)z.project={...z.project,goal:J.project.goal};if(J.project?.main_language)z.project={...z.project,main_language:J.project.main_language};K0($,z,{onAliasKept:(W)=>console.log(M(` ${u0(W)}`))}),console.log(`${I("◆")} sync CLAUDE.md → .faf ${M("(Trophy-gated)")}`);let Y=n($,()=>j0(C0(c($))));_0(Y,$)}var BE={created:"created",updated:"block updated",migrated:"earlier tri-sync section replaced by the block",added:"block added on top; Claude's notes kept",unchanged:"unchanged"};function jU($,Z){try{let z=FU(Z,r($));console.log(`${I("◆")} sync .faf → MEMORY.md ${M(`${BE[z.action]} — ${z.path}`)}`);for(let Q of z.warnings)console.log(M(` ${Q}`))}catch(z){console.error(`${A("×")} sync .faf → MEMORY.md ${z instanceof Error?z.message:String(z)}`),process.exitCode=1}}function ME($,Z,z){let{watch:Q}=l0("fs"),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{if(console.log(M("change detected...")),EU($,Z,z),G4())jU($,z)},200)};if(Q($,J),HE(Z))Q(Z,J)}import{statSync as SU}from"fs";import{dirname as xU,resolve as V4}from"path";p();function M9($){return $.length>=4&&$[0]===70&&$[1]===65&&$[2]===70&&$[3]===66}var L9="FAFB header (a .fafb faf compiled)";function N9($){return/\.faf$/i.test($)?$.replace(/\.faf$/i,".fafb"):`${$}.fafb`}function D9($,Z){if(V4($)===V4(Z))return!0;try{let z=SU($),Q=SU(Z);return z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function kU($,Z={}){let z=$??f();if(!z)console.error(`Error: project.faf not found
|
|
262
|
+
|
|
263
|
+
Run 'faf init' to create one.`),process.exit(2);let Q=c(z);$2(Q,z);let X=n(z,()=>T5(Q)),J=Z.output??N9(z);if(D9(J,z))console.error(`faf: ${V4(J)} is the file being compiled — faf does not write the .fafb over its source, and left it unchanged. Name another output with --output.`),process.exit(1);Q2(Z.output);let Y=Z.output?xU(V4(J)):xU(V4(z));C2(J,X,{root:Y,owns:M9,mark:L9,force:Z.force}),console.log(`${I("compiled")} ${J} ${M(`(${X.length} bytes)`)}`)}import{readFileSync as bE}from"fs";import{dirname as yE,resolve as pU}from"path";import{createHash as IE}from"crypto";import{resolve as TE}from"path";class y0 extends Error{constructor($){super($);this.name="JsonEditError"}}var LE=new Set([" ","\t",`
|
|
264
|
+
`,"\r"]);class T9{s;i=0;constructor($){this.s=$}parse(){if(this.s.startsWith("\uFEFF"))this.i=1;let $=this.value();if(this.ws(),this.i!==this.s.length)this.fail("text after the end of the JSON value");return $}fail($){throw new y0(`not valid JSON (${$} at offset ${this.i})`)}ws(){while(this.i<this.s.length&&LE.has(this.s[this.i]))this.i++}value(){this.ws();let $=this.s[this.i];if($==="{")return this.object();if($==="[")return this.array();if($==='"'){let Z=this.i;return this.string(),{kind:"string",start:Z,end:this.i,members:[],items:[]}}if($==="-"||$>="0"&&$<="9")return this.number();for(let Z of["true","false","null"])if(this.s.startsWith(Z,this.i)){let z=this.i;return this.i+=Z.length,{kind:"literal",start:z,end:this.i,members:[],items:[]}}return this.fail($===void 0?"unexpected end":`unexpected ${JSON.stringify($)}`)}object(){let $=this.i++,Z=[];if(this.ws(),this.s[this.i]==="}")return this.i++,{kind:"object",start:$,end:this.i,members:Z,items:[]};for(;;){if(this.ws(),this.s[this.i]!=='"')this.fail("expected a key");let z=this.i,Q=this.string(),X=this.i;if(this.ws(),this.s[this.i]!==":")this.fail('expected ":"');if(this.i++,Z.push({key:Q,keyStart:z,keyEnd:X,value:this.value()}),this.ws(),this.s[this.i]===","){this.i++;continue}if(this.s[this.i]==="}")return this.i++,{kind:"object",start:$,end:this.i,members:Z,items:[]};this.fail('expected "," or "}"')}}array(){let $=this.i++,Z=[];if(this.ws(),this.s[this.i]==="]")return this.i++,{kind:"array",start:$,end:this.i,members:[],items:Z};for(;;){if(Z.push(this.value()),this.ws(),this.s[this.i]===","){this.i++;continue}if(this.s[this.i]==="]")return this.i++,{kind:"array",start:$,end:this.i,members:[],items:Z};this.fail('expected "," or "]"')}}string(){let $=this.i++;for(;;){let Z=this.s[this.i];if(Z===void 0)this.fail("unterminated string");if(Z==='"')break;if(Z<" ")this.fail("control character in a string");if(Z==="\\"){let z=this.s[this.i+1];if(z==="u"){if(!/^[0-9a-fA-F]{4}$/.test(this.s.slice(this.i+2,this.i+6)))this.fail("bad \\u escape");this.i+=6;continue}if(!'"\\/bfnrt'.includes(z??"x"))this.fail("bad escape");this.i+=2;continue}this.i++}return this.i++,JSON.parse(this.s.slice($,this.i))}number(){let $=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(this.s.slice(this.i));if(!$)this.fail("bad number");let Z=this.i;return this.i+=$[0].length,{kind:"number",start:Z,end:this.i,members:[],items:[]}}}var O9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function I9($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>I9(z,Z[Q]));if(O9($)&&O9(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&I9($[Q],Z[Q]))}return!1}class A9{s;style;after;edits=[];constructor($,Z,z){this.s=$;this.style=Z;this.after=z}startsLine($){let Z=this.s.lastIndexOf(`
|
|
265
|
+
`,$-1);return Z>=0&&/^[ \t]*$/.test(this.s.slice(Z+1,$))}indentOf($){return this.startsLine($)?this.s.slice(this.s.lastIndexOf(`
|
|
266
|
+
`,$-1)+1,$):""}render($,Z,z){if(!z)return JSON.stringify($);return JSON.stringify($,null,this.style.unit).split(`
|
|
267
|
+
`).join(this.style.eol+Z)}apply($,Z,z,Q){let X={};for(let[J,Y]of Object.entries(Z)){if(Y===void 0)continue;let W=z?`${z}.${J}`:J,U=$.members.filter((q)=>q.key===J);if(U.length>1)throw new y0(`the key "${W}" is there more than once`);let G=U[0];if(!G){if($.members.length===0)X[J]=Y;else this.insert($,J,Y,z);continue}let V=this.startsLine(G.keyStart);if(O9(Y)){if(G.value.kind!=="object")throw new y0(`"${W}" is not an object, so faf cannot add its keys to it`);this.apply(G.value,Y,W,V||this.s.slice(G.value.start,G.value.end).includes(`
|
|
268
|
+
`));continue}let H=JSON.parse(this.s.slice(G.value.start,G.value.end));if(I9(H,Y))continue;if(G.value.kind==="object"||G.value.kind==="array")throw new y0(`"${W}" is ${G.value.kind==="object"?"an object":"an array"}, so faf will not replace it with a value`);this.edits.push({start:G.value.start,end:G.value.end,text:this.render(Y,this.indentOf(G.keyStart),V)})}if(Object.keys(X).length>0)this.fillEmpty($,X,Q)}fillEmpty($,Z,z){let Q=this.indentOf(this.lineLead($.start)),X=z?this.render(Z,Q,!0):JSON.stringify(Z);this.edits.push({start:$.start,end:$.end,text:X})}insert($,Z,z,Q){let X=$.members,J=X[X.length-1],W=(this.after[Q]?.[Z]??[]).map((H)=>X.find((q)=>q.key===H)).find((H)=>H!==void 0);if(this.startsLine(X[0].keyStart)){let H=W&&W!==J?X[X.indexOf(W)+1]:J,q=this.indentOf(H.keyStart),K=this.s.slice(H.keyEnd,H.value.start),L=this.s.lastIndexOf(`
|
|
269
|
+
`,H.keyStart-1),B=L>0&&this.s[L-1]==="\r"?L-1:L,N=`${this.style.eol}${q}${JSON.stringify(Z)}${K}${this.render(z,q,!0)},`;this.edits.push({start:B,end:B,text:N});return}let U=W??J,G=this.s.slice(U.keyEnd,U.value.start),V=X.length>1?this.s.slice(X[0].value.end,X[1].keyStart):", ";this.edits.push({start:U.value.end,end:U.value.end,text:`${V}${JSON.stringify(Z)}${G}${this.render(z,"",!1)}`})}append($,Z,z,Q){if(Z.length===0)return;if($.items.length===0){this.edits.push({start:$.start,end:$.end,text:this.render(Z,this.indentOf(z),Q)});return}let X=$.items[$.items.length-1];if(this.startsLine($.items[0].start)){let Y=this.indentOf($.items[0].start),W=Z.map((U)=>`,${this.style.eol}${Y}${this.render(U,Y,!0)}`).join("");this.edits.push({start:X.end,end:X.end,text:W});return}let J=$.items.length>1?this.s.slice($.items[0].end,$.items[1].start):", ";this.edits.push({start:X.end,end:X.end,text:Z.map((Y)=>`${J}${this.render(Y,"",!1)}`).join("")})}lineLead($){let Z=this.s.lastIndexOf(`
|
|
270
|
+
`,$-1)+1;while(Z<$&&(this.s[Z]===" "||this.s[Z]==="\t"))Z++;return Z}}function bU($,Z){let z=$.includes(`\r
|
|
271
|
+
`)?`\r
|
|
272
|
+
`:`
|
|
273
|
+
`,Q=Z.members[0],X=Q?$.lastIndexOf(`
|
|
274
|
+
`,Q.keyStart-1):-1,J=Q&&X>=0?$.slice(X+1,Q.keyStart):"";return{eol:z,unit:/^[ \t]+$/.test(J)?J:" "}}function a5($,Z,z={}){let Q=new T9($).parse();if(Q.kind!=="object")throw new y0("the JSON is not an object");let X=new A9($,bU($,Q),z);return X.apply(Q,Z,"",$.slice(Q.start,Q.end).includes(`
|
|
275
|
+
`)),o5($,X.edits)}function o5($,Z){if(Z.length===0)return{text:$,changed:!1};let z=Z.map((X,J)=>({e:X,i:J})).sort((X,J)=>J.e.start-X.e.start||J.i-X.i),Q=$;for(let{e:X}of z)Q=Q.slice(0,X.start)+X.text+Q.slice(X.end);return{text:Q,changed:Q!==$}}function yU($){let Z=new T9($).parse();if(Z.kind!=="object")throw new y0("the JSON is not an object");return Z}function NE($,Z,z,Q){let X=Z.members.filter((Y)=>Y.key===z);if(X.length>1)throw new y0(`the key "${Q}.${z}" is there more than once`);let J=X[0]?.value;return J?.kind==="string"?JSON.parse($.slice(J.start,J.end)):void 0}function vU($,Z,z,Q){let X=yU($),J=new A9($,bU($,X),{}),Y=$.slice(X.start,X.end).includes(`
|
|
276
|
+
`),W=X.members.filter((H)=>H.key===Z);if(W.length>1)throw new y0(`the key "${Z}" is there more than once`);if(W.length===0)return J.apply(X,{[Z]:z},"",Y),o5($,J.edits);let U=W[0],G=U.value;if(G.kind!=="array")throw new y0(`"${Z}" is not an array, so faf cannot add its rows to it`);let V=[];for(let H of z){let q=H[Q.id],K=G.items.filter((N,T)=>N.kind==="object"&&NE($,N,Q.id,`${Z}[${T}]`)===q);if(K.length>1)throw new y0(`the ${Z} row ${JSON.stringify(q)} is there more than once`);if(K.length===0){V.push(H);continue}let L=K[0],B=Object.fromEntries(Q.update.map((N)=>[N,H[N]]));J.apply(L,B,`${Z}[${G.items.indexOf(L)}]`,$.slice(L.start,L.end).includes(`
|
|
277
|
+
`))}return J.append(G,V,U.keyStart,Y),o5($,J.edits)}function DE($,Z){let z=$.lastIndexOf(`
|
|
278
|
+
`,Z-1);return z>=0&&/^[ \t]*$/.test($.slice(z+1,Z))}function OE($,Z,z){if(Z.members.length===1)return{start:Z.start,end:Z.end,text:"{}"};let Q=Z.members.indexOf(z);if(DE($,z.keyStart)&&$[z.value.end]===","){let X=$.lastIndexOf(`
|
|
279
|
+
`,z.keyStart-1);return{start:X>0&&$[X-1]==="\r"?X-1:X,end:z.value.end+1,text:""}}if(Q>0)return{start:Z.members[Q-1].value.end,end:z.value.end,text:""};return{start:z.keyStart,end:Z.members[1].keyStart,text:""}}function gU($,Z){let z=[],Q=yU($);for(let X of Z){if(Q.kind!=="object")return{count:0,chain:z};let J=Q.members.filter((Y)=>Y.key===X);if(J.length!==1)return{count:J.length,chain:z};z.push({obj:Q,member:J[0]}),Q=J[0].value}return{count:1,chain:z}}function hU($,Z){let{count:z,chain:Q}=gU($,Z);if(z!==1)return{count:z};let X=Q[Q.length-1].member.value;return{count:z,value:JSON.parse($.slice(X.start,X.end))}}function R9($,Z,z={}){let{count:Q,chain:X}=gU($,Z);if(Q!==1||X.length===0)return null;let J=X[X.length-1];if(z.dropEmptyParent&&X.length>1&&J.obj.members.length===1)J=X[X.length-2];return o5($,[OE($,J.obj,J.member)]).text}var uU="one.faf/render";function _9($){return`sha256:${IE("sha256").update($,"utf8").digest("hex")}`}var AE=/^sha256:[0-9a-f]{64}$/,RE=/^<meta name="faf-render" content="(sha256:[0-9a-f]{64})">$/,CE='<meta name="faf-render"',_E='<meta name="description" content="Visual render of project.faf.';function FE($){let Z=$.split(/(?<=\n)/),z=Z.findIndex((Q)=>Q.startsWith(_E));return Z.splice(z+1,0,`<meta name="faf-render" content="${_9($)}">
|
|
280
|
+
`),Z.join("")}function mU($){let Z=$.split(/(?<=\n)/),z=[],Q=!1;if(Z.forEach((X,J)=>{let Y=X.replace(/\r?\n$/,""),W=RE.exec(Y);if(W)z.push({at:J,hash:W[1]});else if(Y.startsWith(CE))Q=!0}),z.length===0&&!Q)return null;if(z.length!==1||Q)return"many";return Z.splice(z[0].at,1),{hash:z[0].hash,canonical:Z.join("")}}var C9=["_meta",uU];function PE($){return a5($,{_meta:{[uU]:_9($)}}).text}function EE($){try{return R9($,C9,{dropEmptyParent:!0})??$}catch{return $}}function wE($){let Z;try{Z=hU($,C9)}catch{return null}if(Z.count===0)return null;if(Z.count>1||typeof Z.value!=="string"||!AE.test(Z.value))return"many";let z=R9($,C9,{dropEmptyParent:!0});return z===null?"many":{hash:Z.value,canonical:z}}function cU($,Z){return $==="html"?FE(Z):PE(Z)}function jE($,Z){if($==="json")return EE(Z);let z=mU(Z);return z===null||z==="many"?Z:z.canonical}function fU($,Z){let z=new TextDecoder().decode($),Q=Z==="html"?mU(z):wE(z);if(Q===null)return"none";if(Q==="many")return"mismatch";return Buffer.from(z,"utf-8").equals(Buffer.from($))&&Q.hash===_9(Q.canonical)&&cU(Z,Q.canonical)===z?"match":"mismatch"}function SE($){let Z=new TextDecoder().decode($);if(!Z.includes(`\r
|
|
281
|
+
`)||/(?:^|[^\r])\n/.test(Z)||!Buffer.from(Z,"utf-8").equals($))return null;return Buffer.from(Z.replace(/\r\n/g,`
|
|
282
|
+
`),"utf-8")}function xE($,Z,z){let Q=fU($,z);return Q!=="match"&&Z!==null&&fU(Z,z)==="match"?"match":Q}function Y2($,Z,z){let Q=TE($),X=d(z.root,Q),J=jE(z.format,Z),Y=cU(z.format,J),W=h0(X);if(W===null)return a(X,Y,{root:z.root,expect:null}),{path:X,result:"created"};if(W.equals(Buffer.from(Y,"utf-8")))return{path:X,result:"unchanged"};let U=SE(W),G=U===null?Y:Y.replace(/\r?\n/g,`\r
|
|
283
|
+
`);if(U!==null&&W.equals(Buffer.from(G,"utf-8")))return{path:X,result:"unchanged"};if(z.force!==!0&&!kE(Q,W,U,J,z))return{path:X,result:"unchanged"};return a(X,G,{root:z.root,expect:W}),{path:X,result:"updated"}}function kE($,Z,z,Q,X){let J=xE(Z,z,X.format);if(J==="match")return!0;if(J==="mismatch")throw new y("not-owned",$,`${$} was edited since faf wrote it — faf left it unchanged. Use --force to replace it.`,{onWrite:!0});if(!X.hasMark(Z))throw new y("not-owned",$,`${$} has no ${X.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});let Y=Buffer.from(Q,"utf-8");if(Z.equals(Y)||z!==null&&z.equals(Y))return!1;throw new y("not-owned",$,`${$} has no faf render hash (written before 7.13), so faf cannot tell whether it was edited — faf left it unchanged. Use --force once to replace it; after that faf recognises its own output.`,{onWrite:!0})}p();function lU($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let z=new Uint8Array(bE($));if(String.fromCharCode(z[0],z[1],z[2],z[3])!=="FAFB")console.error("Error: Not a valid .fafb file (missing FAFB magic bytes)."),process.exit(3);let Q=n($,()=>tY(z)),X=JSON.stringify(Q,null,2);if(!Z.output){console.log(X);return}if(D9(Z.output,$))console.error(`faf: ${pU(Z.output)} is the file being decompiled — faf does not write the JSON over it, and left it unchanged. Name another output with --output.`),process.exit(1);Q2(Z.output);let{result:J}=Y2(Z.output,`${X}
|
|
284
|
+
`,{root:yE(pU(Z.output)),format:"json",hasMark:()=>!1,mark:'faf render hash (`_meta["one.faf/render"]`)',force:Z.force});console.log(`${I("decompiled")} ${Z.output}${J==="unchanged"?` ${M("(unchanged)")}`:""}`)}function dU($){let Z=[];if(!$||typeof $!=="object")return Z.push("File is not a valid YAML mapping"),{valid:!1,errors:Z};let z=$;if(!z.faf_version)Z.push("Missing required field: faf_version");if(!z.project?.name)Z.push("Missing required field: project.name");if(z.app_type==="about")Z.push("about is not an app_type — declare about.represents (owner/repo) instead");if(z.about!==void 0){if(!ZW(z)||typeof z.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!$W.test(z.about.represents))Z.push(`about.represents must be "owner/repo" format (got: ${z.about.represents})`);if(z.about.source_score!==void 0){let Q=z.about.source_score;if(typeof Q!=="number"||Q<0||Q>100)Z.push(`about.source_score must be a number 0-100 (got: ${Q})`)}}return{valid:Z.length===0,errors:Z}}p();function F9($,Z={}){let z=$??f();if(!z)console.error(`Error: project.faf not found
|
|
285
|
+
|
|
286
|
+
Run 'faf init' to create one.`),process.exit(2);let Q=$2(c(z),z),X=dU(Q);if(!X.valid){console.log(`${A("invalid")} ${z}`);for(let W of X.errors)console.log(` ${M("x")} ${W}`);process.exit(3)}let J=c(z);if(!aY(J))console.log(`${A("invalid yaml")} ${z}`),process.exit(3);console.log(`${I("valid")} ${z}`);let Y=n(z,()=>M0(J));if(_0(Y,z,Z.verbose),Z.strict&&Y.score<100)console.log(M(`
|
|
287
|
+
--strict requires 100%`)),process.exit(1)}import{join as Dw,resolve as Ow}from"path";import{join as vE}from"path";var i0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),iU=($)=>Array.isArray($)?$.join(", "):String($),gE=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),hE=new Set(["target_user","core_problem","mission_purpose"]);function fE($){let Z=[],z=(_="")=>Z.push(_),Q=$.ai_instructions,X=$.preferences,J=$.instant_context,Y=$.security,W=$.commands,U=$.key_files??J?.key_files,G=i0($.project?.default_branch)?String($.project?.default_branch):"main",V=W?Object.entries(W).filter(([,_])=>i0(_)):[],H=V.filter(([_])=>/test/i.test(_)),q=V.filter(([_])=>/lint|check/i.test(_)&&!/test/i.test(_)),K=V.filter(([_])=>!/test|lint|check/i.test(_)),L=(_)=>{let i=_.toLowerCase();if(/install|deps/.test(i))return 0;if(/^build$|build/.test(i)&&!/rebuild/.test(i))return 1;if(/^dev$|develop/.test(i))return 2;if(/^start$|run/.test(i))return 3;return 4},B=[...K].sort((_,i)=>L(_[0])-L(i[0])||_[0].localeCompare(i[0])),N=[...H,...q],T=H[0]?.[1],w=B.find(([_])=>/build/i.test(_))?.[1];z(m2($)),z(),z(`# AGENTS.md — ${$.project?.name??"Project"}`),z();let j=[];if($.project?.main_language)j.push(String($.project.main_language));if(i0($.project?.type))j.push(`type: ${String($.project?.type)}`);if(i0($.project?.version))j.push(`v${String($.project?.version)}`);let x=$.project?.goal?String($.project.goal).trim():"";if(j.length)x+=(x?" — ":"")+j.join(" · ");if(x)z(x),z();if(z("> Authored by faf — do not edit the managed block; refresh with `faf export --agents`. Hand-written content outside the managed block is preserved."),z(),B.length){z("## Setup & build"),z(),z("```bash");for(let[_,i]of B)z(`${i} # ${_}`);z("```"),z()}if(N.length){z("## Run the tests"),z(),z("```bash");for(let[,_]of N)z(_);z("```"),z()}if(U&&U.length){z("## Where things live"),z();let _=U.map((i)=>{let t=String(i),G2=t.indexOf(" — ");return G2>0?{path:t.slice(0,G2),role:t.slice(G2+3)}:{path:t,role:""}});if(_.some((i)=>i.role)){z("| Path | Role |"),z("|------|------|");for(let i of _)z(`| \`${i.path}\` | ${i.role} |`)}else for(let i of _)z(`- \`${i.path}\``);z()}let v=new Map,k=(_)=>{if(!_)return;for(let[i,t]of Object.entries(_)){if(gE.has(i)||!i0(t))continue;let G2=V9(i);if(!v.has(G2))v.set(G2,iU(t))}};k(Q?.working_style),k(X);let l=$.conventions??[];if(v.size||l.length){z("## Conventions"),z();for(let[_,i]of v)z(`- **${_}:** ${i}`);for(let _ of l)if(i0(_))z(`- ${_}`);z()}let R=(Q?.warnings??[]).filter((_)=>i0(_)),u=["read the tree"];if(T)u.push(`run the tests (\`${T}\`)`);if(w)u.push("build the project");for(let[,_]of q.slice(0,1))u.push(`\`${_}\``);z("## Guardrails"),z();for(let _ of R)z(`- ${_}`);z(`- **Always OK:** ${[...new Set(u)].join(" · ")}.`),z("- **Ask first:** dependency installs, deletions, migrations, schema changes, publish/release."),z(`- **Never:** force-push · push straight to \`${G}\` (branch and open a PR) · commit secrets.`),z();let D0=[];for(let[,_]of q)D0.push(`\`${_}\` exits 0`);for(let[,_]of H)D0.push(`\`${_}\` passes`);if(D0.push("changes committed with a conventional message"),z("## Definition of Done"),z(),z(`Done when: ${[...new Set(D0)].join(" · ")}.`),z(),z("## When stuck"),z(),z(`Ask a clarifying question, propose a short plan, or open a draft PR with notes — do not push large speculative changes to \`${G}\`.`),z(),Y&&(i0(Y.secrets)||(Y.never??[]).length)){if(z("## Security & secrets"),z(),i0(Y.secrets)){let _=i0(Y.example)?` (see \`${Y.example}\`)`:"";z(`- Secrets live in \`${Y.secrets}\`${_}. Never read or commit them.`)}for(let _ of Y.never??[])if(i0(_))z(`- Never read or commit \`${_}\`.`);z()}if(z("## Commit & PR"),z(),X&&i0(X.commit_style))z(`- Commit style: ${iU(X.commit_style)}`);else z("- Conventional Commits preferred (`feat:`, `fix:`, `chore:`, …).");if(z(`- Branch off \`${G}\` and open a PR — never commit to \`${G}\` directly.`),z("- If build/test scripts or layout change, refresh this file in the **same PR** (`faf export --agents`)."),z(),$.stack){let _=[];for(let[i,t]of Object.entries($.stack)){if(hE.has(i))continue;if(U0(t))_.push(`- **${b0(`stack.${i}`)}:** ${t.trim()}`)}if(_.length){z("## Stack"),z();for(let i of _)z(i);z()}}let k0=$.generated;if(i0(k0))z(`*Context authored: ${String(k0)}*`);return Z.join(`
|
|
288
|
+
`)}function nU($,Z){J2(vE($,E0.agents),fE(Z))}import{existsSync as t5,readFileSync as rU}from"fs";import{join as H4}from"path";function uE($,Z){let z=[],Q=(U)=>t5(H4($,U)),X=(U)=>{try{return rU(H4($,U),"utf-8")}catch{return""}};if(Q("tsconfig.json")&&/"strict"\s*:\s*true/.test(X("tsconfig.json")))z.push("TypeScript strict mode (tsconfig.json)");if(Z?.type==="module")z.push("ESM modules (`type: module`)");let J=[],Y=Z?.devDependencies??{};if(Q(".eslintrc")||Q(".eslintrc.json")||Q(".eslintrc.cjs")||Q("eslint.config.js")||Q("eslint.config.mjs")||"eslint"in Y)J.push("ESLint");if(Q(".prettierrc")||Q(".prettierrc.json")||Q("prettier.config.js")||"prettier"in Y)J.push("Prettier");let W=Q("pyproject.toml")?X("pyproject.toml"):"";if(/\[tool\.black\]/.test(W))J.push("black");if(/\[tool\.ruff\]/.test(W))J.push("ruff");if(/\[tool\.mypy\]/.test(W))J.push("mypy");if(Q("rustfmt.toml")||Q(".rustfmt.toml"))J.push("rustfmt");if(J.length)z.push(`Style enforced by ${J.join(" · ")} — obey the configs`);return z}function P9($,Z){let z={...Z},Q=null,X=H4($,"package.json");if(t5(X))try{Q=JSON.parse(rU(X,"utf-8"))}catch{Q=null}let J=g5($,Q);if(Object.keys(J).length)z.commands={...J,...Z.commands??{}};let Y=Z.key_files??Z.instant_context?.key_files;if(!Y||Y.length===0){let W=v5($);if(W.length)z.key_files=W}if(!Z.security){let U=[".env",".env.local",".env.development"].find((G)=>t5(H4($,G)));if(U){let G=[".env.example",".env.sample",".env.template"].find((V)=>t5(H4($,V)));z.security={secrets:U,...G?{example:G}:{}}}}if(!Z.conventions){let W=uE($,Q);if(W.length)z.conventions=W}return z}import{join as mE}from"path";function cE($){let Z=[];if(Z.push(m2($)),Z.push(""),Z.push("# .cursorrules"),Z.push(`# Authored from project.faf — ${$.project?.name??"Project"}`),Z.push(""),$.project?.main_language)Z.push(`language: ${$.project.main_language}`);if($.stack){Z.push(""),Z.push("# Stack");for(let[z,Q]of Object.entries($.stack))if(U0(Q))Z.push(`# ${b0(`stack.${z}`)}: ${Q.trim()}`)}return Z.push(""),Z.join(`
|
|
289
|
+
`)}function sU($,Z){J2(mE($,E0.cursorrules),cE(Z),"# faf:start","# faf:end")}import{join as pE}from"path";var lE=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),dE=new Set(["target_user","core_problem","mission_purpose"]);function iE($){let Z=[],z=$.instant_context,Q=$.commands,X=$.key_files??z?.key_files,J=Q?Object.entries(Q).filter(([,q])=>lE(q)):[],Y=J.filter(([q])=>/test/i.test(q)),W=J.filter(([q])=>/lint|check/i.test(q)&&!/test/i.test(q)),U=J.filter(([q])=>!/test|lint|check/i.test(q)),G=(q)=>{let K=q.toLowerCase();if(/install|deps/.test(K))return 0;if(/^build$|build/.test(K)&&!/rebuild/.test(K))return 1;if(/^dev$|develop/.test(K))return 2;if(/^start$|run/.test(K))return 3;return 4},V=[...U].sort((q,K)=>G(q[0])-G(K[0])||q[0].localeCompare(K[0])),H=[...Y,...W];if(Z.push(m2($)),Z.push(""),Z.push(`# GEMINI.md — ${$.project?.name??"Project"}`),Z.push(""),Z.push("> Authored from project.faf — refresh with `faf export --gemini`."),Z.push(""),$.project?.name)Z.push(`Project: ${$.project.name}`);if($.project?.goal)Z.push(`Goal: ${$.project.goal}`);if($.project?.main_language)Z.push(`Language: ${$.project.main_language}`);if(V.length){Z.push(""),Z.push("## Setup & build"),Z.push(""),Z.push("```bash");for(let[q,K]of V)Z.push(`${K} # ${q}`);Z.push("```")}if(H.length){Z.push(""),Z.push("## Test & verify"),Z.push(""),Z.push("```bash");for(let[,q]of H)Z.push(q);Z.push("```")}if(X&&X.length){Z.push(""),Z.push("## Where things live"),Z.push("");for(let q of X)Z.push(`- \`${q}\``)}if($.stack){let q=[];for(let[K,L]of Object.entries($.stack)){if(dE.has(K))continue;if(U0(L))q.push(`- ${b0(`stack.${K}`)}: ${L.trim()}`)}if(q.length){Z.push(""),Z.push("## Stack");for(let K of q)Z.push(K)}}return Z.push(""),Z.push("## Before changing things"),Z.push(""),Z.push("- Ask first: dependency installs, deletions, migrations, schema changes, publish/release."),Z.push("- Never: force-push · push straight to `main` · commit secrets."),Z.push(""),Z.join(`
|
|
290
|
+
`)}function oU($,Z){J2(pE($,E0.gemini),iE(Z))}import{join as nE}from"path";var aU=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],rE=new Set([...aU.map(([$])=>$),"cicd"]);function sE($){let Z=[],z=$.project?.name??"Project";if(Z.push(m2($)),Z.push(""),Z.push(`# GitHub Copilot Instructions — ${z}`),Z.push(""),Z.push("> Authored from project.faf by FAF. Copilot reads these instructions on every request in this repository — keep them short and broadly applicable."),Z.push(""),U0($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let Q=$.stack??{},X=[];if(U0($.project?.main_language))X.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[G,V]of Object.entries(Q)){if(rE.has(G))continue;if(U0(V))X.push(`- **${b0(`stack.${G}`)}:** ${V.trim()}`)}if(X.length>0)Z.push("## Tech stack","",...X,"");let J=[];for(let[G,V]of aU){let H=Q[G];if(U0(H))J.push(`- ${V} \`${H.trim()}\`.`)}if(U0(Q.cicd))J.push(`- CI runs on ${Q.cicd.trim()}.`);if(J.length>0)Z.push("## Build & run","",...J,"");let Y=$.human_context??{},U=[["who",Y.who],["what",Y.what],["why",Y.why],["where",Y.where],["when",Y.when],["how",Y.how]].filter(([,G])=>U0(G)).map(([G,V])=>`- **${b0(`human_context.${G}`)}:** ${V.trim()}`);if(U.length>0)Z.push("## Project context","",...U,"");return Z.join(`
|
|
291
|
+
`)}function tU($,Z){w0($,".github"),J2(nE($,".github",E0.copilot),sE(Z),f2,u2,{root:$})}import{existsSync as oE}from"fs";import{join as aE}from"path";var tE="https://mcpaas.live/grok/mcp/v1",eU="mcp_servers.grok-faf-mcp";function eE($){return[`[${eU}]`,`url = "${tE}"`,""].join(`
|
|
292
|
+
`)}function $G($,Z){let z=eE(Z);w0($,".grok");let Q=d($,aE(".grok","config.toml"));if(!oE(Q))return a(Q,`# grok-faf-mcp — wired by FAF from project.faf
|
|
293
|
+
|
|
294
|
+
`+z,{root:$,expect:null}),"created";let X=J0(Q);if(X.includes(`[${eU}]`))return"unchanged";let J=X.endsWith(`
|
|
295
|
+
|
|
296
|
+
`)?"":X.endsWith(`
|
|
256
297
|
`)?`
|
|
257
298
|
`:`
|
|
258
299
|
|
|
259
|
-
`;return
|
|
300
|
+
`;return a(Q,X+J+z,{root:$,expect:X}),"merged"}import{join as $w}from"path";var Zw=[{key:"who",heading:"Who"},{key:"what",heading:"What"},{key:"why",heading:"Why"},{key:"where",heading:"Where"},{key:"when",heading:"When"},{key:"how",heading:"How"}];function w9($){if(!U0($))return null;let Z=$.trim();if(/^(none|n\/a)$/i.test(Z))return null;return Z}function E9($,Z){if(!$)return null;return w9($[Z])}function zw($){let Z=[],z=w9($.project?.name)??"Project",Q=w9($.project?.goal);if(Z.push(`# ${z}`),Z.push(""),Q)Z.push(`> ${Q}`),Z.push("");let X=$.human_context;for(let{key:Y,heading:W}of Zw){let U=E9(X,Y);if(!U)continue;Z.push(`## ${W}`),Z.push(""),Z.push(U),Z.push("")}let J=E9($.project,"homepage")??E9($.project,"url");if(J&&/^(https?:)?\/\//i.test(J))Z.push("## Links"),Z.push(""),Z.push(`- [Homepage](${J})`),Z.push("");return`${Z.join(`
|
|
260
301
|
`).trimEnd()}
|
|
261
|
-
`}function
|
|
262
|
-
`)}function
|
|
302
|
+
`}function ZG($,Z){J2($w($,E0.llms),zw(Z))}p();import{join as Qw}from"path";import{deprecate as Xw}from"node:util";var zG=i1.orange,Jw=i1.cyan,Yw=i1.cyanDeep,Ww="#FF9500",Uw="#FF3B30",Gw="#E6EDF3",Vw="#6E7681",QG={TROPHY:{glyph:"✪",color:zG},GOLD:{glyph:"★",color:zG},SILVER:{glyph:"◆",color:Jw},BRONZE:{glyph:"◇",color:Yw},GREEN:{glyph:"●",color:Gw},YELLOW:{glyph:"●",color:Ww},RED:{glyph:"○",color:Uw},WHITE:{glyph:"♡",color:Vw}};function x$($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var XG=["who","what","why","where","when","how"];function e5($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,z])=>`<div class="row"><div class="k">${x$(Z)}</div><div class="v">${x$(z)}</div></div>`).join(`
|
|
303
|
+
`)}function JG($,Z,z="project.faf"){let Q=x$($.project?.name??"Project"),X=Z.tier?.name??"WHITE",J=QG[X]??QG.WHITE,Y=Z.inherited?Z.represents?`inherited from ${x$(Z.represents)}`:"inherited":`${Z.score}%`,W=X==="TROPHY"&&!Z.inherited,U=$.human_context??{},G=XG.map((B)=>[B,U[B]]),V=Object.entries(U).filter(([B])=>!XG.includes(B)),H=[["goal",$.project?.goal],["main_language",$.project?.main_language],["type",$.project?.type],["framework",$.project?.framework],["faf_version",$.faf_version]],q=Object.entries($.stack??{}),K=q.filter(([,B])=>B&&B!=="slotignored"&&String(B).trim()!==""),L=q.filter(([,B])=>B==="slotignored").length;return`<!DOCTYPE html>
|
|
263
304
|
<html lang="en">
|
|
264
305
|
<head>
|
|
265
306
|
<meta charset="UTF-8">
|
|
266
307
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
267
|
-
<title>${
|
|
308
|
+
<title>${Q} — project.faf</title>
|
|
268
309
|
<meta name="description" content="Visual render of project.faf. Authored by faf — humans like visuals, we gave them one.">
|
|
269
310
|
<meta name="robots" content="index,follow">
|
|
270
311
|
<style>
|
|
271
312
|
*{margin:0;padding:0;box-sizing:border-box}
|
|
272
313
|
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;background:#0a0a0a;color:#e6edf3;line-height:1.55;padding:48px 20px}
|
|
273
314
|
.wrap{max-width:880px;margin:0 auto}
|
|
274
|
-
.bar{height:3px;border-radius:2px;background:linear-gradient(90deg,transparent,${
|
|
315
|
+
.bar{height:3px;border-radius:2px;background:linear-gradient(90deg,transparent,${J.color},transparent);margin-bottom:40px}
|
|
275
316
|
header{display:flex;align-items:baseline;gap:16px;flex-wrap:wrap;margin-bottom:8px}
|
|
276
317
|
h1{font-size:2.2rem;font-weight:800;letter-spacing:-1px}
|
|
277
|
-
.badge{font-size:1.05rem;font-weight:800;color:${
|
|
318
|
+
.badge{font-size:1.05rem;font-weight:800;color:${J.color};white-space:nowrap}
|
|
278
319
|
.score{font-size:1.05rem;font-weight:700;color:#8b949e}
|
|
279
320
|
.eyebrow{font-size:11px;font-weight:700;letter-spacing:2px;text-transform:uppercase;color:#6e7681;margin-bottom:36px}
|
|
280
321
|
section{margin-bottom:34px}
|
|
281
|
-
h2{font-size:12px;font-weight:700;letter-spacing:2px;text-transform:uppercase;color:${
|
|
322
|
+
h2{font-size:12px;font-weight:700;letter-spacing:2px;text-transform:uppercase;color:${J.color};margin-bottom:14px;padding-bottom:6px;border-bottom:1px solid rgba(255,255,255,.07)}
|
|
282
323
|
.row{display:flex;gap:18px;padding:8px 0;border-bottom:1px solid rgba(255,255,255,.04)}
|
|
283
324
|
.k{flex:0 0 150px;color:#8b949e;font-size:.9rem;text-transform:capitalize}
|
|
284
325
|
.v{flex:1;color:#e6edf3;font-size:.95rem;word-break:break-word}
|
|
285
326
|
.meter{height:8px;border-radius:4px;background:rgba(255,255,255,.06);overflow:hidden;margin:6px 0 10px}
|
|
286
|
-
.meter span{display:block;height:100%;background:${
|
|
327
|
+
.meter span{display:block;height:100%;background:${J.color};width:${Math.max(0,Math.min(100,Z.score))}%}
|
|
287
328
|
.award{font-size:.95rem}
|
|
288
329
|
.statline{margin-bottom:32px}
|
|
289
330
|
.awd-pre{color:#6E7681}
|
|
@@ -299,8 +340,8 @@ footer strong{color:#e6edf3}
|
|
|
299
340
|
<div class="bar"></div>
|
|
300
341
|
<div class="eyebrow">project.faf · visual render</div>
|
|
301
342
|
<header>
|
|
302
|
-
<h1>${
|
|
303
|
-
<span class="badge">${
|
|
343
|
+
<h1>${Q}</h1>
|
|
344
|
+
<span class="badge">${J.glyph} ${x$(X)}</span>
|
|
304
345
|
<span class="score">${Y}</span>
|
|
305
346
|
</header>
|
|
306
347
|
<div class="meter"><span></span></div>
|
|
@@ -308,97 +349,103 @@ ${W?'<p class="award statline"><span class="awd-pre">✅ All Required slots fill
|
|
|
308
349
|
|
|
309
350
|
<section>
|
|
310
351
|
<h2>The 6 W's</h2>
|
|
311
|
-
${
|
|
312
|
-
${
|
|
352
|
+
${e5(G)||'<p class="muted">No human_context yet.</p>'}
|
|
353
|
+
${V.length?e5(V):""}
|
|
313
354
|
</section>
|
|
314
355
|
|
|
315
356
|
<section>
|
|
316
357
|
<h2>Project</h2>
|
|
317
|
-
${
|
|
358
|
+
${e5(H)||'<p class="muted">—</p>'}
|
|
318
359
|
</section>
|
|
319
360
|
|
|
320
361
|
<section>
|
|
321
362
|
<h2>Stack</h2>
|
|
322
|
-
${
|
|
363
|
+
${K.length?e5(K):'<p class="muted">No active stack slots.</p>'}
|
|
323
364
|
</section>
|
|
324
365
|
|
|
325
366
|
<footer>
|
|
326
|
-
Rendered on-demand from your current <strong>${
|
|
367
|
+
Rendered on-demand from your current <strong>${x$(z)}</strong><br>
|
|
327
368
|
<strong>Humans like visuals. <span style="color:#00D4D4">We gave them one.</span></strong>
|
|
328
369
|
</footer>
|
|
329
370
|
</div>
|
|
330
371
|
</body>
|
|
331
372
|
</html>
|
|
332
|
-
`}function
|
|
333
|
-
`,"
|
|
373
|
+
`}var Hw='<meta name="description" content="Visual render of project.faf.';function qw($){return new TextDecoder().decode($).split(/\r?\n/).some((Z)=>Z.trim().startsWith(Hw)&&Z.includes(" by faf"))}function $Z($,Z,z,Q="project.faf",X={}){Y2(Qw($,"project.html"),JG(Z,z,Q),{root:$,format:"html",hasMark:qw,mark:"faf mark (the `Visual render of project.faf` description line)",force:X.force})}var uu=Xw(JG,"faf-cli: generateProjectHtml is deprecated, use renderProjectHtml","FAF0001");import{join as Kw}from"path";import{deprecate as Bw}from"node:util";var YG="application/vnd.faf+yaml",Mw="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",Lw=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function UG($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&Lw.test(Z))return Z;let z=$.project?.homepage??$.project?.website??$.project?.url,Q="local";if(z)try{Q=new URL(z).hostname.replace(/^www\./,"").split(".").reverse().join(".")}catch{}let X=Z.replace(/[^a-zA-Z0-9._-]/g,"-").replace(/^-+|-+$/g,"")||"project";return`${Q}/${X}`}function Nw($){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 q4($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:YG,iana:`https://www.iana.org/assignments/media-types/${YG}`,deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function ZZ($,Z={}){let z={$schema:Mw,name:UG($),version:String($.project?.version??"0.1.0"),description:Nw($)},Q=j9($)??$.project?.name;if(Q&&Q.length<=100)z.title=Q;let X=$.project?.homepage??$.project?.website??$.project?.url;if(X)z.websiteUrl=X;if(Z.remoteUrl)z.remotes=[{type:"streamable-http",url:Z.remoteUrl}];return z._meta={"one.faf/context":q4($,Z)},z}var k$="io.modelcontextprotocol.registry/publisher-provided",WG=4096;function GG($,Z={}){let z={"one.faf/context":q4($,Z)},Q=new TextEncoder().encode(JSON.stringify(z)).length;if(Q>WG)throw Error(`publisher-provided _meta is ${Q}B — exceeds the registry ${WG}B cap`);return{[k$]:z}}function VG($){return UG($)}function j9($){let Z=$.project?.title;if(typeof Z==="string"){let z=Z.trim();if(z&&z.length<=100)return z}return}function HG($){try{return JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return}}var s6=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function K4($){let Z=HG($);return s6(Z)&&s6(Z._meta)&&s6(Z._meta["one.faf/context"])}function zZ($){let Z=HG($),z=s6(Z)&&s6(Z._meta)?Z._meta[k$]:void 0;return s6(z)&&s6(z["one.faf/context"])}function qG($,Z,z={},Q={}){let X=ZZ(Z,z),J=Kw($,"server-card");return Y2(J,`${JSON.stringify(X,null,2)}
|
|
374
|
+
`,{root:$,format:"json",hasMark:K4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:Q.force}),J}function QZ($,Z){let z={name:Z.name,title:Z.title,version:Z.version,_meta:Z.meta};return a5($,z,{"":{name:["$schema"],title:["name"],version:["description","title","name"]}})}var iu=Bw(ZZ,"faf-cli: generateServerCard is deprecated, use buildServerCard","FAF0002");p();function B4($,Z,z,Q){let X=i5(Dw($,Z),Z,Q?.[0],Q?.[1],{root:$});if(z(),console.log(` ${Z}`),X)console.log(M(` ${X}`))}function Iw($){try{return $(),!0}catch(Z){if(!w$(Z))throw Z;return console.error(B6(Z,!0)),!1}}function o6($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
|
|
334
375
|
|
|
335
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
336
|
-
`,"
|
|
376
|
+
Run 'faf init' to create one.`),process.exit(2);let z=$.output?Ow(process.cwd(),$.output):process.cwd();if($.output)w0(z);let Q=r(Z),X=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.llms&&!$.conductor&&!$.html&&!$.card,J=0,Y=(U)=>{if(!Iw(U))J++};if(X||$.agents)Y(()=>B4(z,"AGENTS.md",()=>nU(z,P9(z,Q))));if(X||$.cursor)Y(()=>B4(z,".cursorrules",()=>sU(z,Q),["# faf:start","# faf:end"]));if(X||$.gemini)Y(()=>B4(z,"GEMINI.md",()=>oU(z,P9(z,Q))));if(X||$.copilot)Y(()=>B4(z,".github/copilot-instructions.md",()=>tU(z,Q)));if($.grok)Y(()=>{let U=$G(z,Q);console.log(` .grok/config.toml (${U})`)});if($.llms)Y(()=>B4(z,"llms.txt",()=>ZG(z,Q)));if(X||$.html)Y(()=>{let U=n(Z,()=>M0(c(Z)));$Z(z,Q,U,Z,{force:$.force}),console.log(" project.html")});let W=Q.app_type==="server-card"||Q.project?.type==="server-card";if($.card||X&&W)Y(()=>{let U=qG(z,Q,{},{force:$.force});console.log(` ${U.replace(`${z}/`,"")}`)});if(console.log(`${I("exported")} ${M(`from ${Z}`)}`),J>0)process.exit(1)}import{existsSync as xw,lstatSync as kw}from"fs";import{dirname as TG,resolve as y9}from"path";import{existsSync as KG,readFileSync as Tw}from"fs";import{dirname as XZ,join as BG}from"path";import{deprecate as Aw}from"node:util";var JZ="https://faf.one/context",Rw="JSONRPC",MG="1.0",S9=["a2a","mcp","registry","catalog"];function LG($){return d0(Tw($,"utf-8"))}function NG($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let Q of Z){let X=BG($,Q);if(KG(X))return X}let z=XZ($);if(z!==$)for(let Q of Z){let X=BG(z,Q);if(KG(X))return X}return null}function Cw($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function x9($,Z={}){let z=Cw($);if(z.length>0)return z;let Q=Z.doorUrl?.trim();if(Q)return[{protocol:"a2a",location:Q,version:MG}];return[]}function DG($,Z,z={}){let Q=$.agent??{},X=x9($,z);if(X.length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");let J=String(Q.displayName??$.metadata?.persona??Q.name??"").trim(),Y=String(Q.description??"").trim(),W=String(Q.version??"").trim(),U=String(Q.vendor??"").trim(),G=String(Q.homepage??"").trim();if(!J||!Y||!W||!U||!G)throw Error("A2A card needs agent.displayName|name, description, version, vendor, homepage in .fafa");let V=q4(Z,z),H=($.capabilities??[]).map((q)=>{let K=String(q.name??"").trim();if(!K)throw Error("A2A skill missing capabilities[].name");let L=Array.isArray(q.tags)?q.tags.map(String):[];return{id:K,name:K,description:String(q.description??"").trim()||K,tags:L}});return{name:J,description:Y,supportedInterfaces:X.map((q)=>({url:String(q.location),protocolBinding:Rw,protocolVersion:String(q.version??MG)})),provider:{organization:U,url:G},version:W,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[{uri:JZ,description:"FAF context provenance — the durable context block (one context, every door).",required:!1,params:V}]},defaultInputModes:["text/plain","application/json"],defaultOutputModes:["text/plain","application/json"],skills:H}}var Om=Aw(DG,"faf-cli: generateA2ACard is deprecated, use buildA2ACard","FAF0003");function _w($){let Z=$.agent?.homepage;if(!Z)return"local";try{return new URL(Z).hostname.replace(/^www\./,"")}catch{return"local"}}function Fw($,Z){if(Z.a2aCardUrl)return Z.a2aCardUrl;let z=$.agent?.homepage;if(z)try{return new URL("/.well-known/agent-card.json",z).href}catch{}return"/.well-known/agent-card.json"}function Pw($,Z,z={}){let Q=_w($),X=$.agent??{},J=String(X.name??"agent"),Y=z.now??Z.generated??new Date().toISOString(),W=[];if(x9($,z).length>0)W.push({identifier:`urn:air:${Q}:a2a:${J}`,displayName:String(X.displayName??X.name??"A2A Agent Card"),type:"application/a2a-agent-card+json",description:"A2A v1.0 Agent Card. Projected from .fafa.",url:Fw($,z),updatedAt:Y});let U=Ew($,"fafa");if(U)W.push({identifier:`urn:air:${Q}:agent:${J}`,displayName:String(X.displayName??X.name??".fafa"),type:"application/vnd.fafa+yaml",description:"FAF agent passport (.fafa).",url:U,updatedAt:Y});return W}function Ew($,Z){let z=$.agent?.homepage;if(!z)return;try{return new URL(`/.well-known/${Z}`,z).href}catch{return}}var ww=["url","type","updatedAt"];function OG($,Z){if($===null)return{text:`${JSON.stringify({specVersion:"1.0",entries:Z},null,2)}
|
|
377
|
+
`,changed:!0};return vU($,"entries",Z,{id:"identifier",update:ww})}function YZ($){let Z=$.opts??{},z=new Set($.targets?.length?$.targets:S9),X={block:q4($.faf,Z)};if(z.has("mcp"))X.mcp=ZZ($.faf,Z);if(z.has("registry")){let J=j9($.faf);X.registry={name:VG($.faf),...J?{title:J}:{},_meta:GG($.faf,Z)}}if(z.has("a2a")||z.has("catalog")){if(!$.fafa){if($.targets?.includes("a2a")||$.targets?.includes("catalog"))throw Error("A2A/catalog require a .fafa (agent.fafa). Will not invent an agent.")}}if(z.has("a2a")&&$.fafa)if(x9($.fafa,Z).length===0){if($.targets?.includes("a2a"))throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.")}else X.a2a=DG($.fafa,$.faf,Z);if(z.has("catalog")&&$.fafa)X.catalog=Pw($.fafa,$.faf,Z);return jw(X),X}function jw($){let Z=JSON.stringify($.block),z=[];if($.a2a)z.push(JSON.stringify($.a2a.capabilities.extensions[0].params));if($.mcp){let Q=$.mcp._meta;z.push(JSON.stringify(Q["one.faf/context"]))}if($.registry){let Q=$.registry._meta["io.modelcontextprotocol.registry/publisher-provided"];z.push(JSON.stringify(Q["one.faf/context"]))}for(let Q of z)if(Q!==Z)throw Error("context block drifted across card targets — one projector, one block")}function k9($){let Z;try{Z=JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return!1}let Q=(typeof Z==="object"&&Z!==null?Z.capabilities:void 0)?.extensions;return Array.isArray(Q)&&Q.some((X)=>typeof X==="object"&&X!==null&&X.uri===JZ)}function Sw($){return K4($)||zZ($)||k9($)}function b9($,Z,z,Q={}){return w0(z??XZ($),XZ($)),Y2($,`${JSON.stringify(Z,null,2)}
|
|
378
|
+
`,{root:z??XZ($),format:"json",hasMark:Q.owns??Sw,mark:Q.mark??"FAF context-block (a faf card mark)",force:Q.force}).result}function IG($){if(!$)return;let Z=$.split(",").map((Q)=>Q.trim().toLowerCase()).filter(Boolean),z=Z.filter((Q)=>!S9.includes(Q));if(z.length)throw Error(`unknown card target: ${z.join(", ")} (use ${S9.join(",")})`);return Z}p();function bw($){try{return kw($),!0}catch{return!1}}function yw($){try{let z=JSON.parse($.replace(/^\uFEFF/,""))?._meta?.[k$]?.["one.faf/context"]?.generated;return typeof z==="string"?z:void 0}catch{return}}function AG($={}){let Z=$.faf?y9($.faf):f();if(!Z||!xw(Z))console.error(`Error: project.faf not found
|
|
337
379
|
|
|
338
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
380
|
+
Run 'faf init' to create one.`),process.exit(2);let z=r(Z),Q=y9($.in??"./server.json"),X=$.in?TG(Q):process.cwd();if(!bw(Q))console.error(`Error: ${Q} not found.
|
|
339
381
|
|
|
340
382
|
'faf server-card' patches the identity into an existing registry server.json;
|
|
341
|
-
it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=
|
|
342
|
-
`;if($.check){process.stdout.write(L);return}let B=nZ($.out??z);NA(B,L),console.error(`${I("✓")} ${B} — name=${q} title=${G??"(none)"} ${M("(identity emitted from faf-cli)")}`)}import{existsSync as Q4,readFileSync as YQ}from"fs";import{join as Y4,resolve as rZ}from"path";l();function WQ($={}){let Z=$.dir?rZ($.dir):process.cwd(),X;try{X=zQ($.target)}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}let z=$.faf?rZ($.faf):f(Z);if(!z||!Q4(z))console.error(`Error: project.faf not found
|
|
383
|
+
it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=d(X,Q),Y=J0(J),W=$.generated??yw(Y)??new Date().toISOString(),U=YZ({faf:z,targets:["registry"],opts:{fafPointer:"./project.faf",now:W}}),G=U.registry.name,V=U.registry.title,H;try{H=QZ(Y,{name:G,title:V,version:$.setVersion,meta:U.registry._meta})}catch(L){if(!(L instanceof y0))throw L;console.error(`faf: ${Q}: ${L.message} — faf cannot change only its identity keys, so it left the file unchanged.`),process.exit(1)}if($.check){process.stdout.write(H.text);return}let q=y9($.out??Q),K=V??"(none in project.faf — the file's own kept)";if(q===Q){if(H.changed)a(J,H.text,{root:X,expect:Y})}else Q2(q),Y2(q,H.text,{root:$.out?TG(q):process.cwd(),format:"json",hasMark:zZ,mark:"faf identity (`_meta` publisher-provided `one.faf/context`)",force:$.force});console.error(`${I("✓")} ${q} — name=${G} title=${K} ${M(H.changed||q!==Q?"(identity emitted from faf-cli)":"(unchanged)")}`)}import{existsSync as RG,lstatSync as vw}from"fs";import{dirname as gw,join as M4,resolve as v9}from"path";p();function g9($){try{return vw($),!0}catch{return!1}}var p2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)?$:void 0,hw=[{target:"registry",file:["server.json"],stamp:($)=>p2(p2(p2($._meta)?.[k$])?.["one.faf/context"])?.generated},{target:"mcp",file:["server-card"],stamp:($)=>p2(p2($._meta)?.["one.faf/context"])?.generated},{target:"a2a",file:[".well-known","agent-card.json"],stamp:($)=>{let Z=p2($.capabilities)?.extensions,z=Array.isArray(Z)?Z.map(p2).find((Q)=>Q?.uri===JZ):void 0;return p2(z?.params)?.generated}}];function fw($,Z){for(let{target:z,file:Q,stamp:X}of hw){let J=M4($,...Q);if(Z?.length&&!Z.includes(z)||!g9(J))continue;try{let Y=p2(JSON.parse(J0(d($,J)).replace(/^\uFEFF/,""))),W=Y?X(Y):void 0;if(typeof W==="string")return W}catch{}}return}function CG($={}){let Z=$.dir?v9($.dir):process.cwd(),z;try{z=IG($.target)}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}let Q=$.faf?v9($.faf):f(Z);if(!Q||!RG(Q))console.error(`Error: project.faf not found
|
|
343
384
|
|
|
344
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
345
|
-
`);return}let U=[];if(W.a2a){let q=
|
|
385
|
+
Run 'faf init' to create one.`),process.exit(2);let X=r(Q),J=$.fafa?v9($.fafa):NG(Z),Y=J&&RG(J)?LG(J):void 0,W;try{W=YZ({faf:X,fafa:Y,targets:z,opts:{a2aCardUrl:$.a2aUrl,doorUrl:$.doorUrl,fafPointer:$.fafPointer,now:fw(Z,z)??new Date().toISOString()}})}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}if($.check){process.stdout.write(`${JSON.stringify(W,null,2)}
|
|
386
|
+
`);return}let U=[],G=$.force===!0,V=0,H=(q,K,L="its own keys")=>{try{U.push({out:q,changed:K()})}catch(B){if(B instanceof y0)console.error(`faf: ${q}: ${B.message} — faf cannot change only ${L}, so it left the file unchanged.`);else if(w$(B))console.error(B6(B,!0));else throw B;V++}};if(W.a2a){let q=M4(Z,".well-known","agent-card.json");H(q,()=>b9(q,W.a2a,Z,{owns:k9,mark:"FAF context extension (https://faf.one/context)",force:G})!=="unchanged")}if(W.mcp){let q=M4(Z,"server-card");H(q,()=>b9(q,W.mcp,Z,{owns:K4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:G})!=="unchanged")}if(W.catalog){let q=M4(Z,".well-known","ai-catalog.json"),K=W.catalog;H(q,()=>{w0(Z,gw(q));let L=d(Z,q),B=g9(q)?J0(L):null,N=OG(B,K);if(N.changed)a(L,N.text,{root:Z,expect:B});return N.changed},"its own rows")}if(W.registry){let q=M4(Z,"server.json");if(g9(q)){let K=W.registry;H(q,()=>{let L=d(Z,q),B=J0(L),N=QZ(B,{name:K.name,title:K.title,meta:K._meta});if(N.changed)a(L,N.text,{root:Z,expect:B});return N.changed},"its identity keys")}else if(z?.includes("registry"))console.error(`Error: ${q} not found.
|
|
346
387
|
|
|
347
|
-
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
|
|
388
|
+
Registry target patches an existing server.json. Seed one first.`),process.exit(2)}if(U.length===0&&V===0){console.error(`${I("faf cards")} ${M("nothing to write — need .fafa for A2A/catalog; server.json for registry")}`);return}for(let{out:q,changed:K}of U)console.error(`${I("✓")} ${q}${K?"":` ${M("(unchanged)")}`}`);if(V>0)process.exit(1)}import{join as uw}from"path";import mw from"open";p();function cw($){if(process.env.CI)return!1;try{return mw($).catch(()=>{return}),!0}catch{return!1}}function _G($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
|
|
348
389
|
|
|
349
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
350
|
-
`+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:
|
|
390
|
+
Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=r(Z),X=n(Z,()=>M0(c(Z)));$Z(z,Q,X,Z,{force:$.force});let J=uw(z,"project.html"),Y=cw(J);console.log(" project.html"),console.log(Y?`${I("opened")} ${M("in your browser")}`:`${I("rendered")} ${M(`file://${J}`)}`)}import{existsSync as pw}from"fs";import{join as wG,resolve as lw}from"path";import{execFileSync as dw}from"child_process";function FG($){let Z=($??"").trim();if(!Z)throw Error("Please provide a GitHub URL.");if(/[\s;&|`$(){}<>\\^'"!*?[\]]/.test(Z))throw Error(`Refusing unsafe URL: ${JSON.stringify($)}`);let z=Z.replace(/\/+$/,"").replace(/\.git$/i,""),Q=z.match(/^(?:github\.com\/)?([A-Za-z0-9][A-Za-z0-9._-]*)\/([A-Za-z0-9][A-Za-z0-9._-]*)$/);if(Q)return`https://github.com/${Q[1]}/${Q[2]}.git`;if(/^https?:\/\/[A-Za-z0-9._\-/:@~%]+$/.test(z))return`${z}.git`;throw Error(`Not a recognized GitHub repo URL: ${JSON.stringify($)}`)}function PG($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function EG($,Z={}){let z=P$($);if(Z.repoUrl&&z.project&&!D2($)?.name&&z.project.name===$.split("/").pop())z.project.name=PG(Z.repoUrl);return z}p();function iw($,Z,z){return["clone","--depth","1",...z?["--branch",z]:[],"--",$,Z]}function nw($,Z=process.cwd()){if($.stdout)return{outputPath:null};let z=$.output?lw(Z,$.output):wG(Z,"project.faf");if(pw(z)&&!$.force)throw Error(`${z} already exists — refusing to overwrite your context.
|
|
391
|
+
`+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:z}}function jG($,Z={},z=process.cwd()){let Q;try{Q=FG($)}catch(W){console.error(`Error: ${W.message}
|
|
351
392
|
|
|
352
|
-
Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let
|
|
393
|
+
Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let X;try{X=nw(Z,z)}catch(W){console.error(`Error: ${W.message}`),process.exit(1);return}Q2(X.outputPath===null?void 0:Z.output);let J=V5("faf-git-"),Y=wG(J,"repo");try{console.error(M(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{dw("git",iw(Q,Y,Z.ref),{stdio:"pipe"})}catch(V){let q=(V?.stderr?.toString()??"").trim().split(`
|
|
353
394
|
`).slice(-2).join(" ").trim()||"git clone failed",K=Z.ref?`
|
|
354
395
|
|
|
355
396
|
(does the branch/tag '${Z.ref}' exist?)`:"";console.error(`Error: could not clone ${$}
|
|
356
397
|
|
|
357
|
-
${
|
|
358
|
-
`)}function
|
|
359
|
-
`)
|
|
360
|
-
`)
|
|
361
|
-
|
|
362
|
-
`)
|
|
398
|
+
${q}${K}`),process.exit(1)}let W=EG(Y,{repoUrl:Q});if(X.outputPath===null){process.stdout.write(F3(W));return}K0(X.outputPath,W,{replace:Z.force===!0}),console.log(`${I("created")} ${X.outputPath}`);let U=c(X.outputPath),G=n(X.outputPath,()=>j0(C0(U)));_0(G,X.outputPath)}finally{H5(J)}}import{execFileSync as F2}from"child_process";import{readFileSync as rw,existsSync as sw}from"fs";import{dirname as ow,resolve as aw}from"path";var b$=($)=>String($).trim(),tw="slotignored",SG=($)=>W0($)||typeof $==="string"&&$.trim().toLowerCase()===tw;function ew($,Z){let z=[],Q=0,X=0;for(let J of z0){let Y=h1($,J),W=h1(Z,J),U=!SG(Y),G=!SG(W);if(U)Q++;if(G)X++;let V=J.label??J.path.split(".").pop()??J.path,H={path:J.path,label:V,category:String(J.category)};if(!U&&G)z.push({...H,kind:"added",to:b$(W)});else if(U&&!G)z.push({...H,kind:"removed",from:b$(Y)});else if(U&&G&&b$(Y)!==b$(W))z.push({...H,kind:"changed",from:b$(Y),to:b$(W)})}return{changes:z,filledBase:Q,filledTarget:X}}function xG($){if(!$.trim())return 0;try{return M0($).score??0}catch{return 0}}function kG($){if(!$.trim())return{};try{return $2($)??{}}catch{return{}}}function GZ($,Z){let{changes:z,filledBase:Q,filledTarget:X}=ew(kG($),kG(Z)),J=xG($),Y=xG(Z);return{changes:z,scoreBase:J,scoreTarget:Y,scoreDelta:Y-J,filledBase:Q,filledTarget:X}}var $j={added:"+",removed:"-",changed:"~"},bG=($)=>$>0?`+${$}`:`${$}`,WZ=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function vG($,Z,z){let Q=[],X=B2(V6($.scoreBase)),J=B2(V6($.scoreTarget));if(Q.push(`project.faf ${Z} → ${z}`),Q.push(`Score: ${$.scoreBase}% ${X} → ${$.scoreTarget}% ${J} (${bG($.scoreDelta)})`),Q.push(""),$.changes.length===0)Q.push(" (no slot changes)");else{let Y="";for(let W of $.changes){if(W.category!==Y)Q.push(` ${W.category}`),Y=W.category;let U=$j[W.kind],G=W.label.padEnd(16);if(W.kind==="changed")Q.push(` ${U} ${G} ${WZ(W.from)} → ${WZ(W.to)}`);else if(W.kind==="added")Q.push(` ${U} ${G} ${WZ(W.to)} (added)`);else Q.push(` ${U} ${G} ${WZ(W.from)} (removed)`)}}return Q.push(""),Q.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${bG($.filledTarget-$.filledBase)})`),Q.join(`
|
|
399
|
+
`)}function Zj($,Z){try{return F2("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function L4($,Z){if(!Zj($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function y$($,Z,z){try{return F2("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function gG($){let Z=$[0]??"project.faf";try{if($.length<5){console.log(`${Z} — unmerged (resolve the conflict, then \`faf diff\`)`);return}let z=(J)=>J&&J!=="/dev/null"&&sw(J)?rw(J,"utf-8"):"",Q=(J,Y)=>{if(!J||J==="/dev/null")return"(absent)";if(!Y||/^0+$/.test(Y))return"(working tree)";return Y.slice(0,7)},X=GZ(z($[1]),z($[4]));console.log(vG(X,Q($[1],$[2]),Q($[4],$[5])))}catch(z){console.log(`${Z} — faf diff unavailable (${z instanceof Error?z.message:"error"})`)}}var UZ="*.faf diff=faf";function h9($){let[Z,...z]=$.trim().split(/\s+/);try{return F2(Z,z,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function hG($){try{return F2("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}catch{throw console.error("Error: not a git repository."),process.exit(2),Error("unreachable")}}var n0="faf-cli diff-driver";function fG($,Z,z){try{return F2("git",["config","--null",...Z],{cwd:$,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch(Q){if(Q.status===1)return"";let X=String(Q.stderr??"").trim().split(`
|
|
400
|
+
`)[0]||"git config failed";throw Error(`git cannot read ${z} (${X})`,{cause:Q})}}function f9($,Z=!1){return fG($,[...Z?["--local"]:[],"--get-all","diff.faf.command"],"diff.faf.command").split("\x00").slice(0,-1)}function zj($){let z=fG($,["--get-regexp","^diff\\.faf\\."],"the diff.faf settings").split("\x00").slice(0,-1).map((Q)=>Q.split(`
|
|
401
|
+
`)[0]);return[...new Set(z.filter((Q)=>Q!=="diff.faf.command"))]}var uG=($)=>$.map((Z)=>JSON.stringify(Z)).join(", ");function Qj($){let Z=d($,".gitattributes"),z=M6(Z),Q=z??"";if(Q.split(`
|
|
402
|
+
`).some((Y)=>Y.trim()===UZ)){console.log(`• .gitattributes already opts in (${UZ})`);return}let X=Q.includes(`\r
|
|
403
|
+
`)?`\r
|
|
404
|
+
`:`
|
|
405
|
+
`,J=`${Q}${Q&&!Q.endsWith(`
|
|
406
|
+
`)?X:""}${UZ}${X}`;a(Z,J,{root:$,expect:z}),console.log(`✅ .gitattributes ${UZ}`)}function Xj($){let Z=hG($),z;try{z=f9($)}catch(J){return console.error(`faf: ${J.message} — faf left your git config unchanged.`),!1}let Q=z.length===1&&z[0]===n0;if(z.length>0&&!Q)return console.error(`faf: diff.faf.command is already set to ${uG(z)}, not faf's driver (${n0}) — faf left your git config and .gitattributes unchanged.`),!1;let X;try{X=zj($)}catch(J){return console.error(`faf: ${J.message} — faf left your git config unchanged.`),!1}if(X.length>0)return console.error(`faf: your git config already has ${X.join(", ")} — a diff driver setting of your own, so faf left your git config and .gitattributes unchanged.`),!1;if(Qj(Z),Q)console.log(`• git config already set (diff.faf.command = ${n0})`);else F2("git",["config","diff.faf.command",n0],{cwd:$}),console.log(`✅ git config diff.faf.command = ${n0}`);if(console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!h9(n0))console.log("\n⚠ the `faf-cli` on your PATH does not support `diff-driver` yet (needs faf-cli ≥ 7.0)."),console.log(" `git diff` on .faf files falls back to the raw text diff until you upgrade.");return!0}var Jj='[diff "faf"]',Yj=` command = ${n0}`,mG=($)=>/\r(?!\n)/.test($),Wj=($)=>(/\\+$/.exec(X2($))?.[0].length??0)%2===1;function Uj($){if(mG($))return null;let Z=n6($),z=Z.map((V,H)=>H>0&&Wj(Z[H-1])),Q=Z.map((V,H)=>!z[H]&&X2(V).trimStart().startsWith("[")),X=[],J=-1;if(Z.forEach((V,H)=>{if(Q[H])J=X2(V)===Jj?H:-1;else if(J>=0&&!z[H]&&X2(V)===Yj)X.push({at:H,head:J})}),X.length!==1)return null;let{at:Y,head:W}=X[0],U=Y+1;while(U<Z.length&&!Q[U])U++;if(Z.slice(W+1,U).some((V,H)=>W+1+H!==Y&&X2(V).trim()!==""))return null;return Z.filter((V,H)=>H!==W&&H!==Y).join("")}function yG($,Z){try{return F2("git",["config","--file","-","--null","--list"],{cwd:$,input:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).split("\x00").slice(0,-1)}catch{return null}}function Gj($,Z,z){let Q=yG($,Z),X=yG($,z);if(Q===null||X===null)return!1;let J=`diff.faf.command
|
|
407
|
+
${n0}`,Y=Q.indexOf(J);if(Y<0||Q.lastIndexOf(J)!==Y)return!1;let W=[...Q.slice(0,Y),...Q.slice(Y+1)];return W.length===X.length&&W.every((U,G)=>U===X[G])}function Vj($){let Z=f9($,!0);if(Z.length!==1||Z[0]!==n0)return`diff.faf.command = ${n0} is set outside this repo's own config (your global or system git config) — faf left it unchanged.`;let z=aw($,F2("git",["rev-parse","--git-path","config"],{cwd:$,encoding:"utf-8"}).trim()),Q=ow(z);try{let X=d(Q,z,{allowGitConfig:!0}),J=J0(X);if(mG(J))return`${X} has a carriage return (CR) that does not end a line, so faf and git could read its lines differently — faf left your git config unchanged.`;let Y=Uj(J);if(Y===null||!Gj($,J,Y))return`diff.faf.command in ${X} is not in the section faf writes (a [diff "faf"] line and a tab-indented "command = ${n0}" line, with nothing else in the section or on either line) — faf left your git config unchanged.`;return a(X,Y,{root:Q,allowGitConfig:!0,expect:J}),null}catch(X){if(X instanceof y||X instanceof b2)return X.message;throw X}}function Hj($){hG($);let Z;try{Z=f9($)}catch(Q){return console.error(`faf: ${Q.message} — faf left your git config unchanged.`),!1}if(Z.length===0)return console.log("• diff.faf.command is not set — nothing to remove (the .gitattributes line, if any, is left for you to keep or delete)."),!0;if(Z.length!==1||Z[0]!==n0)return console.error(`faf: diff.faf.command is ${uG(Z)}, not faf's driver (${n0}) — faf left your git config unchanged.`),!1;let z;try{z=Vj($)}catch(Q){z=`${Q.message.split(`
|
|
408
|
+
`)[0]} — faf left your git config unchanged.`}if(z!==null)return console.error(`faf: ${z}`),!1;return console.log("✅ removed diff.faf.command (the .gitattributes line is left for you to keep or delete)."),!0}function cG($,Z={},z=process.cwd()){if(Z.installDriver){if(!Xj(z))process.exit(1);return}if(Z.uninstallDriver){if(!Hj(z))process.exit(1);return}let Q=f(z);if(!Q)console.error(`Error: project.faf not found
|
|
409
|
+
|
|
410
|
+
Run 'faf init' to create one.`),process.exit(2);let X;try{X=F2("git",["rev-parse","--show-toplevel"],{cwd:z,encoding:"utf-8"}).trim()}catch{console.error("Error: not a git repository — faf diff compares .faf versions across git history."),process.exit(2);return}let J=A$(Q,z),Y,W,U,G;if(!$)Y="HEAD",W="(working tree)",U=y$("HEAD",J,z),G=c(Q);else if($.includes("...")){let[H,q]=$.split("...");L4(H,z),L4(q,z);let K;try{K=F2("git",["merge-base",H,q],{cwd:z,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${H}' and '${q}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=K.slice(0,7),W=q,U=y$(K,J,z),G=y$(q,J,z)}else if($.includes("..")){let[H,q]=$.split("..");L4(H,z),L4(q,z),Y=H,W=q,U=y$(H,J,z),G=y$(q,J,z)}else L4($,z),Y=$,W="(working tree)",U=y$($,J,z),G=c(Q);let V=GZ(U,G);if(Z.json)console.log(JSON.stringify({base:Y,target:W,...V},null,2));else console.log(vG(V,Y,W))}import{execFileSync as u9}from"child_process";function qj($){if(!$.trim())return 0;try{return M0($).score??0}catch{return 0}}var Kj=($)=>$>0?`+${$}`:`${$}`;function Bj($){let Z=$.map((z)=>({...z,score:qj(z.raw)}));return Z.map((z,Q)=>{let X=Z[Q+1];return{hex:z.hex,date:z.date,subject:z.subject,score:z.score,delta:X?z.score-X.score:null,first:!X}})}function Mj($,Z="project.faf"){if($.length===0)return`${Z} — no history (no commits touch it yet)`;let z=[];z.push(`${Z} — score timeline (${$.length} commit${$.length===1?"":"s"})`),z.push("");for(let Q of $){let X=`${String(Q.score).padStart(3)}%`,J=Q.first?" new ":Q.delta===0?" ·":Kj(Q.delta).padStart(4);z.push(` ${X} ${J} ${Q.date} ${Q.hex} ${B2(V6(Q.score))} ${Q.subject}`)}return z.join(`
|
|
411
|
+
`)}function Lj($,Z,z){try{return u9("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function pG($={},Z=process.cwd()){let z=f(Z);if(!z)console.error(`Error: project.faf not found
|
|
363
412
|
|
|
364
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
365
|
-
`)
|
|
413
|
+
Run 'faf init' to create one.`),process.exit(2);let Q;try{Q=u9("git",["rev-parse","--show-toplevel"],{cwd:Z,encoding:"utf-8"}).trim()}catch{console.error("Error: not a git repository — faf log reads the .faf score across git history."),process.exit(2);return}let X=A$(z,Z),J=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=u9("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",X],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let W=Y.split(`
|
|
414
|
+
`).filter(Boolean).map((K)=>{let[L,B,N]=K.split("\x1F");return{hex:L,date:B,subject:N??""}}),U=J>0?Math.min(W.length,J+1):W.length,G=W.slice(0,U).map((K)=>({...K,raw:Lj(K.hex,X,Z)})),V=Bj(G),H=J>0?V.slice(0,J):V;if($.reverse)H=[...H].reverse();let q=W.length;if($.json)console.log(JSON.stringify({file:X,total:q,count:H.length,entries:H},null,2));else{let K=Mj(H,X.split("/").pop()??"project.faf");if(J>0&&q>H.length)K+=`
|
|
366
415
|
|
|
367
|
-
|
|
368
|
-
|
|
416
|
+
… showing ${H.length} of ${q} commits — \`faf log --all\` for the full timeline.`;console.log(K)}}import{execFileSync as N4}from"child_process";import{existsSync as c9,readFileSync as Nj,realpathSync as lG,statSync as nG}from"fs";import{resolve as rG,dirname as p9,relative as Dj,isAbsolute as Oj,sep as Ij}from"path";var l9="# >>> faf >>>",sG="# <<< faf <<<",m9=`#!/bin/sh
|
|
417
|
+
`,dG="faf-cli hooks-run",Tj=($)=>$>0?`+${$}`:`${$}`;function oG($){return N4("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function iG($,Z){try{return N4("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function aG($,Z){try{return N4("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function d9($){let Z=N4("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return rG($,Z)}function Aj($,Z){let z=N4("git",["rev-parse","--git-common-dir"],{cwd:$,encoding:"utf-8"}).trim(),Q=lG.native(rG($,z)),X=lG.native(Z),J=Dj(Q,X);return{out:J===".."||J.startsWith(`..${Ij}`)||Oj(J),real:X}}function tG($){let Z=[],z=[],Q=0;for(let X of $.split(/(?<=\n)/)){let J=X.replace(/\n$/,"").replace(/\r$/,"");if(J===l9)Z.push(Q);if(J===sG)z.push(Q+X.length);Q+=X.length}if(Z.length===0&&z.length===0)return null;if(Z.length!==1||z.length!==1||z[0]<=Z[0])return"broken";return{start:Z[0],end:z[0]}}function Rj($,Z){if(!Z)return 493;let z=nG($).mode&511;return z|(z&292)>>2}function eG($){try{let Z=d(p9($),$,{allowGitHooks:!0});return{real:Z,text:M6(Z)}}catch(Z){if(Z instanceof y)return`${Z.message} faf left the hook as it is.`;throw Z}}function $V($,Z,z,Q){try{return a($,Z,{root:p9($),allowGitHooks:!0,expect:z,mode:Q}),null}catch(X){if(X instanceof y||X instanceof b2)return X.message;throw X}}var ZV="has a faf marker line without its pair (or more than one faf block) — faf cannot tell its section from yours, so it left the hook as it is. Fix the marker lines by hand.";function zV($={},Z=process.cwd()){try{let z;try{z=oG(Z)}catch{return}let Q=f(Z);if(!Q)return;let X=A$(Q,Z),J=iG(`:${X}`,Z);if(J===null)return;let Y=iG(`HEAD:${X}`,Z)??"",W=GZ(Y,J),U=`${W.scoreBase}% → ${W.scoreTarget}% (${Tj(W.scoreDelta)})`;if(W.scoreDelta<0){if(console.error(`⚠ faf: context regressed ${U} — ${W.changes.length} slot change(s)`),$.strict)console.error(" commit blocked (--strict). Fix with `faf score` / `faf sync`, or `git commit --no-verify` to override."),process.exit(1)}else console.log(`✓ faf: context ${U}`)}catch(z){console.error(`faf hooks: skipped (${z instanceof Error?z.message:"error"})`)}}function Cj($,Z){let z=$.trim().split(/\s+/)[0],Q=Z?`${$} --strict || exit 1`:`${$} || true`;return[l9,`if command -v ${z} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${Q}`,"fi",sG,""].join(`
|
|
418
|
+
`)}function _j($,Z={}){let z;try{z=oG($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let Q=aG("core.hooksPath",$);if(Q){let L=Z.runnerCmd??dG;return console.error(`Error: core.hooksPath is set (${Q}) — a hook manager (husky/lefthook/pre-commit) owns hooks here.`),console.error(" faf won't touch a managed hooks directory. Add this to your pre-commit yourself:"),console.error(` ${L}${Z.strict?" --strict":""}`),!1}let X=d9($),J=Z.runnerCmd??dG;if(!h9(J)){let L=J.trim().split(/\s+/)[0];if(Z.strict)return console.error(`Error: \`${L}\` on PATH doesn't support \`hooks-run\` yet (needs faf-cli ≥ 7.0).`),console.error(" A --strict hook against an older faf-cli would BLOCK your commits. Upgrade, then re-install."),!1;console.log(`⚠ \`${L}\` on PATH doesn't support \`hooks-run\` yet (needs faf-cli ≥ 7.0) — the hook no-ops until you upgrade.`)}let Y=Cj(J,!!Z.strict),W=p9(X);if(!c9(W))return console.error(`Error: ${W} does not exist — faf does not create folders inside .git. Create it (mkdir -p) and re-run.`),!1;let U=eG(X);if(typeof U==="string")return console.error(`Error: ${U}`),!1;let{real:G,text:V}=U,H=V===null?null:tG(V);if(H==="broken")return console.error(`Error: ${X} ${ZV}`),!1;let q;if(V===null)q=`${m9}${Y}`;else if(H)q=V.slice(0,H.start)+Y+V.slice(H.end);else{let L=Aj($,W);if(L.out)return console.error(`Error: ${X} is in a hooks folder outside this repo (${L.real}) and faf did not write it — faf left it as it is. Add \`${J}${Z.strict?" --strict":""}\` to it yourself.`),!1;if(V.trim()==="")q=`${m9}${Y}${V}`;else q=V.endsWith(`
|
|
419
|
+
`)?`${V}
|
|
420
|
+
${Y}`:`${V}
|
|
369
421
|
|
|
370
|
-
|
|
371
|
-
`)}function oA($,Z={}){let X;try{X=FQ($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let z=CQ("core.hooksPath",$);if(z){let G=Z.runnerCmd??AQ;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=eZ($),Q=Z.runnerCmd??AQ;if(!sZ(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-cli ≥ 7.0).`),console.error(" A --strict hook against an older faf-cli would BLOCK your commits. Upgrade, then re-install."),!1;console.log(`⚠ \`${G}\` on PATH doesn't support \`hooks-run\` yet (needs faf-cli ≥ 7.0) — the hook no-ops until you upgrade.`)}let Y=aA(Q,!!Z.strict),W=oZ(J)?tZ(J,"utf-8"):"",U=W.indexOf(V4),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(`
|
|
372
|
-
`)?`${W}
|
|
373
|
-
${Y}`:`${W}
|
|
422
|
+
${Y}`}let K=$V(X,q,V,Rj(G,V!==null));if(K)return console.error(`Error: ${K}`),!1;return console.log(`✅ pre-commit context guard installed — ${Z.strict?"STRICT (blocks on score regression)":"warn (informs only)"}`),console.log(" Skips when no .faf is staged · respects `git commit --no-verify` · fails open."),!0}function Fj($,Z){if($===m9&&Z.trim()==="")return"";return $.endsWith(`
|
|
374
423
|
|
|
375
|
-
${Y}
|
|
376
|
-
|
|
377
|
-
`);return _Q(Z,Q),console.log("✅ faf pre-commit block removed (other hook content preserved)."),!0}function eA($){let Z;try{Z=eZ($)}catch{console.error("Error: not a git repository.");return}let X=CQ("core.hooksPath",$),z=oZ(Z)?tZ(Z,"utf-8"):"",J=z.includes(V4),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 EQ($={}){let Z=process.cwd();if($.install){if(!oA(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!tA(Z))process.exit(2);return}eA(Z)}l();function wQ($={}){if($.version||Object.keys($).length===0)ZR()}function ZR(){let $=$5();console.log(`${I(A("faf"))} v${$.version}`),console.log(M(`kernel ${Vz()} 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"}];l();function SQ(){console.log(`${I("formats")} ${M("— supported file types")}
|
|
378
|
-
`);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`))}l();import{readdirSync as XR,rmSync as zR}from"fs";import{tmpdir as JR}from"os";import{join as QR}from"path";function jQ(){let $=JR(),Z=0;try{let X=XR($);for(let z of X)if(z.startsWith("faf-git-"))zR(QR($,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 xQ($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
|
|
424
|
+
`)&&$.slice(0,-1).trim()!==""?$.slice(0,-1):$}function Pj($){let Z;try{Z=d9($)}catch{return console.error("Error: not a git repository."),!1}if(!c9(Z))return console.log("• no pre-commit hook to clean."),!0;let z=eG(Z);if(typeof z==="string")return console.error(`Error: ${z}`),!1;let{real:Q,text:X}=z,J=X===null?null:tG(X);if(J==="broken")return console.error(`Error: ${Z} ${ZV}`),!1;if(X===null||J===null)return console.log("• faf block not found in pre-commit — nothing to remove."),!0;let Y=X.slice(J.end),W=$V(Z,Fj(X.slice(0,J.start),Y)+Y,X,nG(Q).mode&511);if(W)return console.error(`Error: ${W}`),!1;return console.log("✅ faf pre-commit block removed (other hook content preserved)."),!0}function Ej($){let Z;try{Z=d9($)}catch{console.error("Error: not a git repository.");return}let z=aG("core.hooksPath",$),Q=c9(Z)?Nj(Z,"utf-8"):"",X=Q.includes(l9),J=/hooks-run --strict/.test(Q);if(console.log("faf pre-commit context guard"),console.log(` installed: ${X?`yes (${J?"strict":"warn"})`:"no"}`),z)console.log(` ⚠ core.hooksPath = ${z} (a hook manager owns hooks — faf won't install here)`);if(!X&&!z)console.log(" → `faf hooks --install` (add --strict to block on regression)")}function QV($={}){let Z=process.cwd();if($.install){if(!_j(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!Pj(Z))process.exit(2);return}Ej(Z)}p();function XV($={}){if($.version||Object.keys($).length===0)jj()}function jj(){let $=i9();console.log(`${I(A("faf"))} v${$.version}`),console.log(M(`kernel ${eY()} IANA application/vnd.faf+yaml`))}var D4=[{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"}];p();function JV(){console.log(`${I("formats")} ${M("— supported file types")}
|
|
425
|
+
`);let $=new Map;for(let Z of D4){let z=$.get(Z.category)??[];z.push(Z),$.set(Z.category,z)}for(let[Z,z]of $){console.log(` ${A(Z)}`);for(let Q of z)console.log(` ${Q.name} ${M(Q.extensions.join(", "))}`);console.log()}console.log(M(` ${D4.length} formats across ${$.size} categories`))}p();function YV(){let $=0;try{$=MY("faf-git-")}catch{}if($>0)console.log(`${I("cleared")} ${$} cached director${$===1?"y":"ies"}`);else console.log(M("nothing to clear"))}function WV($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
|
|
379
426
|
|
|
380
|
-
Run 'faf init' to create one.`),process.exit(2);if($.json){let
|
|
427
|
+
Run 'faf init' to create one.`),process.exit(2);if($.json){let z=r(Z);console.log(JSON.stringify(z,null,2))}else{let z=c(Z);console.log(z)}}p();function UV(){let $=f();if(!$)console.error(`Error: project.faf not found
|
|
381
428
|
|
|
382
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=
|
|
383
|
-
`))}import{existsSync as
|
|
429
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=r($),z=[];for(let Q of z0){let[X,J]=Q.path.split("."),W=Z[X]?.[J];if(W0(W)||W==="slotignored")continue;z.push(`${Q.path}: ${W}`)}if(z.length===0){console.log(M("no populated slots"));return}console.log(z.join(`
|
|
430
|
+
`))}import{existsSync as Sj,statSync as GV}from"fs";import{dirname as xj,join as kj}from"path";var bj=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"],yj=1000;function VV($,Z=xj($)){let z=GV($).mtimeMs,Q=bj.map((X)=>{let J=kj(Z,X);if(!Sj(J))return{file:X,exists:!1,mtime_ms:null,status:"missing",delta_ms:null};let Y=GV(J).mtimeMs,W=Y-z,U;if(Math.abs(W)<yj)U="in-sync";else if(W>0)U="newer";else U="older";return{file:X,exists:!0,mtime_ms:Y,status:U,delta_ms:W}});return{source:$,source_mtime_ms:z,targets:Q,drifted:Q.filter((X)=>X.status==="newer"||X.status==="older").length,in_sync:Q.filter((X)=>X.status==="in-sync").length,missing:Q.filter((X)=>X.status==="missing").length}}p();function qV($={}){let Z=f();if(!Z){if($.json)console.log(JSON.stringify({error:"project.faf not found",hint:"run 'faf init' to create one"},null,2));else console.error(`Error: project.faf not found
|
|
384
431
|
|
|
385
|
-
Run 'faf init' to create one.`);process.exit(2)}let
|
|
386
|
-
`),console.log(` ${A(".faf")} ${M(
|
|
387
|
-
run ${A("'faf sync'")} to resolve drift`))}function
|
|
432
|
+
Run 'faf init' to create one.`);process.exit(2)}let z=VV(Z,process.cwd());if($.json){let Q=r(Z),X={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",...z};console.log(JSON.stringify(X,null,2));return}vj(z)}function vj($){console.log(`${I("drift")} ${M("— context file sync status")}
|
|
433
|
+
`),console.log(` ${A(".faf")} ${M(HV($.source_mtime_ms))}`);for(let Z of $.targets){if(Z.status==="missing"||Z.mtime_ms===null){console.log(` ${M("○")} ${Z.file} ${M("missing")}`);continue}let z=M(HV(Z.mtime_ms));if(Z.status==="in-sync")console.log(` ${I("●")} ${Z.file} ${M("in sync")}`);else if(Z.status==="newer")console.log(` ${A("!")} ${Z.file} ${A("newer")} ${z}`);else console.log(` ${M("○")} ${Z.file} ${M("older")} ${z}`)}if($.drifted>0)console.log(M(`
|
|
434
|
+
run ${A("'faf sync'")} to resolve drift`))}function HV($){let Z=Date.now()-$,z=Math.floor(Z/1000);if(z<60)return`${z}s ago`;let Q=Math.floor(z/60);if(Q<60)return`${Q}m ago`;let X=Math.floor(Q/60);if(X<24)return`${X}h ago`;return`${Math.floor(X/24)}d ago`}function n9($,Z){let z=Z.split("."),Q=$;for(let X of z){if(Q===null||Q===void 0||typeof Q!=="object")return;Q=Q[X]}return Q}function O4($,Z){let z=Z.split("."),Q=$;for(let X=0;X<z.length-1;X++){let J=Q[z[X]];if(J===null||J===void 0)return null;if(!$0(J))return{at:z.slice(0,X+1).join("."),value:J};Q=J}return null}function I4($,Z){return`cannot set ${$}: ${Z.at} is ${y6(Z.value)}, not a mapping. `+`faf will not replace it — make ${Z.at} a mapping in project.faf by hand, then run again.`}function VZ($,Z,z){let Q=O4($,Z);if(Q)throw Error(I4(Z,Q));let X=Z.split("."),J=$;for(let Y=0;Y<X.length-1;Y++){if(J[X[Y]]===null||J[X[Y]]===void 0)J[X[Y]]={};J=J[X[Y]]}J[X[X.length-1]]=z}p();function KV($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
|
|
388
435
|
|
|
389
|
-
Example: faf edit project.name "My Project"`),process.exit(1);let
|
|
436
|
+
Example: faf edit project.name "My Project"`),process.exit(1);let z=f();if(!z)console.error(`Error: project.faf not found
|
|
390
437
|
|
|
391
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
438
|
+
Run 'faf init' to create one.`),process.exit(2);let Q=r(z);if($.split(".").length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let J=O4(Q,$);if(J)console.error(`Error: ${I4($,J)}`),process.exit(1);VZ(Q,$,Z);let Y=[];if(K0(z,Q,{onAliasKept:(W)=>Y.push(u0(W))}),Y.length>0){for(let W of Y)console.error(`Error: ${W}. Change the value its anchor holds, or replace the alias by hand.`);process.exit(1)}console.log(`${I("updated")} ${$} ${M("→")} ${Z}`)}import{existsSync as gj,lstatSync as hj}from"fs";import{join as s9}from"path";p();function fj($){try{return hj($),!0}catch{return!1}}function r9($,Z,z){if(!fj(s9($,Z)))return null;try{return J0(d($,Z,{read:!0}))}catch(Q){if(!(Q instanceof y))throw Q;return console.error(B6(Q,!1)),z.push(Z),null}}function BV(){let $=process.cwd(),Z=[],z=[],Q={faf_version:H6,project:{}},X=r9($,"CLAUDE.md",z);if(X!==null){let G=n5(X);if(G.project?.name)Q.project.name=G.project.name;if(G.project?.goal)Q.project.goal=G.project.goal;if(G.project?.main_language)Q.project.main_language=G.project.main_language;Z.push("CLAUDE.md")}let J=r9($,"AGENTS.md",z);if(J!==null){if(!Q.project.name){let G=J.match(/^#\s+(.+)/m);if(G)Q.project.name=G[1].trim()}Z.push("AGENTS.md")}let Y=r9($,"GEMINI.md",z);if(Y!==null){if(!Q.project.name){let G=Y.match(/^#\s+(.+)/m);if(G)Q.project.name=G[1].trim()}Z.push("GEMINI.md")}let W=s9($,".cursorrules");if(gj(W))Z.push(".cursorrules");if(Z.length===0){if(z.length>0)console.error(`Nothing to recover from: ${z.join(", ")} ${z.length===1?"was":"were"} refused (above), and no other context file is there. Nothing was written.`),process.exit(1);console.error("No context files found (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules)."),process.exit(2)}let U=f($);if(U){let G=r(U);if(!G.project)G.project={};if(Q.project.name&&!G.project.name)G.project.name=Q.project.name;if(Q.project.goal&&!G.project.goal)G.project.goal=Q.project.goal;if(Q.project.main_language&&!G.project.main_language)G.project.main_language=Q.project.main_language;K0(U,G,{onAliasKept:(V)=>console.log(M(` ${u0(V)}`))}),console.log(`${I("◆")} recover merged into ${U}`)}else{let G=s9($,"project.faf");K0(G,Q),console.log(`${I("◆")} recover created ${G}`)}console.log(M(` sources: ${Z.join(", ")}`))}p();var T4=H6;function MV($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
|
|
392
439
|
|
|
393
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
394
|
-
`),console.log(` Status: ${$?
|
|
395
|
-
`);let $=[["tri-sync",".faf
|
|
396
|
-
`),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
|
|
440
|
+
Run 'faf init' to create one.`),process.exit(2);let z=r(Z),Q=z.faf_version??"unknown";if(Q===T4){console.log(`${I("◆")} migrate already at v${T4}`);return}if(z.faf_version=T4,!z.project)z.project={};if(!z.stack)z.stack={};if(!z.human_context)z.human_context={};if(!z.monorepo)z.monorepo={};if($.dryRun){console.log(`${I("◆")} migrate ${M("(dry run)")} v${Q} → v${T4}`),console.log(M(` would update ${Z}`));return}K0(Z,z,{onAliasKept:(X)=>console.log(M(` ${u0(X)}`))}),console.log(`${I("◆")} migrate v${Q} → v${T4}`),console.log(M(` updated ${Z}`))}p();function LV($){if($==="features")mj();else if($==="activate")cj();else uj()}function uj(){let $=G4();if(console.log(`${I("pro")} ${M("— FAF Pro status")}
|
|
441
|
+
`),console.log(` Status: ${$?R0(A("PRO")):A("Free")}`),console.log(""),!$)console.log(M(" Upgrade: faf pro activate"))}function mj(){console.log(`${I("pro")} ${M("— Pro features")}
|
|
442
|
+
`);let $=[["tri-sync",".faf → CLAUDE.md + Claude Code's MEMORY.md (faf's block only)"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,z]of $)console.log(` ${I("◆")} ${A(Z)} ${M("—")} ${z}`);console.log("")}function cj(){console.log(`${I("pro")} ${M("— activate")}
|
|
443
|
+
`),console.log(" Set FAF_PRO=1 in your environment to enable Pro features."),console.log(""),console.log(M(" export FAF_PRO=1")),console.log(""),console.log(M(" Visit: https://faf.one/pro")),import("open").then(({default:$})=>$("https://faf.one/pro")).catch(()=>{})}import{gzipSync as pj}from"zlib";p();function NV($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
|
|
397
444
|
|
|
398
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
399
|
-
`),console.log(` ${
|
|
445
|
+
Run 'faf init' to create one.`),process.exit(2);let z=c(Z),X=pj(Buffer.from(z)).toString("base64url");if($.raw){console.log(X);return}let J=`https://faf.one/share?d=${X}`;if(console.log(`${I("◆")} share ${M(Z)}
|
|
446
|
+
`),console.log(` ${J}`),$.copy)try{let{execSync:Y}=l0("child_process"),W=process.platform;if(W==="darwin")Y("pbcopy",{input:J});else if(W==="linux")Y("xclip -selection clipboard",{input:J});console.log(M(`
|
|
400
447
|
copied to clipboard`))}catch{console.log(M(`
|
|
401
|
-
copy failed — install xclip or pbcopy`))}}import{
|
|
448
|
+
copy failed — install xclip or pbcopy`))}}import{join as lj}from"path";p();function DV(){let $=V5("faf-demo-");console.log(`${I("demo")} ${M("— FAF in action")}
|
|
402
449
|
`);let Z=`faf_version: 2.5.0
|
|
403
450
|
project:
|
|
404
451
|
name: acme-app
|
|
@@ -424,20 +471,20 @@ human_context:
|
|
|
424
471
|
where: Cloud (Vercel + AWS)
|
|
425
472
|
when: "2026"
|
|
426
473
|
how: Agile sprints with CI/CD
|
|
427
|
-
`,
|
|
428
|
-
`)),console.log(` ${A("2.")} Scoring...`);let
|
|
429
|
-
${M(' Demo complete. Run "faf init" in your project to get started.')}`)}
|
|
430
|
-
`);for(let Y of
|
|
431
|
-
`);for(let Y of
|
|
474
|
+
`,z=lj($,"project.faf");a(z,Z,{root:$,expect:null}),console.log(` ${A("1.")} Created sample project.faf`),console.log(M(` ${z}
|
|
475
|
+
`)),console.log(` ${A("2.")} Scoring...`);let Q=n(z,()=>j0(C0(c(z))));console.log(""),_0(Q,"project.faf",!0),H5($),console.log(`
|
|
476
|
+
${M(' Demo complete. Run "faf init" in your project to get started.')}`)}p();function OV($,Z={}){if(!$)console.error("Usage: faf search <keyword>"),process.exit(2);let z=$.toLowerCase(),Q=!Z.slots&&!Z.formats,X=0;if(Q||Z.slots){let J=z0.filter((Y)=>Y.path.toLowerCase().includes(z)||Y.description.toLowerCase().includes(z)||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${I("slots")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
|
|
477
|
+
`);for(let Y of J)console.log(` ${A(`#${Y.index}`)} ${Y.path} ${M("—")} ${Y.description} ${M(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(Q||Z.formats){let J=D4.filter((Y)=>Y.name.toLowerCase().includes(z)||Y.extensions.some((W)=>W.toLowerCase().includes(z))||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${I("formats")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
|
|
478
|
+
`);for(let Y of J)console.log(` ${A(Y.name)} ${M(Y.extensions.join(", "))} ${M(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(X===0)console.log(M(` No results for "${$}"`))}import{existsSync as v$}from"fs";import{dirname as dj,join as a6,resolve as ij}from"path";p();function nj($){try{let Z=JSON.parse(new TextDecoder().decode($));return typeof Z==="object"&&Z!==null&&!Array.isArray(Z)&&typeof Z.taf_version==="string"}catch{return!1}}var rj="Wolfe-Jam/faf-taf-git@v2.2.0";function IV($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;if($==="setup"){tj(Z);return}ej(Z)}function sj($){if(v$(a6($,"bun.lockb"))||v$(a6($,"bun.lock")))return"bun";if(v$(a6($,"pnpm-lock.yaml")))return"pnpm";if(v$(a6($,"yarn.lock")))return"yarn";return"npm"}var oj={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: pnpm/action-setup@v4
|
|
432
479
|
- uses: actions/setup-node@v4
|
|
433
480
|
with:
|
|
434
481
|
node-version: 20`,install:"pnpm install --frozen-lockfile",test:"pnpm test"},yarn:{setup:` - uses: actions/setup-node@v4
|
|
435
482
|
with:
|
|
436
483
|
node-version: 20`,install:"yarn install --frozen-lockfile",test:"yarn test"},npm:{setup:` - uses: actions/setup-node@v4
|
|
437
484
|
with:
|
|
438
|
-
node-version: 20`,install:"npm ci",test:"npm test"}};function
|
|
485
|
+
node-version: 20`,install:"npm ci",test:"npm test"}};function aj($){let Z=`name: TAF Receipts
|
|
439
486
|
`+`# Prints a Test Receipt (.taf) on every push — proof over time, cannot be gamed.
|
|
440
|
-
`+`#
|
|
487
|
+
`+`# Written by \`faf taf setup\`. Docs: https://github.com/Wolfe-Jam/faf-taf-git
|
|
441
488
|
on:
|
|
442
489
|
push:
|
|
443
490
|
pull_request:
|
|
@@ -447,102 +494,82 @@ jobs:
|
|
|
447
494
|
runs-on: ubuntu-latest
|
|
448
495
|
steps:
|
|
449
496
|
- uses: actions/checkout@v4
|
|
450
|
-
`,
|
|
451
|
-
- run: ${
|
|
497
|
+
`,z;if(v$(a6($,"package.json"))){let X=oj[sj($)];z=`${X.setup}
|
|
498
|
+
- run: ${X.install}
|
|
452
499
|
- name: Run tests
|
|
453
|
-
run: ${
|
|
454
|
-
`}else
|
|
500
|
+
run: ${X.test} 2>&1 | tee test-output.txt
|
|
501
|
+
`}else z=` # TODO: set up your toolchain, then run your tests writing output to test-output.txt
|
|
455
502
|
- name: Run tests
|
|
456
503
|
run: |
|
|
457
504
|
# e.g. pytest -q 2>&1 | tee test-output.txt (or your test command)
|
|
458
505
|
echo "TODO: your test command" 2>&1 | tee test-output.txt
|
|
459
|
-
`;let
|
|
506
|
+
`;let Q=` - name: Print TAF receipt
|
|
460
507
|
if: github.event_name == 'push'
|
|
461
|
-
uses: ${
|
|
508
|
+
uses: ${rj}
|
|
462
509
|
with:
|
|
463
510
|
test-output-file: test-output.txt
|
|
464
511
|
auto-commit: 'true'
|
|
465
512
|
commit-message: 'chore(taf): update .taf receipt [skip ci]'
|
|
466
513
|
target-branch: taf-receipts
|
|
467
|
-
`;return Z+
|
|
468
|
-
`),console.log(M("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(
|
|
469
|
-
|
|
470
|
-
Run 'faf init' to create one.`),process.exit(2);let X=m(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)iQ($.output,Y,"utf-8"),console.log(`${I("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as PR}from"readline";import{existsSync as rQ,readFileSync as ER,writeFileSync as wR,unlinkSync as SR}from"fs";import{join as jR}from"path";l();var xR=".faf-session.json";function bR($,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 kR($,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 sQ($={}){A$(process.cwd(),"faf go");let Z=f();if(!Z)console.error(`Error: project.faf not found
|
|
471
|
-
|
|
472
|
-
Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=jR(X,xR),J=0;if($.resume&&rQ(z))try{J=JSON.parse(ER(z,"utf-8")).slotIndex,console.log(M(` resuming from slot #${J+1}`))}catch{}let Q=m(Z),Y=Z0.filter((H)=>{let L=bR(Q,H.path);return E0(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.
|
|
473
|
-
`));let U=PR({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}`)} ${a8(L.path)} ${M(`(${L.path})`)}: `);if(B.toLowerCase()==="quit"){let O={slotIndex:J+H,fafPath:Z};wR(z,JSON.stringify(O),"utf-8"),console.log(M(`
|
|
474
|
-
session saved. Resume with: faf go --resume`));break}if(B.toLowerCase()==="skip"||B.trim()==="")continue;kR(Q,L.path,B.trim()),G++}if(U.close(),G>0)$0(Z,Q),console.log(`
|
|
475
|
-
${I("◆")} go filled ${G} slot${G===1?"":"s"}`);let K=B0(G0(u(Z)));if(Y0(K,Z),rQ(z))try{SR(z)}catch{}}l();var j_=[/^(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 x_($){if(typeof $!=="string")return!1;let Z=$.trim();if(Z.length<4||Z.length>280)return!1;return!j_.some((X)=>X.test(Z))}function b_($,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 k_($,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 sY($){if($==="analyze")await v_();else if($==="enhance")await y_();else console.log(`${I("ai")} ${M("— AI-powered features")}
|
|
476
|
-
`),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 aY(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
|
|
477
|
-
|
|
478
|
-
export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (rY(),nY));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
|
|
514
|
+
`;return Z+z+Q}function tj($){let Z=process.cwd(),z=aj(Z),Q=a6(Z,".github","workflows","taf.yml");if($.write){if(v$(Q)){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}w0(Z,a6(".github","workflows")),a(Q,z,{root:Z,expect:null}),console.log(`${I("◆")} taf wrote .github/workflows/taf.yml`),console.log(M(" commit + push → your first Test Receipt prints to the taf-receipts branch."));return}console.log(`${I("TAF setup")} ${M("— Test Receipt Printer: proof over time, cannot be gamed")}
|
|
515
|
+
`),console.log(M("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(z),console.log(M("Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run."))}function ej($){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
|
|
479
516
|
|
|
480
|
-
|
|
517
|
+
Run 'faf init' to create one.`),process.exit(2);let z=r(Z),Q=c(Z),X=n(Z,()=>M0(Q)),J={taf_version:"1.0.0",generated:new Date().toISOString(),source:Z,project:z.project?.name??"unknown",faf_version:z.faf_version??"unknown",score:X.score,tier:X.tier.name,populated:X.populated,active:X.active,total:X.total,slots:X.slots},Y=JSON.stringify(J,null,2);if($.output)Q2($.output),Y2($.output,Y,{root:dj(ij($.output)),format:"json",hasMark:nj,mark:"TAF snapshot (`taf_version`)",force:$.force}),console.log(`${I("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as $S}from"readline";import{join as TV}from"path";p();var HZ=".faf-session.json";function o9($){if($===null)return null;let Z=new TextDecoder().decode($);try{let z=JSON.parse(Z);if((typeof z==="object"&&z!==null&&!Array.isArray(z)?Object.keys(z).sort().join(","):"")!=="fafPath,slotIndex"||typeof z.slotIndex!=="number"||typeof z.fafPath!=="string")return null;return JSON.stringify({slotIndex:z.slotIndex,fafPath:z.fafPath})===Z?{slotIndex:z.slotIndex,fafPath:z.fafPath}:null}catch{return null}}function AV($){try{return h0(d($,HZ))}catch(Z){if(!(Z instanceof y))throw Z;return console.error(M(` ${HZ}: ${Z.message}`)),null}}function ZS($,Z){try{return C2(TV($,HZ),JSON.stringify(Z),{root:$,owns:(z)=>o9(z)!==null,mark:"faf go session"}),!0}catch(z){return console.error(M(` session not saved: ${z instanceof Error?z.message:String(z)}`)),!1}}function zS($){let Z=AV($);if(o9(Z)===null||Z===null)return;try{qY(TV($,HZ),{root:$,expect:Z})}catch(z){if(!(z instanceof y))throw z}}function QS($,Z){let z=new Map;for(let X of Z){let J=O4($,X);if(J&&!z.has(J.at))z.set(J.at,I4(X,J))}if(z.size===0)return;console.error(`${A("×")} go project.faf has a section faf cannot write under — nothing was changed:`);for(let X of z.values())console.error(` ${X}`);let Q=$.project;if(Q!==null&&Q!==void 0&&typeof Q!=="object")console.error(M(" 'faf auto' moves a bare `project: <name>` to `project.name` for you."));process.exit(1)}function XS($,Z){let z=O$(Z)?` ${M(`now '${String(Z).trim()}' — Enter keeps it`)}`:"";return` ${A(`#${$.index}`)} ${l5($.path)} ${M(`(${$.path})`)}${z}: `}async function RV($={}){E$(process.cwd(),"faf go");let Z=f();if(!Z)console.error(`Error: project.faf not found
|
|
481
518
|
|
|
482
|
-
Run 'faf init' to create one.`),process.exit(2);let
|
|
483
|
-
`),Y
|
|
484
|
-
|
|
485
|
-
1.
|
|
486
|
-
|
|
487
|
-
3. NEVER use generic placeholders. Forbidden values include: "TBD", "see README", "software application", "for users", "for developers", "general purpose", "various", "multiple", "n/a", "unknown".
|
|
488
|
-
4. NEVER fabricate. If the .faf doesn't say it explicitly, return null for that slot.
|
|
489
|
-
5. Extracted values must be SHORT (under 200 characters) and DIRECTLY supported by the source.
|
|
490
|
-
|
|
491
|
-
The .faf source:
|
|
492
|
-
|
|
493
|
-
${X}
|
|
519
|
+
Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=0;if($.resume){let L=o9(AV(z));if(L)Q=L.slotIndex,console.log(M(` resuming from slot #${Q+1}`))}let X=r(Z),J=n(Z,()=>j0(C0(c(Z)))),Y=z0.filter((L)=>{let B=n9(X,L.path);return W0(B)&&B!==f1});if(QS(X,Y.map((L)=>L.path)),Y.length===0){console.log(`${I("◆")} go all slots populated — ✪ Trophy`),_0(J,Z);return}console.log(`${I("go")} ${M("— guided interview to ✪ Trophy")}`);let W=Y.length===1?"slot":"slots";console.log(M(` ${Y.length} ${W} from Trophy. Enter a value, "skip" to skip, or "quit" to stop.
|
|
520
|
+
`));let U=$S({input:process.stdin,output:process.stdout}),G=(L)=>new Promise((B)=>U.question(L,B)),V=0,H=!1,q=Y.slice(Q);for(let L=0;L<q.length;L++){let B=q[L],N=await G(XS(B,n9(X,B.path)));if(N.toLowerCase()==="quit"){if(H=!0,ZS(z,{slotIndex:Q+L,fafPath:Z}))console.log(M(`
|
|
521
|
+
session saved. Resume with: faf go --resume`));break}if(N.toLowerCase()==="skip"||N.trim()==="")continue;VZ(X,B.path,N.trim()),V++}if(U.close(),V>0)K0(Z,X,{onAliasKept:(L)=>console.log(M(` ${u0(L)}`))}),console.log(`
|
|
522
|
+
${I("◆")} go filled ${V} slot${V===1?"":"s"}`);let K=n(Z,()=>j0(C0(c(Z))));if(_0(K,Z),!H)zS(z)}p();var Zx="faf ai enhance was retired in 7.13 — project.faf isn't enhanced: faf auto fills tech slots from repo facts, and you write the 6Ws (faf go).";async function RH($){if($==="analyze")await Qx();else if($==="enhance")console.error(Zx),process.exit(1);else console.log(`${I("ai")} ${M("— ask Claude for suggestions about project.faf")}
|
|
523
|
+
`),console.log(` ${A("faf ai analyze")} ${M("— get improvement suggestions")}`),console.log(""),console.log(M(" Requires ANTHROPIC_API_KEY environment variable."))}async function zx(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
|
|
494
524
|
|
|
495
|
-
|
|
496
|
-
${Q}
|
|
525
|
+
export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (AH(),TH));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
|
|
497
526
|
|
|
498
|
-
|
|
499
|
-
${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(`
|
|
500
|
-
${M("all extractions rejected as slop. Run")} ${A("'faf go'")} ${M("for interview-fill.")}`);else console.log(`
|
|
501
|
-
${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 v_(){let $=f();if(!$)console.error(`Error: project.faf not found
|
|
527
|
+
npm install @anthropic-ai/sdk`),process.exit(2)}}async function Qx(){let $=f();if(!$)console.error(`Error: project.faf not found
|
|
502
528
|
|
|
503
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=
|
|
529
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=c($);console.log(`${I("ai")} analyze ${M("getting suggestions...")}`);let Q=await(await zx()).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.
|
|
504
530
|
|
|
505
531
|
${Z}
|
|
506
532
|
|
|
507
|
-
Be concise. One line per suggestion.`}]});console.log(""),console.log(
|
|
508
|
-
`),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
|
|
533
|
+
Be concise. One line per suggestion.`}]});console.log(""),console.log(Q.content[0].text)}import{existsSync as HQ,readFileSync as qQ,readdirSync as Xx}from"fs";import{join as CH}from"path";p();function _H($,Z){if($==="import")Jx(Z);else if($==="export")Yx();else console.log(`${I("conductor")} ${M("— conductor integration")}
|
|
534
|
+
`),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 Jx($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!HQ($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:H6,project:{}};if(HQ($)&&$.endsWith(".json")){let X=JSON.parse(qQ($,"utf-8"));if(X.name)Z.project.name=X.name;if(X.description)Z.project.goal=X.description;if(X.language)Z.project.main_language=X.language}else if(HQ($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let X=d0(qQ($,"utf-8"));if(X.name)Z.project.name=X.name;if(X.description)Z.project.goal=X.description;if(X.language)Z.project.main_language=X.language}else try{let X=Xx($);for(let J of X){let Y=CH($,J);if(J.endsWith(".json"))try{let W=JSON.parse(qQ(Y,"utf-8"));if(W.name&&!Z.project.name)Z.project.name=W.name;if(W.description&&!Z.project.goal)Z.project.goal=W.description}catch{}}}catch{console.error(`Error: could not read directory: ${$}`),process.exit(2)}let z=process.cwd(),Q=f(z);if(Q){let X=r(Q);if(!X.project)X.project={};if(Z.project.name&&!X.project.name)X.project.name=Z.project.name;if(Z.project.goal&&!X.project.goal)X.project.goal=Z.project.goal;if(Z.project.main_language&&!X.project.main_language)X.project.main_language=Z.project.main_language;K0(Q,X,{onAliasKept:(J)=>console.log(M(` ${u0(J)}`))}),console.log(`${I("◆")} conductor import merged into ${Q}`)}else{let X=CH(z,"project.faf");K0(X,Z),console.log(`${I("◆")} conductor import created ${X}`)}}function Yx(){let $=f();if(!$)console.error(`Error: project.faf not found
|
|
509
535
|
|
|
510
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=
|
|
511
|
-
|
|
536
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=r($),z={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(z,null,2))}p();import{readdirSync as Wx,readFileSync as Ux,existsSync as Gx}from"fs";import{join as Vx}from"path";var Hx=["BRAKE","ENGINE","AERO","TYRE","PIT"],qx=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function Kx($){let Z=$.match(qx);if(!Z)return null;return Z[1].toUpperCase()}function Bx($){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 Mx($,Z){let z=[];switch(Z){case"typescript":{let Q=/\b(describe|test|it)\s*\(\s*(['"`])((?:\\.|(?!\2).)*)\2/g,X=[],J;while((J=Q.exec($))!==null)X.push({idx:J.index,type:J[1]==="describe"?"describe":"test",name:J[3]});let Y=[],W=0,U=null,G=0;for(let V=0;V<$.length;V++){while(G<X.length&&X[G].idx===V){let q=X[G];if(q.type==="describe")U=q.name;else{let K=Y.map((B)=>B.name),L=K.length>0?`${K.join(" > ")} > ${q.name}`:q.name;z.push(L)}G++}let H=$[V];if(H==="{"){if(W++,U!==null)Y.push({name:U,openDepth:W}),U=null}else if(H==="}"){W--;while(Y.length>0&&W<Y[Y.length-1].openDepth)Y.pop()}}break}case"rust":{let Q=/#\[test\]\s*(?:\r?\n)\s*(?:pub\s+)?fn\s+([a-zA-Z_][a-zA-Z_0-9]*)/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"python":{let Q=/^\s*def\s+(test_[a-zA-Z_0-9]+)\s*\(/gm,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"zig":{let Q=/\btest\s+"((?:\\.|[^"\\])+)"/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"go":{let Q=/\bfunc\s+(Test[A-Z][a-zA-Z_0-9]*)\s*\(/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}}return z}var Lx=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function FH($,Z=[]){let z;try{z=Wx($,{withFileTypes:!0})}catch{return Z}for(let Q of z){if(Lx.has(Q.name))continue;if(Q.name.startsWith(".")&&Q.name!==".")continue;let X=Vx($,Q.name);if(Q.isDirectory())FH(X,Z);else if(Q.isFile())Z.push(X)}return Z}function Nx($){let Z=[];if(!Gx($))return Z;let z=FH($);for(let Q of z){let X=Q.split("/").pop()??"",J=Bx(X);if(!J.ok||!J.lang)continue;let Y;try{Y=Ux(Q,"utf-8")}catch{continue}if(J.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(J.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let W=Mx(Y,J.lang),U=Q.replace(`${$}/`,"");for(let G of W)Z.push({file:U,language:J.lang,testName:G,tier:Kx(G)})}return Z}function Dx($){let Z={BRAKE:0,ENGINE:0,AERO:0,TYRE:0,PIT:0},z={},Q=0,X=[],J=new Set;for(let Y of $)if(J.add(Y.file),z[Y.language]=(z[Y.language]??0)+1,Y.tier)Z[Y.tier]++;else if(Q++,X.length<5)X.push(`${Y.file}: ${Y.testName}`);return{totalTests:$.length,byTier:Z,untiered:Q,untieredExamples:X,filesScanned:J.size,byLanguage:z}}function Ox($){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 Hx){let z=$.byTier[Z],Q=(z/$.totalTests*100).toFixed(0),X=Z==="BRAKE"?R0("●"):Z==="ENGINE"?I("●"):Z==="AERO"?M("●"):Z==="TYRE"?I("◐"):M("○");console.log(` ${X} ${Z.padEnd(7)} ${A(String(z).padStart(4))} ${M(`(${Q}%)`)}`)}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,z]of Object.entries($.byLanguage))console.log(` ${M("·")} ${Z.padEnd(12)} ${A(String(z))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(R0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function PH($={}){let Z=$.path??"tests",z=Nx(Z),Q=Dx(z);if($.json)console.log(JSON.stringify(Q,null,2));else Ox(Q);if($.strict&&Q.untiered>0)process.exit(1)}import{createHash as jH}from"crypto";import{readFileSync as Ix,existsSync as Tx}from"fs";import{join as Ax,dirname as Rx}from"path";p();var EH="faf-bench/1",Cx={"project.name":"What is the project's name?","project.goal":"What is the project's goal — what is it for?","project.main_language":"What is the primary programming language?","human_context.who":"Who is this project for?","human_context.what":"What are they building?","human_context.why":"Why does this project exist?","human_context.where":"Where does it run or get distributed?","human_context.when":"When — what is the project's timeline or stage?","human_context.how":"How is it built or used?"};function _x($,Z){return Cx[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var Fx=[["typescript","ts"],["javascript","js"],["python","py","python3"],["node","nodejs","node js","node.js"],["github actions","gh actions","actions"],["postgresql","postgres","pg"],["kubernetes","k8s"],["npm","npm registry"],["cloudflare workers","cf workers","workers"],["google cloud run","cloud run","gcp cloud run"]],V8=new Map;Fx.forEach(($,Z)=>$.forEach((z)=>V8.set(z,Z)));var Px=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function KQ($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function wH($){return KQ($).split(" ").filter((Z)=>Z&&!Px.has(Z))}function Ex($,Z){let z=KQ($),Q=KQ(Z);if(!z||!Q)return!1;if(z===Q)return!0;let X=V8.get(z);if(X!==void 0&&V8.get(Q)===X)return!0;let J=wH($);if(J.length===0)return!1;let Y=new Set(wH(Z));return J.every((W)=>{if(Y.has(W))return!0;let U=V8.get(W);return U!==void 0&&[...Y].some((G)=>V8.get(G)===U)})}function wx($){let Z=M0($),z=d0($),Q=[],X={},J=0;for(let U of z0){if(Z.slots[U.path]!=="populated")continue;let G=h1(z,U);if(typeof G!=="string")continue;let V=G.trim();if(!V||K3.has(V.toLowerCase()))continue;J+=1,Q.push({n:J,path:U.path,question:_x(U.path,U.description)}),X[J]=V}let Y=JSON.stringify({v:EH,q:Q.map((U)=>[U.path,U.question])}),W=jH("sha256").update(Y).digest("hex").slice(0,12);return{version:EH,qsetHash:W,questions:Q,answers:X}}function jx($,Z){let z=$.questions.map((X)=>{let J=Z[String(X.n)]??Z[X.path]??"";return{n:X.n,path:X.path,ok:typeof J==="string"&&J.trim()!==""&&Ex($.answers[X.n],J)}}),Q=$.questions.filter((X)=>!z[X.n-1].ok);return{correct:z.filter((X)=>X.ok).length,total:$.questions.length,misses:Q,perQuestion:z}}var SH=".faf-bench.json";function xH($){let Z=new TextDecoder().decode($);try{let z=JSON.parse(Z);return typeof z==="object"&&z!==null&&typeof z.version==="string"&&typeof z.qsetHash==="string"&&z.protocol==="in-session"&&`${JSON.stringify(z,null,2)}
|
|
537
|
+
`===Z}catch{return!1}}function Sx($){let Z=h0(d($,SH));if(Z===null||!xH(Z))return{state:null,bytes:Z};return{state:JSON.parse(Z.toString("utf-8")),bytes:Z}}function xx($,Z,z){C2(Ax($,SH),`${JSON.stringify(Z,null,2)}
|
|
538
|
+
`,{root:$,owns:xH,mark:"faf bench state (2-space JSON with version, qsetHash and protocol)",expect:z})}function BQ($,Z){let z=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:z,hash:jH("sha256").update(z).digest("hex")}}var uZ=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function kx($,Z){let{cold:z,faf:Q}=$;console.log(`
|
|
512
539
|
${A(`faf bench — ${Z}`)}
|
|
513
|
-
`),console.log(` ${M("without context")} ${I("with .faf")}`),console.log(`answers ${
|
|
514
|
-
${M(`The ${
|
|
515
|
-
${
|
|
516
|
-
${A(`faf bench — ${Z}`)} ${
|
|
517
|
-
`),console.log(` ${M("without context")}`),console.log(`answers ${
|
|
518
|
-
${
|
|
519
|
-
${I("→ faf init && faf bench")} ${M("(close the gap, get the receipt)")}`)}var
|
|
520
|
-
|
|
521
|
-
Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let
|
|
522
|
-
${A(`faf bench — ${
|
|
523
|
-
`);for(let U of
|
|
524
|
-
${M('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!
|
|
525
|
-
${A(`faf bench — ${W}`)} ${I("with .faf")}: ${A(`${
|
|
526
|
-
${A("faf bench — agent-native protocol")} ${M(`qset ${
|
|
540
|
+
`),console.log(` ${M("without context")} ${I("with .faf")}`),console.log(`answers ${z.score}/${z.total} ${A(`${Q.score}/${Q.total}`)}`),console.log(`tokens ${uZ(z.tokens)} ${uZ(Q.tokens)}`);let X=z.total-z.score;if(X>0)console.log(`
|
|
541
|
+
${M(`The ${X} missing answer${X===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(M("Structured context closes the gap."));let J=BQ($,Z);console.log(`
|
|
542
|
+
${R0("✪ BENCH RECEIPT")}`),console.log(M(` qset: ${$.qsetHash} protocol: ${$.protocol} model: ${Q.model??z.model??"unreported"}`)),console.log(M(` cold ${z.score}/${z.total} · faf ${Q.score}/${Q.total} · sha256: ${J.hash.slice(0,16)}…`))}function bx($,Z){let z=$.cold,Q=z.total-z.score;if(console.log(`
|
|
543
|
+
${A(`faf bench — ${Z}`)} ${R0("Trouble ahead, expensive trouble.")}
|
|
544
|
+
`),console.log(` ${M("without context")}`),console.log(`answers ${z.score}/${z.total} ${M("— the AI is guessing at what you are building")}`),z.tokens!==void 0)console.log(`tokens ${uZ(z.tokens)} ${M("— re-derivation burn, paid again EVERY session")}`);if(Q>0)console.log(`
|
|
545
|
+
${Q} answer${Q===1?"":"s"} missing: the stack it can dig out (you pay for the dig);`),console.log("what you are trying to DO, it cannot derive at any price."),console.log("Both are already in your repo — unstructured.");console.log(`
|
|
546
|
+
${I("→ faf init && faf bench")} ${M("(close the gap, get the receipt)")}`)}var yx="https://mcpaas.live/bench/submit";async function vx($,Z){try{let z=await fetch(Z,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)});console.log(M(z.ok?` ✪ submitted to ${Z}`:` submit failed (${z.status})`))}catch{console.log(M(" submit skipped (endpoint unreachable)"))}}function kH($,Z,z={}){let Q=z.file??f();if(!Q)console.error(`Error: project.faf not found
|
|
547
|
+
|
|
548
|
+
Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let X=c(Q);$2(X,Q);let J=n(Q,()=>wx(X)),Y=Rx(Q),W=d0(X)?.project?.name??Y.split("/").pop();if(J.questions.length===0)console.error("Error: no populated slots to derive questions from.\n\n Run `faf go` to fill the .faf first."),process.exit(2);if($==="questions"){if(z.json){console.log(JSON.stringify({version:J.version,qsetHash:J.qsetHash,questions:J.questions.map(({n:U,question:G})=>({n:U,question:G}))},null,2));return}console.log(`
|
|
549
|
+
${A(`faf bench — ${J.questions.length} questions`)} ${M(`qset ${J.qsetHash}`)}
|
|
550
|
+
`);for(let U of J.questions)console.log(` ${String(U.n).padStart(2)}. ${U.question}`);console.log(`
|
|
551
|
+
${M('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!Tx(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(Ix(Z,"utf-8")),G=U.answers??U,V=jx(J,G),H={score:V.correct,total:V.total,...z.tokens?{tokens:parseInt(z.tokens,10)}:{},...z.model?{model:z.model}:{}},{state:q,bytes:K}=Sx(Y),L=q&&q.qsetHash===J.qsetHash?q:{version:J.version,qsetHash:J.qsetHash,protocol:"in-session"};if(z.cold)L.cold=H;else if(z.faf)L.faf=H;else console.error("Error: specify the run mode — --cold (no context) or --faf (after reading project.faf)."),process.exit(2);if(xx(Y,L,K),z.json){let B=BQ(L,W);console.log(JSON.stringify({...L,receipt:B.hash,perQuestion:V.perQuestion},null,2));return}if(L.cold&&L.faf)kx(L,W);if(z.submit&&L.cold&&L.faf){let{cold:B,faf:N}=L,T=BQ(L,W);vx({date:new Date().toISOString().slice(0,10),model:N.model??B.model??z.model??"unreported",repo:W,qset:L.qsetHash,cold:`${B.score}/${B.total}`,faf:`${N.score}/${N.total}`,sha256:T.hash.slice(0,16)},z.endpoint??yx)}else if(L.cold)bx(L,W);else console.log(`
|
|
552
|
+
${A(`faf bench — ${W}`)} ${I("with .faf")}: ${A(`${H.score}/${H.total}`)} ${M(`tokens ${uZ(H.tokens)}`)}`),console.log(M("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
|
|
553
|
+
${A("faf bench — agent-native protocol")} ${M(`qset ${J.qsetHash} · ${J.questions.length} questions`)}
|
|
527
554
|
`),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>")}
|
|
528
555
|
`),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>")}
|
|
529
|
-
`),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 ${
|
|
556
|
+
`),console.log(M("Grading is mechanical against your own project.faf — the .faf IS the answer key.")),console.log(M(`Receipts carry protocol: in-session (honor-system cold). qset ${J.qsetHash}.`))}import{lstatSync as gx}from"fs";import{dirname as hx,resolve as fx}from"path";p();function ux($){try{return gx($),!0}catch{return!1}}function mx($,Z,z,Q){let X=n(Q,()=>T5(Z));try{return C2($,X,{root:z,owns:M9,mark:L9}),{bytes:X.length,left:null}}catch(J){if(J instanceof y)return{bytes:null,left:J.message};throw J}}function cx({result:$,known:Z,drifted:z,delta:Q,prevScore:X,fafbBytes:J,fafbLeft:Y}){if(console.log(`${I("refresh")} ${M("— re-grounding on the live .faf")}
|
|
557
|
+
`),!Z)console.log(` score unknown ${M("— about-repo with no about.source_score; the DNA journey is left as it is")}`);else if(z){let W=Q>0?"↑":"↓";console.log(` drift: ${M(`${X}%`)} ${W} ${A(`${$.score}%`)} ${M(`(${Q>0?"+":""}${Q})`)}`)}else if(X!==null&&X!==void 0)console.log(` no drift ${M(`— steady at ${$.score}%`)}`);else console.log(` baseline set ${M(`— ${$.score}%`)}`);if(J!==null)console.log(` .fafb re-compiled ${M(`(${J} bytes — fast tier current)`)}`);if(Y!==null)console.log(` .fafb left as it is ${M(`— ${Y}`)}`);if(Z)console.log(` re-grounded: ${B2($.tier)} ${A(`${$.score}%`)}`)}function bH($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
|
|
530
558
|
|
|
531
|
-
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(BF(q)){let V=S8(X);MF(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")}
|
|
532
|
-
`),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: ${d0(z.tier)} ${A(`${z.score}%`)}`)}if(J.exists())J.recordGrowth(z.score,["refresh — re-grounded"]);else J.birth(z.score)}l();import{existsSync as NW}from"fs";import{resolve as v6}from"path";var GW=["ephemeral","standard","high","critical"],X$=Object.fromEntries(GW.map(($,Z)=>[$,Z])),I9=new Set(["user","feedback","project","reference"]),T9=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),A9=new Set(["facts","sessions","preferences","custom"]),R9={low:"ephemeral",medium:"standard"};import{readFileSync as OF,writeFileSync as NF,existsSync as LF}from"fs";function y6(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function T0($){return $===null||$===void 0}function c4($){if(T0($))return"standard";if(R9[$])return R9[$];if($ in X$)return $;return"standard"}var DF=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function VW($){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(!DF.has(z))X[z]=J;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:c4(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 KW($){if(T0($.id)&&T0($.type)&&$.tags.length===0&&$.links.length===0&&T0($.timestamp)&&T0($.source)&&Object.keys($.extra).length===0&&$.priority==="standard")return $.text;let X={text:$.text};if(!T0($.id))X.id=$.id;if(!T0($.type))X.type=$.type;if(X.priority=$.priority,$.tags.length)X.tags=$.tags;if($.links.length)X.links=$.links;if(!T0($.timestamp))X.timestamp=$.timestamp;if(!T0($.source))X.source=$.source;return Object.assign(X,$.extra),X}class e0{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(!T0(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(!LF($))throw Error(`soul file not found: ${$}`);let Z=OF($,"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(!T9.has(U))Q[U]=structuredClone(q);let Y={};for(let[U,q]of Object.entries(z))if(!A9.has(U))Y[U]=structuredClone(q);let W=new e0(String(X.namepoint??$.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(X.profile??"voice"),facts:J.map(VW),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 e0.load($)}toDoc(){let $={facts:this._facts.map(KW),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[X,z]of Object.entries(this._memoryExtra))if(!A9.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(!T9.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 NF($,this.toYaml(),"utf-8"),$}toFile($,Z={}){return this.save($,Z)}add($){if(!T0($.id)&&this._byId.has($.id)){let Z=this._byId.get($.id);if(Z!==void 0)this._facts[Z]=$}else if(this._facts.push($),!T0($.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:c4(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=X$[c4(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(!T0(Z.type)&&W.type!==Z.type)return;if((X$[W.priority]??1)<X)return;Q.push([U,W])}),Q.sort((W,U)=>{let q=X$[W[1].priority]??1,G=X$[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(!T0(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(!T0(X.id))this._byId.set(X.id,z)}),!0}}import{readdirSync as IF,readFileSync as TF,statSync as HW,existsSync as AF}from"fs";import{join as RF,basename as BW,resolve as _F}from"path";var MW=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),FF=/\[\[([^\]]+)\]\]/g;function CF($){let Z=HW($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function PF($){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 EF($,Z,X){if(!X.name)return null;let z=X.metadata&&typeof X.metadata==="object"?X.metadata:{},J=z.type;if(typeof J!=="string"||!I9.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(FF)].map((G)=>G[1]))].sort();return{text:W,id:Q,type:J,priority:"standard",tags:[],links:q,timestamp:CF($),source:`claude-code memory: ${BW($)}`,extra:U}}function _9($,Z={}){let X=_F($);if(!AF(X))throw Error(`Claude memory directory not found: ${X}`);if(!HW(X).isDirectory())throw Error(`Claude memory path is not a directory: ${X}`);let z=Z.skip??MW,J=Z.namepoint??`@claude-code:${BW(X)}`,Q=[],Y=IF(X).filter((V)=>V.endsWith(".md")).sort();for(let V of Y){if(z.has(V))continue;let K=RF(X,V),H;try{H=TF(K,"utf-8")}catch{continue}let{fm:L,body:B}=PF(H);if(!L)continue;let O=EF(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 e0(J,{profile:"knowledge",facts:Q,created:U});return G.last_etched=q,G.rebuildIndex(),G}function F9(){return v6(process.cwd(),"soul.fafm")}function C9($){let Z=v6($??F9());if(!NW(Z))console.error(`Error: soul file not found: ${Z}
|
|
559
|
+
Run 'faf init' to create one.`),process.exit(2);let z=c(Z);$2(z,Z);let Q=n(Z,()=>M0(z)),X=new g2(process.cwd()),J=X.load()?X.getBirthDNADisplay():null,Y=J?J.current:null,W=!Q.unknown,U=W&&Y!==null&&Y!==void 0?Q.score-Y:0,G=W&&Y!==null&&Y!==void 0&&U!==0,V=N9(Z),H=null,q=null;if(ux(V))({bytes:H,left:q}=mx(V,z,hx(fx(Z)),Z));if($.json)console.log(JSON.stringify({reGrounded:W,score:Q.score,...W?{}:{unknown:!0},tier:Q.tier,baseline:Y,delta:U,drifted:G,fafb:H!==null&&H!==void 0?{reCompiled:!0,bytes:H}:{reCompiled:!1,...q!==null?{left:q}:{}},journey:X.getJourney()||null},null,2));else cx({result:Q,known:W,drifted:G,delta:U,prevScore:Y,fafbBytes:H,fafbLeft:q});if(!W)return;if(X.exists())X.recordGrowth(Q.score,["refresh — re-grounded"]),m5(X);else X.birth(Q.score)}p();import{existsSync as rH,lstatSync as Jk}from"fs";import{resolve as q8}from"path";var yH=["ephemeral","standard","high","critical"],Y$=Object.fromEntries(yH.map(($,Z)=>[$,Z])),MQ=new Set(["user","feedback","project","reference"]),LQ=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),NQ=new Set(["facts","sessions","preferences","custom"]),DQ={low:"ephemeral",medium:"standard"};import{existsSync as px}from"fs";import{dirname as mH,resolve as cH}from"path";function U1(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function V0($){return $===null||$===void 0}function lx($){if(Array.isArray($))return`a list (${$.length} item${$.length===1?"":"s"})`;if(V0($))return"empty";if(typeof $==="string")return`a string (${JSON.stringify($.length>40?`${$.slice(0,40)}…`:$)})`;return`a ${typeof $}`}var W1=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function dx($){let Z=cH($),z=d(mH(Z),Z,{read:!0});return{real:z,text:J0(z)}}function vH($,Z,z,Q){let X=cH($),J=d(mH(X),X),Y=z!==void 0&&z.real===J;if(Y&&z.text===Z)return J;let W;try{W=h0(J)}catch{W=void 0}if(W&&W.equals(Buffer.from(Z,"utf-8")))return J;if(!Y&&!Q&&W)throw new y("changed",X,`${X} already exists — not written; pass { replace: true } (faf memory convert --force) to replace it`,{onWrite:!0});let U=Y?z.text:Q?W:null;return a($,Z,U===void 0?{}:{expect:U})}function H8($){if(V0($))return"standard";if(DQ[$])return DQ[$];if($ in Y$)return $;return"standard"}var ix=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function OQ($){if(typeof $==="string")return{text:$,id:null,type:null,priority:"standard",tags:[],links:[],timestamp:null,source:null,extra:{}};if(!$||typeof $!=="object"||!("text"in $))throw Error(`fact must be a string or a mapping with 'text': ${JSON.stringify($)}`);let Z=$,z={};for(let[Q,X]of Object.entries(Z))if(!ix.has(Q))z[Q]=X;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:H8(Z.priority),tags:Array.isArray(Z.tags)?Z.tags.slice():[],links:Array.isArray(Z.links)?Z.links.slice():[],timestamp:Z.timestamp??null,source:Z.source??null,extra:z}}function Y1($){if(V0($.id)&&V0($.type)&&$.tags.length===0&&$.links.length===0&&V0($.timestamp)&&V0($.source)&&Object.keys($.extra).length===0&&$.priority==="standard")return $.text;let z={text:$.text};if(!V0($.id))z.id=$.id;if(!V0($.type))z.type=$.type;if(z.priority=$.priority,$.tags.length)z.tags=$.tags;if($.links.length)z.links=$.links;if(!V0($.timestamp))z.timestamp=$.timestamp;if(!V0($.source))z.source=$.source;return Object.assign(z,$.extra),z}function gH($){let Z=$;return W1($)&&typeof Z.text==="string"&&Array.isArray(Z.tags)&&Array.isArray(Z.links)&&W1(Z.extra)&&typeof Z.priority==="string"?Z:OQ($)}function nx($){if(typeof $==="string"||W1($)&&"text"in $)return OQ($);return null}var hH=["profile","namepoint","created","last_etched","retention"];class v0{namepoint;profile;retention;created;last_etched;_facts;_byId;_index;_sessions;_preferences;_custom;_extra;_memoryExtra;_version;_origin;_factAt=new WeakMap;_indexDerived=!0;_indexAtRecord=[];constructor($,Z={}){this.namepoint=$,this.profile=Z.profile??"knowledge",this.retention=Z.retention??"forever",this.created=Z.created??U1(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.map(gH):[],this._byId=new Map,this._facts.forEach((z,Q)=>{if(!V0(z.id))this._byId.set(z.id,Q)}),this._index=Z.index?Z.index.slice():[],this._sessions=Z.sessions?structuredClone(Z.sessions):[],this._preferences=Z.preferences?{...Z.preferences}:{},this._custom=Z.custom?{...Z.custom}:{},this._extra=Z.extra?{...Z.extra}:{},this._memoryExtra=Z.memoryExtra?{...Z.memoryExtra}:{},this._indexDerived=Z.index===void 0||q0(this._index,this.derivedIndex()),this._indexAtRecord=this._index.slice()}get facts(){return this._facts}get index(){return this._index}get sessions(){return this._sessions}get preferences(){return this._preferences}get custom(){return this._custom}get extra(){return this._extra}get memoryExtra(){return this._memoryExtra}static load($){if(!px($))throw Error(`soul file not found: ${$}`);let{real:Z,text:z}=dx($);return v0.fromText(z,$,Z)}static fromText($,Z,z){let Q=D3($,Z).toJS();if(!W1(Q))throw Error(`soul is not a YAML mapping: ${Z} is ${lx(Q)}`);let X=new pH,J=X.pick("memory",Q.memory,$0)??{},Y=new v0(String(Q.namepoint??Z.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(Q.profile??"voice"),retention:String(Q.retention??"forever"),created:Q.created??null,...X.modelled(Q,J)});return(X.pick("memory.facts",J.facts,Array.isArray)??[]).forEach((W,U)=>{let G=nx(W);if(G)Y.adopt(G,U)}),Y.last_etched=String(Q.last_etched??Y.created),Y._version=V0(Q.version)?void 0:String(Q.version),Y._origin={path:Z,real:z,text:$,base:Y.state(),residual:X.residual},Y.recordIndex(),Y}recordIndex(){this._indexDerived=this.indexIsDerived(),this._indexAtRecord=this._index.slice()}adopt($,Z){if(this._facts.push($),!V0($.id))this._byId.set($.id,this._facts.length-1);this._factAt.set($,Z)}static fromFile($){return v0.load($)}toDoc(){let $={facts:this._facts.map(Y1),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[z,Q]of Object.entries(this._memoryExtra))if(!NQ.has(z))$[z]=structuredClone(Q);let Z={version:this._version??"1.1",profile:this.profile,namepoint:this.namepoint,created:this.created,last_etched:this.last_etched,retention:this.retention,index:this._index.slice(),memory:$};for(let[z,Q]of Object.entries(this._extra))if(!LQ.has(z))Z[z]=structuredClone(Q);return Z}toYaml(){return b1(this.toDoc(),{lineWidth:100})}derivedIndex($=80){return this._facts.map((Z)=>`${Z.id??"?"} — ${String(Z.text).slice(0,$)}`)}indexIsDerived($=80){return!this._origin?.residual.has("index")&&q0(this._index,this.derivedIndex($))}rebuildIndex($=80){return this._index=this.derivedIndex($),this._indexDerived=!0,this._indexAtRecord=this._index.slice(),this._index}save($,Z={}){let z=Z.reindex??(this._indexDerived&&q0(this._index,this._indexAtRecord));if(z)this.rebuildIndex();let Q=Z.replace===!0,X=this._origin;if(!X){let U=this.toYaml(),G=vH($,U,void 0,Q);return this.settle($,U,new Map(this._facts.map((V,H)=>[V,H])),G),$}let J=new Map,{text:Y}=B5(X.text,(U)=>{J=this.applyTo(U,X,z)},$),W=vH($,Y,X.real===void 0?void 0:{real:X.real,text:X.text},Q);return this.settle($,Y,J,W),$}toFile($,Z={}){return this.save($,Z)}settle($,Z,z,Q){this._factAt=new WeakMap;for(let[X,J]of z)this._factAt.set(X,J);this._origin={path:$,real:Q,text:Z,base:this.state(),residual:this._origin?.residual??new Map},this.recordIndex()}state(){let $=new Map;for(let Z of this._facts){let z=this._factAt.get(Z);if(z!==void 0)$.set(z,structuredClone(Y1(Z)))}return{top:Object.fromEntries(hH.map((Z)=>[Z,this[Z]])),index:this._index.slice(),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom),extra:structuredClone(this._extra),memoryExtra:structuredClone(this._memoryExtra),facts:$}}static refuse($,Z,z){throw Error(`${$.path}: ${Z} is ${$.residual.get(Z)} in the file, not the shape faf writes — `+`faf keeps it as it is and will not ${z}. Nothing written.`)}applyTo($,Z,z){let Q=Z.base,X=this.state(),J=Z.path;for(let Y of hH)if(Q.top[Y]!==X.top[Y])$.set(Y,X.top[Y]);if(!q0(Q.index,X.index)){if(Z.residual.has("index")&&!z)v0.refuse(Z,"index","replace it");L5($,["index"],Z.residual.has("index")?void 0:Q.index,X.index,J)}for(let Y of uH(Q.extra,X.extra))L5($,[Y],Q.extra[Y],X.extra[Y],J);return this.applyMemory($,Z,Q,X),this.applyFacts($,Z)}applyMemory($,Z,z,Q){let X=[["sessions",z.sessions,Q.sessions],["preferences",z.preferences,Q.preferences],["custom",z.custom,Q.custom],...uH(z.memoryExtra,Q.memoryExtra).map((J)=>[J,z.memoryExtra[J],Q.memoryExtra[J]])];for(let[J,Y,W]of X){if(q0(Y,W))continue;if(Z.residual.has("memory"))v0.refuse(Z,"memory",`change memory.${J}`);if(Z.residual.has(`memory.${J}`))v0.refuse(Z,`memory.${J}`,"replace it");L5($,["memory",J],Y,W,Z.path)}}sortFacts($){let Z=[],z=[];for(let Q of this._facts){let X=this._factAt.get(Q);if(X===void 0){z.push(Q);continue}if(z.length>0||Z.length>0&&X<=Z[Z.length-1][1])throw Error(`${$.path}: the facts were reordered — faf keeps the order soul.fafm has. Nothing written.`);Z.push([Q,X])}return{kept:Z,added:z}}applyFacts($,Z){let{kept:z,added:Q}=this.sortFacts(Z),X=new Set(z.map(([,G])=>G)),J=[...Z.base.facts.keys()].filter((G)=>!X.has(G)).sort((G,V)=>V-G),Y=z.filter(([G,V])=>!q0(Z.base.facts.get(V),Y1(G))),W=new Map(z);if(Q.length===0&&J.length===0&&Y.length===0)return W;for(let G of["memory","memory.facts"])if(Z.residual.has(G))v0.refuse(Z,G,"add facts to it");let U=hY($,["memory","facts"],Z.path);for(let[G,V]of Y)U.items[V]=sx($,U.items[V],Z.base.facts.get(V),Y1(G));for(let G of J)U.items.splice(G,1);for(let[G,V]of z)W.set(G,V-J.filter((H)=>H<V).length);for(let G of Q)W.set(G,U.items.length),U.items.push($.createNode(Y1(G)));return W}add($){let Z=gH($);if(!V0(Z.id)&&this._byId.has(Z.id)){let z=this._byId.get(Z.id);if(z!==void 0){let Q=this._factAt.get(this._facts[z]);if(this._facts[z]=Z,Q!==void 0)this._factAt.set(Z,Q)}}else if(this._facts.push(Z),!V0(Z.id))this._byId.set(Z.id,this._facts.length-1);if(Z.timestamp&&Z.timestamp>(this.last_etched||""))this.last_etched=Z.timestamp;return Z}etch($,Z={}){let z=V0(Z.id)?null:this.getFact(Z.id);if(z)return this.add(rx(z,$,Z));return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:H8(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:U1(),source:Z.source??null,extra:{}})}recall($,Z={}){let z=W1($)?{...$,...Z}:Z,Q=W1($)?$.query:$,X=Y$[H8(z.minPriority??"ephemeral")]??0,J=typeof Q==="string"?Q.toLowerCase():"",Y=new Set(z.tags??[]),W=[];this._facts.forEach((G,V)=>{if(J&&!String(G.text??"").toLowerCase().includes(J))return;if(Y.size>0&&![...Y].some((H)=>(G.tags??[]).includes(H)))return;if(!V0(z.type)&&G.type!==z.type)return;if((Y$[G.priority]??1)<X)return;W.push([V,G])}),W.sort((G,V)=>{let H=Y$[G[1].priority]??1,q=Y$[V[1].priority]??1;if(q!==H)return q-H;let K=G[1].timestamp??"",L=V[1].timestamp??"";if(L!==K)return L<K?-1:L>K?1:0;return V[0]-G[0]});let U=W.map(([,G])=>G);if(!V0(z.limit))return U.slice(0,z.limit);return U}getFact($){let Z=this._byId.get($);return Z===void 0?null:this._facts[Z]}deleteFact($){let Z=this._byId.get($);if(Z===void 0)return!1;return this._facts.splice(Z,1),this._byId.clear(),this._facts.forEach((z,Q)=>{if(!V0(z.id))this._byId.set(z.id,Q)}),!0}}function rx($,Z,z){let Q=(X,J)=>V0(X)?J:X;return{...$,text:Z,type:Q(z.type,$.type),priority:V0(z.priority)?$.priority:H8(z.priority),tags:Q(z.tags,$.tags).slice(),links:Q(z.links,$.links).slice(),source:Q(z.source,$.source),timestamp:U1(),extra:{...$.extra}}}class pH{residual=new Map;pick($,Z,z){if(V0(Z))return;if(z(Z))return Z;this.residual.set($,y6(Z));return}modelled($,Z){return{index:(this.pick("index",$.index,Array.isArray)??[]).map(String),sessions:this.pick("memory.sessions",Z.sessions,Array.isArray)??[],preferences:structuredClone(this.pick("memory.preferences",Z.preferences,$0)??{}),custom:structuredClone(this.pick("memory.custom",Z.custom,$0)??{}),extra:fH($,LQ),memoryExtra:fH(Z,NQ)}}}function fH($,Z){let z={};for(let[Q,X]of Object.entries($))if(!Z.has(Q))z[Q]=structuredClone(X);return z}function uH($,Z){return[...new Set([...Object.keys($),...Object.keys(Z)])]}function sx($,Z,z,Q){if(!H0(Z))return l1($,Z,z,Q);let X=(J)=>typeof J==="string"?{text:J}:J;return l1($,Z,X(z),X(Q))}import{readdirSync as ox,readFileSync as ax,statSync as lH,existsSync as tx}from"fs";import{join as ex,basename as dH,resolve as $k}from"path";var iH=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),Zk=/\[\[([^\]]+)\]\]/g;function zk($){let Z=lH($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function Qk($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let z=d0(Z[1]);if(!z||typeof z!=="object")return{fm:null,body:Z.slice(2).join("---").trim()};return{fm:z,body:Z.slice(2).join("---").trim()}}catch{return{fm:null,body:$}}}function Xk($,Z,z){if(!z.name)return null;let Q=z.metadata&&typeof z.metadata==="object"?z.metadata:{},X=Q.type;if(typeof X!=="string"||!MQ.has(X))return null;let J=String(z.name).trim(),W=(z.description!==void 0&&z.description!==null&&String(z.description).trim()?String(z.description).trim():"")||J,U={};if(Q.originSessionId)U.provenance=[`session:${Q.originSessionId}`];let G=[...new Set([...Z.matchAll(Zk)].map((V)=>V[1]))].sort();return{text:W,id:J,type:X,priority:"standard",tags:[],links:G,timestamp:zk($),source:`claude-code memory: ${dH($)}`,extra:U}}function IQ($,Z={}){let z=$k($);if(!tx(z))throw Error(`Claude memory directory not found: ${z}`);if(!lH(z).isDirectory())throw Error(`Claude memory path is not a directory: ${z}`);let Q=Z.skip??iH,X=Z.namepoint??`@claude-code:${dH(z)}`,J=[],Y=ox(z).filter((H)=>H.endsWith(".md")).sort();for(let H of Y){if(Q.has(H))continue;let q=ex(z,H),K;try{K=ax(q,"utf-8")}catch{continue}let{fm:L,body:B}=Qk(K);if(!L)continue;let N=Xk(q,B,L);if(N)J.push(N)}let W=J.map((H)=>H.timestamp).filter(Boolean),U=W.length?W.reduce((H,q)=>H<q?H:q):U1(),G=W.length?W.reduce((H,q)=>H>q?H:q):U,V=new v0(X,{profile:"knowledge",facts:J,created:U});return V.last_etched=G,V.rebuildIndex(),V}function Yk($){try{return Jk($),!0}catch{return!1}}function TQ(){return q8(process.cwd(),"soul.fafm")}function AQ($){let Z=q8($??TQ());if(!rH(Z))console.error(`Error: soul file not found: ${Z}
|
|
533
560
|
|
|
534
|
-
Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return
|
|
561
|
+
Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return v0.load(Z)}function Wk($,Z){if(!$)console.error(`Error: directory required
|
|
535
562
|
|
|
536
|
-
faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let
|
|
537
|
-
`);for(let
|
|
538
|
-
`);for(let Y of
|
|
563
|
+
faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let z=q8($),Q=q8(Z.output??TQ());if(Yk(Q)&&!Z.force)console.error(`${Z.output??"soul.fafm"} already exists. Use ${A("--force")} to overwrite.`),process.exit(1);try{let X=IQ(z,{namepoint:Z.namepoint});X.toFile(Q,{replace:Z.force===!0}),console.log(`${I("memory convert")} ${M("—")} ${X.facts.length} facts → ${Q}`),console.log(M(` namepoint ${X.namepoint} profile ${X.profile} index ${X.index.length}`))}catch(X){console.error(`Error: ${X instanceof Error?X.message:X}`),process.exit(1)}}function Uk($){let Z=AQ($.file);if($.json){console.log(JSON.stringify(Z.facts.map((z)=>({id:z.id,text:z.text,type:z.type,priority:z.priority,tags:z.tags})),null,2));return}console.log(`${I("memory ls")} ${M(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
|
|
564
|
+
`);for(let z of Z.recall()){let Q=z.id?A(z.id):M("(no-id)"),X=[z.type,z.priority].filter(Boolean).join(" · ");if(console.log(` ${Q} ${z.text.slice(0,80)}`),X)console.log(M(` ${X}`))}}function Gk($,Z){let z=AQ(Z.file),Q=Z.tag?Z.tag.split(",").map((Y)=>Y.trim()):void 0,X=Z.limit!==void 0&&Z.limit!==null?parseInt(Z.limit,10):void 0,J=z.recall($??null,{tags:Q,type:Z.type,minPriority:Z.priority,limit:Number.isFinite(X)?X:null});if(Z.json){console.log(JSON.stringify(J.map((Y)=>({id:Y.id,text:Y.text,priority:Y.priority})),null,2));return}console.log(`${I("memory recall")} ${M(`— ${J.length} hit(s)`)}${$?M(` for "${$}"`):""}
|
|
565
|
+
`);for(let Y of J)console.log(` ${Y.id?A(Y.id):M("?")} ${Y.text}`)}function Vk($,Z){if(!$)console.error(`Error: text required
|
|
539
566
|
|
|
540
|
-
faf memory etch "a durable fact" [--id slug]`),process.exit(2);let
|
|
567
|
+
faf memory etch "a durable fact" [--id slug]`),process.exit(2);let z=q8(Z.file??TQ()),Q=rH(z)?v0.load(z):new v0(Z.namepoint??"@local",{profile:"knowledge"}),X=Q.indexIsDerived(),J=Q.etch($,{id:Z.id,type:Z.type,priority:Z.priority});Q.toFile(z,{reindex:X}),console.log(`${I("memory etch")} ${M("—")} ${J.id??"(no-id)"} → ${z}`)}function Hk($){let Z=AQ($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${I("memory show")} ${M(`— ${Z.namepoint}`)}
|
|
541
568
|
`),console.log(` profile ${Z.profile}`),console.log(` facts ${Z.facts.length}`),console.log(` index ${Z.index.length}`),console.log(` created ${Z.created}`),console.log(` last_etched ${Z.last_etched}`),Z.index.length){console.log(`
|
|
542
|
-
${A("index")}`);for(let
|
|
569
|
+
${A("index")}`);for(let z of Z.index.slice(0,20))console.log(M(` ${z}`));if(Z.index.length>20)console.log(M(` … +${Z.index.length-20} more`))}}function sH($,Z,z={}){if(Z&&typeof Z==="object")z=Z,Z=void 0;switch($){case"convert":Wk(Z,z);break;case"ls":case"list":Uk(z);break;case"recall":Gk(Z,z);break;case"etch":Vk(Z,z);break;case"show":Hk(z);break;case void 0:case"help":nH();break;default:console.error(`Unknown memory subcommand: ${$}`),nH(),process.exit(2)}}function nH(){console.log(`${I("faf memory")} ${M("— .fafm soul ops (knowledge profile)")}
|
|
543
570
|
`),console.log(" convert <dir> Claude Code memory dir → soul.fafm"),console.log(" etch <text> Write a fact (creates soul.fafm if needed)"),console.log(" ls List facts (ranked)"),console.log(" recall [query] Deterministic recall"),console.log(` show Soul summary
|
|
544
|
-
`),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:DW}=$5(),g=new n9;g.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(DW,"-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(($)=>kZ($));g.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>XJ());g.command("auto").description("Zero to 100% in one command").action(()=>r8());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(($)=>JJ($));g.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>sQ($));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)=>UW($,Z,X));g.command("show").description("Render project.faf → project.html and open it").action(()=>UQ());g.command("sync").description(".faf ↔ CLAUDE.md (mtime auto-direction)").option("--watch","Watch for changes").option("--direction <dir>","Force direction: auto|push|pull","auto").action(($)=>fZ($));g.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").action(($,Z)=>RJ($,Z));g.command("decompile <file>").description("Decompile .fafb to JSON").option("--output <path>","Output path").action(($,Z)=>_J($,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)=>GQ($,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)=>IQ($,Z));g.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>LQ($??[]));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(($)=>TQ($));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(($)=>EQ($));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(($)=>PQ($));g.command("export").description("Export context files from .faf").option("--agents","Author AGENTS.md").option("--cursor","Author .cursorrules").option("--gemini","Author GEMINI.md").option("--copilot","Author .github/copilot-instructions.md (GitHub Copilot)").option("--grok","Wire grok-faf-mcp into .grok/config.toml").option("--llms","Author llms.txt (llmstxt.org view of authored 6Ws — opt-in)").option("--conductor","Author conductor config").option("--html","Author project.html (visual render of project.faf)").option("--card","Author MCP Server Card (.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(($)=>i1($));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(($)=>QQ($));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(($)=>WQ($));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)=>hZ($,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(($)=>wQ($));g.command("formats").description("Show supported formats").action(()=>SQ());g.command("clear").description("Clear cached data").action(()=>jQ());g.command("convert").description("Convert .faf to other formats").option("--json","Output as JSON").action(($)=>xQ($));g.command("context").description("Author context output").action(()=>bQ());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(($)=>qW($));g.command("drift").description("Check context drift").option("--json","Emit the drift report as structured JSON").action(($)=>gQ($));g.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>fQ($,Z));g.command("recover").description("Recover .faf from context files").action(()=>hQ());g.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>uQ($));g.command("pro [subcommand]").description("Pro features & licensing").action(($)=>mQ($));g.command("share").description("Share .faf via URL").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>cQ($));g.command("demo").description("Demo walkthrough").action(()=>dQ());g.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>pQ($,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)=>nQ($,Z));g.command("ai [subcommand]").description("AI-powered features (enhance|analyze)").action(($)=>sY($));g.command("conductor [subcommand] [path]").description("Conductor integration").action(($,Z)=>tY($,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(($)=>$W($));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)=>LW($,Z,X));g.command("bi-sync",{hidden:!0}).action(()=>fZ());g.command("status",{hidden:!0}).action(()=>j8(void 0,{status:!0}));g.command("agents",{hidden:!0}).action(()=>i1({agents:!0}));g.command("cursor",{hidden:!0}).action(()=>i1({cursor:!0}));g.command("gemini",{hidden:!0}).action(()=>i1({gemini:!0}));g.command("grok",{hidden:!0}).action(()=>i1({grok:!0}));g.command("llms",{hidden:!0}).action(()=>i1({llms:!0}));g.command("validate",{hidden:!0}).action(($)=>hZ($));g.command("yolo",{hidden:!0}).action(()=>kZ({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:X}=await Promise.resolve().then(() => (l(),Uz)),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${DW}`)}`);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(`
|
|
545
|
-
`)),
|
|
571
|
+
`),console.log(M(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json · --force")),console.log(M(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}var{version:oH}=i9(),h=new pQ;h.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(oH,"-v, --version");h.command("init").description("Create .faf from your project").option("--yolo","Quick init with sensible defaults").option("--quick","Alias for --yolo").option("--force","Overwrite existing project.faf").option("--output <path>","Output path").action(($)=>X9($));h.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>ZU());h.command("auto").description("Fill every tech slot from the repo, then score").action(()=>c5());h.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(($)=>QU($));h.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>RV($));h.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>R5($,Z));h.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key)").option("--json","Output as JSON").option("--cold","Grade as the without-context run").option("--faf","Grade as the with-context run").option("--tokens <n>","Tokens used in the run (reported by the agent)").option("--model <name>","Model that answered (reported)").option("--file <path>","Path to project.faf (default: discovered)").option("--submit","Submit the full-pair receipt to the public bench ledger").option("--endpoint <url>","Override the submit endpoint").action(($,Z,z)=>kH($,Z,z));h.command("show").description("Render project.faf → project.html and open it").option("--force","Replace a project.html faf cannot prove it rendered (edited since, or not faf's)").action(($)=>_G($));h.command("sync").description(".faf → CLAUDE.md (--direction pull: Trophy-gated backfill into .faf)").option("--watch","Watch for changes").option("--direction <dir>","auto|push write CLAUDE.md from .faf; pull backfills .faf at ✪ Trophy","auto").action(($)=>B9($));h.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").option("--force","Replace an output file that is not a .fafb faf compiled").action(($,Z)=>kU($,Z));h.command("decompile <file>").description("Decompile .fafb to JSON").option("--output <path>","Output path").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a faf decompile)").action(($,Z)=>lU($,Z));h.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)=>jG($,Z));h.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)=>cG($,Z));h.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>gG($??[]));h.command("log").description("Score timeline across git history — the .faf score at every commit that touched it").option("-n, --limit <n>","Max commits to show (default 20)").option("--all","Show every commit, no cap").option("--reverse","Oldest-first instead of newest-first").option("--json","Emit the timeline as structured JSON").action(($)=>pG($));h.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(($)=>QV($));h.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(($)=>zV($));h.command("export").description("Export context files from .faf").option("--agents","Author AGENTS.md").option("--cursor","Author .cursorrules").option("--gemini","Author GEMINI.md").option("--copilot","Author .github/copilot-instructions.md (GitHub Copilot)").option("--grok","Wire grok-faf-mcp into .grok/config.toml").option("--llms","Author llms.txt (llmstxt.org view of authored 6Ws — opt-in)").option("--conductor","Author conductor config").option("--html","Author project.html (visual render of project.faf)").option("--card","Author MCP Server Card (./server-card) with the FAF context-block").option("--all","Author all formats").option("--output <path>","Write exported files to this directory instead of the current one").option("--force","Replace a project.html or Server Card faf cannot prove it wrote (edited since, or not faf's)").action(($)=>o6($));h.command("server-card").description("Emit the registry server.json identity (name + title + _meta) from project.faf — the cross-language server-card emitter; patches an existing file").option("--in <path>","Existing server.json to patch (default: ./server.json)").option("--out <path>","Output path (default: same as --in)").option("--faf <path>","project.faf path (default: auto-discover)").option("--set-version <version>","Set the version field (default: preserve existing). NOTE: not --version, which is the global CLI-version flag").option("--generated <iso>","Override the _meta generated stamp (default: preserve existing)").option("--check","Print to stdout, do not write (diff/verify — the idempotency-test hook)").option("--force","With --out: replace a file faf cannot prove it wrote (edited since, or no faf identity)").action(($)=>AG($));h.command("cards").description("Project .faf + .fafa onto A2A / MCP / registry / catalog cards — one context block, every door").option("--target <list>","Comma list: a2a,mcp,registry,catalog (default: whatever inputs allow)").option("--faf <path>","project.faf path (default: auto-discover)").option("--fafa <path>","agent.fafa path (default: auto-discover)").option("--dir <path>","Working directory (default: cwd)").option("--a2a-url <url>","Public URL of the A2A card (catalog row)").option("--door-url <url>","A2A door when .fafa has no a2a endpoint").option("--faf-pointer <url>","Absolute .faf pointer for served cards (default: ./project.faf)").option("--check","Print projected cards to stdout, do not write").option("--force","Replace a card file faf cannot prove it wrote (edited since, or not faf's)").action(($)=>CG($));h.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--fix","Auto-fix issues").option("--doctor","Full diagnostic").option("--trust","Verify trust chain").option("--verbose","Show slot breakdown").action(($,Z)=>F9($,Z));h.command("info").description("Show version and system info").option("--version","Show version").option("--faq","Show FAQ").option("--index","Show command index").option("--stacks","Show supported stacks").action(($)=>XV($));h.command("formats").description("Show supported formats").action(()=>JV());h.command("clear").description("Clear cached data").action(()=>YV());h.command("convert").description("Convert .faf to other formats").option("--json","Output as JSON").action(($)=>WV($));h.command("context").description("Author context output").action(()=>UV());h.command("refresh").description("Re-ground on the live .faf — re-score, measure drift vs the DNA baseline, keep .fafb current").option("--json","Output as JSON").action(($)=>bH($));h.command("drift").description("Check context drift").option("--json","Emit the drift report as structured JSON").action(($)=>qV($));h.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>KV($,Z));h.command("recover").description("Recover .faf from context files").action(()=>BV());h.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>MV($));h.command("pro [subcommand]").description("Pro features & licensing").action(($)=>LV($));h.command("share").description("Share .faf via URL").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>NV($));h.command("demo").description("Demo walkthrough").action(()=>DV());h.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>OV($,Z));h.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` wires the CI receipt printer; bare snapshot deprecated → faf score --json").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a TAF snapshot)").action(($,Z)=>IV($,Z));h.command("ai [subcommand]").description("Ask Claude for suggestions about project.faf (analyze)").action(($)=>RH($));h.command("conductor [subcommand] [path]").description("Conductor integration").action(($,Z)=>_H($,Z));h.command("wjttc").description("Audit test suite for WJTTC tier coverage (vendor-neutral)").option("--path <path>","Test directory (default: tests)").option("--strict","Exit non-zero if any tests are untiered").option("--json","Output as JSON for CI consumption").action(($)=>PH($));h.command("memory [subcommand] [arg]").description(".fafm soul ops — convert Claude memory, etch, recall, ls, show").option("-f, --file <path>","Soul file (default: ./soul.fafm)").option("-o, --output <path>","Output path (convert)").option("--namepoint <handle>","Namepoint for new/converted soul").option("--id <id>","Fact id (etch)").option("--type <type>","Fact type filter / etch type").option("--tag <tags>","Comma-separated tags (recall)").option("--priority <level>","Min priority floor (recall) or etch priority").option("--limit <n>","Max recall hits").option("--json","JSON output").option("--force","Overwrite an existing soul.fafm (convert)").action(($,Z,z)=>sH($,Z,z));h.command("bi-sync",{hidden:!0}).action(()=>B9());h.command("status",{hidden:!0}).action(()=>R5(void 0,{status:!0}));h.command("agents",{hidden:!0}).action(()=>o6({agents:!0}));h.command("cursor",{hidden:!0}).action(()=>o6({cursor:!0}));h.command("gemini",{hidden:!0}).action(()=>o6({gemini:!0}));h.command("grok",{hidden:!0}).action(()=>o6({grok:!0}));h.command("llms",{hidden:!0}).action(()=>o6({llms:!0}));h.command("validate",{hidden:!0}).action(($)=>F9($));h.command("yolo",{hidden:!0}).action(()=>X9({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:z}=await Promise.resolve().then(() => (p(),oY)),Q=process.cwd().replace(process.env.HOME??"","~"),X="\x1B[38;2;150;150;150m",J="\x1B[48;2;150;150;150m",Y="\x1B[38;2;29;29;29m",W="\x1B[48;2;29;29;29m",U="\x1B[0m";console.log(""),console.log(`\x1B[48;2;29;29;29m ${"\x1B[38;2;150;150;150m"}▄${"\x1B[48;2;150;150;150m"}███████${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▄${"\x1B[0m"}`),console.log(`\x1B[48;2;29;29;29m \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}█${"\x1B[38;2;29;29;29m"}█${"\x1B[38;2;150;150;150m"}███████${"\x1B[0m"} ${z($("faf"))} ${Z(`v${oH}`)}`);let G="\x1B[38;2;39;174;96m";console.log(`\x1B[48;2;29;29;29m${"\x1B[38;2;150;150;150m"}▀${"\x1B[48;2;150;150;150m"}${"\x1B[38;2;29;29;29m"}▀${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[0m ${Z("Nelly Never Forgets")}`),console.log(`${G}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`),console.log(`${Z(` ${Q}`)}`),console.log("");try{await R5(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${z("faf --help")} ${Z("for commands")}`)})();else h.addHelpText("after",["","Git-native (The GIT Version):"," faf diff [range] semantic context diff + score delta (A..B, A...B)"," faf diff --install-driver make native `git diff` render .faf deltas"," faf log score timeline across history (Proof-Over-Time)"," faf hooks --install pre-commit guard against context regression"," faf git <url> [--ref] instant scored context from any repo, any branch/tag","",' "FAF is to Context what Git is to Versions."',""].join(`
|
|
572
|
+
`)),h.parseAsync(process.argv).catch(($)=>{if(!w$($))throw $;console.error(B6($,qk())),process.exit(1)});function qk(){let $=process.argv[2];return h.commands.find((z)=>z.name()===$||z.aliases().includes($))?.options.some((z)=>z.long==="--force")??!1}
|
|
546
573
|
|
|
547
|
-
//# debugId=
|
|
574
|
+
//# debugId=75F1CC6F69A45EF064756E2164756E21
|
|
548
575
|
//# sourceMappingURL=cli.js.map
|