faf-cli 8.2.0 → 8.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -136,10 +136,10 @@ ${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.pus
136
136
  `)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
137
137
  `,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 Q="end"in Z.value?Z.value.end:void 0;if((Array.isArray(Q)?Q[Q.length-1]:void 0)?.type==="comment")Q?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else{if(this.atIndentedComment(Z.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){H8(z,Z.start),z.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let Q=!this.onKeyLine&&this.indent===$.indent,z=Q&&(Z.sep||Z.explicitKey)&&this.type!=="seq-item-ind",X=[];if(z&&Z.sep&&!Z.value){let H=[];for(let U=0;U<Z.sep.length;++U){let J=Z.sep[U];switch(J.type){case"newline":H.push(U);break;case"space":break;case"comment":if(J.indent>$.indent)H.length=0;break;default:H.length=0}}if(H.length>=2)X=Z.sep.splice(H[1])}switch(this.type){case"anchor":case"tag":if(z||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(z||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(t0(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let H=n2(Z.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:H,key:null,sep:[this.sourceToken]}]})}else if(Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(t0(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(d7(Z.key)&&!t0(Z.sep,"newline")){let H=n2(Z.start),U=Z.key,J=Z.sep;J.push(this.sourceToken),delete Z.key,delete Z.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:H,key:U,sep:J}]})}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||z)$.items.push({start:X,key:null,sep:[this.sourceToken]});else if(t0(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 H=this.flowScalar(this.type);if(z||Z.value)$.items.push({start:X,key:H,sep:[]}),this.onKeyLine=!0;else if(Z.sep)this.stack.push(H);else Object.assign(Z,{key:H,sep:[]}),this.onKeyLine=!0;return}default:{let H=this.startBlockValue($);if(H){if(H.type==="block-seq"){if(!Z.explicitKey&&Z.sep&&!t0(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(Q)$.items.push({start:X});this.stack.push(H);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(Z.value){let Q="end"in Z.value?Z.value.end:void 0;if((Array.isArray(Q)?Q[Q.length-1]:void 0)?.type==="comment")Q?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(Z.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){H8(z,Z.start),z.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return;case"anchor":case"tag":if(Z.value||this.indent<=$.indent)break;Z.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(Z.value||t0(Z.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return}if(this.indent>$.indent){let Q=this.startBlockValue($);if(Q){this.stack.push(Q);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let Z=$.items[$.items.length-1];if(this.type==="flow-error-end"){let Q;do yield*this.pop(),Q=this.peek(1);while(Q?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!Z||Z.sep)$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return;case"map-value-ind":if(!Z||Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Object.assign(Z,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!Z||Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let z=this.flowScalar(this.type);if(!Z||Z.value)$.items.push({start:[],key:z,sep:[]});else if(Z.sep)this.stack.push(z);else Object.assign(Z,{key:z,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let Q=this.startBlockValue($);if(Q)this.stack.push(Q);else yield*this.pop(),yield*this.step()}else{let Q=this.peek(2);if(Q.type==="block-map"&&(this.type==="map-value-ind"&&Q.indent===$.indent||this.type==="newline"&&!Q.items[Q.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&Q.type!=="flow-collection"){let z=X8(Q),X=n2(z);c7($);let H=$.end.splice(1,$.end.length);H.push(this.sourceToken);let U={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:X,key:$,sep:H}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=U}else yield*this.lineEnd($)}}flowScalar($){if(this.onNewLine){let Z=this.source.indexOf(`
138
138
  `)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
139
- `,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=X8($),Q=n2(Z);return Q.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Z=X8($),Q=n2(Z);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Z){if(this.type!=="comment")return!1;if(this.indent<=Z)return!1;return $.every((Q)=>Q.type==="newline"||Q.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()}}}kW.Parser=i7});var a7=M((iW)=>{var n7=zZ(),uW=g$(),m$=v$(),fW=q5(),mW=x(),pW=qZ(),r7=KZ();function s7($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new pW.LineCounter||null,prettyErrors:Z}}function lW($,Z={}){let{lineCounter:Q,prettyErrors:z}=s7(Z),X=new r7.Parser(Q?.addNewLine),H=new n7.Composer(Z),U=Array.from(H.compose(X.parse($)));if(z&&Q)for(let J of U)J.errors.forEach(m$.prettifyError($,Q)),J.warnings.forEach(m$.prettifyError($,Q));if(U.length>0)return U;return Object.assign([],{empty:!0},H.streamInfo())}function o7($,Z={}){let{lineCounter:Q,prettyErrors:z}=s7(Z),X=new r7.Parser(Q?.addNewLine),H=new n7.Composer(Z),U=null;for(let J of H.compose(X.parse($),!0,$.length))if(!U)U=J;else if(U.options.logLevel!=="silent"){U.errors.push(new m$.YAMLParseError(J.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&Q)U.errors.forEach(m$.prettifyError($,Q)),U.warnings.forEach(m$.prettifyError($,Q));return U}function cW($,Z,Q){let z=void 0;if(typeof Z==="function")z=Z;else if(Q===void 0&&Z&&typeof Z==="object")Q=Z;let X=o7($,Q);if(!X)return null;if(X.warnings.forEach((H)=>fW.warn(X.options.logLevel,H)),X.errors.length>0)if(X.options.logLevel!=="silent")throw X.errors[0];else X.errors=[];return X.toJS(Object.assign({reviver:z},Q))}function dW($,Z,Q){let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(Q===void 0&&Z)Q=Z;if(typeof Q==="string")Q=Q.length;if(typeof Q==="number"){let X=Math.round(Q);Q=X<1?void 0:X>8?{indent:8}:{indent:X}}if($===void 0){let{keepUndefined:X}=Q??Z??{};if(!X)return}if(mW.isDocument($)&&!z)return $.toString(Q);return new uW.Document($,z,Q).toString(Q)}iW.parse=cW;iW.parseAllDocuments=lW;iW.parseDocument=o7;iW.stringify=dW});var m=[{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"}],g0=new Map(m.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),k1=new Map(m.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),TM=new Map(m.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function h1($,Z){let Q=(X)=>{let H=X.split("."),U=$;for(let J of H)if(U&&typeof U==="object"&&J in U)U=U[J];else return;return U},z=Q(Z.path);if(z!==void 0)return z;if(Z.canonical)return Q(Z.canonical);return}function Tz($){return m.filter((Z)=>Z.category===$)}var Az=m.filter(($)=>$.index<=21),Cz=m,D6=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","tbd","todo","n/a","not applicable"]),u1=new Set(["none","n/a","not applicable"]),L6="slotignored";function jz($){return typeof $==="string"&&u1.has($.trim().toLowerCase())}function a8($){return typeof $==="string"&&$.trim()!==""&&o($)}function o($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return D6.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var y2="no classifying signals — fallback",wz=new Set(["stack.css_framework","stack.ui_library","stack.database","stack.connection","stack.hosting"]);function x2($,Z){if(typeof $!=="string"||!Object.prototype.hasOwnProperty.call(b2,$))return null;if(!b2[$].includes(Z.category))return!1;return!($==="framework"&&wz.has(Z.path))}var b2={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 t8=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,D$=t8("1"),g2=t8("2"),CM=t8("3"),L$={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"},I$=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,e8=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,v2=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var v0=[{name:"TROPHY",indicator:`${v2("✪")} ${v2("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${v2(D$("★"))} ${v2("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${I$("◆")} ${I$("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${e8("◇")} ${e8("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${D$("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${g2("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${g2("○")} RED`,threshold:1},{name:"WHITE",indicator:`${g2("♡")}`,threshold:0}];function O$($){for(let Z of v0)if($>=Z.threshold)return Z;return v0[v0.length-1]}function Sz($){let Z=O$($),Q=v0.indexOf(Z);return Q>0?v0[Q-1]:null}var z5={};Rz(z5,{validate:()=>bz,sdkVersion:()=>kz,scoreFafb:()=>vz,scoreEnterprise:()=>Ez,score:()=>Q5,fafbInfo:()=>gz,decompile:()=>xz,compile:()=>yz});var $5=null;function c0(){if($5)return $5;try{let $=K$("faf-scoring-kernel");return $5=$,$}catch{throw Error(`faf-scoring-kernel not installed.
139
+ `,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=X8($),Q=n2(Z);return Q.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Z=X8($),Q=n2(Z);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Z){if(this.type!=="comment")return!1;if(this.indent<=Z)return!1;return $.every((Q)=>Q.type==="newline"||Q.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()}}}kW.Parser=i7});var a7=M((iW)=>{var n7=zZ(),uW=g$(),m$=v$(),fW=q5(),mW=x(),pW=qZ(),r7=KZ();function s7($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new pW.LineCounter||null,prettyErrors:Z}}function lW($,Z={}){let{lineCounter:Q,prettyErrors:z}=s7(Z),X=new r7.Parser(Q?.addNewLine),H=new n7.Composer(Z),U=Array.from(H.compose(X.parse($)));if(z&&Q)for(let J of U)J.errors.forEach(m$.prettifyError($,Q)),J.warnings.forEach(m$.prettifyError($,Q));if(U.length>0)return U;return Object.assign([],{empty:!0},H.streamInfo())}function o7($,Z={}){let{lineCounter:Q,prettyErrors:z}=s7(Z),X=new r7.Parser(Q?.addNewLine),H=new n7.Composer(Z),U=null;for(let J of H.compose(X.parse($),!0,$.length))if(!U)U=J;else if(U.options.logLevel!=="silent"){U.errors.push(new m$.YAMLParseError(J.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&Q)U.errors.forEach(m$.prettifyError($,Q)),U.warnings.forEach(m$.prettifyError($,Q));return U}function cW($,Z,Q){let z=void 0;if(typeof Z==="function")z=Z;else if(Q===void 0&&Z&&typeof Z==="object")Q=Z;let X=o7($,Q);if(!X)return null;if(X.warnings.forEach((H)=>fW.warn(X.options.logLevel,H)),X.errors.length>0)if(X.options.logLevel!=="silent")throw X.errors[0];else X.errors=[];return X.toJS(Object.assign({reviver:z},Q))}function dW($,Z,Q){let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(Q===void 0&&Z)Q=Z;if(typeof Q==="string")Q=Q.length;if(typeof Q==="number"){let X=Math.round(Q);Q=X<1?void 0:X>8?{indent:8}:{indent:X}}if($===void 0){let{keepUndefined:X}=Q??Z??{};if(!X)return}if(mW.isDocument($)&&!z)return $.toString(Q);return new uW.Document($,z,Q).toString(Q)}iW.parse=cW;iW.parseAllDocuments=lW;iW.parseDocument=o7;iW.stringify=dW});var m=[{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"}],g0=new Map(m.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),k1=new Map(m.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),AM=new Map(m.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function h1($,Z){let Q=(X)=>{let H=X.split("."),U=$;for(let J of H)if(U&&typeof U==="object"&&J in U)U=U[J];else return;return U},z=Q(Z.path);if(z!==void 0)return z;if(Z.canonical)return Q(Z.canonical);return}function Tz($){return m.filter((Z)=>Z.category===$)}var Az=m.filter(($)=>$.index<=21),Cz=m,D6=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","tbd","todo","n/a","not applicable"]),u1=new Set(["none","n/a","not applicable"]),L6="slotignored";function jz($){return typeof $==="string"&&u1.has($.trim().toLowerCase())}function a8($){return typeof $==="string"&&$.trim()!==""&&o($)}function o($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return D6.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var y2="no classifying signals — fallback",wz=new Set(["stack.css_framework","stack.ui_library","stack.database","stack.connection","stack.hosting"]);function x2($,Z){if(typeof $!=="string"||!Object.prototype.hasOwnProperty.call(b2,$))return null;if(!b2[$].includes(Z.category))return!1;return!($==="framework"&&wz.has(Z.path))}var b2={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 t8=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,D$=t8("1"),g2=t8("2"),jM=t8("3"),L$={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"},I$=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,e8=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,v2=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var v0=[{name:"TROPHY",indicator:`${v2("✪")} ${v2("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${v2(D$("★"))} ${v2("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${I$("◆")} ${I$("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${e8("◇")} ${e8("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${D$("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${g2("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${g2("○")} RED`,threshold:1},{name:"WHITE",indicator:`${g2("♡")}`,threshold:0}];function O$($){for(let Z of v0)if($>=Z.threshold)return Z;return v0[v0.length-1]}function Sz($){let Z=O$($),Q=v0.indexOf(Z);return Q>0?v0[Q-1]:null}var z5={};Rz(z5,{validate:()=>bz,sdkVersion:()=>kz,scoreFafb:()=>vz,scoreEnterprise:()=>Ez,score:()=>Q5,fafbInfo:()=>gz,decompile:()=>xz,compile:()=>yz});var $5=null;function c0(){if($5)return $5;try{let $=K$("faf-scoring-kernel");return $5=$,$}catch{throw Error(`faf-scoring-kernel not installed.
140
140
 
141
141
  Run: npm install faf-scoring-kernel
142
- `)}}var I6=($)=>$.startsWith("\uFEFF")?$.slice(1):$;function Z5($){let Z={};for(let[Q,z]of Object.entries($.slots??{}))Z[k1.get(Q)??Q]=z;return{...$,slots:Z}}function Q5($){return Z5(JSON.parse(c0().score_faf(I6($))))}function Ez($){return Z5(JSON.parse(c0().score_faf_enterprise(I6($))))}function bz($){return c0().validate_faf(I6($))}function yz($){return c0().compile_fafb(I6($))}function xz($){return JSON.parse(c0().decompile_fafb($))}function gz($){return JSON.parse(c0().fafb_info($))}function vz($){return Z5(JSON.parse(c0().score_fafb($)))}function kz(){return c0().sdk_version()}var f1=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function m1($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function p1($){let Z=$.match(/^about:\s*\n((?:[ \t]+.*\n?)*)/m);if(!Z)return null;let Q=Z[1]??"",z=Q.match(/^[ \t]+represents:\s*(\S+)\s*$/m);if(!z)return null;let X=z[1],H=Q.match(/^[ \t]+source_score:\s*(\d+)\s*$/m),U=-1;if(H){let J=parseInt(H[1],10);if(J>=0&&J<=100)U=J}return{represents:X,sourceScore:U}}function hz($){return $.unknown?"unknown (—)":`${$.score}%`}function l1($){return{score:$.score,tier:O$($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function X5($){let Z=p1($);if(Z){let Q=Z.sourceScore;return{score:Q,tier:Q>=0?O$(Q):v0[v0.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Z.represents,...Q<0?{unknown:!0}:{}}}return l1(Q5($))}function uz($){let Z=[];if(!$||typeof $!=="object")return Z.push("File is not a valid YAML mapping"),{valid:!1,errors:Z};let Q=$;if(!Q.faf_version)Z.push("Missing required field: faf_version");if(!Q.project?.name)Z.push("Missing required field: project.name");if(Q.app_type==="about")Z.push("about is not an app_type — declare about.represents (owner/repo) instead");if(Q.about!==void 0){if(!m1(Q)||typeof Q.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!f1.test(Q.about.represents))Z.push(`about.represents must be "owner/repo" format (got: ${Q.about.represents})`);if(Q.about.source_score!==void 0){let z=Q.about.source_score;if(typeof z!=="number"||z<0||z>100)Z.push(`about.source_score must be a number 0-100 (got: ${z})`)}}return{valid:Z.length===0,errors:Z}}import{lstatSync as p9}from"fs";import{join as u9,dirname as xZ,basename as IF,resolve as t$}from"path";var aW=zZ(),tW=g$(),eW=m5(),DZ=v$(),$B=P$(),e0=x(),ZB=r0(),QB=d(),zB=o0(),XB=a0(),ZF=Q8(),HB=BZ(),UB=qZ(),JB=KZ(),U8=a7(),t7=_$();var GB=aW.Composer,J8=tW.Document,VB=eW.Schema,YB=DZ.YAMLError,G8=DZ.YAMLParseError,WB=DZ.YAMLWarning,BB=$B.Alias,u0=e0.isAlias,B2=e0.isCollection,qB=e0.isDocument,p=e0.isMap,L0=e0.isNode,KB=e0.isPair,s=e0.isScalar,f0=e0.isSeq,DB=ZB.Pair,LB=QB.Scalar,r2=zB.YAMLMap,p$=XB.YAMLSeq;var IB=HB.Lexer,OB=UB.LineCounter,_B=JB.Parser,m0=U8.parse,MB=U8.parseAllDocuments,s2=U8.parseDocument,q2=U8.stringify,PB=t7.visit,FB=t7.visitAsync;import{accessSync as e7,closeSync as _Z,constants as $9,existsSync as RB,fchmodSync as Z9,fchownSync as NB,fsyncSync as Q9,lstatSync as MZ,mkdirSync as z9,mkdtempSync as XF,openSync as X9,readdirSync as TB,readFileSync as PZ,readlinkSync as AB,realpathSync as CB,renameSync as jB,rmSync as HF,statSync as o2,unlinkSync as H9,writeFileSync as wB}from"fs";import{randomBytes as SB}from"crypto";import{basename as $2,dirname as K2,isAbsolute as U9,join as a2,relative as FZ,resolve as V0,sep as V8}from"path";class b extends Error{reason;path;onWrite;constructor($,Z,Q,z={}){super(Q,z.cause===void 0?void 0:{cause:z.cause});this.name="SafePathError",this.reason=$,this.path=Z,this.onWrite=z.onWrite===!0}}var t=Object.freeze({claude:"CLAUDE.md",agents:"AGENTS.md",gemini:"GEMINI.md",cursorrules:".cursorrules",copilot:"copilot-instructions.md",memory:"MEMORY.md",llms:"llms.txt"}),EB=new Set(Object.values(t).map(($)=>$.toLowerCase())),bB=($,Z)=>$.toLowerCase()===Z.toLowerCase(),LZ=($)=>EB.has($.toLowerCase());function t2($){return $.split(/[\\/]/).some((Z)=>Z.toLowerCase()===".git")}var yB=/\.fafm?$/i,xB=/^[a-z][a-z0-9-]*$/,w0=($)=>CB.native($),Z2=($)=>$?.code;function c$($,Z){let Q=FZ($,Z);return Q===""||Q!==".."&&!Q.startsWith(`..${V8}`)&&!U9(Q)}function J9($){try{return AB($)}catch{return"?"}}function gB($,Z,Q,z){let X;try{X=w0(Q)}catch(H){let U=Z2(H);if(U==="ENOENT"||U==="ELOOP"||U==="ENOTDIR")throw new b("dangling",Z,`${Z} is a link to ${J9(Q)}, which does not exist. faf does not create files through a link — refused.`);throw H}if(!c$($,X))throw new b("outside",Z,`${Z} is a link to ${X}, outside ${$} — refused.`);if(t2(X)&&!(z.inGit&&K2(X)===$))throw new b("git",Z,`${Z} is a link to ${X}, inside .git/ — refused.`);if(!o2(X).isFile())throw new b("not-a-file",Z,`${Z} is a link to ${X}, which is not a regular file — refused.`);return vB(Z,X,z.read),X}function vB($,Z,Q){let z=$2($),X=$2(Z),H=LZ(z)&&LZ(X);if(Q&&!yB.test(X)&&!H){let U=LZ(z)?"a .faf or .fafm file, nor another AI context file":"a .faf or .fafm file";throw new b("not-faf",$,`${$} is a link to ${Z}, which is not ${U} — refused.`)}if(!Q&&!bB(z,X)&&!H)throw new b("other-file",$,`${$} is a link to ${Z}, a file with another name — refused (faf follows a link only to a file of the same name, or from one AI context file to another).`)}function kB($,Z,Q,z){if($2(V0($))!=="hooks"||!xB.test($2(Z)))throw new b("git",Z,`${Z} is not a git hook in a hooks folder — refused.`);if(z!==Q)throw new b("git",Z,`${Z} is not directly in the hooks folder ${Q} — refused.`)}function hB($,Z,Q){if($2($)!=="config"||Q!==Z)throw new b("git",$,`${$} is not the git config file directly in ${Z} — refused.`)}function h($,Z,Q={}){let z=w0(V0($)),X=V0($,Z),H=w0(K2(X));if(!c$(z,H))throw new b("outside",X,`${X} is in ${H}, outside ${z} — refused.`);let U=Q.allowGitHooks===!0,J=Q.allowGitConfig===!0;if(U)kB($,X,z,H);if(J)hB(X,z,H);let G=a2(H,$2(X));if(t2(G)&&!U&&!J)throw new b("git",X,G===X?`${X} is inside .git/ — refused.`:`${X} resolves to ${G}, inside .git/ — refused.`);let V;try{V=MZ(G)}catch(Y){if(Z2(Y)==="ENOENT")return G;throw Y}if(V.isSymbolicLink())return gB(z,X,G,{read:Q.read===!0,inGit:U||J});if(!V.isFile())throw new b("not-a-file",X,`${X} is not a regular file — refused.`);return w0(G)}var uB=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function fB($,Z){if(!($.length>=2&&($[0]===255&&$[1]===254||$[0]===254&&$[1]===255)))try{return uB.decode($)}catch{}throw new b("not-utf8",Z,`${Z} is not UTF-8 — faf left it unchanged`)}function Z0($){return fB(PZ($),$)}function I0($){try{return PZ($)}catch(Z){if(Z2(Z)==="ENOENT")return null;throw Z}}function l$($,Z){let Q=V0(a2($,Z));if(!RB(Q))return null;let z,X;try{z=w0(mB($)),X=w0(Q)}catch{return null}if(!c$(z,X)||t2(FZ(z,X)))return null;return X}var OZ=[];function mB($){let Z=V0($);return OZ.find((Q)=>Z===Q||Z.startsWith(Q.endsWith(V8)?Q:Q+V8))??Z}function e2($,Z){OZ.push(V0($));try{return Z()}finally{OZ.pop()}}function I($,Z){return l$($,Z)!==null}function S($,Z){let Q=l$($,Z);if(Q===null)return null;try{return o2(Q).isFile()?PZ(Q,"utf-8"):null}catch{return null}}function O0($,Z){let Q=l$($,Z);if(Q===null)return null;try{return o2(Q)}catch{return null}}function v($,Z="."){let Q=l$($,Z);if(Q===null)return null;let z;try{z=TB(Q,{withFileTypes:!0})}catch{return null}return z.filter((X)=>!X.isSymbolicLink()||l$($,a2(Z,X.name))!==null)}function pB($){try{let Z=o2($);return{mode:Z.mode&511,perm:Z.mode&4095,uid:Z.uid,gid:Z.gid}}catch(Z){if(Z2(Z)==="ENOENT")return;throw Z}}class G9 extends Error{path;constructor($,Z,Q={}){super(Z,{cause:Q.cause});this.path=$}}var IZ=($)=>new b("changed",$,`${$} changed on disk while faf was writing — not written; original kept`,{onWrite:!0});function RZ($,Z,Q){if(Z!==void 0){let X=I0($),H=Z===null?null:typeof Z==="string"?Buffer.from(Z,"utf-8"):Buffer.from(Z);if(!(X===null||H===null?X===H:X.equals(H)))throw IZ($)}if(!Q)return;let z;try{z=o2($)}catch(X){if(Z2(X)==="ENOENT")return;throw X}if((z.mode&4095)!==Q.perm)throw IZ($);try{e7($,$9.W_OK)}catch{throw IZ($)}}function lB($,Z){if(process.platform!=="win32")try{NB($,Z.uid,Z.gid)}catch{}Z9($,Z.mode)}function cB($){if(process.platform==="win32")return;try{let Z=X9($,"r");try{Q9(Z)}finally{_Z(Z)}}catch{}}function dB($,Z,Q,z){if($.fd=X9($.path,"wx",z??Q?.mode??438),$.created=!0,wB($.fd,Z),Q)lB($.fd,Q);if(z!==void 0)Z9($.fd,z);Q9($.fd),_Z($.fd),$.fd=void 0}function iB($){if($.fd!==void 0)try{_Z($.fd)}catch{}if($.created)try{H9($.path)}catch{}}function nB($,Z,Q){let z=K2($),X={path:a2(z,`.${$2($).slice(0,100)}.${process.pid}.${SB(6).toString("hex")}.faf-tmp`),created:!1},H=pB($);try{if(H)e7($,$9.W_OK);dB(X,Z,H,Q.mode),RZ($,Q.expect,H),jB(X.path,$)}catch(U){if(iB(X),U instanceof b)throw U;let J=Z2(U)??(U instanceof Error?U.message:String(U));throw new G9($,`${$}: not written${H?"; original kept":""} (${J})`,{cause:U})}cB(z)}function rB($){return $ instanceof b&&!$.onWrite?new b($.reason,$.path,$.message,{onWrite:!0}):$}function e($,Z,Q={}){let z=V0($),X;try{X=h(Q.root??K2(z),z,{allowGitHooks:Q.allowGitHooks,allowGitConfig:Q.allowGitConfig})}catch(H){throw rB(H)}return nB(X,Z,Q),X}function V9($,Z,Q){let z=V0($),X=Q.root??K2(z),H=h(X,z),U=I0(H);if(Q.expect!==void 0)RZ(H,Q.expect,void 0);if(U!==null&&Q.force!==!0&&!Q.owns(U))throw new b("not-owned",z,`${z} has no ${Q.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});return e(H,Z,{root:X,expect:U})}function $$($,Z=$){let Q=V0($);z9(Q,{recursive:!0});let z=w0(Q),X=V0(Q,Z),H=FZ(Q,X);if(H===".."||H.startsWith(`..${V8}`)||U9(H))throw new b("outside",X,`${X} is outside ${z} — refused.`,{onWrite:!0});let U=z;for(let J of H.split(/[\\/]/).filter(Boolean)){let G=a2(U,J);if(t2(G))throw new b("git",X,`${X} runs through ${G}, inside .git/ — refused.`,{onWrite:!0});U=sB(z,X,G)}return U}function sB($,Z,Q){let z;try{z=MZ(Q)}catch(H){if(Z2(H)!=="ENOENT")throw H;return z9(Q),Q}let X=Q;if(z.isSymbolicLink()){try{X=w0(Q)}catch{throw new b("dangling",Z,`${Q} is a link to ${J9(Q)}, which does not exist. faf does not create folders through a link — refused.`,{onWrite:!0})}if(!c$($,X))throw new b("outside",Z,`${Q} is a link to ${X}, outside ${$} — refused.`,{onWrite:!0});if(t2(X))throw new b("git",Z,`${Q} is a link to ${X}, inside .git/ — refused.`,{onWrite:!0})}if(!o2(X).isDirectory())throw new b("not-a-file",Z,`${Q} is not a folder — refused.`,{onWrite:!0});return X}function oB($,Z){let Q=V0($),z=w0(V0(Z.root??K2(Q))),X=w0(K2(Q));if(!c$(z,X))throw new b("outside",Q,`${Q} is in ${X}, outside ${z} — refused.`,{onWrite:!0});let H=a2(X,$2(Q));if(t2(H))throw new b("git",Q,`${Q} is inside .git/ — refused.`,{onWrite:!0});let U;try{U=MZ(H)}catch(J){if(Z2(J)==="ENOENT")return!1;throw J}if(!U.isFile())throw new b("not-a-file",Q,`${Q} is not a regular file faf wrote — left as it is.`,{onWrite:!0});return RZ(H,Z.expect,void 0),H9(H),!0}function u($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function d$($){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 Y8($,Z){if($===null||$===void 0)return{};if(!u($))throw new b("not-yaml",Z,`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${d$($)}. `+"faf left it unchanged — fix it by hand.");return $}var D9=new Set(["tag:yaml.org,2002:int","tag:yaml.org,2002:float"]);function Y9($){return typeof $==="object"&&$.collection===void 0}function aB($,Z){let Q=$.source;if(typeof Q!=="string"||Q.includes(`
142
+ `)}}var I6=($)=>$.startsWith("\uFEFF")?$.slice(1):$;function Z5($){let Z={};for(let[Q,z]of Object.entries($.slots??{}))Z[k1.get(Q)??Q]=z;return{...$,slots:Z}}function Q5($){return Z5(JSON.parse(c0().score_faf(I6($))))}function Ez($){return Z5(JSON.parse(c0().score_faf_enterprise(I6($))))}function bz($){return c0().validate_faf(I6($))}function yz($){return c0().compile_fafb(I6($))}function xz($){return JSON.parse(c0().decompile_fafb($))}function gz($){return JSON.parse(c0().fafb_info($))}function vz($){return Z5(JSON.parse(c0().score_fafb($)))}function kz(){return c0().sdk_version()}var f1=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function m1($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function p1($){let Z=$.match(/^about:\s*\n((?:[ \t]+.*\n?)*)/m);if(!Z)return null;let Q=Z[1]??"",z=Q.match(/^[ \t]+represents:\s*(\S+)\s*$/m);if(!z)return null;let X=z[1],H=Q.match(/^[ \t]+source_score:\s*(\d+)\s*$/m),U=-1;if(H){let J=parseInt(H[1],10);if(J>=0&&J<=100)U=J}return{represents:X,sourceScore:U}}function hz($){return $.unknown?"unknown (—)":`${$.score}%`}function l1($){return{score:$.score,tier:O$($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function X5($){let Z=p1($);if(Z){let Q=Z.sourceScore;return{score:Q,tier:Q>=0?O$(Q):v0[v0.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Z.represents,...Q<0?{unknown:!0}:{}}}return l1(Q5($))}function uz($){let Z=[];if(!$||typeof $!=="object")return Z.push("File is not a valid YAML mapping"),{valid:!1,errors:Z};let Q=$;if(!Q.faf_version)Z.push("Missing required field: faf_version");if(!Q.project?.name)Z.push("Missing required field: project.name");if(Q.app_type==="about")Z.push("about is not an app_type — declare about.represents (owner/repo) instead");if(Q.about!==void 0){if(!m1(Q)||typeof Q.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!f1.test(Q.about.represents))Z.push(`about.represents must be "owner/repo" format (got: ${Q.about.represents})`);if(Q.about.source_score!==void 0){let z=Q.about.source_score;if(typeof z!=="number"||z<0||z>100)Z.push(`about.source_score must be a number 0-100 (got: ${z})`)}}return{valid:Z.length===0,errors:Z}}import{lstatSync as p9}from"fs";import{join as u9,dirname as xZ,basename as OF,resolve as t$}from"path";var aW=zZ(),tW=g$(),eW=m5(),DZ=v$(),$B=P$(),e0=x(),ZB=r0(),QB=d(),zB=o0(),XB=a0(),QF=Q8(),HB=BZ(),UB=qZ(),JB=KZ(),U8=a7(),t7=_$();var GB=aW.Composer,J8=tW.Document,VB=eW.Schema,YB=DZ.YAMLError,G8=DZ.YAMLParseError,WB=DZ.YAMLWarning,BB=$B.Alias,u0=e0.isAlias,B2=e0.isCollection,qB=e0.isDocument,p=e0.isMap,L0=e0.isNode,KB=e0.isPair,s=e0.isScalar,f0=e0.isSeq,DB=ZB.Pair,LB=QB.Scalar,r2=zB.YAMLMap,p$=XB.YAMLSeq;var IB=HB.Lexer,OB=UB.LineCounter,_B=JB.Parser,m0=U8.parse,MB=U8.parseAllDocuments,s2=U8.parseDocument,q2=U8.stringify,PB=t7.visit,FB=t7.visitAsync;import{accessSync as e7,closeSync as _Z,constants as $9,existsSync as RB,fchmodSync as Z9,fchownSync as NB,fsyncSync as Q9,lstatSync as MZ,mkdirSync as z9,mkdtempSync as HF,openSync as X9,readdirSync as TB,readFileSync as PZ,readlinkSync as AB,realpathSync as CB,renameSync as jB,rmSync as UF,statSync as o2,unlinkSync as H9,writeFileSync as wB}from"fs";import{randomBytes as SB}from"crypto";import{basename as $2,dirname as K2,isAbsolute as U9,join as a2,relative as FZ,resolve as V0,sep as V8}from"path";class b extends Error{reason;path;onWrite;constructor($,Z,Q,z={}){super(Q,z.cause===void 0?void 0:{cause:z.cause});this.name="SafePathError",this.reason=$,this.path=Z,this.onWrite=z.onWrite===!0}}var t=Object.freeze({claude:"CLAUDE.md",agents:"AGENTS.md",gemini:"GEMINI.md",cursorrules:".cursorrules",copilot:"copilot-instructions.md",memory:"MEMORY.md",llms:"llms.txt"}),EB=new Set(Object.values(t).map(($)=>$.toLowerCase())),bB=($,Z)=>$.toLowerCase()===Z.toLowerCase(),LZ=($)=>EB.has($.toLowerCase());function t2($){return $.split(/[\\/]/).some((Z)=>Z.toLowerCase()===".git")}var yB=/\.fafm?$/i,xB=/^[a-z][a-z0-9-]*$/,w0=($)=>CB.native($),Z2=($)=>$?.code;function c$($,Z){let Q=FZ($,Z);return Q===""||Q!==".."&&!Q.startsWith(`..${V8}`)&&!U9(Q)}function J9($){try{return AB($)}catch{return"?"}}function gB($,Z,Q,z){let X;try{X=w0(Q)}catch(H){let U=Z2(H);if(U==="ENOENT"||U==="ELOOP"||U==="ENOTDIR")throw new b("dangling",Z,`${Z} is a link to ${J9(Q)}, which does not exist. faf does not create files through a link — refused.`);throw H}if(!c$($,X))throw new b("outside",Z,`${Z} is a link to ${X}, outside ${$} — refused.`);if(t2(X)&&!(z.inGit&&K2(X)===$))throw new b("git",Z,`${Z} is a link to ${X}, inside .git/ — refused.`);if(!o2(X).isFile())throw new b("not-a-file",Z,`${Z} is a link to ${X}, which is not a regular file — refused.`);return vB(Z,X,z.read),X}function vB($,Z,Q){let z=$2($),X=$2(Z),H=LZ(z)&&LZ(X);if(Q&&!yB.test(X)&&!H){let U=LZ(z)?"a .faf or .fafm file, nor another AI context file":"a .faf or .fafm file";throw new b("not-faf",$,`${$} is a link to ${Z}, which is not ${U} — refused.`)}if(!Q&&!bB(z,X)&&!H)throw new b("other-file",$,`${$} is a link to ${Z}, a file with another name — refused (faf follows a link only to a file of the same name, or from one AI context file to another).`)}function kB($,Z,Q,z){if($2(V0($))!=="hooks"||!xB.test($2(Z)))throw new b("git",Z,`${Z} is not a git hook in a hooks folder — refused.`);if(z!==Q)throw new b("git",Z,`${Z} is not directly in the hooks folder ${Q} — refused.`)}function hB($,Z,Q){if($2($)!=="config"||Q!==Z)throw new b("git",$,`${$} is not the git config file directly in ${Z} — refused.`)}function h($,Z,Q={}){let z=w0(V0($)),X=V0($,Z),H=w0(K2(X));if(!c$(z,H))throw new b("outside",X,`${X} is in ${H}, outside ${z} — refused.`);let U=Q.allowGitHooks===!0,J=Q.allowGitConfig===!0;if(U)kB($,X,z,H);if(J)hB(X,z,H);let G=a2(H,$2(X));if(t2(G)&&!U&&!J)throw new b("git",X,G===X?`${X} is inside .git/ — refused.`:`${X} resolves to ${G}, inside .git/ — refused.`);let V;try{V=MZ(G)}catch(Y){if(Z2(Y)==="ENOENT")return G;throw Y}if(V.isSymbolicLink())return gB(z,X,G,{read:Q.read===!0,inGit:U||J});if(!V.isFile())throw new b("not-a-file",X,`${X} is not a regular file — refused.`);return w0(G)}var uB=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function fB($,Z){if(!($.length>=2&&($[0]===255&&$[1]===254||$[0]===254&&$[1]===255)))try{return uB.decode($)}catch{}throw new b("not-utf8",Z,`${Z} is not UTF-8 — faf left it unchanged`)}function Z0($){return fB(PZ($),$)}function I0($){try{return PZ($)}catch(Z){if(Z2(Z)==="ENOENT")return null;throw Z}}function l$($,Z){let Q=V0(a2($,Z));if(!RB(Q))return null;let z,X;try{z=w0(mB($)),X=w0(Q)}catch{return null}if(!c$(z,X)||t2(FZ(z,X)))return null;return X}var OZ=[];function mB($){let Z=V0($);return OZ.find((Q)=>Z===Q||Z.startsWith(Q.endsWith(V8)?Q:Q+V8))??Z}function e2($,Z){OZ.push(V0($));try{return Z()}finally{OZ.pop()}}function I($,Z){return l$($,Z)!==null}function S($,Z){let Q=l$($,Z);if(Q===null)return null;try{return o2(Q).isFile()?PZ(Q,"utf-8"):null}catch{return null}}function O0($,Z){let Q=l$($,Z);if(Q===null)return null;try{return o2(Q)}catch{return null}}function v($,Z="."){let Q=l$($,Z);if(Q===null)return null;let z;try{z=TB(Q,{withFileTypes:!0})}catch{return null}return z.filter((X)=>!X.isSymbolicLink()||l$($,a2(Z,X.name))!==null)}function pB($){try{let Z=o2($);return{mode:Z.mode&511,perm:Z.mode&4095,uid:Z.uid,gid:Z.gid}}catch(Z){if(Z2(Z)==="ENOENT")return;throw Z}}class G9 extends Error{path;constructor($,Z,Q={}){super(Z,{cause:Q.cause});this.path=$}}var IZ=($)=>new b("changed",$,`${$} changed on disk while faf was writing — not written; original kept`,{onWrite:!0});function RZ($,Z,Q){if(Z!==void 0){let X=I0($),H=Z===null?null:typeof Z==="string"?Buffer.from(Z,"utf-8"):Buffer.from(Z);if(!(X===null||H===null?X===H:X.equals(H)))throw IZ($)}if(!Q)return;let z;try{z=o2($)}catch(X){if(Z2(X)==="ENOENT")return;throw X}if((z.mode&4095)!==Q.perm)throw IZ($);try{e7($,$9.W_OK)}catch{throw IZ($)}}function lB($,Z){if(process.platform!=="win32")try{NB($,Z.uid,Z.gid)}catch{}Z9($,Z.mode)}function cB($){if(process.platform==="win32")return;try{let Z=X9($,"r");try{Q9(Z)}finally{_Z(Z)}}catch{}}function dB($,Z,Q,z){if($.fd=X9($.path,"wx",z??Q?.mode??438),$.created=!0,wB($.fd,Z),Q)lB($.fd,Q);if(z!==void 0)Z9($.fd,z);Q9($.fd),_Z($.fd),$.fd=void 0}function iB($){if($.fd!==void 0)try{_Z($.fd)}catch{}if($.created)try{H9($.path)}catch{}}function nB($,Z,Q){let z=K2($),X={path:a2(z,`.${$2($).slice(0,100)}.${process.pid}.${SB(6).toString("hex")}.faf-tmp`),created:!1},H=pB($);try{if(H)e7($,$9.W_OK);dB(X,Z,H,Q.mode),RZ($,Q.expect,H),jB(X.path,$)}catch(U){if(iB(X),U instanceof b)throw U;let J=Z2(U)??(U instanceof Error?U.message:String(U));throw new G9($,`${$}: not written${H?"; original kept":""} (${J})`,{cause:U})}cB(z)}function rB($){return $ instanceof b&&!$.onWrite?new b($.reason,$.path,$.message,{onWrite:!0}):$}function e($,Z,Q={}){let z=V0($),X;try{X=h(Q.root??K2(z),z,{allowGitHooks:Q.allowGitHooks,allowGitConfig:Q.allowGitConfig})}catch(H){throw rB(H)}return nB(X,Z,Q),X}function V9($,Z,Q){let z=V0($),X=Q.root??K2(z),H=h(X,z),U=I0(H);if(Q.expect!==void 0)RZ(H,Q.expect,void 0);if(U!==null&&Q.force!==!0&&!Q.owns(U))throw new b("not-owned",z,`${z} has no ${Q.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});return e(H,Z,{root:X,expect:U})}function $$($,Z=$){let Q=V0($);z9(Q,{recursive:!0});let z=w0(Q),X=V0(Q,Z),H=FZ(Q,X);if(H===".."||H.startsWith(`..${V8}`)||U9(H))throw new b("outside",X,`${X} is outside ${z} — refused.`,{onWrite:!0});let U=z;for(let J of H.split(/[\\/]/).filter(Boolean)){let G=a2(U,J);if(t2(G))throw new b("git",X,`${X} runs through ${G}, inside .git/ — refused.`,{onWrite:!0});U=sB(z,X,G)}return U}function sB($,Z,Q){let z;try{z=MZ(Q)}catch(H){if(Z2(H)!=="ENOENT")throw H;return z9(Q),Q}let X=Q;if(z.isSymbolicLink()){try{X=w0(Q)}catch{throw new b("dangling",Z,`${Q} is a link to ${J9(Q)}, which does not exist. faf does not create folders through a link — refused.`,{onWrite:!0})}if(!c$($,X))throw new b("outside",Z,`${Q} is a link to ${X}, outside ${$} — refused.`,{onWrite:!0});if(t2(X))throw new b("git",Z,`${Q} is a link to ${X}, inside .git/ — refused.`,{onWrite:!0})}if(!o2(X).isDirectory())throw new b("not-a-file",Z,`${Q} is not a folder — refused.`,{onWrite:!0});return X}function oB($,Z){let Q=V0($),z=w0(V0(Z.root??K2(Q))),X=w0(K2(Q));if(!c$(z,X))throw new b("outside",Q,`${Q} is in ${X}, outside ${z} — refused.`,{onWrite:!0});let H=a2(X,$2(Q));if(t2(H))throw new b("git",Q,`${Q} is inside .git/ — refused.`,{onWrite:!0});let U;try{U=MZ(H)}catch(J){if(Z2(J)==="ENOENT")return!1;throw J}if(!U.isFile())throw new b("not-a-file",Q,`${Q} is not a regular file faf wrote — left as it is.`,{onWrite:!0});return RZ(H,Z.expect,void 0),H9(H),!0}function u($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function d$($){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 Y8($,Z){if($===null||$===void 0)return{};if(!u($))throw new b("not-yaml",Z,`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${d$($)}. `+"faf left it unchanged — fix it by hand.");return $}var D9=new Set(["tag:yaml.org,2002:int","tag:yaml.org,2002:float"]);function Y9($){return typeof $==="object"&&$.collection===void 0}function aB($,Z){let Q=$.source;if(typeof Q!=="string"||Q.includes(`
143
143
  `)||typeof $.value!=="number")return;let z=Z.find((H)=>H.default===!0&&H.test?.test(Q));if(!z||!D9.has(z.tag))return;let X;try{X=z.resolve(Q,()=>{return},{})}catch{return}return Object.is(s(X)?X.value:X,$.value)?Q:void 0}function tB($){let Z=$.filter(Y9);return $.map((Q)=>{if(!Y9(Q)||!D9.has(Q.tag)||!Q.stringify)return Q;let z=Q.stringify;return{...Q,stringify:(X,H,U,J)=>aB(X,Z)??z(X,H,U,J)}})}var W8={keepSourceTokens:!0,customTags:tB};function eB($,Z){let Q=/^( *)[^\s#-][^#]*?:[ \t]*(?:#.*)?$/.exec($),z=/^( *)(\S)/.exec(Z);if(!Q||!z||z[2]==="#")return{};let X=z[1].length-Q[1].length;if(z[2]==="-")return X>=0?{indentSeq:X>0}:{};return X>=1&&X<=8?{indent:X}:{}}function $q($){let Z=$.split(/\r?\n/),Q,z;for(let X=0;X+1<Z.length;X++){let H=eB(Z[X],Z[X+1]);Q??=H.indent,z??=H.indentSeq}return{indent:Q??2,indentSeq:z??!0}}function jZ($,Z){let Q=s2($,W8);if(Q.errors.length>0){let z=Q.errors[0].message.split(`
144
144
  `)[0];throw Error(`${Z}: not valid YAML (${z}) — faf left it unchanged.`,{cause:Q.errors[0]})}return Q}function D2($,Z,Q,z){$.edits.push({start:Z,end:Q,text:z,seq:$.edits.length})}function i$($,Z){return $.lastIndexOf(`
145
145
  `,Z-1)+1}function L9($,Z){if(Z>0&&$[Z-1]===`
@@ -246,39 +246,39 @@ Rendered on-demand from your current <strong>${Z$(Q)}</strong><br>
246
246
  </div>
247
247
  </body>
248
248
  </html>
249
- `}var FK='<meta name="description" content="Visual render of project.faf.';function RK($){return new TextDecoder().decode($).split(/\r?\n/).some((Z)=>Z.trim().startsWith(FK)&&Z.includes(" by faf"))}function NK($,Z,Q,z="project.faf",X={}){$6(KK($,"project.html"),mZ(Z,Q,z),{root:$,format:"html",hasMark:RK,mark:"faf mark (the `Visual render of project.faf` description line)",force:X.force})}var TK=DK(mZ,"faf-cli: generateProjectHtml is deprecated, use renderProjectHtml","FAF0001");import{join as cK}from"path";import{deprecate as dK}from"node:util";var Q$="https://faf.one/ext/context/v1",pZ="io.modelcontextprotocol.registry/publisher-provided";function S0($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:"application/vnd.faf+yaml",iana:"https://www.iana.org/assignments/media-types/application/vnd.faf+yaml",deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function I2($,Z={}){let Q={"one.faf/context":S0($,Z)},z=new TextEncoder().encode(JSON.stringify(Q)).length;if(z>4096)throw Error(`publisher-provided _meta is ${z}B — exceeds the registry ${"4096"}B cap`);return{["io.modelcontextprotocol.registry/publisher-provided"]:Q}}var WQ="JSONRPC",dZ="1.0",M8=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],P8="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",BQ="https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",qQ="1.0",KQ="1.0",lZ={a2a:"application/a2a-agent-card+json",server_card:"application/mcp-server-card+json",fafa:"application/vnd.fafa+yaml"};function DQ($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function O2($,Z={}){let Q=DQ($);if(Q.length>0)return Q;let z=Z.doorUrl?.trim();if(z)return[{protocol:"a2a",location:z,version:dZ}];return[]}function AK($){try{return`https://${z$($)}/.well-known/fafa`}catch{return}}function iZ($,Z,Q={}){let z=S0(Z,Q),X=$.agent??{},H={fafaSpecVersion:String($.version??KQ),mediaTypes:[...M8],provenance:{faf:z.faf,mediaType:z.mediaType},generated:z.generated};if(X.id)H.agentId=X.id;let U=AK($);if(U)H.passport=U;return{uri:Q$,description:"FAF passport and project DNA as typed parts",required:!1,params:H}}function CK($){let Z=new Set;for(let Q of $.capabilities??[])if(Q.cites_spec&&M8.includes(Q.cites_spec))Z.add(Q.cites_spec);return["text/plain",...Z]}function F8($,Z={}){let Q=$.agent??{},z=O2($,Z);if(z.length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");let X=String(Q.displayName??$.metadata?.persona??Q.name??"").trim(),H=String(Q.description??"").trim(),U=String(Q.version??"").trim();if(!X||!H||!U)throw Error("A2A card needs agent.displayName|name, description, version in .fafa");let J=String(Q.vendor??"").trim(),G=String(Q.homepage??"").trim(),V=J&&G?{organization:J,url:G}:void 0,Y=($.capabilities??[]).map((W)=>{let B=String(W.name??"").trim();if(!B)throw Error("A2A skill missing capabilities[].name");let K=Array.isArray(W.tags)?W.tags.map(String):[],L=W.cites_spec&&M8.includes(W.cites_spec)?[W.cites_spec,"text/plain"]:void 0;return{id:B,name:B,description:String(W.description??"").trim()||B,tags:K,...L?{inputModes:L}:{}}});return{name:X,description:H,supportedInterfaces:z.map((W)=>({url:String(W.location),protocolBinding:WQ,protocolVersion:String(W.version??dZ)})),...V?{provider:V}:{},version:U,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[...Z.extensions??[]]},defaultInputModes:CK($),defaultOutputModes:["text/plain","application/json"],skills:Y}}var jK=/^[a-z0-9][a-z0-9._-]*$/,wK=/^(@[a-z0-9~][a-z0-9-._~]*\/)?[a-z0-9~][a-z0-9-._~]*$/,SK=/^[A-Za-z0-9]([A-Za-z0-9._-]*[A-Za-z0-9])?$/,EK=/^[A-Za-z0-9][^\s]*$/,bK=["a2a","mcp"],yK=/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/;function T($){return String($??"").trim()}function _8($){return Array.isArray($)?$.map(T).filter(Boolean):[]}function xK($){return T($).toLowerCase().replace(/^https?:\/\//,"").replace(/\/.*$/,"").replace(/^www\./,"")}function gK($,Z,Q){let z=["display_name","description","version"].filter((X)=>!T($[X]));if(z.length)throw Error(`Missing answer: ${z.join(", ")}`);if(!jK.test(Z))throw Error("Short name: lowercase letters, digits, dots, hyphens or underscores.");if(!yK.test(Q))throw Error(`Domain "${$.domain}" is not a domain name (e.g. example.com).`)}function vK($,Z){return($.skills??[]).filter((Q)=>T(Q.name)).map((Q)=>({name:T(Q.name),type:T(Q.type)||"tool",description:T(Q.description)||T(Q.name),tags:Z.length?Z:[T(Q.name).toLowerCase()]}))}function kK($){let Z=($.packages??[]).filter((Q)=>T(Q.registryType)&&T(Q.identifier));for(let Q of Z){let z=T(Q.registryType),X=T(Q.identifier);if(z==="npm"&&!wK.test(X))throw Error(`Package "${X}" is not an npm package name (e.g. weather-mcp or @acme/weather).`);if(z==="pypi"&&!SK.test(X))throw Error(`Package "${X}" is not a PyPI package name (e.g. weather-mcp or weather_mcp).`);if(z!=="npm"&&z!=="pypi"&&!EK.test(X))throw Error(`Package "${X}" is not a ${z} package identifier: it must start with a letter or digit and have no spaces.`)}return Z.map((Q)=>({registryType:T(Q.registryType),identifier:T(Q.identifier),...T(Q.version)?{version:T(Q.version)}:{}}))}function hK($){if(!/^https?:\/\/[^\s/]+/i.test(T($.url)))throw Error(`Where it runs: "${T($.url)}" is not an http(s) URL (or give an npm package).`);if(!bK.includes(T($.protocol).toLowerCase()))throw Error(`Protocol "${T($.protocol)}": a2a or mcp.`)}function uK($,Z){let Q=($.endpoints??[]).filter((X)=>T(X.url));Q.forEach(hK);let z=[...Q.map((X)=>({protocol:T(X.protocol).toLowerCase(),transport:"http",location:T(X.url)})),...Z.map((X)=>({protocol:"mcp",transport:"stdio",location:X.identifier}))];if(z.length===0)throw Error("Missing answer: endpoints (a URL, or a package people install)");return z}function fK($,Z,Q,z){let X={domain:Z},H=[["repository",T($.repository)],["icon",T($.icon)],["organizationUrl",T($.organization_url)]];for(let[J,G]of H)if(G)X[J]=G;if(Q.length)X.keywords=Q;let U=_8($.example_requests);if(U.length)X.examples=U;if(z.length)X.packages=z;return X}function LQ($){let Z=T($.handle).toLowerCase(),Q=xK($.domain);gK($,Z,Q);let z=_8($.tags),X=kK($),H={name:Z,displayName:T($.display_name),id:`urn:air:${Q}:agent:${Z}`,...T($.organization)?{vendor:T($.organization)}:{},version:T($.version),description:T($.description),homepage:T($.homepage)||`https://${Q}`,...T($.license)?{license:T($.license)}:{}};return{version:KQ,agent:H,capabilities:vK($,z),endpoints:uK($,X),metadata:{cards:fK($,Q,z,X)}}}function IQ($){return q2($,{lineWidth:0})}function z$($){let Z=T($.agent?.id),Q=/^urn:air:([^:]+):/.exec(Z);if(Q)return Q[1];let z=T($.metadata?.cards?.domain);if(z)return z;try{return new URL(T($.agent?.homepage)).hostname.replace(/^www\./,"")}catch{throw Error("The .fafa names no domain (agent.id urn:air, metadata.cards.domain or agent.homepage).")}}function OQ($){let Z=T($.agent?.name).toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/^-+|-+$/g,"");if(!Z)throw Error("The .fafa needs agent.name (the short name).");return Z}function nZ($){return`${z$($).split(".").reverse().join(".")}/${OQ($)}`}function cZ($){let Z=$.replace(/\s+/g," ").trim();return Z.length<=100?Z:`${Z.slice(0,97).trimEnd()}...`}function _2($){return($.endpoints??[]).filter((Z)=>T(Z.protocol).toLowerCase()==="mcp"&&/^https?:\/\//.test(T(Z.location))).map((Z)=>({type:"streamable-http",url:T(Z.location)}))}function mK($){if(!$)return;try{let Z=new URL($).hostname.replace(/^www\./,"");return{url:$,source:Z.split(".")[0]}}catch{return}}function _Q($){let Z=$.agent??{},Q=$.metadata?.cards??{},z=T(Z.description),X=T(Z.version);if(!z||!X)throw Error("An MCP card needs agent.description and agent.version in .fafa");let H={name:nZ($),version:X,description:cZ(z)},U=T(Z.displayName);if(U)H.title=cZ(U);let J=T(Z.homepage);if(J)H.websiteUrl=J;let G=mK(T(Q.repository));if(G)H.repository=G;if(T(Q.icon))H.icons=[{src:T(Q.icon)}];return H}function MQ($){return($.metadata?.cards?.packages??[]).map((Z)=>({registryType:T(Z.registryType),identifier:T(Z.identifier),...T(Z.version)?{version:T(Z.version)}:{},transport:{type:"stdio"}}))}function rZ($){return _2($).length>0||MQ($).length>0}function PQ($){let Z=T($.agent?.displayName);return{name:nZ($),...Z?{title:cZ(Z)}:{}}}function R8($,Z,Q={}){let z=_2($);if(z.length===0)throw Error("A Server Card describes a remote MCP server: the .fafa has no mcp endpoint at an http(s) URL.");return{$schema:P8,..._Q($),remotes:z,...Z?{_meta:{"one.faf/context":S0(Z,Q)}}:{}}}function FQ($,Z,Q={}){let z=_2($),X=MQ($);if(z.length===0&&X.length===0)throw Error("A registry entry needs a package people install or a remote MCP URL.");return{$schema:BQ,..._Q($),...X.length?{packages:X}:{},...z.length?{remotes:z}:{},...Z?{_meta:I2(Z,Q)}:{}}}function pK($,Z,Q){if(!Z.includes("a2a")||O2($,Q).length===0)return;return Q.a2aCardUrl??`https://${z$($)}/.well-known/agent-card.json`}function N8($,Z,Q={}){let z=z$($),X=OQ($),H=$.agent??{},U=T(H.displayName)||T(H.name),J=T(H.description),G=T(H.version),V=Q.now??new Date().toISOString(),Y=(K,L,q)=>({identifier:`urn:air:${z}:${K}:${X}`,displayName:U,type:L,description:J,url:q,...G?{version:G}:{},updatedAt:V}),W=[],B=pK($,Z,Q);if(B)W.push(Y("a2a",lZ.a2a,B));if(Z.includes("server_card")){let K=_2($)[0];if(K)W.push(Y("mcp",lZ.server_card,`${K.url.replace(/\/+$/,"")}/server-card`))}if(Q.listFafa!==!1)W.push(Y("agent",lZ.fafa,`https://${z}/.well-known/fafa`));return W}function T8($){let Z=$.agent??{},Q=T(Z.vendor)||T(Z.displayName)||T(Z.name);if(!Q)return;let z;try{z=z$($)}catch{z=void 0}return{displayName:Q,...z?{identifier:z}:{}}}function RQ($,Z,Q={}){let z=T8($);return{specVersion:qQ,...z?{host:z}:{},entries:N8($,Z,Q)}}function sZ($){let Z=$.metadata?.cards??{},Q=_8(Z.keywords),z=_8(Z.examples);return{...Q.length?{tags:Q}:{},...z.length?{representativeQueries:z}:{}}}function NQ($,Z,Q={}){let z=T8($),X=sZ($);return{specVersion:qQ,...z?{host:z}:{},entries:N8($,Z,Q).map((H)=>({...H,...X}))}}function TQ($,Z){let Q=new Set(Z.cards),z={fafa:$,fafaText:IQ($)},{faf:X}=Z;if(Q.has("a2a")){let U=[...Z.a2aExtensions??[],...X?[iZ($,X,Z)]:[]];z.a2a=F8($,{extensions:U})}if(Q.has("server_card"))z.server_card=R8($,X,Z);if(Q.has("server_json"))z.server_json=FQ($,X,Z);let H={now:Z.now,listFafa:Z.listFafa};if(Q.has("ai_catalog"))z.ai_catalog=RQ($,Z.cards,H);if(Q.has("ard"))z.ard=NQ($,Z.cards,H);return z}function lK($,Z){return TQ(LQ($),Z)}var iK=P8,nK=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function AQ($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&nK.test(Z))return Z;let Q=$.project?.homepage??$.project?.website??$.project?.url,z="local";if(Q)try{z=new URL(Q).hostname.replace(/^www\./,"").split(".").reverse().join(".")}catch{}let X=Z.replace(/[^a-zA-Z0-9._-]/g,"-").replace(/^-+|-+$/g,"")||"project";return`${z}/${X}`}function rK($){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 Z6($,Z={}){let Q={$schema:iK,name:AQ($),version:String($.project?.version??"0.1.0"),description:rK($)},z=A8($)??$.project?.name;if(z&&z.length<=100)Q.title=z;let X=$.project?.homepage??$.project?.website??$.project?.url;if(X)Q.websiteUrl=X;if(Z.remoteUrl)Q.remotes=[{type:"streamable-http",url:Z.remoteUrl}];return Q._meta={"one.faf/context":S0($,Z)},Q}function aZ($){return AQ($)}function A8($){let Z=$.project?.title;if(typeof Z==="string"){let Q=Z.trim();if(Q&&Q.length<=100)return Q}return}function sK($){try{return JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return}}var oZ=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function CQ($){let Z=sK($);return oZ(Z)&&oZ(Z._meta)&&oZ(Z._meta["one.faf/context"])}function oK($,Z,Q={},z={}){let X=Z6(Z,Q),H=cK($,"server-card");return $6(H,`${JSON.stringify(X,null,2)}
250
- `,{root:$,format:"json",hasMark:CQ,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:z.force}),H}function aK($,Z){let Q={name:Z.name,title:Z.title,version:Z.version,_meta:Z.meta};return e$($,Q,{"":{name:["$schema"],title:["name"],version:["description","title","name"]}})}var tK=dK(Z6,"faf-cli: generateServerCard is deprecated, use buildServerCard","FAF0002");import{existsSync as jQ}from"fs";import{basename as eK,dirname as SQ,join as wQ}from"path";import{deprecate as $D}from"node:util";var ZD=["a2a","mcp","registry","catalog","ard"];function QD($){return m0(Z0(h(SQ($),eK($))))}function zD($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let z of Z){let X=wQ($,z);if(jQ(X))return X}let Q=SQ($);if(Q!==$)for(let z of Z){let X=wQ(Q,z);if(jQ(X))return X}return null}function tZ($,Z,Q={}){if(O2($,Q).length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");return F8($,{doorUrl:Q.doorUrl,extensions:Z?[iZ($,Z,Q)]:[]})}var XD=$D(tZ,"faf-cli: generateA2ACard is deprecated, use buildA2ACard","FAF0003");function HD($,Z={},Q={}){return N8($,["a2a","server_card"],{now:Q.now??Z.generated??new Date().toISOString(),a2aCardUrl:Q.a2aCardUrl,doorUrl:Q.doorUrl})}function UD($,Z){return $.findIndex((Q)=>Q.identifier===Z.identifier)}function JD($,Z,Q){let z=$?{...$,entries:[...$.entries??[]]}:{specVersion:"1.0",entries:[]},X=Q&&z.host===void 0?(({specVersion:H,...U})=>({specVersion:H,host:{...Q},...U}))(z):z;for(let H of Z){let U=UD(X.entries,H);if(U>=0)X.entries[U]={...X.entries[U],url:H.url,type:H.type,...H.updatedAt?{updatedAt:H.updatedAt}:{}};else X.entries.push(H)}return X}function GD($,Z={}){return[...O2($,Z).length>0?["a2a"]:[],..._2($).length>0?["mcp"]:[],...rZ($)?["registry"]:[],"catalog","ard"]}function VD($){let Z=$.opts??{},Q=$.faf,z=$.fafa,X=Q?ZD:z?GD(z,Z):[],H=new Set($.targets?.length?$.targets:X),U={};if(Q)U.block=S0(Q,Z);if(H.has("mcp"))if(z&&_2(z).length>0)U.mcp=R8(z,Q,Z);else if(Q)U.mcp=Z6(Q,Z);else throw Error("A Server Card needs an MCP endpoint at an http(s) URL in the .fafa, or a project.faf.");if(H.has("registry"))if(z&&rZ(z))U.registry={...PQ(z),...Q?{_meta:I2(Q,Z)}:{}};else if(Q){let J=A8(Q);U.registry={name:aZ(Q),...J?{title:J}:{},_meta:I2(Q,Z)}}else throw Error("A registry entry needs a package or a remote MCP URL in the .fafa, or a project.faf.");if(H.has("a2a")||H.has("catalog")||H.has("ard")){if(!$.fafa){if($.targets?.some((J)=>J==="a2a"||J==="catalog"||J==="ard"))throw Error("A2A/catalog/ARD require a .fafa (agent.fafa). Will not invent an agent.")}}if(H.has("a2a")&&$.fafa)if(O2($.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 U.a2a=tZ($.fafa,Q,Z);if((H.has("catalog")||H.has("ard"))&&$.fafa){let J=HD($.fafa,Q,Z);if(H.has("catalog"))U.catalog=J;if(H.has("ard")){let V=sZ($.fafa);U.ard=J.map((Y)=>({...Y,...V}))}let G=T8($.fafa);if(G)U.catalogHost=G}return YD(U),U}function YD($){if(!$.block)return;let Z=JSON.stringify($.block),Q=[];if($.mcp){let z=$.mcp._meta;Q.push(JSON.stringify(z["one.faf/context"]))}if($.registry?._meta){let z=$.registry._meta["io.modelcontextprotocol.registry/publisher-provided"];Q.push(JSON.stringify(z["one.faf/context"]))}for(let z of Q)if(z!==Z)throw Error("context block drifted across card targets — one projector, one block");if($.a2a){let z=$.a2a.capabilities.extensions?.find((U)=>U.uri===Q$);if(!z)throw Error("A2A card has no FAF context extension, but a project.faf was given");let X=z.params,H=$.block;if(X.provenance?.faf!==H.faf||X.provenance?.mediaType!==H.mediaType)throw Error("A2A extension provenance drifted from the context block — one context, every door")}}var eZ=["ephemeral","standard","high","critical"],z2=Object.fromEntries(eZ.map(($,Z)=>[$,Z])),C8=new Set(["user","feedback","project","reference"]),$1=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),Z1=new Set(["facts","sessions","preferences","custom"]),Q1={low:"ephemeral",medium:"standard"};import{existsSync as WD}from"fs";import{dirname as vQ,resolve as kQ}from"path";function M2(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function f($){return $===null||$===void 0}function BD($){if(Array.isArray($))return`a list (${$.length} item${$.length===1?"":"s"})`;if(f($))return"empty";if(typeof $==="string")return`a string (${JSON.stringify($.length>40?`${$.slice(0,40)}…`:$)})`;return`a ${typeof $}`}var H$=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function qD($){let Z=kQ($),Q=h(vQ(Z),Z,{read:!0});return{real:Q,text:Z0(Q)}}function EQ($,Z,Q,z){let X=kQ($),H=h(vQ(X),X),U=Q!==void 0&&Q.real===H;if(U&&Q.text===Z)return H;let J;try{J=I0(H)}catch{J=void 0}if(J&&J.equals(Buffer.from(Z,"utf-8")))return H;if(!U&&!z&&J)throw new b("changed",X,`${X} already exists — not written; pass { replace: true } (faf memory convert --force) to replace it`,{onWrite:!0});let G=U?Q.text:z?J:null;return e($,Z,G===void 0?{}:{expect:G})}function U$($){if(f($))return"standard";if(Q1[$])return Q1[$];if($ in z2)return $;return"standard"}var KD=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function z1($){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=$,Q={};for(let[z,X]of Object.entries(Z))if(!KD.has(z))Q[z]=X;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:U$(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:Q}}function X$($){if(f($.id)&&f($.type)&&$.tags.length===0&&$.links.length===0&&f($.timestamp)&&f($.source)&&Object.keys($.extra).length===0&&$.priority==="standard")return $.text;let Q={text:$.text};if(!f($.id))Q.id=$.id;if(!f($.type))Q.type=$.type;if(Q.priority=$.priority,$.tags.length)Q.tags=$.tags;if($.links.length)Q.links=$.links;if(!f($.timestamp))Q.timestamp=$.timestamp;if(!f($.source))Q.source=$.source;return Object.assign(Q,$.extra),Q}function bQ($){let Z=$;return H$($)&&typeof Z.text==="string"&&Array.isArray(Z.tags)&&Array.isArray(Z.links)&&H$(Z.extra)&&typeof Z.priority==="string"?Z:z1($)}function DD($){if(typeof $==="string"||H$($)&&"text"in $)return z1($);return null}var yQ=["profile","namepoint","created","last_etched","retention"];class Y0{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??M2(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.map(bQ):[],this._byId=new Map,this._facts.forEach((Q,z)=>{if(!f(Q.id))this._byId.set(Q.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}:{},this._indexDerived=Z.index===void 0||l(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(!WD($))throw Error(`soul file not found: ${$}`);let{real:Z,text:Q}=qD($);return Y0.fromText(Q,$,Z)}static fromText($,Z,Q){let z=jZ($,Z).toJS();if(!H$(z))throw Error(`soul is not a YAML mapping: ${Z} is ${BD(z)}`);let X=new hQ,H=X.pick("memory",z.memory,u)??{},U=new Y0(String(z.namepoint??Z.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(z.profile??"voice"),retention:String(z.retention??"forever"),created:z.created??null,...X.modelled(z,H)});return(X.pick("memory.facts",H.facts,Array.isArray)??[]).forEach((J,G)=>{let V=DD(J);if(V)U.adopt(V,G)}),U.last_etched=String(z.last_etched??U.created),U._version=f(z.version)?void 0:String(z.version),U._origin={path:Z,real:Q,text:$,base:U.state(),residual:X.residual},U.recordIndex(),U}recordIndex(){this._indexDerived=this.indexIsDerived(),this._indexAtRecord=this._index.slice()}adopt($,Z){if(this._facts.push($),!f($.id))this._byId.set($.id,this._facts.length-1);this._factAt.set($,Z)}static fromFile($){return Y0.load($)}toDoc(){let $={facts:this._facts.map(X$),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[Q,z]of Object.entries(this._memoryExtra))if(!Z1.has(Q))$[Q]=structuredClone(z);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[Q,z]of Object.entries(this._extra))if(!$1.has(Q))Z[Q]=structuredClone(z);return Z}toYaml(){return q2(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")&&l(this._index,this.derivedIndex($))}rebuildIndex($=80){return this._index=this.derivedIndex($),this._indexDerived=!0,this._indexAtRecord=this._index.slice(),this._index}save($,Z={}){let Q=Z.reindex??(this._indexDerived&&l(this._index,this._indexAtRecord));if(Q)this.rebuildIndex();let z=Z.replace===!0,X=this._origin;if(!X){let G=this.toYaml(),V=EQ($,G,void 0,z);return this.settle($,G,new Map(this._facts.map((Y,W)=>[Y,W])),V),$}let H=new Map,{text:U}=q8(X.text,(G)=>{H=this.applyTo(G,X,Q)},$),J=EQ($,U,X.real===void 0?void 0:{real:X.real,text:X.text},z);return this.settle($,U,H,J),$}toFile($,Z={}){return this.save($,Z)}settle($,Z,Q,z){this._factAt=new WeakMap;for(let[X,H]of Q)this._factAt.set(X,H);this._origin={path:$,real:z,text:Z,base:this.state(),residual:this._origin?.residual??new Map},this.recordIndex()}state(){let $=new Map;for(let Z of this._facts){let Q=this._factAt.get(Z);if(Q!==void 0)$.set(Q,structuredClone(X$(Z)))}return{top:Object.fromEntries(yQ.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,Q){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 ${Q}. Nothing written.`)}applyTo($,Z,Q){let z=Z.base,X=this.state(),H=Z.path;for(let U of yQ)if(z.top[U]!==X.top[U])$.set(U,X.top[U]);if(!l(z.index,X.index)){if(Z.residual.has("index")&&!Q)Y0.refuse(Z,"index","replace it");D8($,["index"],Z.residual.has("index")?void 0:z.index,X.index,H)}for(let U of gQ(z.extra,X.extra))D8($,[U],z.extra[U],X.extra[U],H);return this.applyMemory($,Z,z,X),this.applyFacts($,Z)}applyMemory($,Z,Q,z){let X=[["sessions",Q.sessions,z.sessions],["preferences",Q.preferences,z.preferences],["custom",Q.custom,z.custom],...gQ(Q.memoryExtra,z.memoryExtra).map((H)=>[H,Q.memoryExtra[H],z.memoryExtra[H]])];for(let[H,U,J]of X){if(l(U,J))continue;if(Z.residual.has("memory"))Y0.refuse(Z,"memory",`change memory.${H}`);if(Z.residual.has(`memory.${H}`))Y0.refuse(Z,`memory.${H}`,"replace it");D8($,["memory",H],U,J,Z.path)}}sortFacts($){let Z=[],Q=[];for(let z of this._facts){let X=this._factAt.get(z);if(X===void 0){Q.push(z);continue}if(Q.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([z,X])}return{kept:Z,added:Q}}applyFacts($,Z){let{kept:Q,added:z}=this.sortFacts(Z),X=new Set(Q.map(([,V])=>V)),H=[...Z.base.facts.keys()].filter((V)=>!X.has(V)).sort((V,Y)=>Y-V),U=Q.filter(([V,Y])=>!l(Z.base.facts.get(Y),X$(V))),J=new Map(Q);if(z.length===0&&H.length===0&&U.length===0)return J;for(let V of["memory","memory.facts"])if(Z.residual.has(V))Y0.refuse(Z,V,"add facts to it");let G=b9($,["memory","facts"],Z.path);for(let[V,Y]of U)G.items[Y]=ID($,G.items[Y],Z.base.facts.get(Y),X$(V));for(let V of H)G.items.splice(V,1);for(let[V,Y]of Q)J.set(V,Y-H.filter((W)=>W<Y).length);for(let V of z)J.set(V,G.items.length),G.items.push($.createNode(X$(V)));return J}add($){let Z=bQ($);if(!f(Z.id)&&this._byId.has(Z.id)){let Q=this._byId.get(Z.id);if(Q!==void 0){let z=this._factAt.get(this._facts[Q]);if(this._facts[Q]=Z,z!==void 0)this._factAt.set(Z,z)}}else if(this._facts.push(Z),!f(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 Q=f(Z.id)?null:this.getFact(Z.id);if(Q)return this.add(LD(Q,$,Z));return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:U$(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:M2(),source:Z.source??null,extra:{}})}recall($,Z={}){let Q=H$($)?{...$,...Z}:Z,z=H$($)?$.query:$,X=z2[U$(Q.minPriority??"ephemeral")]??0,H=typeof z==="string"?z.toLowerCase():"",U=new Set(Q.tags??[]),J=[];this._facts.forEach((V,Y)=>{if(H&&!String(V.text??"").toLowerCase().includes(H))return;if(U.size>0&&![...U].some((W)=>(V.tags??[]).includes(W)))return;if(!f(Q.type)&&V.type!==Q.type)return;if((z2[V.priority]??1)<X)return;J.push([Y,V])}),J.sort((V,Y)=>{let W=z2[V[1].priority]??1,B=z2[Y[1].priority]??1;if(B!==W)return B-W;let K=V[1].timestamp??"",L=Y[1].timestamp??"";if(L!==K)return L<K?-1:L>K?1:0;return Y[0]-V[0]});let G=J.map(([,V])=>V);if(!f(Q.limit))return G.slice(0,Q.limit);return G}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((Q,z)=>{if(!f(Q.id))this._byId.set(Q.id,z)}),!0}}function LD($,Z,Q){let z=(X,H)=>f(X)?H:X;return{...$,text:Z,type:z(Q.type,$.type),priority:f(Q.priority)?$.priority:U$(Q.priority),tags:z(Q.tags,$.tags).slice(),links:z(Q.links,$.links).slice(),source:z(Q.source,$.source),timestamp:M2(),extra:{...$.extra}}}class hQ{residual=new Map;pick($,Z,Q){if(f(Z))return;if(Q(Z))return Z;this.residual.set($,d$(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,u)??{}),custom:structuredClone(this.pick("memory.custom",Z.custom,u)??{}),extra:xQ($,$1),memoryExtra:xQ(Z,Z1)}}}function xQ($,Z){let Q={};for(let[z,X]of Object.entries($))if(!Z.has(z))Q[z]=structuredClone(X);return Q}function gQ($,Z){return[...new Set([...Object.keys($),...Object.keys(Z)])]}function ID($,Z,Q,z){if(!p(Z))return o$($,Z,Q,z);let X=(H)=>typeof H==="string"?{text:H}:H;return o$($,Z,X(Q),X(z))}import{readdirSync as OD,readFileSync as _D,statSync as uQ,existsSync as MD}from"fs";import{join as PD,basename as fQ,resolve as FD}from"path";var mQ=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),RD=/\[\[([^\]]+)\]\]/g;function ND($){let Z=uQ($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function TD($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let Q=m0(Z[1]);if(!Q||typeof Q!=="object")return{fm:null,body:Z.slice(2).join("---").trim()};return{fm:Q,body:Z.slice(2).join("---").trim()}}catch{return{fm:null,body:$}}}function AD($,Z,Q){if(!Q.name)return null;let z=Q.metadata&&typeof Q.metadata==="object"?Q.metadata:{},X=z.type;if(typeof X!=="string"||!C8.has(X))return null;let H=String(Q.name).trim(),J=(Q.description!==void 0&&Q.description!==null&&String(Q.description).trim()?String(Q.description).trim():"")||H,G={};if(z.originSessionId)G.provenance=[`session:${z.originSessionId}`];let V=[...new Set([...Z.matchAll(RD)].map((Y)=>Y[1]))].sort();return{text:J,id:H,type:X,priority:"standard",tags:[],links:V,timestamp:ND($),source:`claude-code memory: ${fQ($)}`,extra:G}}function pQ($,Z={}){let Q=FD($);if(!MD(Q))throw Error(`Claude memory directory not found: ${Q}`);if(!uQ(Q).isDirectory())throw Error(`Claude memory path is not a directory: ${Q}`);let z=Z.skip??mQ,X=Z.namepoint??`@claude-code:${fQ(Q)}`,H=[],U=OD(Q).filter((W)=>W.endsWith(".md")).sort();for(let W of U){if(z.has(W))continue;let B=PD(Q,W),K;try{K=_D(B,"utf-8")}catch{continue}let{fm:L,body:q}=TD(K);if(!L)continue;let D=AD(B,q,L);if(D)H.push(D)}let J=H.map((W)=>W.timestamp).filter(Boolean),G=J.length?J.reduce((W,B)=>W<B?W:B):M2(),V=J.length?J.reduce((W,B)=>W>B?W:B):G,Y=new Y0(X,{profile:"knowledge",facts:H,created:G});return Y.last_etched=V,Y.rebuildIndex(),Y}var nQ="faf-interview/1",J$="(terse — 3-4 words)",X1=[{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}],rQ=[{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}],G$=[...X1,...rQ],sQ=new Map(G$.map(($)=>[$.path,$])),CD=Object.fromEntries(G$.map(($)=>[$.path,$]));function H1($){let Z=sQ.get($);if(Z)return Z.question;let Q=g0.get($)??m.find((z)=>z.canonical===$);return Q?`${Q.description}?`.replace(/\?\?$/,"?"):`${$}?`}function jD($,Z){return G$.filter((Q)=>{let z=Q.path.split("."),X=$;for(let H of z)if(X&&typeof X==="object"&&H in X)X=X[H];else{X=void 0;break}if(X==="slotignored")return!1;return Z(X)})}var wD=new Set(["developers","development teams","development team","teams","development","cloud platform","web platform","platform","best practices","improve development efficiency","development efficiency","modern development practices","modern development","test-driven development","production/stable","production","stable","app","project","tool"]),SD=[["npm",/\bnpm\b/i],["PyPI",/\bpypi\b/i],["crates.io",/\bcrates\.io\b/i],["Homebrew",/\bhomebrew\b/i],["Docker",/\bdocker\b/i],["Cloudflare",/\bcloudflare\b/i],["Vercel",/\bvercel\b/i],["Netlify",/\bnetlify\b/i],["AWS",/\baws\b/i],["Cloud Run",/\bcloud run\b/i],["edge",/\bedge\b/i],["browser",/\bbrowser\b/i],["WASM",/\bwasm\b/i],["GitHub",/\bgithub\b/i],["MCP Registry",/\bmcp registry\b/i],["Chrome Web Store",/\bchrome web store\b/i],["Smithery",/\bsmithery\b/i]],lQ=($)=>wD.has($.toLowerCase().trim()),ED=/^(?:with|and|or|using|for|to|that|who|whom|whose|the|a|an|in|on|of|via|by|&)$/i;function cQ($,Z=5){let Q=$.trim().split(/\s+/).filter(Boolean).slice(0,Z);while(Q.length&&ED.test(Q[Q.length-1].replace(/[.,;:]+$/,"")))Q.pop();return Q.join(" ")}function oQ($){let Z={};if(!$||typeof $!=="string")return Z;let Q=$.trim(),z=Q.replace(/^[^A-Za-z0-9]+/,"").split(/\s+(?:for|that|which|to)\s+|\s+[—–]\s+|\s-\s|:\s|\.\s|,\s/)[0].trim(),X=cQ(z);if(X.split(/\s+/).filter(Boolean).length>=2&&!lQ(X))Z.what=X;let H=SD.filter(([,G])=>G.test(Q)).map(([G])=>G);if(H.length)Z.where=H.slice(0,4).join(", ");let U=Q.match(/\bfor ((?:[A-Za-z][\w./+-]* )?(?:any |all )?(?:developers?|teams?|engineers?|builders?|users?|integrators?)\b[^.,;:—]*)/i),J=cQ((U?.[1]||"").trim().replace(/\s+/g," "));if(J&&!lQ(J))Z.who=J;return Z}function dQ($,Z){let Q=$;for(let z of Z.split("."))if(Q&&typeof Q==="object"&&z in Q)Q=Q[z];else return;return Q}function iQ($){if(typeof $!=="string")return!1;let Z=$.trim();if(!Z||Z==="slotignored")return!1;return!o(Z)}function bD($,Z={}){let Q=$&&typeof $==="object"?$:{},z=dQ(Q,"project.goal"),X=(iQ(z)?String(z).trim():"")||(Z.goal??"").trim(),H=oQ(X),U=Z.detailed??{},J={"project.goal":X||void 0,"human_context.what":H.what,"human_context.where":H.where,"human_context.who":H.who},G=(K)=>{let L=J[K];if(L)return{value:L,source:"project goal",confidence:0.9};let q=K.startsWith("human_context.")?K.slice(14):"",D=q?U[q]:void 0;return D?{value:D.value,source:D.source,confidence:D.confidence}:void 0},V=X1.map((K,L)=>{let q={n:L+1,path:K.path,header:K.header,question:K.question},D=dQ(Q,K.path);if(iQ(D))return{...q,value:String(D).trim(),status:"filled",seeded:!1};let O=G(K.path);if(O)return{...q,value:O.value,status:"seeded",seeded:!0,source:O.source,confidence:O.confidence};return{...q,value:"",status:"empty",seeded:!1}}),Y=V.filter((K)=>K.status==="filled").length,W=V.filter((K)=>K.status==="seeded").length,B=V.filter((K)=>K.status==="empty").length;return{version:nQ,rows:V,filledCount:Y,seededCount:W,emptyCount:B,complete:B===0}}function j8($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||o(Z)}return!1}function yD($,Z){let Q=$;for(let z of Z.split("."))if(Q&&typeof Q==="object"&&z in Q)Q=Q[z];else return;return Q}function aQ($){if($==="project.goal")return!0;return g0.get($)?.category==="human"}function tQ($,Z=j8){let Q=[],z=[];for(let X of G$){let H=yD($,X.path);if(H==="slotignored")continue;if(!Z(H))continue;(aQ(X.path)?Q:z).push(X.path)}return{human:Q,sourceable:z}}function eQ($,Z,Q=j8){let z=tQ(Z,Q),X;if($>=100||z.human.length===0&&z.sourceable.length===0)X="done";else if(z.sourceable.length>0)X="can-source";else X="needs-human";let H=X==="needs-human"?U1(z):[];return{status:X,score:$,gaps:z,ask:H}}function U1($){return $.human.map((Z)=>({path:Z,question:H1(Z)}))}function xD($,Z={}){let Q=Math.max(1,Z.maxRounds??5),z=Z.isEmpty??j8,X=[],H=0;for(let J=0;J<=Q;J++){let G=$.read();if(!G)return{status:"no-faf",score:0,rounds:H,history:X,ask:[]};let V=$.score(G.yaml);X.push(V);let Y=eQ(V,G.data,z);if(Y.status==="done")return{status:"done",score:V,rounds:H,history:X,ask:[]};if(Y.status==="needs-human")return{status:"needs-human",score:V,rounds:H,history:X,ask:Y.ask};if(X.length>=2&&V<=X[X.length-2])return Y.gaps.human.length?{status:"needs-human",score:V,rounds:H,history:X,ask:U1(Y.gaps)}:{status:"stuck",score:V,rounds:H,history:X,ask:[]};if(H>=Q)return{status:"capped",score:V,rounds:H,history:X,ask:U1(Y.gaps)};$.runAuto(),H++}return{status:"capped",score:X[X.length-1]??0,rounds:H,history:X,ask:[]}}import{createHash as Z3}from"crypto";var J1="faf-bench/1",gD={"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 vD($,Z){return gD[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var Q3=[["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"]],Q6=new Map;Q3.forEach(($,Z)=>$.forEach((Q)=>Q6.set(Q,Z)));var kD=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function w8($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function $3($){return w8($).split(" ").filter((Z)=>Z&&!kD.has(Z))}function z3($,Z){let Q=w8($),z=w8(Z);if(!Q||!z)return!1;if(Q===z)return!0;let X=Q6.get(Q);if(X!==void 0&&Q6.get(z)===X)return!0;let H=$3($);if(H.length===0)return!1;let U=new Set($3(Z));return H.every((J)=>{if(U.has(J))return!0;let G=Q6.get(J);return G!==void 0&&[...U].some((V)=>Q6.get(V)===G)})}function hD($){let Z=X5($),Q=m0($),z=[],X={},H=0;for(let G of m){if(Z.slots[G.path]!=="populated")continue;let V=h1(Q,G);if(typeof V!=="string")continue;let Y=V.trim();if(!Y||D6.has(Y.toLowerCase()))continue;H+=1,z.push({n:H,path:G.path,question:vD(G.path,G.description)}),X[H]=Y}let U=JSON.stringify({v:J1,q:z.map((G)=>[G.path,G.question])}),J=Z3("sha256").update(U).digest("hex").slice(0,12);return{version:J1,qsetHash:J,questions:z,answers:X}}function uD($){return{version:$.version,qsetHash:$.qsetHash,questions:$.questions}}function fD($,Z){let Q=$.questions.map((X)=>{let H=Z[String(X.n)]??Z[X.path]??"";return{n:X.n,path:X.path,ok:typeof H==="string"&&H.trim()!==""&&z3($.answers[X.n],H)}}),z=$.questions.filter((X)=>!Q[X.n-1].ok);return{correct:Q.filter((X)=>X.ok).length,total:$.questions.length,misses:z,perQuestion:Q}}function mD($,Z){let Q=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:Q,hash:Z3("sha256").update(Q).digest("hex")}}import{join as qI,extname as KI,resolve as DI}from"path";var G1={"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"]}};import{join as lD}from"path";var V$={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 cD=V$.flutterDeps,dD=V$.mcpDeps,iD=V$.serverFrameworks,nD=V$.stateManagement,rD=V$.routing;function sD($){let Z=new Set,Q=!1;for(let z of $.split(`
251
- `)){if(/^(dependencies|dev_dependencies|dependency_overrides):\s*$/.test(z)){Q=!0;continue}if(/^\S/.test(z))Q=!1;if(Q){let X=z.match(/^\s{2}([a-zA-Z0-9_]+):/);if(X)Z.add(X[1].toLowerCase())}}return Z}function S8($){let Z=S($,"pubspec.yaml");if(Z===null)return null;let Q=sD(Z),z=(_)=>Q.has(_.toLowerCase()),X=cD.some(z)||/^flutter:\s*$/m.test(Z)||/\bsdk:\s*flutter\b/.test(Z),H=dD.find(z),U=iD.find(([_])=>z(_)),J=nD.find(([_])=>z(_)),G=J?J[1]:"",V=rD.find(([_])=>z(_)),Y=V?V[1]:"",W=z("flutter_test")?"flutter_test":z("test")?"test":"",B=/^executables:\s*$/m.test(Z),K=(v($,"bin")??[]).some((_)=>_.name.endsWith(".dart")),L=B||K,q,D="",O;if(X)if(D="Flutter",I($,lD("lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(Z))q="mobile",O="pubspec.yaml (Flutter app)";else q="library",O="pubspec.yaml (Flutter package)";else if(H)q="mcp",O=`pubspec.yaml + ${H} (Dart MCP server)`;else if(U)q="backend",D=U[1],O=`pubspec.yaml + ${U[0]} (Dart backend)`;else if(L)q="cli",O=B?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else q="library",O="pubspec.yaml (Dart package)";return{appType:q,isFlutter:X,framework:D,stateManagement:G,routing:Y,testing:W,found:O}}import{join as aD}from"path";var E8={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 tD=E8.mcpModules,eD=E8.serverFrameworks,$L=E8.cliFrameworks;function ZL($){let Z=new Set,Q=!1;for(let z of $.split(`
252
- `)){let X=z.replace(/\/\/.*$/,"").trim();if(!X)continue;if(/^require\s*\(\s*$/.test(X)){Q=!0;continue}if(Q){if(X===")"){Q=!1;continue}let U=X.match(/^(\S+)/);if(U)Z.add(U[1].toLowerCase());continue}let H=X.match(/^require\s+(\S+)/);if(H&&H[1]!=="(")Z.add(H[1].toLowerCase())}return Z}function H3($,Z){let Q=Z.toLowerCase();for(let z of $)if(z===Q||z.startsWith(`${Q}/`))return!0;return!1}function X3($,Z){let Q;for(let z of Z){if(!H3($,z[0]))continue;if(!Q||z[0].length>Q[0].length)Q=z}return Q}function QL($,Z){let Q;for(let z of Z){if(!H3($,z))continue;if(!Q||z.length>Q.length)Q=z}return Q}function zL($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function XL($){for(let{name:Z}of v($,"cmd")??[]){let Q=aD("cmd",Z),z=O0($,Q);if(z?.isDirectory()){if((v($,Q)??[]).some((X)=>X.name.endsWith(".go")))return!0}else if(z&&Z.endsWith(".go"))return!0}return!1}function HL($){let Z=S($,"main.go");return Z!==null&&/^package\s+main\b/m.test(Z)}function b8($){let Z=S($,"go.mod");if(Z===null)return null;let Q=zL(Z),z=ZL(Z),X=QL(z,tD),H=X3(z,eD),U=X3(z,$L),J=XL($),G=HL($),V,Y="",W;if(X)V="mcp",W=`go.mod + ${X} (Go MCP server)`;else if(H)V="backend",Y=H[1],W=`go.mod + ${H[0]} (Go backend)`;else if(U)V="cli",Y=U[1],W=`go.mod + ${U[0]} (Go CLI)`;else if(J)V="cli",W="go.mod + cmd/ (Go CLI layout)";else if(G&&!H)V="cli",W="go.mod + main.go package main (Go CLI)";else V="library",W="go.mod (Go module)";return{appType:V,modulePath:Q,framework:Y,found:W}}var P2={version:1,_doc:"SINGLE SOURCE of C# /.NET detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Bolster C# by editing THIS file. Logic stays in csharp.ts. Content-aware: .csproj alone ≠ type — Sdk first, then props/packages. Kill line: .csproj alone ≠ type. 2026-08-01 initial.",mcpPackages:["ModelContextProtocol","ModelContextProtocol.AspNetCore","ModelContextProtocol.Core","ModelContextProtocol.Extensions.Tasks","ModelContextProtocol.Extensions.Apps"],cliPackages:[["System.CommandLine","System.CommandLine"],["Spectre.Console.Cli","Spectre.Console"],["Spectre.Console","Spectre.Console"],["McMaster.Extensions.CommandLineUtils","McMaster"]],testPackages:[["Microsoft.NET.Test.Sdk","VSTest"],["xunit.v3","xUnit"],["xunit","xUnit"],["NUnit","NUnit"],["MSTest.TestFramework","MSTest"],["MSTest","MSTest"]],grpcServerPackages:["Grpc.AspNetCore"],specializedSdks:[["Microsoft.NET.Sdk.Web","web","ASP.NET Core"],["Microsoft.NET.Sdk.Worker","worker","Worker"],["Microsoft.NET.Sdk.BlazorWebAssembly","blazor-wasm","Blazor WebAssembly"],["Microsoft.NET.Sdk.Razor","razor-lib","Razor Class Library"],["MSTest.Sdk","test","MSTest"],["Aspire.AppHost.Sdk","aspire","Aspire AppHost"]],baseSdk:"Microsoft.NET.Sdk"};var JL=P2.mcpPackages.map(($)=>$.toLowerCase()),GL=P2.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),VL=P2.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),YL=P2.grpcServerPackages.map(($)=>$.toLowerCase()),WL=P2.specializedSdks,U3=P2.baseSdk.toLowerCase();function BL($){let Z=$.match(/<Project\b[^>]*\bSdk\s*=\s*"([^"/]+)(?:\/[^"]*)?"/i),Q=$.match(/<Sdk\b[^>]*\bName\s*=\s*"([^"]+)"/i),z=(Z?.[1]||Q?.[1]||"").trim(),X=($.match(/<OutputType>\s*([^<]+?)\s*<\/OutputType>/i)?.[1]||"").trim(),H=$.match(/<TargetFramework>\s*([^<]+?)\s*<\/TargetFramework>/i)?.[1],J=($.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i)?.[1]||H||"").trim(),G=/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test($),V=/<UseMaui>\s*true\s*<\/UseMaui>/i.test($),Y=/<UseWPF>\s*true\s*<\/UseWPF>/i.test($),W=/<UseWindowsForms>\s*true\s*<\/UseWindowsForms>/i.test($),B=new Set;for(let L of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))B.add(L[1].toLowerCase());for(let L of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))B.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:z,outputType:X,targetFramework:J,isTestProject:G,useMaui:V,useWpf:Y,useWindowsForms:W,packages:B,frameworkRefs:K}}function V1($,Z){let Q=Z.toLowerCase();if($.has(Q))return!0;for(let z of $)if(z===Q||z.startsWith(`${Q}.`))return!0;return!1}function J3($,Z){let Q;for(let[z,X]of Z){if(!V1($,z))continue;if(!Q||z.length>Q[0].length)Q=[z,X]}return Q}function qL($){let Z;for(let Q of JL){if(!V1($,Q))continue;if(!Z||Q.length>Z.length)Z=Q}for(let Q of $)if(Q==="modelcontextprotocol"||Q.startsWith("modelcontextprotocol.")){if(!Z||Q.length>Z.length)Z=Q}return Z}function KL($){let Z=$.toLowerCase();if(!Z)return;let Q;for(let z of WL){let X=z[0].toLowerCase();if(Z===X||Z.startsWith(`${X}/`)){if(!Q||X.length>Q[0].length)Q=z}}return Q}function y8($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function DL($,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 LL($,Z){let Q=Z.replace(/\.csproj$/i,""),{sdk:z,packages:X,frameworkRefs:H,outputType:U}=$,J,G="",V,Y=qL(X),W=KL(z),B=J3(X,VL),K=J3(X,GL),L=YL.some((D)=>V1(X,D)),q=H.has("microsoft.aspnetcore.app");if(Y)J="mcp",G="MCP",V=`${Z} + ${Y} (C# MCP server)`;else if($.isTestProject||W?.[1]==="test"||B)J="library",G=B?.[1]||(W?.[1]==="test"?W[2]:"Test"),V=`${Z} + test (${G})`;else if($.useMaui)J="mobile",G="MAUI",V=`${Z} + UseMaui (MAUI)`;else if($.useWpf||$.useWindowsForms)J="backend",G=$.useWpf&&$.useWindowsForms?"WPF+WinForms":$.useWpf?"WPF":"Windows Forms",V=`${Z} + ${G}`;else if(W?.[1]==="web")J="backend",G=L?"gRPC":W[2],V=`${Z} + Sdk=${W[0]}${L?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(W?.[1]==="worker")J="backend",G=W[2],V=`${Z} + Sdk=${W[0]} (Worker)`;else if(W?.[1]==="blazor-wasm")J="backend",G=W[2],V=`${Z} + Sdk=${W[0]} (Blazor WASM)`;else if(W?.[1]==="aspire")J="backend",G=W[2],V=`${Z} + Sdk=${W[0]} (Aspire)`;else if(W?.[1]==="razor-lib")J="library",G=W[2],V=`${Z} + Sdk=${W[0]} (Razor class library)`;else if(q&&y8(U))J="backend",G="ASP.NET Core",V=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(q&&!y8(U))J="library",G="ASP.NET Core",V=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(K&&(y8(U)||!U))J="cli",G=K[1],V=`${Z} + ${K[0]} (C# CLI)`;else if(y8(U))J="cli",V=`${Z} + OutputType=Exe (C# console)`;else{J="library";let D=z?` Sdk=${z}`:"";if(V=`${Z}${D} (C# class library)`.replace(" Sdk=Microsoft.NET.Sdk",""),!z||z.toLowerCase()===U3||z.toLowerCase().startsWith(`${U3}/`))V=`${Z} (C# class library)`}return{appType:J,projectName:Q,targetFramework:$.targetFramework,sdk:z||"Microsoft.NET.Sdk",framework:G,found:V}}function Y$($){return(v($)??[]).map((Z)=>Z.name).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}function x8($){let Z=Y$($);if(Z.length===0)return null;let Q=null,z=999;for(let X of Z){let H=S($,X);if(H===null)continue;let U=BL(H),J=LL(U,X),G=DL(J.appType,J.framework);if(!Q||G<z)Q=J,z=G}return Q}import{join as F2}from"path";var M0={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=M0.mcpArtifacts.map(($)=>$.toLowerCase()),_L=M0.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),ML=M0.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),PL=M0.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),LN=M0.androidPlugins.map(($)=>$.toLowerCase()),FL=M0.kmpPlugins.map(($)=>$.toLowerCase()),RL=M0.jvmKotlinPlugins.map(($)=>$.toLowerCase()),NL=M0.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),TL=M0.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),AL=M0.libraryPlugins.map(($)=>$.toLowerCase()),CL=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function Y1($){return CL.some((Z)=>I($,Z))}function jL($){let Z=new Map,Q=new Map,z="";for(let X of $.split(`
253
- `)){let H=X.replace(/#.*$/,"").trim();if(!H)continue;let U=H.match(/^\[([^\]]+)\]$/);if(U){z=U[1].trim().toLowerCase();continue}let J=H.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bid\s*=\s*"([^"]+)"/);if(J&&(z==="plugins"||z.endsWith(".plugins"))){Z.set(J[1].replace(/-/g,".").toLowerCase(),J[2].toLowerCase()),Z.set(J[1].toLowerCase(),J[2].toLowerCase());continue}let G=H.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bmodule\s*=\s*"([^"]+)"/);if(G&&(z==="libraries"||z.endsWith(".libraries"))){let W=G[1].toLowerCase();Q.set(W,G[2].toLowerCase()),Q.set(W.replace(/-/g,"."),G[2].toLowerCase());continue}let V=H.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bgroup\s*=\s*"([^"]+)"[^}]*\bname\s*=\s*"([^"]+)"/);if(V&&(z==="libraries"||z.endsWith(".libraries"))){let W=`${V[2]}:${V[3]}`.toLowerCase(),B=V[1].toLowerCase();Q.set(B,W),Q.set(B.replace(/-/g,"."),W);continue}let Y=H.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(Y){let W=Y[1].toLowerCase(),B=Y[2];if(z==="plugins"||z.endsWith(".plugins")){let K=B.split(":")[0].toLowerCase();Z.set(W,K),Z.set(W.replace(/-/g,"."),K)}else if(z==="libraries"||z.endsWith(".libraries")){let K=B.split(":");if(K.length>=2){let L=`${K[0]}:${K[1]}`.toLowerCase();Q.set(W,L),Q.set(W.replace(/-/g,"."),L)}}}}return{plugins:Z,libraries:Q}}function wL($){let Z=S($,F2("gradle","libs.versions.toml"));if(!Z)return{plugins:new Map,libraries:new Map};return jL(Z)}function SL($){let Z=[];for(let Q of $.matchAll(/include\s*\(\s*([^)]+)\)/g))for(let z of Q[1].split(",")){let X=z.replace(/['":\s]/g,"").replace(/^:/,"");if(X)Z.push(X.replace(/:/g,"/"))}for(let Q of $.matchAll(/include\s+((?:['"][^'"]+['"]\s*,?\s*)+)/g))for(let z of Q[1].split(",")){let X=z.replace(/['":\s]/g,"").replace(/^:/,"");if(X)Z.push(X.replace(/:/g,"/"))}for(let Q of $.matchAll(/project\s*\(\s*["']:([^"']+)["']\s*\)\s*\.projectDir\s*=\s*file\s*\(\s*["']([^"']+)["']\s*\)/g))Z.push(Q[2].replace(/^\.\//,""));return[...new Set(Z)]}function EL($,Z){let Q=new Set;for(let z of $.matchAll(/\bid\s*\(\s*["']([^"']+)["']\s*\)/g))Q.add(z[1].toLowerCase());for(let z of $.matchAll(/\bid\s+['"]([^'"]+)['"]/g))Q.add(z[1].toLowerCase());for(let z of $.matchAll(/plugins\s*\{([\s\S]*?)\}/g))for(let X of z[1].split(/[\n;]/)){let H=X.replace(/\/\/.*$/,"").trim();if(!H||H.startsWith("id")||H.startsWith("kotlin")||H.startsWith("alias"))continue;let U=H.match(/^`([a-zA-Z0-9.-]+)`$/)||H.match(/^([a-zA-Z][a-zA-Z0-9.-]*)$/);if(U)Q.add(U[1].toLowerCase())}for(let z of $.matchAll(/\bkotlin\s*\(\s*["']([^"']+)["']\s*\)/g)){let X=z[1].toLowerCase();if(X==="jvm")Q.add("org.jetbrains.kotlin.jvm");else if(X==="multiplatform")Q.add("org.jetbrains.kotlin.multiplatform");else if(X==="android")Q.add("org.jetbrains.kotlin.android");else Q.add(`org.jetbrains.kotlin.${X}`)}for(let z of $.matchAll(/libs\.plugins\.([A-Za-z0-9_.]+)/g)){let X=z[1].toLowerCase(),H=Z.plugins.get(X)||Z.plugins.get(X.replace(/\./g,"-"))||Z.plugins.get(X.replace(/-/g,"."));if(H)Q.add(H);else if(X.includes("spring")&&X.includes("boot"))Q.add("org.springframework.boot")}for(let z of $.matchAll(/apply\s+plugin\s*:\s*['"]([^'"]+)['"]/g))Q.add(z[1].toLowerCase());return Q}function bL($,Z){let Q=new Set;for(let z of $.matchAll(/["']([A-Za-z0-9_.-]+:[A-Za-z0-9_.-]+)(?::[^"']+)?["']/g))Q.add(z[1].toLowerCase());for(let z of $.matchAll(/libs\.([A-Za-z0-9_.]+)/g)){let X=z[1].toLowerCase();if(X.startsWith("plugins."))continue;let H=[X,X.replace(/\./g,"-"),X.replace(/-/g,".")];for(let U of H){let J=Z.libraries.get(U);if(J){Q.add(J.includes(":")?J.split(":").slice(0,2).join(":"):J);break}}}return Q}function Y3($){let Z=($.match(/<packaging>\s*([^<]+?)\s*<\/packaging>/i)?.[1]||"jar").trim().toLowerCase(),Q=new Set,z=$.match(/<parent>([\s\S]*?)<\/parent>/i);if(z){let U=z[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),J=z[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(U&&J)Q.add(`${U}:${J}`.toLowerCase())}let X=new Set;for(let U of $.matchAll(/<dependency>([\s\S]*?)<\/dependency>/gi)){let J=U[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),G=U[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(J&&G)X.add(`${J}:${G}`.toLowerCase())}let H=[];for(let U of $.matchAll(/<module>\s*([^<]+?)\s*<\/module>/gi))H.push(U[1].trim());return{packaging:Z,parents:Q,artifacts:X,modules:H}}function p0($,Z){let Q=Z.toLowerCase();if($.has(Q))return!0;for(let z of $)if(z===Q||z.endsWith(`.${Q}`)||z===Q.replace(/^org\.gradle\./,""))return!0;return!1}function z6($,Z,Q){let z;for(let[X,H]of Z){let U=!1;if(Q==="plugin")U=p0($,X);else if(U=$.has(X)||[...$].some((J)=>J===X||J.startsWith(`${X}:`)||J.startsWith(`${X}.`)),!U&&Q==="artifact")U=[...$].some((J)=>J===X||J.startsWith(`${X}`));if(!U)continue;if(!z||X.length>z[0].length)z=[X,H]}return z}function yL($){let Z;for(let Q of OL)for(let z of $){if(z===Q||z.startsWith(`${Q}:`)||z.startsWith(Q.replace(/:mcp$/,":"))){if(!Z||Q.length>Z.length)Z=Q}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 W3($,Z){let Q=new Set,z=!1,X=!1,H=[F2(Z,"src"),F2(Z,"src","main")],U=(J,G)=>{if(G>4)return;let V=v($,J);if(!V)return;for(let{name:Y}of V){if(Y==="androidMain"||Y==="commonMain"||Y==="jvmMain"||Y==="iosMain")Q.add(Y);let W=F2(J,Y),B=O0($,W);if(!B)continue;if(B.isDirectory())U(W,G+1);else if(Y.endsWith(".kt")||Y.endsWith(".kts"))z=!0;else if(Y.endsWith(".java"))X=!0}};for(let J of H)U(J,0);return{kotlin:z,java:X,hints:Q}}function xL($){let Z=[],Q=$.plugins,z=$.artifacts,X=FL.some((F)=>p0(Q,F))||$.sourceHints.has("commonMain"),H=p0(Q,"com.android.application"),U=p0(Q,"com.android.library")||p0(Q,"com.android.kotlin.multiplatform.library");if(H||U)Z.push("android");if(X)Z.push("multiplatform");let J=yL(z),G=z6(Q,_L,"plugin"),V=z6($.parents,ML,"parent"),Y=z6(z,PL,"artifact"),W=z6(Q,NL,"plugin"),B=z6(z,TL,"artifact"),K=AL.some((F)=>p0(Q,F)),L=$.packaging==="pom",q,D="",O;if(H)q="mobile",D=X?"Android+KMP":"Android",O=`${$.path||"root"} + com.android.application (${D})`;else if(J)q="mcp",D="MCP",Z.push("mcp"),O=`${$.path||"root"} + ${J} (JVM MCP server)`;else if(G||V||Y){q="backend",D=G?.[1]||V?.[1]||Y?.[1]||"JVM";let F=G?.[0]||V?.[0]||Y?.[0]||"web";O=`${$.path||"root"} + ${F} (JVM backend)`}else if(X&&!U)q="library",D="Kotlin Multiplatform",O=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(U)q="library",D=X?"Android+KMP":"Android",O=`${$.path||"root"} + android library (${D})`;else if(B||$.hasApplicationPlugin&&($.hasMainClass||W)||W&&$.hasMainClass)q="cli",D=B?.[1]||"application",O=B?`${$.path||"root"} + ${B[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!K)q="cli",D="application",O=`${$.path||"root"} + application plugin (JVM CLI)`;else if(L)q="library",O=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{q="library";let F=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(O=`${$.path||"root"} (${F} library)`,K)O=`${$.path||"root"} + java-library (JVM library)`}let _="Java";if($.kotlinSources&&$.javaSources)_="Java/Kotlin";else if($.kotlinSources||RL.some((F)=>p0(Q,F))||X)_="Kotlin";let C=[...new Set(Z)];return{appType:q,framework:D,facets:C,found:O,buildTool:$.buildTool,mainLanguage:_}}function gL($,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 G3($,Z,Q){let z=F2(Z,"build.gradle.kts"),X=F2(Z,"build.gradle"),H=I($,z)?z:I($,X)?X:null;if(!H)return null;let U=S($,H);if(!U)return null;let J=EL(U,Q),G=bL(U,Q),V=W3($,Z),Y=/mainClass\s*[.=]/.test(U)||/mainClassName\s*=/.test(U)||/Main-Class/.test(U),W=p0(J,"application")||p0(J,"org.gradle.application");return{path:Z||"build.gradle",plugins:J,artifacts:G,packaging:"jar",parents:new Set,hasMainClass:Y,hasApplicationPlugin:W,sourceHints:V.hints,kotlinSources:V.kotlin||H.endsWith(".kts"),javaSources:V.java,buildTool:"gradle"}}function V3($,Z){let Q=S($,F2(Z,"pom.xml"));if(!Q)return null;let{packaging:z,parents:X,artifacts:H}=Y3(Q),U=W3($,Z);return{path:Z?`${Z}/pom.xml`:"pom.xml",plugins:new Set,artifacts:H,packaging:z,parents:X,hasMainClass:/<mainClass>/.test(Q),hasApplicationPlugin:!1,sourceHints:U.hints,kotlinSources:U.kotlin,javaSources:U.java,buildTool:"maven"}}function X6($){if(!Y1($))return null;let Z=wL($),Q=[],z=null;for(let V of["settings.gradle.kts","settings.gradle"])if(I($,V)){z=S($,V);break}let X=z?SL(z):[],H=G3($,"",Z);if(H)Q.push(H);for(let V of X){let Y=G3($,V,Z);if(Y)Q.push(Y)}let U=V3($,"");if(U){Q.push(U);let V=S($,"pom.xml");if(V){let{modules:Y}=Y3(V);for(let W of Y){let B=V3($,W);if(B)Q.push(B)}}}if(Q.length===0&&z)return{appType:"library",framework:"",buildTool:"gradle",mainLanguage:"Java/Kotlin",facets:[],found:"settings.gradle (Gradle multi-project root)"};if(Q.length===0)return null;let J=null,G=999;for(let V of Q){let Y=xL(V),W=gL(Y.appType,Y.facets);if(!J||W<G)J={appType:Y.appType,framework:Y.framework,buildTool:Y.buildTool,mainLanguage:Y.mainLanguage,facets:Y.facets,found:Y.found},G=W}if(J&&X.length>0&&!J.found.includes("multi-project"));return J}import{join as kL}from"path";var H6={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 hL=H6.mcpGems.map(($)=>$.toLowerCase()),uL=H6.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),B3=H6.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),fL=H6.railsLayoutFiles;function mL($){return I($,"Gemfile")||I($,"gems.rb")||pL($)}function pL($){return(v($)??[]).some((Z)=>Z.name.endsWith(".gemspec"))}function lL($){let Z=new Set;for(let Q of $.split(`
254
- `)){let z=Q.replace(/#.*$/,"").trim();if(!z)continue;let X=z.match(/^\s*gem\s+['"]([^'"]+)['"]/i)||z.match(/^\s*gem\s+:([A-Za-z0-9_.-]+)/i);if(X)Z.add(X[1].toLowerCase())}return Z}function cL($){let Z=new Set,Q=!1;for(let z of $.split(`
255
- `)){let X=z.replace(/\r$/,"");if(/^\s*specs:\s*$/.test(X)){Q=!0;continue}if(Q){if(/^[A-Z]/.test(X)||X.startsWith("PLATFORMS")||X.startsWith("DEPENDENCIES")||X.startsWith("BUNDLED")||X.startsWith("RUBY VERSION")||X.startsWith("CHECKSUMS")){Q=!1;continue}let H=X.match(/^\s{2,}([a-zA-Z0-9_.-]+)\s*\(/);if(H)Z.add(H[1].toLowerCase())}}return Z}function dL($){let Z=new Set;for(let Q of $.split(`
256
- `)){let X=Q.replace(/#.*$/,"").match(/add_(?:runtime_|development_)?dependency\s*\(?\s*['"]([^'"]+)['"]/i);if(X)Z.add(X[1].toLowerCase())}return Z}function iL($){let Z=new Set,Q=[];for(let X of["Gemfile","gems.rb"]){let H=S($,X);if(H){for(let U of lL(H))Z.add(U);Q.push(X)}}let z=S($,"Gemfile.lock")||S($,"gems.locked");if(z){for(let X of cL(z))Z.add(X);Q.push("Gemfile.lock")}for(let{name:X}of v($)??[]){if(!X.endsWith(".gemspec"))continue;let H=S($,X);if(H){for(let U of dL(H))Z.add(U);Q.push(X)}}return{gems:Z,sources:Q}}function U6($,Z){let Q=Z.toLowerCase();if($.has(Q))return!0;return!1}function W1($,Z){let Q;for(let[z,X]of Z){if(!U6($,z))continue;if(!Q||z.length>Q[0].length)Q=[z,X]}return Q}function nL($){let Z;for(let Q of hL)if(U6($,Q)&&(!Z||Q.length>Z.length))Z=Q;return Z}function q3($){for(let Z of fL)if(I($,Z))return Z;return}function rL($,Z){let Q=W1(Z,B3);if(Q)return{hit:!0,why:Q[0]};for(let{name:X}of v($)??[]){if(!X.endsWith(".gemspec"))continue;let H=S($,X);if(H&&/executables\s*=/.test(H)&&!/executables\s*=\s*\[\s*\]/.test(H))return{hit:!0,why:`${X} executables`}}let z=v($,"bin");if(z){let H=z.map((U)=>U.name).filter((U)=>{if(U==="setup"||U==="console"||U==="rake")return!1;return O0($,kL("bin",U))?.isFile()===!0}).filter((U)=>U!=="rails");if(H.length>0&&!U6(Z,"rails")&&!q3($))return{hit:!0,why:`bin/${H[0]}`}}return{hit:!1,why:""}}function g8($){if(!mL($))return null;let{gems:Z,sources:Q}=iL($),z=Q[0]||"Gemfile",X=Q.some((D)=>D==="Gemfile"||D==="gems.rb"||D.includes("lock"))?"bundler":"rubygems",H=nL(Z),U=W1(Z,uL),J=q3($),G=U6(Z,"rails")||U6(Z,"railties"),V=rL($,Z),Y=I($,"config.ru"),W=G||!!J,B=U&&U[1]!=="Rails"&&!(U[0]==="rack"&&!Y)?U:void 0,K,L="",q;if(H)K="mcp",L="MCP",q=`${z} + gem ${H} (Ruby MCP)`;else if(W)if(K="backend",L="Rails",G&&J)q=`${z} + rails + ${J} (Rails)`;else if(G)q=`${z} + gem rails (Rails)`;else q=`${J} (Rails layout)`;else if(B)K="backend",L=B[1],q=`${z} + gem ${B[0]} (Ruby backend)`;else if(V.hit)K="cli",L=W1(Z,B3)?.[1]||"",q=`${z} + ${V.why} (Ruby CLI)`;else K="library",q=`${z} (Ruby library)`;return{appType:K,framework:L,packageManager:X,found:q}}import{join as oL}from"path";var E0={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 aL=E0.mcpPackageUrls.map(($)=>$.toLowerCase()),tL=E0.mcpProducts.map(($)=>$.toLowerCase()),eL=E0.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),$I=E0.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),ZI=E0.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),QI=E0.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),zI=E0.appProductTypes,XI=E0.cliProductTypes,HI=E0.vaporLayoutFiles;function UI($){return I($,"Package.swift")||B1($).length>0}function B1($){return(v($)??[]).map((Z)=>Z.name).filter((Z)=>Z.endsWith(".xcodeproj")&&O0($,Z)?.isDirectory()===!0)}function JI($){let Z=GI($),Q=Z.toLowerCase(),z=[],X=/\.package\s*\(\s*url\s*:\s*"([^"]+)"/gi,H;while((H=X.exec(Z))!==null)z.push(H[1]);let U=/\.package\s*\(\s*url\s*:\s*'([^']+)'/gi;while((H=U.exec(Z))!==null)z.push(H[1]);let J=[],G=/\.product\s*\(\s*name\s*:\s*"([^"]+)"/gi;while((H=G.exec(Z))!==null)J.push(H[1]);let V=/\.product\s*\(\s*name\s*:\s*'([^']+)'/gi;while((H=V.exec(Z))!==null)J.push(H[1]);let Y=/\.library\s*\(/.test(Q),W=/\.executable\s*\(/.test(Q),B=/\.plugin\s*\(/.test(Q)&&!Y&&!W?!0:/\bproducts\s*:\s*\[[\s\S]*?\.plugin\s*\(/.test(Q),K=/\.executabletarget\s*\(/.test(Q),L=/\.target\s*\(/.test(Q)&&!K?!0:(Q.match(/\.target\s*\(/g)||[]).length>(Q.match(/\.executabletarget\s*\(/g)||[]).length+(Q.match(/\.testtarget\s*\(/g)||[]).length;return{packageUrls:z,productNames:J,hasLibraryProduct:Y,hasExecutableProduct:W,hasPluginProduct:!!B,hasExecutableTarget:K,hasLibraryTarget:L}}function GI($){let Z="",Q=0;while(Q<$.length){if($[Q]==='"'||$[Q]==="'"){let z=$[Q];Z+=z,Q++;while(Q<$.length){if($[Q]==="\\"&&Q+1<$.length){Z+=$[Q]+$[Q+1],Q+=2;continue}if(Z+=$[Q],$[Q]===z){Q++;break}Q++}continue}if($[Q]==="/"&&$[Q+1]==="/"){Q+=2;while(Q<$.length&&$[Q]!==`
257
- `)Q++;continue}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<$.length&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;Q+=2;continue}Z+=$[Q],Q++}return Z}function VI($,Z){let Q=$.map((X)=>X.toLowerCase()),z;for(let X of Z)for(let H of Q)if(H.includes(X)&&(!z||X.length>z.length))z=X;return z}function K3($,Z){let Q=$.map((X)=>X.toLowerCase()),z;for(let[X,H]of Z)for(let U of Q)if(U.includes(X)&&(!z||X.length>z[0].length))z=[X,H];return z}function D3($,Z){let Q=$.map((X)=>X.toLowerCase()),z;for(let[X,H]of Z)if(Q.includes(X)&&(!z||X.length>z[0].length))z=[X,H];return z}function YI($){let Z=$.map((Q)=>Q.toLowerCase());return tL.some((Q)=>Z.includes(Q))}function WI($){let Z=!1,Q=!1,z;for(let X of B1($)){let H=S($,oL(X,"project.pbxproj"));if(!H)continue;for(let U of zI)if(H.includes(U))Z=!0,z=U;for(let U of XI)if(H.includes(U)){if(Q=!0,!z)z=U}}return{hasApplication:Z,hasTool:Q,hit:z}}function BI($){for(let Z of HI)if(I($,Z))return Z;return}function J6($){if(!UI($))return null;let Z=I($,"Package.swift"),Q=B1($),z=Q.length>0,X=null;if(Z){let P=S($,"Package.swift");if(P)X=JI(P)}let H=z?WI($):{hasApplication:!1,hasTool:!1},U=BI($),J=X?.packageUrls??[],G=X?.productNames??[],V=VI(J,aL),Y=YI(G),W=K3(J,eL),B=D3(G,$I),K=K3(J,ZI),L=D3(G,QI),q=!!(V||Y),D=!!(W||B||U),O=!!(X?.hasExecutableProduct||X?.hasExecutableTarget),_=!!(K||L),C=H.hasApplication,F=Z&&z?"spm+xcode":Z?"spm":"xcode",R,N="",w;if(q)if(R="mcp",N="MCP",Y)w="Package.swift + product MCP (Swift MCP)";else w=`Package.swift + ${V} (Swift MCP)`;else if(D)if(R="backend",N=B?.[1]||W?.[1]||(U?"Vapor":""),B)w=`Package.swift + product ${B[1]} (Swift backend)`;else if(W)w=`Package.swift + ${W[1]} (Swift backend)`;else w=`${U} (Swift backend layout)`;else if(C)R="app",N="",w=`${Q[0]} + ${H.hit||"application"} (Swift app)`;else if(_||O&&!D&&!q)if(R="cli",N=L?.[1]||K?.[1]||"",L)w=`Package.swift + product ${L[1]} (Swift CLI)`;else if(K)w=`Package.swift + ${K[1]} (Swift CLI)`;else if(X?.hasExecutableProduct)w="Package.swift + .executable product (Swift CLI)";else w="Package.swift + .executableTarget (Swift CLI)";else if(H.hasTool&&!Z)R="cli",w=`${Q[0]} + tool productType (Swift CLI)`;else if(Z)if(R="library",X?.hasLibraryProduct)w="Package.swift + .library product (Swift library)";else w="Package.swift (Swift library)";else R="library",w=`${Q[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:R,framework:N,packageManager:F,found:w}}var LI=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),II=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),OI={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"]},_I=[["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 MI($,Z){for(let[Q,z]of _I)if(Q in $)return z;return Z.length>0?"framework":"config"}function PI($,Z){try{let Q=JSON.parse(S($,Z)??""),z=["background","content_scripts","action","browser_action","permissions"].some((X)=>(X in Q));if(typeof Q.manifest_version==="number"&&z)return"chrome";return"other"}catch{return"other"}}function FI($,Z){if(Z.isFile())return!0;if(!Z.isSymbolicLink())return!1;return O0($,Z.name)?.isFile()===!0}function RI($,Z){if(Z.isDirectory())return!0;if(!Z.isSymbolicLink())return!1;return O0($,Z.name)?.isDirectory()===!0}function NI($){let Z=[],Q=DI($),z=new Set,X=v(Q);if(!X)return Z;for(let H of X){let U=H.name;if(U.endsWith(".xcodeproj")?!RI(Q,H):!FI(Q,H))continue;if(U.toLowerCase().endsWith(".csproj")){let G=x8(Q);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 Y=G.framework?[G.framework,"C#",".NET"]:["C#",".NET"];Z.push({slots:V,priority:36,frameworks:Y,fileName:U})}continue}if(U.endsWith(".xcodeproj")){let G=J6(Q);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"&&G.framework)V.framework=G.framework;let Y=G.framework?[G.framework,"Swift"]:["Swift"];Z.push({slots:V,priority:36,frameworks:Y,fileName:U})}continue}let J=G1[U];if(!J)continue;if(U==="manifest.json"&&PI(Q,U)!=="chrome")continue;if(U==="pubspec.yaml"){let G=S8(Q);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:J.priority,frameworks:G.isFlutter?["Flutter","Dart"]:["Dart"],fileName:U});continue}}if(U==="go.mod"){let G=b8(Q);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 Y=G.framework?[G.framework,"Go"]:["Go"];Z.push({slots:V,priority:J.priority,frameworks:Y,fileName:U});continue}}if(U==="Gemfile"||U==="Gemfile.lock"||U==="gems.rb"){let G=g8(Q);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 Y=G.framework?[G.framework,"Ruby"]:["Ruby"];Z.push({slots:V,priority:J.priority??35,frameworks:Y,fileName:U});continue}}if(U==="Package.swift"){let G=J6(Q);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"&&G.framework)V.framework=G.framework;let Y=G.framework?[G.framework,"Swift"]:["Swift"];Z.push({slots:V,priority:J.priority??36,frameworks:Y,fileName:U});continue}}if(U==="pom.xml"||U==="build.gradle"||U==="build.gradle.kts"||U==="settings.gradle"||U==="settings.gradle.kts"){if(z.has(Q))continue;z.add(Q);let G=X6(Q);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 Y=G.framework?[G.framework,"JVM",G.mainLanguage==="Kotlin"?"Kotlin":"Java"]:["JVM",G.mainLanguage==="Kotlin"?"Kotlin":"Java"];Z.push({slots:V,priority:J.priority??35,frameworks:Y,fileName:U});continue}}Z.push({slots:J.slots||{},priority:J.priority,frameworks:J.frameworks,fileName:U})}return Z}function TI($){let Z=[];for(let Q of e2($,()=>I3($,2,{count:0}))){let z=G1[`*${Q}`],X=z?.slots?.mainLanguage;if(X)Z.push({slots:{mainLanguage:X},priority:z.priority,frameworks:z.frameworks})}return Z}function L3($){let Z=[...NI($),...TI($)],Q={},z={},X=new Set;for(let V of Z){V.frameworks.forEach((Y)=>X.add(Y));for(let[Y,W]of Object.entries(V.slots))if(W&&!W.includes("/")&&(!(Y in Q)||V.priority>z[Y]))Q[Y]=W,z[Y]=V.priority}let H=new Map;for(let V of Z){if(!V.fileName)continue;if(!H.has(V.fileName))H.set(V.fileName,{fileName:V.fileName,category:MI(V.slots,V.frameworks),priority:V.priority})}let U=[...H.values()].sort((V,Y)=>Y.priority-V.priority||V.fileName.localeCompare(Y.fileName)),J=[];if(Q.mainLanguage)J.push(Q.mainLanguage.toLowerCase());if(Q.framework)J.push(Q.framework.toLowerCase());let G=J.length>0?J.join("-"):"unknown-stack";return{slotFills:Q,frameworks:[...X],confirmedCount:Z.length,discoveredFormats:U,stackSignature:G}}function v8($){let{slotFills:Z}=L3($),Q={};for(let[z,X]of Object.entries(Z)){let H=OI[z];if(!H||!X)continue;let[U,J]=H;if(U==="project")(Q.project??={})[J]=X;else(Q.stack??={})[J]=X}return Q}function I3($,Z,Q){let z=new Set;if(Z<0||Q.count>400)return z;let X=v($);if(!X)return z;for(let H of X){if(Q.count++>400)break;if(!H.isDirectory()){let U=KI(H.name);if(II.has(U))z.add(U);continue}if(LI.has(H.name)||H.name.startsWith("."))continue;for(let U of I3(qI($,H.name),Z-1,Q))z.add(U)}return z}var $0=($,Z,Q)=>({value:$,source:Z,confidence:Q});function O3($,Z={}){let Q=Z.toolingRoot?null:AI($),z=CI($),X={},H=(U,J)=>{if(J)X[U]=J};return H("what",SI(Q,z)),H("who",EI(z)),H("why",bI(z)),H("where",yI(Q,z)),H("when",xI(z)),H("how",gI(Q,z)),X}function k8($,Z={}){let Q=O3($,Z),z={};return Object.keys(Q).forEach((X)=>{let H=Q[X];if(H)z[X]=H.value}),z}function AI($){let Z=S($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function CI($){let Z=S($,"README.md");if(Z===null)return"";return Z.replace(/<!--[\s\S]*?-->/g,"").split(`
249
+ `}var FK='<meta name="description" content="Visual render of project.faf.';function RK($){return new TextDecoder().decode($).split(/\r?\n/).some((Z)=>Z.trim().startsWith(FK)&&Z.includes(" by faf"))}function NK($,Z,Q,z="project.faf",X={}){$6(KK($,"project.html"),mZ(Z,Q,z),{root:$,format:"html",hasMark:RK,mark:"faf mark (the `Visual render of project.faf` description line)",force:X.force})}var TK=DK(mZ,"faf-cli: generateProjectHtml is deprecated, use renderProjectHtml","FAF0001");import{join as dK}from"path";import{deprecate as iK}from"node:util";var Q$="https://faf.one/ext/context/v1",pZ="io.modelcontextprotocol.registry/publisher-provided";function S0($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:"application/vnd.faf+yaml",iana:"https://www.iana.org/assignments/media-types/application/vnd.faf+yaml",deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function I2($,Z={}){let Q={"one.faf/context":S0($,Z)},z=new TextEncoder().encode(JSON.stringify(Q)).length;if(z>4096)throw Error(`publisher-provided _meta is ${z}B — exceeds the registry ${"4096"}B cap`);return{["io.modelcontextprotocol.registry/publisher-provided"]:Q}}var WQ="JSONRPC",dZ="1.0",M8=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],P8="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",BQ="https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",qQ="1.0",KQ="1.0",lZ={a2a:"application/a2a-agent-card+json",server_card:"application/mcp-server-card+json",fafa:"application/vnd.fafa+yaml"};function DQ($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function O2($,Z={}){let Q=DQ($);if(Q.length>0)return Q;let z=Z.doorUrl?.trim();if(z)return[{protocol:"a2a",location:z,version:dZ}];return[]}function AK($){try{return`https://${z$($)}/.well-known/fafa`}catch{return}}function iZ($,Z,Q={}){let z=S0(Z,Q),X=$.agent??{},H={fafaSpecVersion:String($.version??KQ),mediaTypes:[...M8],provenance:{faf:z.faf,mediaType:z.mediaType},generated:z.generated};if(X.id)H.agentId=X.id;let U=AK($);if(U)H.passport=U;return{uri:Q$,description:"FAF passport and project DNA as typed parts",required:!1,params:H}}function CK($){let Z=new Set;for(let Q of $.capabilities??[])if(Q.cites_spec&&M8.includes(Q.cites_spec))Z.add(Q.cites_spec);return["text/plain",...Z]}function F8($,Z={}){let Q=$.agent??{},z=O2($,Z);if(z.length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");let X=String(Q.displayName??$.metadata?.persona??Q.name??"").trim(),H=String(Q.description??"").trim(),U=String(Q.version??"").trim();if(!X||!H||!U)throw Error("A2A card needs agent.displayName|name, description, version in .fafa");let J=String(Q.vendor??"").trim(),G=String(Q.homepage??"").trim(),V=J&&G?{organization:J,url:G}:void 0,Y=($.capabilities??[]).map((W)=>{let B=String(W.name??"").trim();if(!B)throw Error("A2A skill missing capabilities[].name");let K=Array.isArray(W.tags)?W.tags.map(String):[],L=W.cites_spec&&M8.includes(W.cites_spec)?[W.cites_spec,"text/plain"]:void 0;return{id:B,name:B,description:String(W.description??"").trim()||B,tags:K,...L?{inputModes:L}:{}}});return{name:X,description:H,supportedInterfaces:z.map((W)=>({url:String(W.location),protocolBinding:WQ,protocolVersion:String(W.version??dZ)})),...V?{provider:V}:{},version:U,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[...Z.extensions??[]]},defaultInputModes:CK($),defaultOutputModes:["text/plain","application/json"],skills:Y}}var jK=/^[a-z0-9][a-z0-9._-]*$/,wK=/^(@[a-z0-9~][a-z0-9-._~]*\/)?[a-z0-9~][a-z0-9-._~]*$/,SK=/^[A-Za-z0-9]([A-Za-z0-9._-]*[A-Za-z0-9])?$/,EK=/^[A-Za-z0-9][^\s]*$/,bK=["a2a","mcp"],yK=/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/;function T($){return String($??"").trim()}function _8($){return Array.isArray($)?$.map(T).filter(Boolean):[]}function xK($){return T($).toLowerCase().replace(/^https?:\/\//,"").replace(/\/.*$/,"").replace(/^www\./,"")}function gK($,Z,Q){let z=["display_name","description","version"].filter((X)=>!T($[X]));if(z.length)throw Error(`Missing answer: ${z.join(", ")}`);if(!jK.test(Z))throw Error("Short name: lowercase letters, digits, dots, hyphens or underscores.");if(!yK.test(Q))throw Error(`Domain "${$.domain}" is not a domain name (e.g. example.com).`)}function vK($,Z){return($.skills??[]).filter((Q)=>T(Q.name)).map((Q)=>({name:T(Q.name),type:T(Q.type)||"tool",description:T(Q.description)||T(Q.name),tags:Z.length?Z:[T(Q.name).toLowerCase()]}))}function kK($){let Z=($.packages??[]).filter((Q)=>T(Q.registryType)&&T(Q.identifier));for(let Q of Z){let z=T(Q.registryType),X=T(Q.identifier);if(z==="npm"&&!wK.test(X))throw Error(`Package "${X}" is not an npm package name (e.g. weather-mcp or @acme/weather).`);if(z==="pypi"&&!SK.test(X))throw Error(`Package "${X}" is not a PyPI package name (e.g. weather-mcp or weather_mcp).`);if(z!=="npm"&&z!=="pypi"&&!EK.test(X))throw Error(`Package "${X}" is not a ${z} package identifier: it must start with a letter or digit and have no spaces.`)}return Z.map((Q)=>({registryType:T(Q.registryType),identifier:T(Q.identifier),...T(Q.version)?{version:T(Q.version)}:{}}))}function hK($){if(/\s/.test($))return!1;try{let Z=new URL($);return(Z.protocol==="http:"||Z.protocol==="https:")&&Z.hostname!==""}catch{return!1}}function uK($){if(!hK(T($.url)))throw Error(`Where it runs: "${T($.url)}" is not an http(s) URL (or give an npm package).`);if(!bK.includes(T($.protocol).toLowerCase()))throw Error(`Protocol "${T($.protocol)}": a2a or mcp.`)}function fK($,Z){let Q=($.endpoints??[]).filter((X)=>T(X.url));Q.forEach(uK);let z=[...Q.map((X)=>({protocol:T(X.protocol).toLowerCase(),transport:"http",location:T(X.url)})),...Z.map((X)=>({protocol:"mcp",transport:"stdio",location:X.identifier}))];if(z.length===0)throw Error("Missing answer: endpoints (a URL, or a package people install)");return z}function mK($,Z,Q,z){let X={domain:Z},H=[["repository",T($.repository)],["icon",T($.icon)],["organizationUrl",T($.organization_url)]];for(let[J,G]of H)if(G)X[J]=G;if(Q.length)X.keywords=Q;let U=_8($.example_requests);if(U.length)X.examples=U;if(z.length)X.packages=z;return X}function LQ($){let Z=T($.handle).toLowerCase(),Q=xK($.domain);gK($,Z,Q);let z=_8($.tags),X=kK($),H={name:Z,displayName:T($.display_name),id:`urn:air:${Q}:agent:${Z}`,...T($.organization)?{vendor:T($.organization)}:{},version:T($.version),description:T($.description),homepage:T($.homepage)||`https://${Q}`,...T($.license)?{license:T($.license)}:{}};return{version:KQ,agent:H,capabilities:vK($,z),endpoints:fK($,X),metadata:{cards:mK($,Q,z,X)}}}function IQ($){return q2($,{lineWidth:0})}function z$($){let Z=T($.agent?.id),Q=/^urn:air:([^:]+):/.exec(Z);if(Q)return Q[1];let z=T($.metadata?.cards?.domain);if(z)return z;try{return new URL(T($.agent?.homepage)).hostname.replace(/^www\./,"")}catch{throw Error("The .fafa names no domain (agent.id urn:air, metadata.cards.domain or agent.homepage).")}}function OQ($){let Z=T($.agent?.name).toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/^-+|-+$/g,"");if(!Z)throw Error("The .fafa needs agent.name (the short name).");return Z}function nZ($){return`${z$($).split(".").reverse().join(".")}/${OQ($)}`}function cZ($){let Z=$.replace(/\s+/g," ").trim();return Z.length<=100?Z:`${Z.slice(0,97).trimEnd()}...`}function _2($){return($.endpoints??[]).filter((Z)=>T(Z.protocol).toLowerCase()==="mcp"&&/^https?:\/\//.test(T(Z.location))).map((Z)=>({type:"streamable-http",url:T(Z.location)}))}function pK($){if(!$)return;try{let Z=new URL($).hostname.replace(/^www\./,"");return{url:$,source:Z.split(".")[0]}}catch{return}}function _Q($){let Z=$.agent??{},Q=$.metadata?.cards??{},z=T(Z.description),X=T(Z.version);if(!z||!X)throw Error("An MCP card needs agent.description and agent.version in .fafa");let H={name:nZ($),version:X,description:cZ(z)},U=T(Z.displayName);if(U)H.title=cZ(U);let J=T(Z.homepage);if(J)H.websiteUrl=J;let G=pK(T(Q.repository));if(G)H.repository=G;if(T(Q.icon))H.icons=[{src:T(Q.icon)}];return H}function MQ($){return($.metadata?.cards?.packages??[]).map((Z)=>({registryType:T(Z.registryType),identifier:T(Z.identifier),...T(Z.version)?{version:T(Z.version)}:{},transport:{type:"stdio"}}))}function rZ($){return _2($).length>0||MQ($).length>0}function PQ($){let Z=T($.agent?.displayName);return{name:nZ($),...Z?{title:cZ(Z)}:{}}}function R8($,Z,Q={}){let z=_2($);if(z.length===0)throw Error("A Server Card describes a remote MCP server: the .fafa has no mcp endpoint at an http(s) URL.");return{$schema:P8,..._Q($),remotes:z,...Z?{_meta:{"one.faf/context":S0(Z,Q)}}:{}}}function FQ($,Z,Q={}){let z=_2($),X=MQ($);if(z.length===0&&X.length===0)throw Error("A registry entry needs a package people install or a remote MCP URL.");return{$schema:BQ,..._Q($),...X.length?{packages:X}:{},...z.length?{remotes:z}:{},...Z?{_meta:I2(Z,Q)}:{}}}function lK($,Z,Q){if(!Z.includes("a2a")||O2($,Q).length===0)return;return Q.a2aCardUrl??`https://${z$($)}/.well-known/agent-card.json`}function N8($,Z,Q={}){let z=z$($),X=OQ($),H=$.agent??{},U=T(H.displayName)||T(H.name),J=T(H.description),G=T(H.version),V=Q.now??new Date().toISOString(),Y=(K,L,q)=>({identifier:`urn:air:${z}:${K}:${X}`,displayName:U,type:L,description:J,url:q,...G?{version:G}:{},updatedAt:V}),W=[],B=lK($,Z,Q);if(B)W.push(Y("a2a",lZ.a2a,B));if(Z.includes("server_card")){let K=_2($)[0];if(K)W.push(Y("mcp",lZ.server_card,`${K.url.replace(/\/+$/,"")}/server-card`))}if(Q.listFafa!==!1)W.push(Y("agent",lZ.fafa,`https://${z}/.well-known/fafa`));return W}function T8($){let Z=$.agent??{},Q=T(Z.vendor)||T(Z.displayName)||T(Z.name);if(!Q)return;let z;try{z=z$($)}catch{z=void 0}return{displayName:Q,...z?{identifier:z}:{}}}function RQ($,Z,Q={}){let z=T8($);return{specVersion:qQ,...z?{host:z}:{},entries:N8($,Z,Q)}}function sZ($){let Z=$.metadata?.cards??{},Q=_8(Z.keywords),z=_8(Z.examples);return{...Q.length?{tags:Q}:{},...z.length?{representativeQueries:z}:{}}}function NQ($,Z,Q={}){let z=T8($),X=sZ($);return{specVersion:qQ,...z?{host:z}:{},entries:N8($,Z,Q).map((H)=>({...H,...X}))}}function TQ($,Z){let Q=new Set(Z.cards),z={fafa:$,fafaText:IQ($)},{faf:X}=Z;if(Q.has("a2a")){let U=[...Z.a2aExtensions??[],...X?[iZ($,X,Z)]:[]];z.a2a=F8($,{extensions:U})}if(Q.has("server_card"))z.server_card=R8($,X,Z);if(Q.has("server_json"))z.server_json=FQ($,X,Z);let H={now:Z.now,listFafa:Z.listFafa};if(Q.has("ai_catalog"))z.ai_catalog=RQ($,Z.cards,H);if(Q.has("ard"))z.ard=NQ($,Z.cards,H);return z}function cK($,Z){return TQ(LQ($),Z)}var nK=P8,rK=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function AQ($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&rK.test(Z))return Z;let Q=$.project?.homepage??$.project?.website??$.project?.url,z="local";if(Q)try{z=new URL(Q).hostname.replace(/^www\./,"").split(".").reverse().join(".")}catch{}let X=Z.replace(/[^a-zA-Z0-9._-]/g,"-").replace(/^-+|-+$/g,"")||"project";return`${z}/${X}`}function sK($){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 Z6($,Z={}){let Q={$schema:nK,name:AQ($),version:String($.project?.version??"0.1.0"),description:sK($)},z=A8($)??$.project?.name;if(z&&z.length<=100)Q.title=z;let X=$.project?.homepage??$.project?.website??$.project?.url;if(X)Q.websiteUrl=X;if(Z.remoteUrl)Q.remotes=[{type:"streamable-http",url:Z.remoteUrl}];return Q._meta={"one.faf/context":S0($,Z)},Q}function aZ($){return AQ($)}function A8($){let Z=$.project?.title;if(typeof Z==="string"){let Q=Z.trim();if(Q&&Q.length<=100)return Q}return}function oK($){try{return JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return}}var oZ=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function CQ($){let Z=oK($);return oZ(Z)&&oZ(Z._meta)&&oZ(Z._meta["one.faf/context"])}function aK($,Z,Q={},z={}){let X=Z6(Z,Q),H=dK($,"server-card");return $6(H,`${JSON.stringify(X,null,2)}
250
+ `,{root:$,format:"json",hasMark:CQ,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:z.force}),H}function tK($,Z){let Q={name:Z.name,title:Z.title,version:Z.version,_meta:Z.meta};return e$($,Q,{"":{name:["$schema"],title:["name"],version:["description","title","name"]}})}var eK=iK(Z6,"faf-cli: generateServerCard is deprecated, use buildServerCard","FAF0002");import{existsSync as jQ}from"fs";import{basename as $D,dirname as SQ,join as wQ}from"path";import{deprecate as ZD}from"node:util";var QD=["a2a","mcp","registry","catalog","ard"];function zD($){return m0(Z0(h(SQ($),$D($))))}function XD($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let z of Z){let X=wQ($,z);if(jQ(X))return X}let Q=SQ($);if(Q!==$)for(let z of Z){let X=wQ(Q,z);if(jQ(X))return X}return null}function tZ($,Z,Q={}){if(O2($,Q).length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");return F8($,{doorUrl:Q.doorUrl,extensions:Z?[iZ($,Z,Q)]:[]})}var HD=ZD(tZ,"faf-cli: generateA2ACard is deprecated, use buildA2ACard","FAF0003");function UD($,Z={},Q={}){return N8($,["a2a","server_card"],{now:Q.now??Z.generated??new Date().toISOString(),a2aCardUrl:Q.a2aCardUrl,doorUrl:Q.doorUrl})}function JD($,Z){return $.findIndex((Q)=>Q.identifier===Z.identifier)}function GD($,Z,Q){let z=$?{...$,entries:[...$.entries??[]]}:{specVersion:"1.0",entries:[]},X=Q&&z.host===void 0?(({specVersion:H,...U})=>({specVersion:H,host:{...Q},...U}))(z):z;for(let H of Z){let U=JD(X.entries,H);if(U>=0)X.entries[U]={...X.entries[U],url:H.url,type:H.type,...H.updatedAt?{updatedAt:H.updatedAt}:{}};else X.entries.push(H)}return X}function VD($,Z={}){return[...O2($,Z).length>0?["a2a"]:[],..._2($).length>0?["mcp"]:[],...rZ($)?["registry"]:[],"catalog","ard"]}function YD($){let Z=$.opts??{},Q=$.faf,z=$.fafa,X=Q?QD:z?VD(z,Z):[],H=new Set($.targets?.length?$.targets:X),U={};if(Q)U.block=S0(Q,Z);if(H.has("mcp"))if(z&&_2(z).length>0)U.mcp=R8(z,Q,Z);else if(Q)U.mcp=Z6(Q,Z);else throw Error("A Server Card needs an MCP endpoint at an http(s) URL in the .fafa, or a project.faf.");if(H.has("registry"))if(z&&rZ(z))U.registry={...PQ(z),...Q?{_meta:I2(Q,Z)}:{}};else if(Q){let J=A8(Q);U.registry={name:aZ(Q),...J?{title:J}:{},_meta:I2(Q,Z)}}else throw Error("A registry entry needs a package or a remote MCP URL in the .fafa, or a project.faf.");if(H.has("a2a")||H.has("catalog")||H.has("ard")){if(!$.fafa){if($.targets?.some((J)=>J==="a2a"||J==="catalog"||J==="ard"))throw Error("A2A/catalog/ARD require a .fafa (agent.fafa). Will not invent an agent.")}}if(H.has("a2a")&&$.fafa)if(O2($.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 U.a2a=tZ($.fafa,Q,Z);if((H.has("catalog")||H.has("ard"))&&$.fafa){let J=UD($.fafa,Q,Z);if(H.has("catalog"))U.catalog=J;if(H.has("ard")){let V=sZ($.fafa);U.ard=J.map((Y)=>({...Y,...V}))}let G=T8($.fafa);if(G)U.catalogHost=G}return WD(U),U}function WD($){if(!$.block)return;let Z=JSON.stringify($.block),Q=[];if($.mcp){let z=$.mcp._meta;Q.push(JSON.stringify(z["one.faf/context"]))}if($.registry?._meta){let z=$.registry._meta["io.modelcontextprotocol.registry/publisher-provided"];Q.push(JSON.stringify(z["one.faf/context"]))}for(let z of Q)if(z!==Z)throw Error("context block drifted across card targets — one projector, one block");if($.a2a){let z=$.a2a.capabilities.extensions?.find((U)=>U.uri===Q$);if(!z)throw Error("A2A card has no FAF context extension, but a project.faf was given");let X=z.params,H=$.block;if(X.provenance?.faf!==H.faf||X.provenance?.mediaType!==H.mediaType)throw Error("A2A extension provenance drifted from the context block — one context, every door")}}var eZ=["ephemeral","standard","high","critical"],z2=Object.fromEntries(eZ.map(($,Z)=>[$,Z])),C8=new Set(["user","feedback","project","reference"]),$1=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),Z1=new Set(["facts","sessions","preferences","custom"]),Q1={low:"ephemeral",medium:"standard"};import{existsSync as BD}from"fs";import{dirname as vQ,resolve as kQ}from"path";function M2(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function f($){return $===null||$===void 0}function qD($){if(Array.isArray($))return`a list (${$.length} item${$.length===1?"":"s"})`;if(f($))return"empty";if(typeof $==="string")return`a string (${JSON.stringify($.length>40?`${$.slice(0,40)}…`:$)})`;return`a ${typeof $}`}var H$=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function KD($){let Z=kQ($),Q=h(vQ(Z),Z,{read:!0});return{real:Q,text:Z0(Q)}}function EQ($,Z,Q,z){let X=kQ($),H=h(vQ(X),X),U=Q!==void 0&&Q.real===H;if(U&&Q.text===Z)return H;let J;try{J=I0(H)}catch{J=void 0}if(J&&J.equals(Buffer.from(Z,"utf-8")))return H;if(!U&&!z&&J)throw new b("changed",X,`${X} already exists — not written; pass { replace: true } (faf memory convert --force) to replace it`,{onWrite:!0});let G=U?Q.text:z?J:null;return e($,Z,G===void 0?{}:{expect:G})}function U$($){if(f($))return"standard";if(Q1[$])return Q1[$];if($ in z2)return $;return"standard"}var DD=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function z1($){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=$,Q={};for(let[z,X]of Object.entries(Z))if(!DD.has(z))Q[z]=X;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:U$(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:Q}}function X$($){if(f($.id)&&f($.type)&&$.tags.length===0&&$.links.length===0&&f($.timestamp)&&f($.source)&&Object.keys($.extra).length===0&&$.priority==="standard")return $.text;let Q={text:$.text};if(!f($.id))Q.id=$.id;if(!f($.type))Q.type=$.type;if(Q.priority=$.priority,$.tags.length)Q.tags=$.tags;if($.links.length)Q.links=$.links;if(!f($.timestamp))Q.timestamp=$.timestamp;if(!f($.source))Q.source=$.source;return Object.assign(Q,$.extra),Q}function bQ($){let Z=$;return H$($)&&typeof Z.text==="string"&&Array.isArray(Z.tags)&&Array.isArray(Z.links)&&H$(Z.extra)&&typeof Z.priority==="string"?Z:z1($)}function LD($){if(typeof $==="string"||H$($)&&"text"in $)return z1($);return null}var yQ=["profile","namepoint","created","last_etched","retention"];class Y0{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??M2(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.map(bQ):[],this._byId=new Map,this._facts.forEach((Q,z)=>{if(!f(Q.id))this._byId.set(Q.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}:{},this._indexDerived=Z.index===void 0||l(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(!BD($))throw Error(`soul file not found: ${$}`);let{real:Z,text:Q}=KD($);return Y0.fromText(Q,$,Z)}static fromText($,Z,Q){let z=jZ($,Z).toJS();if(!H$(z))throw Error(`soul is not a YAML mapping: ${Z} is ${qD(z)}`);let X=new hQ,H=X.pick("memory",z.memory,u)??{},U=new Y0(String(z.namepoint??Z.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(z.profile??"voice"),retention:String(z.retention??"forever"),created:z.created??null,...X.modelled(z,H)});return(X.pick("memory.facts",H.facts,Array.isArray)??[]).forEach((J,G)=>{let V=LD(J);if(V)U.adopt(V,G)}),U.last_etched=String(z.last_etched??U.created),U._version=f(z.version)?void 0:String(z.version),U._origin={path:Z,real:Q,text:$,base:U.state(),residual:X.residual},U.recordIndex(),U}recordIndex(){this._indexDerived=this.indexIsDerived(),this._indexAtRecord=this._index.slice()}adopt($,Z){if(this._facts.push($),!f($.id))this._byId.set($.id,this._facts.length-1);this._factAt.set($,Z)}static fromFile($){return Y0.load($)}toDoc(){let $={facts:this._facts.map(X$),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[Q,z]of Object.entries(this._memoryExtra))if(!Z1.has(Q))$[Q]=structuredClone(z);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[Q,z]of Object.entries(this._extra))if(!$1.has(Q))Z[Q]=structuredClone(z);return Z}toYaml(){return q2(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")&&l(this._index,this.derivedIndex($))}rebuildIndex($=80){return this._index=this.derivedIndex($),this._indexDerived=!0,this._indexAtRecord=this._index.slice(),this._index}save($,Z={}){let Q=Z.reindex??(this._indexDerived&&l(this._index,this._indexAtRecord));if(Q)this.rebuildIndex();let z=Z.replace===!0,X=this._origin;if(!X){let G=this.toYaml(),V=EQ($,G,void 0,z);return this.settle($,G,new Map(this._facts.map((Y,W)=>[Y,W])),V),$}let H=new Map,{text:U}=q8(X.text,(G)=>{H=this.applyTo(G,X,Q)},$),J=EQ($,U,X.real===void 0?void 0:{real:X.real,text:X.text},z);return this.settle($,U,H,J),$}toFile($,Z={}){return this.save($,Z)}settle($,Z,Q,z){this._factAt=new WeakMap;for(let[X,H]of Q)this._factAt.set(X,H);this._origin={path:$,real:z,text:Z,base:this.state(),residual:this._origin?.residual??new Map},this.recordIndex()}state(){let $=new Map;for(let Z of this._facts){let Q=this._factAt.get(Z);if(Q!==void 0)$.set(Q,structuredClone(X$(Z)))}return{top:Object.fromEntries(yQ.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,Q){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 ${Q}. Nothing written.`)}applyTo($,Z,Q){let z=Z.base,X=this.state(),H=Z.path;for(let U of yQ)if(z.top[U]!==X.top[U])$.set(U,X.top[U]);if(!l(z.index,X.index)){if(Z.residual.has("index")&&!Q)Y0.refuse(Z,"index","replace it");D8($,["index"],Z.residual.has("index")?void 0:z.index,X.index,H)}for(let U of gQ(z.extra,X.extra))D8($,[U],z.extra[U],X.extra[U],H);return this.applyMemory($,Z,z,X),this.applyFacts($,Z)}applyMemory($,Z,Q,z){let X=[["sessions",Q.sessions,z.sessions],["preferences",Q.preferences,z.preferences],["custom",Q.custom,z.custom],...gQ(Q.memoryExtra,z.memoryExtra).map((H)=>[H,Q.memoryExtra[H],z.memoryExtra[H]])];for(let[H,U,J]of X){if(l(U,J))continue;if(Z.residual.has("memory"))Y0.refuse(Z,"memory",`change memory.${H}`);if(Z.residual.has(`memory.${H}`))Y0.refuse(Z,`memory.${H}`,"replace it");D8($,["memory",H],U,J,Z.path)}}sortFacts($){let Z=[],Q=[];for(let z of this._facts){let X=this._factAt.get(z);if(X===void 0){Q.push(z);continue}if(Q.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([z,X])}return{kept:Z,added:Q}}applyFacts($,Z){let{kept:Q,added:z}=this.sortFacts(Z),X=new Set(Q.map(([,V])=>V)),H=[...Z.base.facts.keys()].filter((V)=>!X.has(V)).sort((V,Y)=>Y-V),U=Q.filter(([V,Y])=>!l(Z.base.facts.get(Y),X$(V))),J=new Map(Q);if(z.length===0&&H.length===0&&U.length===0)return J;for(let V of["memory","memory.facts"])if(Z.residual.has(V))Y0.refuse(Z,V,"add facts to it");let G=b9($,["memory","facts"],Z.path);for(let[V,Y]of U)G.items[Y]=OD($,G.items[Y],Z.base.facts.get(Y),X$(V));for(let V of H)G.items.splice(V,1);for(let[V,Y]of Q)J.set(V,Y-H.filter((W)=>W<Y).length);for(let V of z)J.set(V,G.items.length),G.items.push($.createNode(X$(V)));return J}add($){let Z=bQ($);if(!f(Z.id)&&this._byId.has(Z.id)){let Q=this._byId.get(Z.id);if(Q!==void 0){let z=this._factAt.get(this._facts[Q]);if(this._facts[Q]=Z,z!==void 0)this._factAt.set(Z,z)}}else if(this._facts.push(Z),!f(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 Q=f(Z.id)?null:this.getFact(Z.id);if(Q)return this.add(ID(Q,$,Z));return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:U$(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:M2(),source:Z.source??null,extra:{}})}recall($,Z={}){let Q=H$($)?{...$,...Z}:Z,z=H$($)?$.query:$,X=z2[U$(Q.minPriority??"ephemeral")]??0,H=typeof z==="string"?z.toLowerCase():"",U=new Set(Q.tags??[]),J=[];this._facts.forEach((V,Y)=>{if(H&&!String(V.text??"").toLowerCase().includes(H))return;if(U.size>0&&![...U].some((W)=>(V.tags??[]).includes(W)))return;if(!f(Q.type)&&V.type!==Q.type)return;if((z2[V.priority]??1)<X)return;J.push([Y,V])}),J.sort((V,Y)=>{let W=z2[V[1].priority]??1,B=z2[Y[1].priority]??1;if(B!==W)return B-W;let K=V[1].timestamp??"",L=Y[1].timestamp??"";if(L!==K)return L<K?-1:L>K?1:0;return Y[0]-V[0]});let G=J.map(([,V])=>V);if(!f(Q.limit))return G.slice(0,Q.limit);return G}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((Q,z)=>{if(!f(Q.id))this._byId.set(Q.id,z)}),!0}}function ID($,Z,Q){let z=(X,H)=>f(X)?H:X;return{...$,text:Z,type:z(Q.type,$.type),priority:f(Q.priority)?$.priority:U$(Q.priority),tags:z(Q.tags,$.tags).slice(),links:z(Q.links,$.links).slice(),source:z(Q.source,$.source),timestamp:M2(),extra:{...$.extra}}}class hQ{residual=new Map;pick($,Z,Q){if(f(Z))return;if(Q(Z))return Z;this.residual.set($,d$(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,u)??{}),custom:structuredClone(this.pick("memory.custom",Z.custom,u)??{}),extra:xQ($,$1),memoryExtra:xQ(Z,Z1)}}}function xQ($,Z){let Q={};for(let[z,X]of Object.entries($))if(!Z.has(z))Q[z]=structuredClone(X);return Q}function gQ($,Z){return[...new Set([...Object.keys($),...Object.keys(Z)])]}function OD($,Z,Q,z){if(!p(Z))return o$($,Z,Q,z);let X=(H)=>typeof H==="string"?{text:H}:H;return o$($,Z,X(Q),X(z))}import{readdirSync as _D,readFileSync as MD,statSync as uQ,existsSync as PD}from"fs";import{join as FD,basename as fQ,resolve as RD}from"path";var mQ=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),ND=/\[\[([^\]]+)\]\]/g;function TD($){let Z=uQ($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function AD($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let Q=m0(Z[1]);if(!Q||typeof Q!=="object")return{fm:null,body:Z.slice(2).join("---").trim()};return{fm:Q,body:Z.slice(2).join("---").trim()}}catch{return{fm:null,body:$}}}function CD($,Z,Q){if(!Q.name)return null;let z=Q.metadata&&typeof Q.metadata==="object"?Q.metadata:{},X=z.type;if(typeof X!=="string"||!C8.has(X))return null;let H=String(Q.name).trim(),J=(Q.description!==void 0&&Q.description!==null&&String(Q.description).trim()?String(Q.description).trim():"")||H,G={};if(z.originSessionId)G.provenance=[`session:${z.originSessionId}`];let V=[...new Set([...Z.matchAll(ND)].map((Y)=>Y[1]))].sort();return{text:J,id:H,type:X,priority:"standard",tags:[],links:V,timestamp:TD($),source:`claude-code memory: ${fQ($)}`,extra:G}}function pQ($,Z={}){let Q=RD($);if(!PD(Q))throw Error(`Claude memory directory not found: ${Q}`);if(!uQ(Q).isDirectory())throw Error(`Claude memory path is not a directory: ${Q}`);let z=Z.skip??mQ,X=Z.namepoint??`@claude-code:${fQ(Q)}`,H=[],U=_D(Q).filter((W)=>W.endsWith(".md")).sort();for(let W of U){if(z.has(W))continue;let B=FD(Q,W),K;try{K=MD(B,"utf-8")}catch{continue}let{fm:L,body:q}=AD(K);if(!L)continue;let D=CD(B,q,L);if(D)H.push(D)}let J=H.map((W)=>W.timestamp).filter(Boolean),G=J.length?J.reduce((W,B)=>W<B?W:B):M2(),V=J.length?J.reduce((W,B)=>W>B?W:B):G,Y=new Y0(X,{profile:"knowledge",facts:H,created:G});return Y.last_etched=V,Y.rebuildIndex(),Y}var nQ="faf-interview/1",J$="(terse — 3-4 words)",X1=[{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}],rQ=[{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}],G$=[...X1,...rQ],sQ=new Map(G$.map(($)=>[$.path,$])),jD=Object.fromEntries(G$.map(($)=>[$.path,$]));function H1($){let Z=sQ.get($);if(Z)return Z.question;let Q=g0.get($)??m.find((z)=>z.canonical===$);return Q?`${Q.description}?`.replace(/\?\?$/,"?"):`${$}?`}function wD($,Z){return G$.filter((Q)=>{let z=Q.path.split("."),X=$;for(let H of z)if(X&&typeof X==="object"&&H in X)X=X[H];else{X=void 0;break}if(X==="slotignored")return!1;return Z(X)})}var SD=new Set(["developers","development teams","development team","teams","development","cloud platform","web platform","platform","best practices","improve development efficiency","development efficiency","modern development practices","modern development","test-driven development","production/stable","production","stable","app","project","tool"]),ED=[["npm",/\bnpm\b/i],["PyPI",/\bpypi\b/i],["crates.io",/\bcrates\.io\b/i],["Homebrew",/\bhomebrew\b/i],["Docker",/\bdocker\b/i],["Cloudflare",/\bcloudflare\b/i],["Vercel",/\bvercel\b/i],["Netlify",/\bnetlify\b/i],["AWS",/\baws\b/i],["Cloud Run",/\bcloud run\b/i],["edge",/\bedge\b/i],["browser",/\bbrowser\b/i],["WASM",/\bwasm\b/i],["GitHub",/\bgithub\b/i],["MCP Registry",/\bmcp registry\b/i],["Chrome Web Store",/\bchrome web store\b/i],["Smithery",/\bsmithery\b/i]],lQ=($)=>SD.has($.toLowerCase().trim()),bD=/^(?:with|and|or|using|for|to|that|who|whom|whose|the|a|an|in|on|of|via|by|&)$/i;function cQ($,Z=5){let Q=$.trim().split(/\s+/).filter(Boolean).slice(0,Z);while(Q.length&&bD.test(Q[Q.length-1].replace(/[.,;:]+$/,"")))Q.pop();return Q.join(" ")}function oQ($){let Z={};if(!$||typeof $!=="string")return Z;let Q=$.trim(),z=Q.replace(/^[^A-Za-z0-9]+/,"").split(/\s+(?:for|that|which|to)\s+|\s+[—–]\s+|\s-\s|:\s|\.\s|,\s/)[0].trim(),X=cQ(z);if(X.split(/\s+/).filter(Boolean).length>=2&&!lQ(X))Z.what=X;let H=ED.filter(([,G])=>G.test(Q)).map(([G])=>G);if(H.length)Z.where=H.slice(0,4).join(", ");let U=Q.match(/\bfor ((?:[A-Za-z][\w./+-]* )?(?:any |all )?(?:developers?|teams?|engineers?|builders?|users?|integrators?)\b[^.,;:—]*)/i),J=cQ((U?.[1]||"").trim().replace(/\s+/g," "));if(J&&!lQ(J))Z.who=J;return Z}function dQ($,Z){let Q=$;for(let z of Z.split("."))if(Q&&typeof Q==="object"&&z in Q)Q=Q[z];else return;return Q}function iQ($){if(typeof $!=="string")return!1;let Z=$.trim();if(!Z||Z==="slotignored")return!1;return!o(Z)}function yD($,Z={}){let Q=$&&typeof $==="object"?$:{},z=dQ(Q,"project.goal"),X=(iQ(z)?String(z).trim():"")||(Z.goal??"").trim(),H=oQ(X),U=Z.detailed??{},J={"project.goal":X||void 0,"human_context.what":H.what,"human_context.where":H.where,"human_context.who":H.who},G=(K)=>{let L=J[K];if(L)return{value:L,source:"project goal",confidence:0.9};let q=K.startsWith("human_context.")?K.slice(14):"",D=q?U[q]:void 0;return D?{value:D.value,source:D.source,confidence:D.confidence}:void 0},V=X1.map((K,L)=>{let q={n:L+1,path:K.path,header:K.header,question:K.question},D=dQ(Q,K.path);if(iQ(D))return{...q,value:String(D).trim(),status:"filled",seeded:!1};let O=G(K.path);if(O)return{...q,value:O.value,status:"seeded",seeded:!0,source:O.source,confidence:O.confidence};return{...q,value:"",status:"empty",seeded:!1}}),Y=V.filter((K)=>K.status==="filled").length,W=V.filter((K)=>K.status==="seeded").length,B=V.filter((K)=>K.status==="empty").length;return{version:nQ,rows:V,filledCount:Y,seededCount:W,emptyCount:B,complete:B===0}}function j8($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||o(Z)}return!1}function xD($,Z){let Q=$;for(let z of Z.split("."))if(Q&&typeof Q==="object"&&z in Q)Q=Q[z];else return;return Q}function aQ($){if($==="project.goal")return!0;return g0.get($)?.category==="human"}function tQ($,Z=j8){let Q=[],z=[];for(let X of G$){let H=xD($,X.path);if(H==="slotignored")continue;if(!Z(H))continue;(aQ(X.path)?Q:z).push(X.path)}return{human:Q,sourceable:z}}function eQ($,Z,Q=j8){let z=tQ(Z,Q),X;if($>=100||z.human.length===0&&z.sourceable.length===0)X="done";else if(z.sourceable.length>0)X="can-source";else X="needs-human";let H=X==="needs-human"?U1(z):[];return{status:X,score:$,gaps:z,ask:H}}function U1($){return $.human.map((Z)=>({path:Z,question:H1(Z)}))}function gD($,Z={}){let Q=Math.max(1,Z.maxRounds??5),z=Z.isEmpty??j8,X=[],H=0;for(let J=0;J<=Q;J++){let G=$.read();if(!G)return{status:"no-faf",score:0,rounds:H,history:X,ask:[]};let V=$.score(G.yaml);X.push(V);let Y=eQ(V,G.data,z);if(Y.status==="done")return{status:"done",score:V,rounds:H,history:X,ask:[]};if(Y.status==="needs-human")return{status:"needs-human",score:V,rounds:H,history:X,ask:Y.ask};if(X.length>=2&&V<=X[X.length-2])return Y.gaps.human.length?{status:"needs-human",score:V,rounds:H,history:X,ask:U1(Y.gaps)}:{status:"stuck",score:V,rounds:H,history:X,ask:[]};if(H>=Q)return{status:"capped",score:V,rounds:H,history:X,ask:U1(Y.gaps)};$.runAuto(),H++}return{status:"capped",score:X[X.length-1]??0,rounds:H,history:X,ask:[]}}import{createHash as Z3}from"crypto";var J1="faf-bench/1",vD={"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 kD($,Z){return vD[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var Q3=[["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"]],Q6=new Map;Q3.forEach(($,Z)=>$.forEach((Q)=>Q6.set(Q,Z)));var hD=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function w8($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function $3($){return w8($).split(" ").filter((Z)=>Z&&!hD.has(Z))}function z3($,Z){let Q=w8($),z=w8(Z);if(!Q||!z)return!1;if(Q===z)return!0;let X=Q6.get(Q);if(X!==void 0&&Q6.get(z)===X)return!0;let H=$3($);if(H.length===0)return!1;let U=new Set($3(Z));return H.every((J)=>{if(U.has(J))return!0;let G=Q6.get(J);return G!==void 0&&[...U].some((V)=>Q6.get(V)===G)})}function uD($){let Z=X5($),Q=m0($),z=[],X={},H=0;for(let G of m){if(Z.slots[G.path]!=="populated")continue;let V=h1(Q,G);if(typeof V!=="string")continue;let Y=V.trim();if(!Y||D6.has(Y.toLowerCase()))continue;H+=1,z.push({n:H,path:G.path,question:kD(G.path,G.description)}),X[H]=Y}let U=JSON.stringify({v:J1,q:z.map((G)=>[G.path,G.question])}),J=Z3("sha256").update(U).digest("hex").slice(0,12);return{version:J1,qsetHash:J,questions:z,answers:X}}function fD($){return{version:$.version,qsetHash:$.qsetHash,questions:$.questions}}function mD($,Z){let Q=$.questions.map((X)=>{let H=Z[String(X.n)]??Z[X.path]??"";return{n:X.n,path:X.path,ok:typeof H==="string"&&H.trim()!==""&&z3($.answers[X.n],H)}}),z=$.questions.filter((X)=>!Q[X.n-1].ok);return{correct:Q.filter((X)=>X.ok).length,total:$.questions.length,misses:z,perQuestion:Q}}function pD($,Z){let Q=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:Q,hash:Z3("sha256").update(Q).digest("hex")}}import{join as KI,extname as DI,resolve as LI}from"path";var G1={"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"]}};import{join as cD}from"path";var V$={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 dD=V$.flutterDeps,iD=V$.mcpDeps,nD=V$.serverFrameworks,rD=V$.stateManagement,sD=V$.routing;function oD($){let Z=new Set,Q=!1;for(let z of $.split(`
251
+ `)){if(/^(dependencies|dev_dependencies|dependency_overrides):\s*$/.test(z)){Q=!0;continue}if(/^\S/.test(z))Q=!1;if(Q){let X=z.match(/^\s{2}([a-zA-Z0-9_]+):/);if(X)Z.add(X[1].toLowerCase())}}return Z}function S8($){let Z=S($,"pubspec.yaml");if(Z===null)return null;let Q=oD(Z),z=(_)=>Q.has(_.toLowerCase()),X=dD.some(z)||/^flutter:\s*$/m.test(Z)||/\bsdk:\s*flutter\b/.test(Z),H=iD.find(z),U=nD.find(([_])=>z(_)),J=rD.find(([_])=>z(_)),G=J?J[1]:"",V=sD.find(([_])=>z(_)),Y=V?V[1]:"",W=z("flutter_test")?"flutter_test":z("test")?"test":"",B=/^executables:\s*$/m.test(Z),K=(v($,"bin")??[]).some((_)=>_.name.endsWith(".dart")),L=B||K,q,D="",O;if(X)if(D="Flutter",I($,cD("lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(Z))q="mobile",O="pubspec.yaml (Flutter app)";else q="library",O="pubspec.yaml (Flutter package)";else if(H)q="mcp",O=`pubspec.yaml + ${H} (Dart MCP server)`;else if(U)q="backend",D=U[1],O=`pubspec.yaml + ${U[0]} (Dart backend)`;else if(L)q="cli",O=B?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else q="library",O="pubspec.yaml (Dart package)";return{appType:q,isFlutter:X,framework:D,stateManagement:G,routing:Y,testing:W,found:O}}import{join as tD}from"path";var E8={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 eD=E8.mcpModules,$L=E8.serverFrameworks,ZL=E8.cliFrameworks;function QL($){let Z=new Set,Q=!1;for(let z of $.split(`
252
+ `)){let X=z.replace(/\/\/.*$/,"").trim();if(!X)continue;if(/^require\s*\(\s*$/.test(X)){Q=!0;continue}if(Q){if(X===")"){Q=!1;continue}let U=X.match(/^(\S+)/);if(U)Z.add(U[1].toLowerCase());continue}let H=X.match(/^require\s+(\S+)/);if(H&&H[1]!=="(")Z.add(H[1].toLowerCase())}return Z}function H3($,Z){let Q=Z.toLowerCase();for(let z of $)if(z===Q||z.startsWith(`${Q}/`))return!0;return!1}function X3($,Z){let Q;for(let z of Z){if(!H3($,z[0]))continue;if(!Q||z[0].length>Q[0].length)Q=z}return Q}function zL($,Z){let Q;for(let z of Z){if(!H3($,z))continue;if(!Q||z.length>Q.length)Q=z}return Q}function XL($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function HL($){for(let{name:Z}of v($,"cmd")??[]){let Q=tD("cmd",Z),z=O0($,Q);if(z?.isDirectory()){if((v($,Q)??[]).some((X)=>X.name.endsWith(".go")))return!0}else if(z&&Z.endsWith(".go"))return!0}return!1}function UL($){let Z=S($,"main.go");return Z!==null&&/^package\s+main\b/m.test(Z)}function b8($){let Z=S($,"go.mod");if(Z===null)return null;let Q=XL(Z),z=QL(Z),X=zL(z,eD),H=X3(z,$L),U=X3(z,ZL),J=HL($),G=UL($),V,Y="",W;if(X)V="mcp",W=`go.mod + ${X} (Go MCP server)`;else if(H)V="backend",Y=H[1],W=`go.mod + ${H[0]} (Go backend)`;else if(U)V="cli",Y=U[1],W=`go.mod + ${U[0]} (Go CLI)`;else if(J)V="cli",W="go.mod + cmd/ (Go CLI layout)";else if(G&&!H)V="cli",W="go.mod + main.go package main (Go CLI)";else V="library",W="go.mod (Go module)";return{appType:V,modulePath:Q,framework:Y,found:W}}var P2={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 GL=P2.mcpPackages.map(($)=>$.toLowerCase()),VL=P2.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),YL=P2.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),WL=P2.grpcServerPackages.map(($)=>$.toLowerCase()),BL=P2.specializedSdks,U3=P2.baseSdk.toLowerCase();function qL($){let Z=$.match(/<Project\b[^>]*\bSdk\s*=\s*"([^"/]+)(?:\/[^"]*)?"/i),Q=$.match(/<Sdk\b[^>]*\bName\s*=\s*"([^"]+)"/i),z=(Z?.[1]||Q?.[1]||"").trim(),X=($.match(/<OutputType>\s*([^<]+?)\s*<\/OutputType>/i)?.[1]||"").trim(),H=$.match(/<TargetFramework>\s*([^<]+?)\s*<\/TargetFramework>/i)?.[1],J=($.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i)?.[1]||H||"").trim(),G=/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test($),V=/<UseMaui>\s*true\s*<\/UseMaui>/i.test($),Y=/<UseWPF>\s*true\s*<\/UseWPF>/i.test($),W=/<UseWindowsForms>\s*true\s*<\/UseWindowsForms>/i.test($),B=new Set;for(let L of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))B.add(L[1].toLowerCase());for(let L of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))B.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:z,outputType:X,targetFramework:J,isTestProject:G,useMaui:V,useWpf:Y,useWindowsForms:W,packages:B,frameworkRefs:K}}function V1($,Z){let Q=Z.toLowerCase();if($.has(Q))return!0;for(let z of $)if(z===Q||z.startsWith(`${Q}.`))return!0;return!1}function J3($,Z){let Q;for(let[z,X]of Z){if(!V1($,z))continue;if(!Q||z.length>Q[0].length)Q=[z,X]}return Q}function KL($){let Z;for(let Q of GL){if(!V1($,Q))continue;if(!Z||Q.length>Z.length)Z=Q}for(let Q of $)if(Q==="modelcontextprotocol"||Q.startsWith("modelcontextprotocol.")){if(!Z||Q.length>Z.length)Z=Q}return Z}function DL($){let Z=$.toLowerCase();if(!Z)return;let Q;for(let z of BL){let X=z[0].toLowerCase();if(Z===X||Z.startsWith(`${X}/`)){if(!Q||X.length>Q[0].length)Q=z}}return Q}function y8($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function LL($,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 IL($,Z){let Q=Z.replace(/\.csproj$/i,""),{sdk:z,packages:X,frameworkRefs:H,outputType:U}=$,J,G="",V,Y=KL(X),W=DL(z),B=J3(X,YL),K=J3(X,VL),L=WL.some((D)=>V1(X,D)),q=H.has("microsoft.aspnetcore.app");if(Y)J="mcp",G="MCP",V=`${Z} + ${Y} (C# MCP server)`;else if($.isTestProject||W?.[1]==="test"||B)J="library",G=B?.[1]||(W?.[1]==="test"?W[2]:"Test"),V=`${Z} + test (${G})`;else if($.useMaui)J="mobile",G="MAUI",V=`${Z} + UseMaui (MAUI)`;else if($.useWpf||$.useWindowsForms)J="backend",G=$.useWpf&&$.useWindowsForms?"WPF+WinForms":$.useWpf?"WPF":"Windows Forms",V=`${Z} + ${G}`;else if(W?.[1]==="web")J="backend",G=L?"gRPC":W[2],V=`${Z} + Sdk=${W[0]}${L?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(W?.[1]==="worker")J="backend",G=W[2],V=`${Z} + Sdk=${W[0]} (Worker)`;else if(W?.[1]==="blazor-wasm")J="backend",G=W[2],V=`${Z} + Sdk=${W[0]} (Blazor WASM)`;else if(W?.[1]==="aspire")J="backend",G=W[2],V=`${Z} + Sdk=${W[0]} (Aspire)`;else if(W?.[1]==="razor-lib")J="library",G=W[2],V=`${Z} + Sdk=${W[0]} (Razor class library)`;else if(q&&y8(U))J="backend",G="ASP.NET Core",V=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(q&&!y8(U))J="library",G="ASP.NET Core",V=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(K&&(y8(U)||!U))J="cli",G=K[1],V=`${Z} + ${K[0]} (C# CLI)`;else if(y8(U))J="cli",V=`${Z} + OutputType=Exe (C# console)`;else{J="library";let D=z?` Sdk=${z}`:"";if(V=`${Z}${D} (C# class library)`.replace(" Sdk=Microsoft.NET.Sdk",""),!z||z.toLowerCase()===U3||z.toLowerCase().startsWith(`${U3}/`))V=`${Z} (C# class library)`}return{appType:J,projectName:Q,targetFramework:$.targetFramework,sdk:z||"Microsoft.NET.Sdk",framework:G,found:V}}function Y$($){return(v($)??[]).map((Z)=>Z.name).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}function x8($){let Z=Y$($);if(Z.length===0)return null;let Q=null,z=999;for(let X of Z){let H=S($,X);if(H===null)continue;let U=qL(H),J=IL(U,X),G=LL(J.appType,J.framework);if(!Q||G<z)Q=J,z=G}return Q}import{join as F2}from"path";var M0={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 _L=M0.mcpArtifacts.map(($)=>$.toLowerCase()),ML=M0.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),PL=M0.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),FL=M0.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),IN=M0.androidPlugins.map(($)=>$.toLowerCase()),RL=M0.kmpPlugins.map(($)=>$.toLowerCase()),NL=M0.jvmKotlinPlugins.map(($)=>$.toLowerCase()),TL=M0.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),AL=M0.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),CL=M0.libraryPlugins.map(($)=>$.toLowerCase()),jL=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function Y1($){return jL.some((Z)=>I($,Z))}function wL($){let Z=new Map,Q=new Map,z="";for(let X of $.split(`
253
+ `)){let H=X.replace(/#.*$/,"").trim();if(!H)continue;let U=H.match(/^\[([^\]]+)\]$/);if(U){z=U[1].trim().toLowerCase();continue}let J=H.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bid\s*=\s*"([^"]+)"/);if(J&&(z==="plugins"||z.endsWith(".plugins"))){Z.set(J[1].replace(/-/g,".").toLowerCase(),J[2].toLowerCase()),Z.set(J[1].toLowerCase(),J[2].toLowerCase());continue}let G=H.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bmodule\s*=\s*"([^"]+)"/);if(G&&(z==="libraries"||z.endsWith(".libraries"))){let W=G[1].toLowerCase();Q.set(W,G[2].toLowerCase()),Q.set(W.replace(/-/g,"."),G[2].toLowerCase());continue}let V=H.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bgroup\s*=\s*"([^"]+)"[^}]*\bname\s*=\s*"([^"]+)"/);if(V&&(z==="libraries"||z.endsWith(".libraries"))){let W=`${V[2]}:${V[3]}`.toLowerCase(),B=V[1].toLowerCase();Q.set(B,W),Q.set(B.replace(/-/g,"."),W);continue}let Y=H.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(Y){let W=Y[1].toLowerCase(),B=Y[2];if(z==="plugins"||z.endsWith(".plugins")){let K=B.split(":")[0].toLowerCase();Z.set(W,K),Z.set(W.replace(/-/g,"."),K)}else if(z==="libraries"||z.endsWith(".libraries")){let K=B.split(":");if(K.length>=2){let L=`${K[0]}:${K[1]}`.toLowerCase();Q.set(W,L),Q.set(W.replace(/-/g,"."),L)}}}}return{plugins:Z,libraries:Q}}function SL($){let Z=S($,F2("gradle","libs.versions.toml"));if(!Z)return{plugins:new Map,libraries:new Map};return wL(Z)}function EL($){let Z=[];for(let Q of $.matchAll(/include\s*\(\s*([^)]+)\)/g))for(let z of Q[1].split(",")){let X=z.replace(/['":\s]/g,"").replace(/^:/,"");if(X)Z.push(X.replace(/:/g,"/"))}for(let Q of $.matchAll(/include\s+((?:['"][^'"]+['"]\s*,?\s*)+)/g))for(let z of Q[1].split(",")){let X=z.replace(/['":\s]/g,"").replace(/^:/,"");if(X)Z.push(X.replace(/:/g,"/"))}for(let Q of $.matchAll(/project\s*\(\s*["']:([^"']+)["']\s*\)\s*\.projectDir\s*=\s*file\s*\(\s*["']([^"']+)["']\s*\)/g))Z.push(Q[2].replace(/^\.\//,""));return[...new Set(Z)]}function bL($,Z){let Q=new Set;for(let z of $.matchAll(/\bid\s*\(\s*["']([^"']+)["']\s*\)/g))Q.add(z[1].toLowerCase());for(let z of $.matchAll(/\bid\s+['"]([^'"]+)['"]/g))Q.add(z[1].toLowerCase());for(let z of $.matchAll(/plugins\s*\{([\s\S]*?)\}/g))for(let X of z[1].split(/[\n;]/)){let H=X.replace(/\/\/.*$/,"").trim();if(!H||H.startsWith("id")||H.startsWith("kotlin")||H.startsWith("alias"))continue;let U=H.match(/^`([a-zA-Z0-9.-]+)`$/)||H.match(/^([a-zA-Z][a-zA-Z0-9.-]*)$/);if(U)Q.add(U[1].toLowerCase())}for(let z of $.matchAll(/\bkotlin\s*\(\s*["']([^"']+)["']\s*\)/g)){let X=z[1].toLowerCase();if(X==="jvm")Q.add("org.jetbrains.kotlin.jvm");else if(X==="multiplatform")Q.add("org.jetbrains.kotlin.multiplatform");else if(X==="android")Q.add("org.jetbrains.kotlin.android");else Q.add(`org.jetbrains.kotlin.${X}`)}for(let z of $.matchAll(/libs\.plugins\.([A-Za-z0-9_.]+)/g)){let X=z[1].toLowerCase(),H=Z.plugins.get(X)||Z.plugins.get(X.replace(/\./g,"-"))||Z.plugins.get(X.replace(/-/g,"."));if(H)Q.add(H);else if(X.includes("spring")&&X.includes("boot"))Q.add("org.springframework.boot")}for(let z of $.matchAll(/apply\s+plugin\s*:\s*['"]([^'"]+)['"]/g))Q.add(z[1].toLowerCase());return Q}function yL($,Z){let Q=new Set;for(let z of $.matchAll(/["']([A-Za-z0-9_.-]+:[A-Za-z0-9_.-]+)(?::[^"']+)?["']/g))Q.add(z[1].toLowerCase());for(let z of $.matchAll(/libs\.([A-Za-z0-9_.]+)/g)){let X=z[1].toLowerCase();if(X.startsWith("plugins."))continue;let H=[X,X.replace(/\./g,"-"),X.replace(/-/g,".")];for(let U of H){let J=Z.libraries.get(U);if(J){Q.add(J.includes(":")?J.split(":").slice(0,2).join(":"):J);break}}}return Q}function Y3($){let Z=($.match(/<packaging>\s*([^<]+?)\s*<\/packaging>/i)?.[1]||"jar").trim().toLowerCase(),Q=new Set,z=$.match(/<parent>([\s\S]*?)<\/parent>/i);if(z){let U=z[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),J=z[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(U&&J)Q.add(`${U}:${J}`.toLowerCase())}let X=new Set;for(let U of $.matchAll(/<dependency>([\s\S]*?)<\/dependency>/gi)){let J=U[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),G=U[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(J&&G)X.add(`${J}:${G}`.toLowerCase())}let H=[];for(let U of $.matchAll(/<module>\s*([^<]+?)\s*<\/module>/gi))H.push(U[1].trim());return{packaging:Z,parents:Q,artifacts:X,modules:H}}function p0($,Z){let Q=Z.toLowerCase();if($.has(Q))return!0;for(let z of $)if(z===Q||z.endsWith(`.${Q}`)||z===Q.replace(/^org\.gradle\./,""))return!0;return!1}function z6($,Z,Q){let z;for(let[X,H]of Z){let U=!1;if(Q==="plugin")U=p0($,X);else if(U=$.has(X)||[...$].some((J)=>J===X||J.startsWith(`${X}:`)||J.startsWith(`${X}.`)),!U&&Q==="artifact")U=[...$].some((J)=>J===X||J.startsWith(`${X}`));if(!U)continue;if(!z||X.length>z[0].length)z=[X,H]}return z}function xL($){let Z;for(let Q of _L)for(let z of $){if(z===Q||z.startsWith(`${Q}:`)||z.startsWith(Q.replace(/:mcp$/,":"))){if(!Z||Q.length>Z.length)Z=Q}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 W3($,Z){let Q=new Set,z=!1,X=!1,H=[F2(Z,"src"),F2(Z,"src","main")],U=(J,G)=>{if(G>4)return;let V=v($,J);if(!V)return;for(let{name:Y}of V){if(Y==="androidMain"||Y==="commonMain"||Y==="jvmMain"||Y==="iosMain")Q.add(Y);let W=F2(J,Y),B=O0($,W);if(!B)continue;if(B.isDirectory())U(W,G+1);else if(Y.endsWith(".kt")||Y.endsWith(".kts"))z=!0;else if(Y.endsWith(".java"))X=!0}};for(let J of H)U(J,0);return{kotlin:z,java:X,hints:Q}}function gL($){let Z=[],Q=$.plugins,z=$.artifacts,X=RL.some((F)=>p0(Q,F))||$.sourceHints.has("commonMain"),H=p0(Q,"com.android.application"),U=p0(Q,"com.android.library")||p0(Q,"com.android.kotlin.multiplatform.library");if(H||U)Z.push("android");if(X)Z.push("multiplatform");let J=xL(z),G=z6(Q,ML,"plugin"),V=z6($.parents,PL,"parent"),Y=z6(z,FL,"artifact"),W=z6(Q,TL,"plugin"),B=z6(z,AL,"artifact"),K=CL.some((F)=>p0(Q,F)),L=$.packaging==="pom",q,D="",O;if(H)q="mobile",D=X?"Android+KMP":"Android",O=`${$.path||"root"} + com.android.application (${D})`;else if(J)q="mcp",D="MCP",Z.push("mcp"),O=`${$.path||"root"} + ${J} (JVM MCP server)`;else if(G||V||Y){q="backend",D=G?.[1]||V?.[1]||Y?.[1]||"JVM";let F=G?.[0]||V?.[0]||Y?.[0]||"web";O=`${$.path||"root"} + ${F} (JVM backend)`}else if(X&&!U)q="library",D="Kotlin Multiplatform",O=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(U)q="library",D=X?"Android+KMP":"Android",O=`${$.path||"root"} + android library (${D})`;else if(B||$.hasApplicationPlugin&&($.hasMainClass||W)||W&&$.hasMainClass)q="cli",D=B?.[1]||"application",O=B?`${$.path||"root"} + ${B[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!K)q="cli",D="application",O=`${$.path||"root"} + application plugin (JVM CLI)`;else if(L)q="library",O=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{q="library";let F=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(O=`${$.path||"root"} (${F} library)`,K)O=`${$.path||"root"} + java-library (JVM library)`}let _="Java";if($.kotlinSources&&$.javaSources)_="Java/Kotlin";else if($.kotlinSources||NL.some((F)=>p0(Q,F))||X)_="Kotlin";let C=[...new Set(Z)];return{appType:q,framework:D,facets:C,found:O,buildTool:$.buildTool,mainLanguage:_}}function vL($,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 G3($,Z,Q){let z=F2(Z,"build.gradle.kts"),X=F2(Z,"build.gradle"),H=I($,z)?z:I($,X)?X:null;if(!H)return null;let U=S($,H);if(!U)return null;let J=bL(U,Q),G=yL(U,Q),V=W3($,Z),Y=/mainClass\s*[.=]/.test(U)||/mainClassName\s*=/.test(U)||/Main-Class/.test(U),W=p0(J,"application")||p0(J,"org.gradle.application");return{path:Z||"build.gradle",plugins:J,artifacts:G,packaging:"jar",parents:new Set,hasMainClass:Y,hasApplicationPlugin:W,sourceHints:V.hints,kotlinSources:V.kotlin||H.endsWith(".kts"),javaSources:V.java,buildTool:"gradle"}}function V3($,Z){let Q=S($,F2(Z,"pom.xml"));if(!Q)return null;let{packaging:z,parents:X,artifacts:H}=Y3(Q),U=W3($,Z);return{path:Z?`${Z}/pom.xml`:"pom.xml",plugins:new Set,artifacts:H,packaging:z,parents:X,hasMainClass:/<mainClass>/.test(Q),hasApplicationPlugin:!1,sourceHints:U.hints,kotlinSources:U.kotlin,javaSources:U.java,buildTool:"maven"}}function X6($){if(!Y1($))return null;let Z=SL($),Q=[],z=null;for(let V of["settings.gradle.kts","settings.gradle"])if(I($,V)){z=S($,V);break}let X=z?EL(z):[],H=G3($,"",Z);if(H)Q.push(H);for(let V of X){let Y=G3($,V,Z);if(Y)Q.push(Y)}let U=V3($,"");if(U){Q.push(U);let V=S($,"pom.xml");if(V){let{modules:Y}=Y3(V);for(let W of Y){let B=V3($,W);if(B)Q.push(B)}}}if(Q.length===0&&z)return{appType:"library",framework:"",buildTool:"gradle",mainLanguage:"Java/Kotlin",facets:[],found:"settings.gradle (Gradle multi-project root)"};if(Q.length===0)return null;let J=null,G=999;for(let V of Q){let Y=gL(V),W=vL(Y.appType,Y.facets);if(!J||W<G)J={appType:Y.appType,framework:Y.framework,buildTool:Y.buildTool,mainLanguage:Y.mainLanguage,facets:Y.facets,found:Y.found},G=W}if(J&&X.length>0&&!J.found.includes("multi-project"));return J}import{join as hL}from"path";var H6={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 uL=H6.mcpGems.map(($)=>$.toLowerCase()),fL=H6.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),B3=H6.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),mL=H6.railsLayoutFiles;function pL($){return I($,"Gemfile")||I($,"gems.rb")||lL($)}function lL($){return(v($)??[]).some((Z)=>Z.name.endsWith(".gemspec"))}function cL($){let Z=new Set;for(let Q of $.split(`
254
+ `)){let z=Q.replace(/#.*$/,"").trim();if(!z)continue;let X=z.match(/^\s*gem\s+['"]([^'"]+)['"]/i)||z.match(/^\s*gem\s+:([A-Za-z0-9_.-]+)/i);if(X)Z.add(X[1].toLowerCase())}return Z}function dL($){let Z=new Set,Q=!1;for(let z of $.split(`
255
+ `)){let X=z.replace(/\r$/,"");if(/^\s*specs:\s*$/.test(X)){Q=!0;continue}if(Q){if(/^[A-Z]/.test(X)||X.startsWith("PLATFORMS")||X.startsWith("DEPENDENCIES")||X.startsWith("BUNDLED")||X.startsWith("RUBY VERSION")||X.startsWith("CHECKSUMS")){Q=!1;continue}let H=X.match(/^\s{2,}([a-zA-Z0-9_.-]+)\s*\(/);if(H)Z.add(H[1].toLowerCase())}}return Z}function iL($){let Z=new Set;for(let Q of $.split(`
256
+ `)){let X=Q.replace(/#.*$/,"").match(/add_(?:runtime_|development_)?dependency\s*\(?\s*['"]([^'"]+)['"]/i);if(X)Z.add(X[1].toLowerCase())}return Z}function nL($){let Z=new Set,Q=[];for(let X of["Gemfile","gems.rb"]){let H=S($,X);if(H){for(let U of cL(H))Z.add(U);Q.push(X)}}let z=S($,"Gemfile.lock")||S($,"gems.locked");if(z){for(let X of dL(z))Z.add(X);Q.push("Gemfile.lock")}for(let{name:X}of v($)??[]){if(!X.endsWith(".gemspec"))continue;let H=S($,X);if(H){for(let U of iL(H))Z.add(U);Q.push(X)}}return{gems:Z,sources:Q}}function U6($,Z){let Q=Z.toLowerCase();if($.has(Q))return!0;return!1}function W1($,Z){let Q;for(let[z,X]of Z){if(!U6($,z))continue;if(!Q||z.length>Q[0].length)Q=[z,X]}return Q}function rL($){let Z;for(let Q of uL)if(U6($,Q)&&(!Z||Q.length>Z.length))Z=Q;return Z}function q3($){for(let Z of mL)if(I($,Z))return Z;return}function sL($,Z){let Q=W1(Z,B3);if(Q)return{hit:!0,why:Q[0]};for(let{name:X}of v($)??[]){if(!X.endsWith(".gemspec"))continue;let H=S($,X);if(H&&/executables\s*=/.test(H)&&!/executables\s*=\s*\[\s*\]/.test(H))return{hit:!0,why:`${X} executables`}}let z=v($,"bin");if(z){let H=z.map((U)=>U.name).filter((U)=>{if(U==="setup"||U==="console"||U==="rake")return!1;return O0($,hL("bin",U))?.isFile()===!0}).filter((U)=>U!=="rails");if(H.length>0&&!U6(Z,"rails")&&!q3($))return{hit:!0,why:`bin/${H[0]}`}}return{hit:!1,why:""}}function g8($){if(!pL($))return null;let{gems:Z,sources:Q}=nL($),z=Q[0]||"Gemfile",X=Q.some((D)=>D==="Gemfile"||D==="gems.rb"||D.includes("lock"))?"bundler":"rubygems",H=rL(Z),U=W1(Z,fL),J=q3($),G=U6(Z,"rails")||U6(Z,"railties"),V=sL($,Z),Y=I($,"config.ru"),W=G||!!J,B=U&&U[1]!=="Rails"&&!(U[0]==="rack"&&!Y)?U:void 0,K,L="",q;if(H)K="mcp",L="MCP",q=`${z} + gem ${H} (Ruby MCP)`;else if(W)if(K="backend",L="Rails",G&&J)q=`${z} + rails + ${J} (Rails)`;else if(G)q=`${z} + gem rails (Rails)`;else q=`${J} (Rails layout)`;else if(B)K="backend",L=B[1],q=`${z} + gem ${B[0]} (Ruby backend)`;else if(V.hit)K="cli",L=W1(Z,B3)?.[1]||"",q=`${z} + ${V.why} (Ruby CLI)`;else K="library",q=`${z} (Ruby library)`;return{appType:K,framework:L,packageManager:X,found:q}}import{join as aL}from"path";var E0={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 tL=E0.mcpPackageUrls.map(($)=>$.toLowerCase()),eL=E0.mcpProducts.map(($)=>$.toLowerCase()),$I=E0.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),ZI=E0.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),QI=E0.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),zI=E0.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),XI=E0.appProductTypes,HI=E0.cliProductTypes,UI=E0.vaporLayoutFiles;function JI($){return I($,"Package.swift")||B1($).length>0}function B1($){return(v($)??[]).map((Z)=>Z.name).filter((Z)=>Z.endsWith(".xcodeproj")&&O0($,Z)?.isDirectory()===!0)}function GI($){let Z=VI($),Q=Z.toLowerCase(),z=[],X=/\.package\s*\(\s*url\s*:\s*"([^"]+)"/gi,H;while((H=X.exec(Z))!==null)z.push(H[1]);let U=/\.package\s*\(\s*url\s*:\s*'([^']+)'/gi;while((H=U.exec(Z))!==null)z.push(H[1]);let J=[],G=/\.product\s*\(\s*name\s*:\s*"([^"]+)"/gi;while((H=G.exec(Z))!==null)J.push(H[1]);let V=/\.product\s*\(\s*name\s*:\s*'([^']+)'/gi;while((H=V.exec(Z))!==null)J.push(H[1]);let Y=/\.library\s*\(/.test(Q),W=/\.executable\s*\(/.test(Q),B=/\.plugin\s*\(/.test(Q)&&!Y&&!W?!0:/\bproducts\s*:\s*\[[\s\S]*?\.plugin\s*\(/.test(Q),K=/\.executabletarget\s*\(/.test(Q),L=/\.target\s*\(/.test(Q)&&!K?!0:(Q.match(/\.target\s*\(/g)||[]).length>(Q.match(/\.executabletarget\s*\(/g)||[]).length+(Q.match(/\.testtarget\s*\(/g)||[]).length;return{packageUrls:z,productNames:J,hasLibraryProduct:Y,hasExecutableProduct:W,hasPluginProduct:!!B,hasExecutableTarget:K,hasLibraryTarget:L}}function VI($){let Z="",Q=0;while(Q<$.length){if($[Q]==='"'||$[Q]==="'"){let z=$[Q];Z+=z,Q++;while(Q<$.length){if($[Q]==="\\"&&Q+1<$.length){Z+=$[Q]+$[Q+1],Q+=2;continue}if(Z+=$[Q],$[Q]===z){Q++;break}Q++}continue}if($[Q]==="/"&&$[Q+1]==="/"){Q+=2;while(Q<$.length&&$[Q]!==`
257
+ `)Q++;continue}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<$.length&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;Q+=2;continue}Z+=$[Q],Q++}return Z}function YI($,Z){let Q=$.map((X)=>X.toLowerCase()),z;for(let X of Z)for(let H of Q)if(H.includes(X)&&(!z||X.length>z.length))z=X;return z}function K3($,Z){let Q=$.map((X)=>X.toLowerCase()),z;for(let[X,H]of Z)for(let U of Q)if(U.includes(X)&&(!z||X.length>z[0].length))z=[X,H];return z}function D3($,Z){let Q=$.map((X)=>X.toLowerCase()),z;for(let[X,H]of Z)if(Q.includes(X)&&(!z||X.length>z[0].length))z=[X,H];return z}function WI($){let Z=$.map((Q)=>Q.toLowerCase());return eL.some((Q)=>Z.includes(Q))}function BI($){let Z=!1,Q=!1,z;for(let X of B1($)){let H=S($,aL(X,"project.pbxproj"));if(!H)continue;for(let U of XI)if(H.includes(U))Z=!0,z=U;for(let U of HI)if(H.includes(U)){if(Q=!0,!z)z=U}}return{hasApplication:Z,hasTool:Q,hit:z}}function qI($){for(let Z of UI)if(I($,Z))return Z;return}function J6($){if(!JI($))return null;let Z=I($,"Package.swift"),Q=B1($),z=Q.length>0,X=null;if(Z){let P=S($,"Package.swift");if(P)X=GI(P)}let H=z?BI($):{hasApplication:!1,hasTool:!1},U=qI($),J=X?.packageUrls??[],G=X?.productNames??[],V=YI(J,tL),Y=WI(G),W=K3(J,$I),B=D3(G,ZI),K=K3(J,QI),L=D3(G,zI),q=!!(V||Y),D=!!(W||B||U),O=!!(X?.hasExecutableProduct||X?.hasExecutableTarget),_=!!(K||L),C=H.hasApplication,F=Z&&z?"spm+xcode":Z?"spm":"xcode",R,N="",w;if(q)if(R="mcp",N="MCP",Y)w="Package.swift + product MCP (Swift MCP)";else w=`Package.swift + ${V} (Swift MCP)`;else if(D)if(R="backend",N=B?.[1]||W?.[1]||(U?"Vapor":""),B)w=`Package.swift + product ${B[1]} (Swift backend)`;else if(W)w=`Package.swift + ${W[1]} (Swift backend)`;else w=`${U} (Swift backend layout)`;else if(C)R="app",N="",w=`${Q[0]} + ${H.hit||"application"} (Swift app)`;else if(_||O&&!D&&!q)if(R="cli",N=L?.[1]||K?.[1]||"",L)w=`Package.swift + product ${L[1]} (Swift CLI)`;else if(K)w=`Package.swift + ${K[1]} (Swift CLI)`;else if(X?.hasExecutableProduct)w="Package.swift + .executable product (Swift CLI)";else w="Package.swift + .executableTarget (Swift CLI)";else if(H.hasTool&&!Z)R="cli",w=`${Q[0]} + tool productType (Swift CLI)`;else if(Z)if(R="library",X?.hasLibraryProduct)w="Package.swift + .library product (Swift library)";else w="Package.swift (Swift library)";else R="library",w=`${Q[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:R,framework:N,packageManager:F,found:w}}var II=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"]),_I={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"]},MI=[["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 PI($,Z){for(let[Q,z]of MI)if(Q in $)return z;return Z.length>0?"framework":"config"}function FI($,Z){try{let Q=JSON.parse(S($,Z)??""),z=["background","content_scripts","action","browser_action","permissions"].some((X)=>(X in Q));if(typeof Q.manifest_version==="number"&&z)return"chrome";return"other"}catch{return"other"}}function RI($,Z){if(Z.isFile())return!0;if(!Z.isSymbolicLink())return!1;return O0($,Z.name)?.isFile()===!0}function NI($,Z){if(Z.isDirectory())return!0;if(!Z.isSymbolicLink())return!1;return O0($,Z.name)?.isDirectory()===!0}function TI($){let Z=[],Q=LI($),z=new Set,X=v(Q);if(!X)return Z;for(let H of X){let U=H.name;if(U.endsWith(".xcodeproj")?!NI(Q,H):!RI(Q,H))continue;if(U.toLowerCase().endsWith(".csproj")){let G=x8(Q);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 Y=G.framework?[G.framework,"C#",".NET"]:["C#",".NET"];Z.push({slots:V,priority:36,frameworks:Y,fileName:U})}continue}if(U.endsWith(".xcodeproj")){let G=J6(Q);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"&&G.framework)V.framework=G.framework;let Y=G.framework?[G.framework,"Swift"]:["Swift"];Z.push({slots:V,priority:36,frameworks:Y,fileName:U})}continue}let J=G1[U];if(!J)continue;if(U==="manifest.json"&&FI(Q,U)!=="chrome")continue;if(U==="pubspec.yaml"){let G=S8(Q);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:J.priority,frameworks:G.isFlutter?["Flutter","Dart"]:["Dart"],fileName:U});continue}}if(U==="go.mod"){let G=b8(Q);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 Y=G.framework?[G.framework,"Go"]:["Go"];Z.push({slots:V,priority:J.priority,frameworks:Y,fileName:U});continue}}if(U==="Gemfile"||U==="Gemfile.lock"||U==="gems.rb"){let G=g8(Q);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 Y=G.framework?[G.framework,"Ruby"]:["Ruby"];Z.push({slots:V,priority:J.priority??35,frameworks:Y,fileName:U});continue}}if(U==="Package.swift"){let G=J6(Q);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"&&G.framework)V.framework=G.framework;let Y=G.framework?[G.framework,"Swift"]:["Swift"];Z.push({slots:V,priority:J.priority??36,frameworks:Y,fileName:U});continue}}if(U==="pom.xml"||U==="build.gradle"||U==="build.gradle.kts"||U==="settings.gradle"||U==="settings.gradle.kts"){if(z.has(Q))continue;z.add(Q);let G=X6(Q);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 Y=G.framework?[G.framework,"JVM",G.mainLanguage==="Kotlin"?"Kotlin":"Java"]:["JVM",G.mainLanguage==="Kotlin"?"Kotlin":"Java"];Z.push({slots:V,priority:J.priority??35,frameworks:Y,fileName:U});continue}}Z.push({slots:J.slots||{},priority:J.priority,frameworks:J.frameworks,fileName:U})}return Z}function AI($){let Z=[];for(let Q of e2($,()=>I3($,2,{count:0}))){let z=G1[`*${Q}`],X=z?.slots?.mainLanguage;if(X)Z.push({slots:{mainLanguage:X},priority:z.priority,frameworks:z.frameworks})}return Z}function L3($){let Z=[...TI($),...AI($)],Q={},z={},X=new Set;for(let V of Z){V.frameworks.forEach((Y)=>X.add(Y));for(let[Y,W]of Object.entries(V.slots))if(W&&!W.includes("/")&&(!(Y in Q)||V.priority>z[Y]))Q[Y]=W,z[Y]=V.priority}let H=new Map;for(let V of Z){if(!V.fileName)continue;if(!H.has(V.fileName))H.set(V.fileName,{fileName:V.fileName,category:PI(V.slots,V.frameworks),priority:V.priority})}let U=[...H.values()].sort((V,Y)=>Y.priority-V.priority||V.fileName.localeCompare(Y.fileName)),J=[];if(Q.mainLanguage)J.push(Q.mainLanguage.toLowerCase());if(Q.framework)J.push(Q.framework.toLowerCase());let G=J.length>0?J.join("-"):"unknown-stack";return{slotFills:Q,frameworks:[...X],confirmedCount:Z.length,discoveredFormats:U,stackSignature:G}}function v8($){let{slotFills:Z}=L3($),Q={};for(let[z,X]of Object.entries(Z)){let H=_I[z];if(!H||!X)continue;let[U,J]=H;if(U==="project")(Q.project??={})[J]=X;else(Q.stack??={})[J]=X}return Q}function I3($,Z,Q){let z=new Set;if(Z<0||Q.count>400)return z;let X=v($);if(!X)return z;for(let H of X){if(Q.count++>400)break;if(!H.isDirectory()){let U=DI(H.name);if(OI.has(U))z.add(U);continue}if(II.has(H.name)||H.name.startsWith("."))continue;for(let U of I3(KI($,H.name),Z-1,Q))z.add(U)}return z}var $0=($,Z,Q)=>({value:$,source:Z,confidence:Q});function O3($,Z={}){let Q=Z.toolingRoot?null:CI($),z=jI($),X={},H=(U,J)=>{if(J)X[U]=J};return H("what",EI(Q,z)),H("who",bI(z)),H("why",yI(z)),H("where",xI(Q,z)),H("when",gI(z)),H("how",vI(Q,z)),X}function k8($,Z={}){let Q=O3($,Z),z={};return Object.keys(Q).forEach((X)=>{let H=Q[X];if(H)z[X]=H.value}),z}function CI($){let Z=S($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function jI($){let Z=S($,"README.md");if(Z===null)return"";return Z.replace(/<!--[\s\S]*?-->/g,"").split(`
258
258
  `).filter((Q)=>!/^\s*\[!\[/.test(Q)&&!/^\s*!\[/.test(Q)).join(`
259
- `).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function R2($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function jI($){if(!$)return 0;return($.match(/\[[^\]]*\]\([^)]*\)/g)??[]).join("").length/$.length}function W$($,Z){let Q=new RegExp(`##?\\s+(${Z})\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n##?|$)`,"i"),z=$.match(Q);if(!z||!z[2]||z[2].trim().length<=20||jI(z[2])>0.4)return null;return{body:R2(z[2]),heading:z[1].trim()}}function wI($){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 Q=Z.split(/[·|]/).map((z)=>z.trim()).filter(Boolean);if(Q.length>=3&&Q.every((z)=>z.length<=24))return!0;return!1}function G6($,Z,Q=30){for(let z of Z){let X=$.match(z);if(X&&X[1]&&X[1].trim().length>=Q)return R2(X[1])}return null}function SI($,Z){if($?.description&&$.description.length>20)return $0(R2($.description),"package.json:description",0.95);let Q=W$(Z,"Purpose|What|About|Overview|Description");if(Q)return $0(Q.body,`README:## ${Q.heading}`,0.8);let z=Z.split(/\n\s*\n/).map((H)=>H.replace(/\s+/g," ").trim()).find((H)=>H.length>30&&!H.startsWith("#")&&!wI(H));if(z)return $0(R2(z),"README:first-paragraph",0.5);let X=G6(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?$0(X,"README:problem-heuristic",0.6):null}function EI($){let Z=W$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return $0(Z.body,`README:## ${Z.heading}`,0.8);let Q=G6($,[/\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 Q?$0(Q,"README:audience-heuristic",0.6):null}function bI($){let Z=W$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return $0(Z.body,`README:## ${Z.heading}`,0.8);let Q=G6($,[/(?: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 Q?$0(Q,"README:mission-heuristic",0.6):null}function yI($,Z){let Q=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(Q)return $0(R2(Q.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return $0(R2($.homepage),"package.json:homepage",0.9);let z=G6(Z,[/\b(?:deployed|hosted|available|published)\s+(?:on|at|via)\s+([^.\n]{3,80})/i],3);return z?$0(z,"README:deploy-heuristic",0.6):null}function xI($){let Z=W$($,"Timeline|Status|Release|Roadmap");if(Z)return $0(Z.body,`README:## ${Z.heading}`,0.8);let Q=G6($,[/\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 Q?$0(Q,"README:since-heuristic",0.6):null}function gI($,Z){let Q=$?.scripts?Object.keys($.scripts):[],z=["start","dev","build"].filter((U)=>Q.includes(U));if(z.length)return $0(R2(z.map((U)=>`npm run ${U}`).join(", ")),"package.json:scripts",0.9);let X=W$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(X)return $0(X.body,`README:## ${X.heading}`,0.8);let H=W$(Z,"Architecture|Approach|How it works|Methodology|How");return H?$0(H.body,`README:## ${H.heading}`,0.7):null}var _3="3.0";import{join as P3}from"path";var M3=[{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:"anyDependency",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"}]}];function vI($){let Z=S($,"Cargo.toml");if(Z===null)return null;let Q=Z.match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return Q?Q[1]:null}function kI($){let Z=S($,"Cargo.toml");return Z!==null&&/^\s*\[\[bin\]\]/m.test(Z)}function hI($,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 Q=vI($);if(Q&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(Q))return`Cargo.toml name "${Q}" → sdk`;return null}function uI($){let Z=["manifest.json","public/manifest.json","src/manifest.json","app/manifest.json","extension/manifest.json","dist/manifest.json"];for(let Q of Z){let z=S($,Q);if(z===null)continue;try{let X=JSON.parse(z);if(typeof X.manifest_version==="number")return`${Q} manifest_version ${X.manifest_version} (browser extension)`}catch{}}return null}function fI($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,Q=S($,"pyproject.toml");if(Q!==null){let X=Q.match(Z);if(X)return`pyproject.toml depends on ${X[1]}`}let z=S($,"requirements.txt");if(z!==null){let X=z.match(Z);if(X)return`requirements.txt contains ${X[1]}`}return null}function mI($,Z){let Q=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let z of Q)if(Z.dependencies?.[z]||Z.devDependencies?.[z])return`${z} dependency`}if(I($,"ios")&&I($,"android"))return"ios/ + android/ dirs";return null}function pI($,Z){let Q=S($,"Cargo.toml");if(Q!==null){if(/crate-type\s*=\s*\[[^\]]*"cdylib"/.test(Q))return'Cargo.toml crate-type = ["cdylib"]';if(/wasm-bindgen|wasm-pack/i.test(Q))return"Cargo.toml wasm-bindgen/wasm-pack"}let z=S($,"build.zig");if(z!==null&&/\.wasm\b|wasm32|setOutputFormat\(\.wasm/i.test(z))return"build.zig wasm target";if(Z?.keywords?.some((X)=>/^wasm(?:-|$)|webassembly/i.test(X)))return'package.json keywords contains "wasm"';return null}function lI($,Z){if(!I($,"index.html"))return null;if(Z?.dependencies||Z?.devDependencies){let Q={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((X)=>Q[X]))return null}return"index.html (vanilla, no frontend framework)"}function cI($,Z){if(Z?.name&&/specification|^@.*\/spec/i.test(Z.name))return`package name "${Z.name}" → documentation`;if(Z?.keywords?.some((Q)=>/^(specification|format-spec|standard)$/i.test(Q)))return'package keywords contains "specification"';if(Z?.bin)return null;if(Z?.files&&Z.files.length>0){let Q=/^(dist|src|lib|build|bin)(\/|$)|\/(dist|src|lib|build|bin)(\/|$)|(\.|\/)(js|ts|tsx|jsx|mjs|cjs|py|rs|go)$/,z=Z.files.some((H)=>Q.test(H)),X=Z.files.some((H)=>/\.(md|MD)$|examples?\//.test(H)||H==="README.md"||H==="docs"||H==="docs/");if(!z&&X)return"package.json files = docs/examples only (no source)"}return null}function dI($,Z,Q){let z=Q.find((X)=>X.slug==="astro"||X.slug==="gatsby");if(z)return`${z.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 iI($,Z){if(!Z)return null;let Q={...Z.dependencies??{},...Z.devDependencies??{}},z=["@clerk/nextjs","@clerk/clerk-react","next-auth","@auth/core","auth0","@auth0/nextjs-auth0"],X=["stripe","@stripe/stripe-js","lemonsqueezy"],H=z.some((J)=>Q[J]),U=X.some((J)=>Q[J]);if(H&&U)return"auth + payment dependencies";return null}function nI($,Z,Q){if(Z?.keywords?.some((H)=>/mcpaas/i.test(H)))return'package keywords contains "mcpaas"';if(Z?.name&&/mcpaas/i.test(Z.name))return`package name "${Z.name}" → mcpaas`;let z=Q.some((H)=>H.slug==="mcp"),X=Q.some((H)=>H.category==="database");if(z&&X&&Z?.dependencies&&Object.keys(Z.dependencies).length>10)return"MCP + database + complex deps (platform shape)";return null}function rI($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||I($,"pnpm-workspace.yaml")))return null;return"private workspace + multi-package"}var sI=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"]),F3=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,oI=new Set(["frontend","backend","database","css","ui","state"]);function aI($){if(I($,"pyproject.toml")||I($,"manage.py")||I($,"setup.py")||h8($,"requirements*.txt"))return!0;if(I($,"go.mod"))return!0;if(I($,"Cargo.toml"))return!0;if(I($,"Gemfile"))return!0;if(I($,"pom.xml")||h8($,"build.gradle*"))return!0;if(Y$($).length>0)return!0;let Z=W0($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function u8($){return e2($,()=>tI($))}function tI($){let Z=v($)??[],Q=[];for(let z of Z){if(!z.isDirectory()||z.name.startsWith(".")||sI.has(z.name))continue;let X=P3($,z.name);if(!aI(X))continue;let H=m8(X);if(!H)continue;let U=f8(X).filter((Y)=>oI.has(Y.category)),J=U.find((Y)=>Y.category==="frontend"),G=U.find((Y)=>Y.category==="backend"),V=J??G??U[0]??null;Q.push({name:z.name,language:H,topFramework:V?.name??null,frontend:!!J,backend:!!G||F3.test(H),hasFramework:!!V,appRoot:I(X,"manage.py")||I(X,"config.ru")||I(X,"bin/rails")||I(X,"artisan")})}return Q}function eI($,Z){if(Z?.workspaces||I($,"pnpm-workspace.yaml"))return null;let Q=u8($),z=new Set(Q.map((X)=>X.language));if(Q.length<2||z.size<2)return null;if(!Q.some((X)=>X.frontend)||!Q.some((X)=>X.backend))return null;return`polyglot: ${Q.map((X)=>`${X.name}/ (${X.language})`).join(", ")}`}function R3($){let Z=u8($);if(Z.length<2)return null;let Q=(U)=>(U.appRoot?2:0)+(F3.test(U.language)?2:0)+(U.hasFramework?1:0)+(U.frontend?0.5:0),z=[...Z].sort((U,J)=>Q(J)-Q(U)),X=new Set,H=[];for(let U of z){if(X.has(U.language))continue;X.add(U.language);let J=U.frontend?"frontend":U.backend?"backend":"service";H.push(U.topFramework?`${U.language} (${U.topFramework} · ${J})`:`${U.language} (${J})`)}return H.join("; ")}function W0($){let Z=S($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function h8($,Z){if(!Z.includes("*"))return I($,Z);let Q=Z.split("/");if(Q.length===1){let J=Z.split("*")[0];return(v($)??[]).some((G)=>G.name.startsWith(J))}let z=P3(...Q.slice(0,-1)),X=Q[Q.length-1],H=X.split("*")[0],U=X.split("*")[1]||"";return(v($,z)??[]).some((J)=>J.name.startsWith(H)&&J.name.endsWith(U))}function $O($,Z,Q){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"anyDependency":{let z=$.key??"";return!!(Z?.dependencies?.[z]||Z?.devDependencies?.[z])}case"file":return h8(Q,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!h8(Q,$.pattern))return!1;let z=S(Q,$.pattern);return z!==null&&z.toLowerCase().includes($.key.toLowerCase())}default:return!1}}function f8($){let Z=W0($);return M3.map((Q)=>{let X=Q.signals.filter((H)=>$O(H,Z,$)).length/Q.signals.length;return{name:Q.name,slug:Q.slug,category:Q.category,confidence:X}}).filter((Q)=>Q.confidence>0).sort((Q,z)=>z.confidence-Q.confidence)}function m8($){let Z=W0($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(I($,"tsconfig.json"))return"TypeScript";if(I($,"Cargo.toml"))return"Rust";if(I($,"go.mod"))return"Go";if(Y$($).length>0)return"C#";if(I($,"pyproject.toml")||I($,"setup.py"))return"Python";if(I($,"Gemfile"))return"Ruby";if(Y1($)){let Q=X6($);if(Q)return Q.mainLanguage==="Java/Kotlin"?"Kotlin":Q.mainLanguage;return"Java"}if(I($,"Package.swift"))return"Swift";if(I($,"build.zig"))return"Zig";if(I($,"pubspec.yaml"))return"Dart";if(Z)return"JavaScript";return""}function N3($){let Z=W0($),Q=f8($),z=[],X=cI($,Z);if(X)return z.push(X),{type:"documentation",found:z};let H=hI($,Z);if(H)return z.push(H),{type:"sdk",found:z};let U=uI($);if(U)return z.push(U),{type:"extension",found:z};let J=nI($,Z,Q);if(J)return z.push(J),{type:"mcpaas",found:z};let G=iI($,Z);if(G)return z.push(G),{type:"saas",found:z};let V=pI($,Z);if(V)return z.push(V),{type:"wasm",found:z};let Y=S8($);if(Y)return z.push(Y.found),{type:Y.appType,found:z};let W=b8($);if(W)return z.push(W.found),{type:W.appType,found:z};let B=x8($);if(B)return z.push(B.found),{type:B.appType,found:z};let K=X6($);if(K)return z.push(K.found),{type:K.appType,found:z};let L=g8($);if(L)return z.push(L.found),{type:L.appType,found:z};let q=J6($);if(q)return z.push(q.found),{type:q.appType,found:z};let D=mI($,Z);if(D)return z.push(D),{type:"mobile",found:z};if(Q.some((j)=>j.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(kI($))return z.push("Cargo.toml [[bin]]"),{type:"cli",found:z};if(I($,"build.zig")){if(z.push("build.zig"),I($,"src/main.zig"))return z.push("src/main.zig"),{type:"cli",found:z};if(I($,"src/root.zig"))return z.push("src/root.zig"),{type:"library",found:z}}let _=Q.some((j)=>j.slug==="svelte"||j.slug==="sveltekit");if(Z?.private===!0&&(I($,"pnpm-workspace.yaml")||Z?.workspaces!==void 0)&&_)return z.push("private workspace","Svelte"),{type:"framework",found:z};if(_)return z.push("Svelte/SvelteKit"),{type:"svelte",found:z};let F=Q.some((j)=>j.category==="frontend"),R=Q.some((j)=>j.category==="backend");if(Z?.private&&(Z.workspaces||I($,"pnpm-workspace.yaml"))&&F&&R)return z.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:z};let N=rI($,Z);if(N)return z.push(N),{type:"monorepo-root",found:z};let w=dI($,Z,Q);if(w)return z.push(w),{type:"website",found:z};if(Q.some((j)=>j.slug==="nextjs"||j.slug==="nuxt"))return z.push(Q.find((j)=>j.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:z};let E=Q.some((j)=>j.category==="frontend"),n=Q.some((j)=>j.category==="backend");if(E&&n)return z.push("frontend framework","backend framework"),{type:"fullstack",found:z};if(E)return z.push("frontend framework"),{type:"frontend",found:z};if(n)return z.push("backend framework"),{type:"backend",found:z};let a=fI($);if(a)return z.push(a),{type:"data-science",found:z};let g=lI($,Z);if(g)return z.push(g),{type:"html",found:z};let A=eI($,Z);if(A)return z.push(A),{type:"fullstack",found:z};if(Z?.main&&!Z?.bin)return z.push("package.json main (no bin)"),{type:"library",found:z};return z.push(y2),{type:"library",found:z}}function T3($){if(I($,"bunfig.toml"))return"Bun";if(I($,"deno.json")||I($,"deno.jsonc"))return"Deno";if(W0($))return"Node.js";if(I($,"Cargo.toml"))return"Rust";if(I($,"go.mod"))return"Go";if(Y$($).length>0)return".NET";if(I($,"pubspec.yaml"))return"Dart";return""}var ZO=new Set(["npm","pnpm","yarn","bun"]);function QO($){let Z=W0($)?.packageManager;if(typeof Z!=="string")return"";let Q=/^([a-z]+)@/i.exec(Z.trim())?.[1]?.toLowerCase()??"";return ZO.has(Q)?Q:""}function zO($){if(I($,"pubspec.yaml"))return"pub";if(I($,"go.mod"))return"go modules";if(Y$($).length>0)return"NuGet";if(I($,"pom.xml"))return"maven";return["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"].some((Q)=>I($,Q))?"gradle":""}var XO=[["bun.lockb","bun"],["bun.lock","bun"],["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"]];function A3($){return zO($)||QO($)||(XO.find(([Z])=>I($,Z))?.[1]??"")}function C3($){if(I($,".github/workflows"))return"GitHub Actions";if(I($,".gitlab-ci.yml"))return"GitLab CI";if(I($,".circleci"))return"CircleCI";if(I($,"Jenkinsfile"))return"Jenkins";return null}function j3($){if(I($,"vercel.json"))return"Vercel";if(I($,"netlify.toml"))return"Netlify";if(I($,"wrangler.toml"))return"Cloudflare";if(I($,"fly.toml"))return"Fly.io";if(I($,"render.yaml"))return"Render";return null}var HO=["svelte.config.js","vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"];function UO($){for(let z of HO){let X=S($,z)?.match(/@sveltejs\/adapter-(\w+)/);if(X)return X[1]}let Z=W0($);return Object.keys({...Z?.dependencies,...Z?.devDependencies}).map((z)=>/^@sveltejs\/adapter-(\w+)$/.exec(z)?.[1]).find(Boolean)??null}function w3($){let Z=UO($);if(Z)switch(Z){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 Z}return null}function q1($){let Z=$?.devDependencies?.vite??$?.dependencies?.vite,Q=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return Q===void 0?"Vite":`Vite ${Q}`}function S3($){let Z=W0($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return q1(Z);if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(I($,"tsconfig.json")&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function p8($){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((Q)=>I($,Q))}function l8($,Z){let Q={};if(Z?.scripts){for(let z of["build","test","lint","dev","start"])if(Z.scripts[z]){let X=I($,"bun.lock")||I($,"bun.lockb")?"bun run":"npm run";Q[z]=`${X} ${z}`}}if(I($,"Cargo.toml")){if(!Q.build)Q.build="cargo build --release";if(!Q.test)Q.test="cargo test";if(!Q.lint&&JO($))Q.lint="cargo clippy"}if(I($,"build.zig")){if(!Q.build)Q.build="zig build";if(!Q.test&&/\.step\(\s*"test"/.test(K1($,"build.zig")))Q.test="zig build test"}if(I($,"go.mod")){if(!Q.build)Q.build="go build ./...";if(!Q.test)Q.test="go test ./..."}if(!Q.test&&GO($))Q.test="pytest";return Q}function K1($,Z){return S($,Z)??""}function JO($){if(I($,"clippy.toml")||I($,".clippy.toml"))return!0;return/^\s*\[(workspace\.)?lints\.clippy\]/m.test(K1($,"Cargo.toml"))}function GO($){if(I($,"pytest.ini")||I($,"conftest.py"))return!0;return["pyproject.toml","setup.cfg","tox.ini"].some((Z)=>/\bpytest\b/.test(K1($,Z)))}function E3($,Z,Q,z){let X=[];if(z&&z!=="Unknown")X.push(z);let H=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let U of Q)if(H.has(U.category))X.push(U.name);if(I($,"bunfig.toml"))X.push("Bun");else if(I($,"deno.json")||I($,"deno.jsonc"))X.push("Deno");if(X.length<3&&Z?.dependencies){let U=Object.keys(Z.dependencies).slice(0,5);for(let J of U)if(!X.some((G)=>G.toLowerCase().includes(J.toLowerCase())))X.push(J)}return X}function VO($){let Z=$?.dependencies?.svelte??$?.devDependencies?.svelte,Q=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return Q===void 0?NaN:Number(Q)}function b3($){return D1($).data}function D1($){let Z=W0($),Q=f8($),z=N3($),X=z.type,H=z.found.some((y)=>y.startsWith("polyglot:")),U=H&&R3($)||m8($),J=T3($),G=A3($),V=C3($),Y=j3($),W=S3($),B=Q.find((y)=>y.slug==="sveltekit")??Q.find((y)=>y.category==="frontend"),K=Q.find((y)=>y.category==="css"),L=Q.find((y)=>y.category==="ui"),q=Q.find((y)=>y.category==="state"),D=Q.find((y)=>y.category==="backend"),O=Q.find((y)=>y.category==="database"),_=(y)=>x2(X,y)??x2("library",y)===!0,C=X==="framework",F=Q.some((y)=>y.slug==="svelte"||y.slug==="sveltekit"),R=C&&F?"svelte":C?null:null,N=X==="svelte"||R==="svelte",w=N?w3($):null,P=N&&Q.some((y)=>y.slug==="sveltekit"),E={},n=m.filter((y)=>y.path.startsWith("stack."));for(let y of n){let k=y.path.replace("stack.","");switch(k){case"frontend":E[k]=B?.name??"";break;case"css_framework":E[k]=K?.name??"";break;case"ui_library":E[k]=L?.name??"";break;case"state_management":E[k]=q?.name??(N&&VO(Z)>=5?"Runes":"");break;case"backend":E[k]=N?P?"SvelteKit":D?.name??"":D?.name??"";break;case"api_type":E[k]=P?"Server Routes":"";break;case"runtime":E[k]=J;break;case"database":E[k]=O?.name??"";break;case"connection":E[k]=O?.name??"";break;case"hosting":if(N&&w)E[k]=w;else E[k]=Y??"";break;case"build":E[k]=P?q1(Z):W??"";break;case"cicd":E[k]=V??"";break;case"package_manager":E[k]=G;break;default:E[k]="";break}}let a={};for(let y of n){let k=y.path.replace("stack.","");a[k]=_(y)?E[k]:"slotignored"}let g={},A=m.filter((y)=>y.path.startsWith("monorepo."));for(let y of A){let k=y.path.replace("monorepo.","");if(!_(y))g[k]="slotignored";else g[k]=""}let j={name:Z?.name??$.split("/").pop()??"project",goal:H?"":Z?.description??"",main_language:U,type:X};if(C&&R)j.framework=R;let c=E3($,Z,Q,H?m8($):U);if(H){for(let y of u8($))for(let k of[y.language,y.topFramework])if(k&&!c.includes(k))c.push(k)}let q0=p8($),v1=l8($,Z),K6={faf_version:_3,project:j,stack:a,human_context:{who:"",what:H?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:g,_meta:{found:z.found}};if(c.length>0)K6.tech_stack=c;if(q0.length>0)K6.key_files=q0;if(Object.keys(v1).length>0)K6.commands=v1;return{data:K6,facts:E}}var y3={MIN_LENGTH:8,MAX_LENGTH:280},YO=[/^(see|see\s+the?)\s+readme/i,/^(tbd|todo|fixme|coming\s+soon)\b/i,/^(software|application|app|project|tool|library|framework)\.?$/i,/^(for\s+users|for\s+developers)\.?$/i,/^(description|goal|name|title)\.?$/i,/^lorem\s+ipsum/i,/^example(\s+\w+)?\.?$/i];function P0($){let Z=$.trim();if(Z.length<y3.MIN_LENGTH)return!1;if(Z.length>y3.MAX_LENGTH)return!1;if(YO.some((Q)=>Q.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
260
- `).length>4)return!1;return!0}function WO($){let Z=$.split(`
259
+ `).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function R2($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function wI($){if(!$)return 0;return($.match(/\[[^\]]*\]\([^)]*\)/g)??[]).join("").length/$.length}function W$($,Z){let Q=new RegExp(`##?\\s+(${Z})\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n##?|$)`,"i"),z=$.match(Q);if(!z||!z[2]||z[2].trim().length<=20||wI(z[2])>0.4)return null;return{body:R2(z[2]),heading:z[1].trim()}}function SI($){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 Q=Z.split(/[·|]/).map((z)=>z.trim()).filter(Boolean);if(Q.length>=3&&Q.every((z)=>z.length<=24))return!0;return!1}function G6($,Z,Q=30){for(let z of Z){let X=$.match(z);if(X&&X[1]&&X[1].trim().length>=Q)return R2(X[1])}return null}function EI($,Z){if($?.description&&$.description.length>20)return $0(R2($.description),"package.json:description",0.95);let Q=W$(Z,"Purpose|What|About|Overview|Description");if(Q)return $0(Q.body,`README:## ${Q.heading}`,0.8);let z=Z.split(/\n\s*\n/).map((H)=>H.replace(/\s+/g," ").trim()).find((H)=>H.length>30&&!H.startsWith("#")&&!SI(H));if(z)return $0(R2(z),"README:first-paragraph",0.5);let X=G6(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?$0(X,"README:problem-heuristic",0.6):null}function bI($){let Z=W$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return $0(Z.body,`README:## ${Z.heading}`,0.8);let Q=G6($,[/\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 Q?$0(Q,"README:audience-heuristic",0.6):null}function yI($){let Z=W$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return $0(Z.body,`README:## ${Z.heading}`,0.8);let Q=G6($,[/(?: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 Q?$0(Q,"README:mission-heuristic",0.6):null}function xI($,Z){let Q=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(Q)return $0(R2(Q.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return $0(R2($.homepage),"package.json:homepage",0.9);let z=G6(Z,[/\b(?:deployed|hosted|available|published)\s+(?:on|at|via)\s+([^.\n]{3,80})/i],3);return z?$0(z,"README:deploy-heuristic",0.6):null}function gI($){let Z=W$($,"Timeline|Status|Release|Roadmap");if(Z)return $0(Z.body,`README:## ${Z.heading}`,0.8);let Q=G6($,[/\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 Q?$0(Q,"README:since-heuristic",0.6):null}function vI($,Z){let Q=$?.scripts?Object.keys($.scripts):[],z=["start","dev","build"].filter((U)=>Q.includes(U));if(z.length)return $0(R2(z.map((U)=>`npm run ${U}`).join(", ")),"package.json:scripts",0.9);let X=W$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(X)return $0(X.body,`README:## ${X.heading}`,0.8);let H=W$(Z,"Architecture|Approach|How it works|Methodology|How");return H?$0(H.body,`README:## ${H.heading}`,0.7):null}var _3="3.0";import{join as P3}from"path";var M3=[{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:"anyDependency",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"}]}];function kI($){let Z=S($,"Cargo.toml");if(Z===null)return null;let Q=Z.match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return Q?Q[1]:null}function hI($){let Z=S($,"Cargo.toml");return Z!==null&&/^\s*\[\[bin\]\]/m.test(Z)}function uI($,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 Q=kI($);if(Q&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(Q))return`Cargo.toml name "${Q}" → sdk`;return null}function fI($){let Z=["manifest.json","public/manifest.json","src/manifest.json","app/manifest.json","extension/manifest.json","dist/manifest.json"];for(let Q of Z){let z=S($,Q);if(z===null)continue;try{let X=JSON.parse(z);if(typeof X.manifest_version==="number")return`${Q} manifest_version ${X.manifest_version} (browser extension)`}catch{}}return null}function mI($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,Q=S($,"pyproject.toml");if(Q!==null){let X=Q.match(Z);if(X)return`pyproject.toml depends on ${X[1]}`}let z=S($,"requirements.txt");if(z!==null){let X=z.match(Z);if(X)return`requirements.txt contains ${X[1]}`}return null}function pI($,Z){let Q=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let z of Q)if(Z.dependencies?.[z]||Z.devDependencies?.[z])return`${z} dependency`}if(I($,"ios")&&I($,"android"))return"ios/ + android/ dirs";return null}function lI($,Z){let Q=S($,"Cargo.toml");if(Q!==null){if(/crate-type\s*=\s*\[[^\]]*"cdylib"/.test(Q))return'Cargo.toml crate-type = ["cdylib"]';if(/wasm-bindgen|wasm-pack/i.test(Q))return"Cargo.toml wasm-bindgen/wasm-pack"}let z=S($,"build.zig");if(z!==null&&/\.wasm\b|wasm32|setOutputFormat\(\.wasm/i.test(z))return"build.zig wasm target";if(Z?.keywords?.some((X)=>/^wasm(?:-|$)|webassembly/i.test(X)))return'package.json keywords contains "wasm"';return null}function cI($,Z){if(!I($,"index.html"))return null;if(Z?.dependencies||Z?.devDependencies){let Q={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((X)=>Q[X]))return null}return"index.html (vanilla, no frontend framework)"}function dI($,Z){if(Z?.name&&/specification|^@.*\/spec/i.test(Z.name))return`package name "${Z.name}" → documentation`;if(Z?.keywords?.some((Q)=>/^(specification|format-spec|standard)$/i.test(Q)))return'package keywords contains "specification"';if(Z?.bin)return null;if(Z?.files&&Z.files.length>0){let Q=/^(dist|src|lib|build|bin)(\/|$)|\/(dist|src|lib|build|bin)(\/|$)|(\.|\/)(js|ts|tsx|jsx|mjs|cjs|py|rs|go)$/,z=Z.files.some((H)=>Q.test(H)),X=Z.files.some((H)=>/\.(md|MD)$|examples?\//.test(H)||H==="README.md"||H==="docs"||H==="docs/");if(!z&&X)return"package.json files = docs/examples only (no source)"}return null}function iI($,Z,Q){let z=Q.find((X)=>X.slug==="astro"||X.slug==="gatsby");if(z)return`${z.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 nI($,Z){if(!Z)return null;let Q={...Z.dependencies??{},...Z.devDependencies??{}},z=["@clerk/nextjs","@clerk/clerk-react","next-auth","@auth/core","auth0","@auth0/nextjs-auth0"],X=["stripe","@stripe/stripe-js","lemonsqueezy"],H=z.some((J)=>Q[J]),U=X.some((J)=>Q[J]);if(H&&U)return"auth + payment dependencies";return null}function rI($,Z,Q){if(Z?.keywords?.some((H)=>/mcpaas/i.test(H)))return'package keywords contains "mcpaas"';if(Z?.name&&/mcpaas/i.test(Z.name))return`package name "${Z.name}" → mcpaas`;let z=Q.some((H)=>H.slug==="mcp"),X=Q.some((H)=>H.category==="database");if(z&&X&&Z?.dependencies&&Object.keys(Z.dependencies).length>10)return"MCP + database + complex deps (platform shape)";return null}function sI($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||I($,"pnpm-workspace.yaml")))return null;return"private workspace + multi-package"}var oI=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"]),F3=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,aI=new Set(["frontend","backend","database","css","ui","state"]);function tI($){if(I($,"pyproject.toml")||I($,"manage.py")||I($,"setup.py")||h8($,"requirements*.txt"))return!0;if(I($,"go.mod"))return!0;if(I($,"Cargo.toml"))return!0;if(I($,"Gemfile"))return!0;if(I($,"pom.xml")||h8($,"build.gradle*"))return!0;if(Y$($).length>0)return!0;let Z=W0($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function u8($){return e2($,()=>eI($))}function eI($){let Z=v($)??[],Q=[];for(let z of Z){if(!z.isDirectory()||z.name.startsWith(".")||oI.has(z.name))continue;let X=P3($,z.name);if(!tI(X))continue;let H=m8(X);if(!H)continue;let U=f8(X).filter((Y)=>aI.has(Y.category)),J=U.find((Y)=>Y.category==="frontend"),G=U.find((Y)=>Y.category==="backend"),V=J??G??U[0]??null;Q.push({name:z.name,language:H,topFramework:V?.name??null,frontend:!!J,backend:!!G||F3.test(H),hasFramework:!!V,appRoot:I(X,"manage.py")||I(X,"config.ru")||I(X,"bin/rails")||I(X,"artisan")})}return Q}function $O($,Z){if(Z?.workspaces||I($,"pnpm-workspace.yaml"))return null;let Q=u8($),z=new Set(Q.map((X)=>X.language));if(Q.length<2||z.size<2)return null;if(!Q.some((X)=>X.frontend)||!Q.some((X)=>X.backend))return null;return`polyglot: ${Q.map((X)=>`${X.name}/ (${X.language})`).join(", ")}`}function R3($){let Z=u8($);if(Z.length<2)return null;let Q=(U)=>(U.appRoot?2:0)+(F3.test(U.language)?2:0)+(U.hasFramework?1:0)+(U.frontend?0.5:0),z=[...Z].sort((U,J)=>Q(J)-Q(U)),X=new Set,H=[];for(let U of z){if(X.has(U.language))continue;X.add(U.language);let J=U.frontend?"frontend":U.backend?"backend":"service";H.push(U.topFramework?`${U.language} (${U.topFramework} · ${J})`:`${U.language} (${J})`)}return H.join("; ")}function W0($){let Z=S($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function h8($,Z){if(!Z.includes("*"))return I($,Z);let Q=Z.split("/");if(Q.length===1){let J=Z.split("*")[0];return(v($)??[]).some((G)=>G.name.startsWith(J))}let z=P3(...Q.slice(0,-1)),X=Q[Q.length-1],H=X.split("*")[0],U=X.split("*")[1]||"";return(v($,z)??[]).some((J)=>J.name.startsWith(H)&&J.name.endsWith(U))}function ZO($,Z,Q){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"anyDependency":{let z=$.key??"";return!!(Z?.dependencies?.[z]||Z?.devDependencies?.[z])}case"file":return h8(Q,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!h8(Q,$.pattern))return!1;let z=S(Q,$.pattern);return z!==null&&z.toLowerCase().includes($.key.toLowerCase())}default:return!1}}function f8($){let Z=W0($);return M3.map((Q)=>{let X=Q.signals.filter((H)=>ZO(H,Z,$)).length/Q.signals.length;return{name:Q.name,slug:Q.slug,category:Q.category,confidence:X}}).filter((Q)=>Q.confidence>0).sort((Q,z)=>z.confidence-Q.confidence)}function m8($){let Z=W0($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(I($,"tsconfig.json"))return"TypeScript";if(I($,"Cargo.toml"))return"Rust";if(I($,"go.mod"))return"Go";if(Y$($).length>0)return"C#";if(I($,"pyproject.toml")||I($,"setup.py"))return"Python";if(I($,"Gemfile"))return"Ruby";if(Y1($)){let Q=X6($);if(Q)return Q.mainLanguage==="Java/Kotlin"?"Kotlin":Q.mainLanguage;return"Java"}if(I($,"Package.swift"))return"Swift";if(I($,"build.zig"))return"Zig";if(I($,"pubspec.yaml"))return"Dart";if(Z)return"JavaScript";return""}function N3($){let Z=W0($),Q=f8($),z=[],X=dI($,Z);if(X)return z.push(X),{type:"documentation",found:z};let H=uI($,Z);if(H)return z.push(H),{type:"sdk",found:z};let U=fI($);if(U)return z.push(U),{type:"extension",found:z};let J=rI($,Z,Q);if(J)return z.push(J),{type:"mcpaas",found:z};let G=nI($,Z);if(G)return z.push(G),{type:"saas",found:z};let V=lI($,Z);if(V)return z.push(V),{type:"wasm",found:z};let Y=S8($);if(Y)return z.push(Y.found),{type:Y.appType,found:z};let W=b8($);if(W)return z.push(W.found),{type:W.appType,found:z};let B=x8($);if(B)return z.push(B.found),{type:B.appType,found:z};let K=X6($);if(K)return z.push(K.found),{type:K.appType,found:z};let L=g8($);if(L)return z.push(L.found),{type:L.appType,found:z};let q=J6($);if(q)return z.push(q.found),{type:q.appType,found:z};let D=pI($,Z);if(D)return z.push(D),{type:"mobile",found:z};if(Q.some((j)=>j.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(hI($))return z.push("Cargo.toml [[bin]]"),{type:"cli",found:z};if(I($,"build.zig")){if(z.push("build.zig"),I($,"src/main.zig"))return z.push("src/main.zig"),{type:"cli",found:z};if(I($,"src/root.zig"))return z.push("src/root.zig"),{type:"library",found:z}}let _=Q.some((j)=>j.slug==="svelte"||j.slug==="sveltekit");if(Z?.private===!0&&(I($,"pnpm-workspace.yaml")||Z?.workspaces!==void 0)&&_)return z.push("private workspace","Svelte"),{type:"framework",found:z};if(_)return z.push("Svelte/SvelteKit"),{type:"svelte",found:z};let F=Q.some((j)=>j.category==="frontend"),R=Q.some((j)=>j.category==="backend");if(Z?.private&&(Z.workspaces||I($,"pnpm-workspace.yaml"))&&F&&R)return z.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:z};let N=sI($,Z);if(N)return z.push(N),{type:"monorepo-root",found:z};let w=iI($,Z,Q);if(w)return z.push(w),{type:"website",found:z};if(Q.some((j)=>j.slug==="nextjs"||j.slug==="nuxt"))return z.push(Q.find((j)=>j.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:z};let E=Q.some((j)=>j.category==="frontend"),n=Q.some((j)=>j.category==="backend");if(E&&n)return z.push("frontend framework","backend framework"),{type:"fullstack",found:z};if(E)return z.push("frontend framework"),{type:"frontend",found:z};if(n)return z.push("backend framework"),{type:"backend",found:z};let a=mI($);if(a)return z.push(a),{type:"data-science",found:z};let g=cI($,Z);if(g)return z.push(g),{type:"html",found:z};let A=$O($,Z);if(A)return z.push(A),{type:"fullstack",found:z};if(Z?.main&&!Z?.bin)return z.push("package.json main (no bin)"),{type:"library",found:z};return z.push(y2),{type:"library",found:z}}function T3($){if(I($,"bunfig.toml"))return"Bun";if(I($,"deno.json")||I($,"deno.jsonc"))return"Deno";if(W0($))return"Node.js";if(I($,"Cargo.toml"))return"Rust";if(I($,"go.mod"))return"Go";if(Y$($).length>0)return".NET";if(I($,"pubspec.yaml"))return"Dart";return""}var QO=new Set(["npm","pnpm","yarn","bun"]);function zO($){let Z=W0($)?.packageManager;if(typeof Z!=="string")return"";let Q=/^([a-z]+)@/i.exec(Z.trim())?.[1]?.toLowerCase()??"";return QO.has(Q)?Q:""}function XO($){if(I($,"pubspec.yaml"))return"pub";if(I($,"go.mod"))return"go modules";if(Y$($).length>0)return"NuGet";if(I($,"pom.xml"))return"maven";return["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"].some((Q)=>I($,Q))?"gradle":""}var HO=[["bun.lockb","bun"],["bun.lock","bun"],["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"]];function A3($){return XO($)||zO($)||(HO.find(([Z])=>I($,Z))?.[1]??"")}function C3($){if(I($,".github/workflows"))return"GitHub Actions";if(I($,".gitlab-ci.yml"))return"GitLab CI";if(I($,".circleci"))return"CircleCI";if(I($,"Jenkinsfile"))return"Jenkins";return null}function j3($){if(I($,"vercel.json"))return"Vercel";if(I($,"netlify.toml"))return"Netlify";if(I($,"wrangler.toml"))return"Cloudflare";if(I($,"fly.toml"))return"Fly.io";if(I($,"render.yaml"))return"Render";return null}var UO=["svelte.config.js","vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"];function JO($){for(let z of UO){let X=S($,z)?.match(/@sveltejs\/adapter-(\w+)/);if(X)return X[1]}let Z=W0($);return Object.keys({...Z?.dependencies,...Z?.devDependencies}).map((z)=>/^@sveltejs\/adapter-(\w+)$/.exec(z)?.[1]).find(Boolean)??null}function w3($){let Z=JO($);if(Z)switch(Z){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 Z}return null}function q1($){let Z=$?.devDependencies?.vite??$?.dependencies?.vite,Q=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return Q===void 0?"Vite":`Vite ${Q}`}function S3($){let Z=W0($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return q1(Z);if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(I($,"tsconfig.json")&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function p8($){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((Q)=>I($,Q))}function l8($,Z){let Q={};if(Z?.scripts){for(let z of["build","test","lint","dev","start"])if(Z.scripts[z]){let X=I($,"bun.lock")||I($,"bun.lockb")?"bun run":"npm run";Q[z]=`${X} ${z}`}}if(I($,"Cargo.toml")){if(!Q.build)Q.build="cargo build --release";if(!Q.test)Q.test="cargo test";if(!Q.lint&&GO($))Q.lint="cargo clippy"}if(I($,"build.zig")){if(!Q.build)Q.build="zig build";if(!Q.test&&/\.step\(\s*"test"/.test(K1($,"build.zig")))Q.test="zig build test"}if(I($,"go.mod")){if(!Q.build)Q.build="go build ./...";if(!Q.test)Q.test="go test ./..."}if(!Q.test&&VO($))Q.test="pytest";return Q}function K1($,Z){return S($,Z)??""}function GO($){if(I($,"clippy.toml")||I($,".clippy.toml"))return!0;return/^\s*\[(workspace\.)?lints\.clippy\]/m.test(K1($,"Cargo.toml"))}function VO($){if(I($,"pytest.ini")||I($,"conftest.py"))return!0;return["pyproject.toml","setup.cfg","tox.ini"].some((Z)=>/\bpytest\b/.test(K1($,Z)))}function E3($,Z,Q,z){let X=[];if(z&&z!=="Unknown")X.push(z);let H=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let U of Q)if(H.has(U.category))X.push(U.name);if(I($,"bunfig.toml"))X.push("Bun");else if(I($,"deno.json")||I($,"deno.jsonc"))X.push("Deno");if(X.length<3&&Z?.dependencies){let U=Object.keys(Z.dependencies).slice(0,5);for(let J of U)if(!X.some((G)=>G.toLowerCase().includes(J.toLowerCase())))X.push(J)}return X}function YO($){let Z=$?.dependencies?.svelte??$?.devDependencies?.svelte,Q=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return Q===void 0?NaN:Number(Q)}function b3($){return D1($).data}function D1($){let Z=W0($),Q=f8($),z=N3($),X=z.type,H=z.found.some((y)=>y.startsWith("polyglot:")),U=H&&R3($)||m8($),J=T3($),G=A3($),V=C3($),Y=j3($),W=S3($),B=Q.find((y)=>y.slug==="sveltekit")??Q.find((y)=>y.category==="frontend"),K=Q.find((y)=>y.category==="css"),L=Q.find((y)=>y.category==="ui"),q=Q.find((y)=>y.category==="state"),D=Q.find((y)=>y.category==="backend"),O=Q.find((y)=>y.category==="database"),_=(y)=>x2(X,y)??x2("library",y)===!0,C=X==="framework",F=Q.some((y)=>y.slug==="svelte"||y.slug==="sveltekit"),R=C&&F?"svelte":C?null:null,N=X==="svelte"||R==="svelte",w=N?w3($):null,P=N&&Q.some((y)=>y.slug==="sveltekit"),E={},n=m.filter((y)=>y.path.startsWith("stack."));for(let y of n){let k=y.path.replace("stack.","");switch(k){case"frontend":E[k]=B?.name??"";break;case"css_framework":E[k]=K?.name??"";break;case"ui_library":E[k]=L?.name??"";break;case"state_management":E[k]=q?.name??(N&&YO(Z)>=5?"Runes":"");break;case"backend":E[k]=N?P?"SvelteKit":D?.name??"":D?.name??"";break;case"api_type":E[k]=P?"Server Routes":"";break;case"runtime":E[k]=J;break;case"database":E[k]=O?.name??"";break;case"connection":E[k]=O?.name??"";break;case"hosting":if(N&&w)E[k]=w;else E[k]=Y??"";break;case"build":E[k]=P?q1(Z):W??"";break;case"cicd":E[k]=V??"";break;case"package_manager":E[k]=G;break;default:E[k]="";break}}let a={};for(let y of n){let k=y.path.replace("stack.","");a[k]=_(y)?E[k]:"slotignored"}let g={},A=m.filter((y)=>y.path.startsWith("monorepo."));for(let y of A){let k=y.path.replace("monorepo.","");if(!_(y))g[k]="slotignored";else g[k]=""}let j={name:Z?.name??$.split("/").pop()??"project",goal:H?"":Z?.description??"",main_language:U,type:X};if(C&&R)j.framework=R;let c=E3($,Z,Q,H?m8($):U);if(H){for(let y of u8($))for(let k of[y.language,y.topFramework])if(k&&!c.includes(k))c.push(k)}let q0=p8($),v1=l8($,Z),K6={faf_version:_3,project:j,stack:a,human_context:{who:"",what:H?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:g,_meta:{found:z.found}};if(c.length>0)K6.tech_stack=c;if(q0.length>0)K6.key_files=q0;if(Object.keys(v1).length>0)K6.commands=v1;return{data:K6,facts:E}}var y3={MIN_LENGTH:8,MAX_LENGTH:280},WO=[/^(see|see\s+the?)\s+readme/i,/^(tbd|todo|fixme|coming\s+soon)\b/i,/^(software|application|app|project|tool|library|framework)\.?$/i,/^(for\s+users|for\s+developers)\.?$/i,/^(description|goal|name|title)\.?$/i,/^lorem\s+ipsum/i,/^example(\s+\w+)?\.?$/i];function P0($){let Z=$.trim();if(Z.length<y3.MIN_LENGTH)return!1;if(Z.length>y3.MAX_LENGTH)return!1;if(WO.some((Q)=>Q.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
260
+ `).length>4)return!1;return!0}function BO($){let Z=$.split(`
261
261
  `),Q=0;while(Q<Z.length&&/^(#\s|$)/.test(Z[Q].trim()))Q++;while(Q<Z.length){let z=Z[Q].trim();if(/^\[!\[/.test(z)){Q++;continue}if(/^!\[/.test(z)){Q++;continue}if(/^<img\s/i.test(z)){Q++;continue}if(z===""){Q++;continue}break}return Z.slice(Q).join(`
262
- `)}function BO($){let Q=WO($).split(`
262
+ `)}function qO($){let Q=BO($).split(`
263
263
  `),z=[];for(let X of Q){let H=X.trim();if(H===""){if(z.length>0)break;continue}if(/^(#|>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(H))break;if(/^\*\*[^*]+\*\*\s*$/.test(H)&&z.length===0)continue;z.push(H)}if(z.length===0)return null;return z.join(" ").trim()}function N2($,Z){let Q=$.split(`
264
- `),z=0;while(z<Q.length){let H=Q[z].trim().match(/^(#{1,6})\s+(.+)$/);if(H&&Z.test(H[2])){let U=H[1].length,J=[];z++;while(z<Q.length){let G=Q[z].trim(),V=G.match(/^(#{1,6})\s+/);if(V&&V[1].length<=U)break;if(G===""){if(J.length>0)break;z++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(G))break;J.push(G),z++}if(J.length===0)return null;return J.join(" ").trim()}z++}return null}function qO($){let Z=N2($,/^(use\s+cases?|goal)\b/i);if(Z&&P0(Z))return Z;let Q=BO($);if(Q&&P0(Q))return Q;return}function KO($){let Z=N2($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&P0(Z))return Z;return}function DO($){let Z=N2($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&P0(Z))return Z;return}function LO($){let Z=N2($,/^(why|motivation|problem|rationale)\b/i);if(Z&&P0(Z))return Z;return}function IO($){let Z=N2($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&P0(Z))return Z;return}function OO($){let Z=N2($,/^(status|history|timeline|since|launched)\b/i);if(Z&&P0(Z))return Z;return}function _O($){let Z=N2($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&P0(Z))return Z;return}function L1($){let Z=["README.md","README.MD","Readme.md","readme.md"],Q=null;for(let K of Z)if(I($,K)){Q=K;break}if(!Q)return{};let z=S($,Q);if(z===null)return{};z=z.replace(/<!--[\s\S]*?-->/g,"");let X={},H=qO(z);if(H)X.project={goal:H};let U={},J=KO(z);if(J)U.what=J;let G=DO(z);if(G)U.who=G;let V=LO(z);if(V)U.why=V;let Y=IO(z);if(Y)U.where=Y;let W=OO(z);if(W)U.when=W;let B=_O(z);if(B)U.how=B;if(Object.keys(U).length>0)X.human_context=U;return X}function MO($,Z){let Q=$.split(`
265
- `),z=!1;for(let X of Q){let H=X.trim();if(/^\[/.test(H)){z=H==="[package]";continue}if(!z)continue;let U=H.match(new RegExp(`^${Z}\\s*=\\s*(.+)$`));if(U){let J=U[1].trim();J=J.replace(/\s*#.*$/,"").trim();let G=J.match(/^"((?:[^"\\]|\\.)*)"$/)||J.match(/^'((?:[^'\\]|\\.)*)'$/);if(G)return G[1];return J}}return null}function I1($){let Z=S($,"Cargo.toml");if(Z===null)return{};let Q=MO(Z,"description");if(Q&&P0(Q))return{project:{goal:Q}};return{}}import{join as x3}from"path";var PO=[{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"}],FO=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function RO($){let Z=[],Q=(z,X)=>{for(let H of v($,z)??[])if(H.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(H.name))Z.push(x3(z,H.name));else if(H.isDirectory()&&X>0&&!H.name.startsWith(".")&&!FO.has(H.name))Q(x3(z,H.name),X-1)};return Q(".",1),Z}function V6($){return[...$].join(" · ")}function O1($){let Z=RO($);if(Z.length===0)return{};let Q={database:new Set,cache:new Set,search:new Set,storage:new Set,runtime:new Set};for(let X of Z){let H=S($,X);if(H===null)continue;for(let U of H.matchAll(/^\s*image:\s*["']?([^\s"'#]+)/gm)){let J=U[1].toLowerCase(),G=J.replace(/:[^/]*$/,"").split("/").pop()??J,V=J.replace(/:[^/]*$/,"");for(let{re:Y,slot:W,label:B}of PO)if(Y.test(G)||Y.test(V))Q[W].add(B)}}let z={};if(Q.database.size)z.database=V6(Q.database);if(Q.cache.size)z.cache=V6(Q.cache);if(Q.search.size)z.search=V6(Q.search);if(Q.storage.size)z.storage=V6(Q.storage);if(Q.runtime.size)z.runtime=`Docker Compose (${V6(Q.runtime)})`;if(Object.keys(z).length===0&&!Q.runtime.size)return{stack:{hosting:"Docker Compose"}};return z.hosting="Docker Compose",{stack:z}}import{join as NO}from"path";var TO=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),AO=[{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((Q)=>Q[1])}}];function _1($,Z){for(let Q of Z){let z=$.find((X)=>Q.test(X));if(z)return z}return null}function CO($){let Z=[$];for(let Q of v($)??[])if(Q.isDirectory()&&!Q.name.startsWith(".")&&!TO.has(Q.name))Z.push(NO($,Q.name));return Z}function jO($){let Z=0;if(I($,"manage.py")||I($,"pyproject.toml")||I($,"Gemfile"))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function M1($){return e2($,()=>wO($))}function wO($){let Z=[];for(let z of CO($)){let X=z===$,H=X?"":`cd ${z.slice($.length+1)} && `;for(let U of AO){let J=S(z,U.file);if(J===null)continue;let G=U.targets(J);if(G.length===0)continue;let V={},Y=_1(G,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),W=_1(G,[/^build$/i,/^compile$/i,/^build/i]),B=_1(G,[/^check-all$/i,/^check$/i,/^lint$/i,/^lint/i,/^fmt$/i,/^format$/i]);if(Y)V.test=`${H}${U.runner} ${Y}`;if(W)V.build=`${H}${U.runner} ${W}`;if(B)V.lint=`${H}${U.runner} ${B}`;if(Object.keys(V).length===0)continue;Z.push({score:Object.keys(V).length+(X?10:jO(z)),commands:V})}}let Q=Z.sort((z,X)=>X.score-z.score)[0];return Q?{commands:Q.commands}:{}}var SO=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function P1($){for(let Z of SO)if(I($,Z))return{security:{secrets:".env",example:Z}};return{}}function EO($,Z){let Q={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(Q[z]&&Object.keys(Q[z]).length===0)delete Q[z];return Q}function F1($){return[L1($),I1($),O1($),M1($),P1($)].reduce(EO,{})}function g3($){try{let Z=s2($,{logLevel:"error"}).getIn(["project","type"],!0);return s(Z)&&typeof Z.comment==="string"&&Z.comment.includes(y2)}catch{return!1}}function R1($){let Z=b3($),Q=F1($),z={};if(Q.stack)z.stack=Q.stack;if(Q.commands)z.commands=Q.commands;if(Q.security)z.security=Q.security;let X={};if(Q.project)X.project=Q.project;if(Q.human_context)X.human_context=Q.human_context;let H=l0(l0(z,Z),X);mO(H);let J=(Z._meta?.found??[]).some((V)=>V.startsWith("polyglot:")),G=l0(H,v8($));return l0(G,{human_context:k8($,{toolingRoot:J})})}function bO($,Z){let Q=fO(Y8(Z,"updateExistingFaf: the existing .faf")),{data:z,facts:X}=D1($),H=z,U=l0(Q,F1($)),J=l0(U,H),G=l0(J,v8($)),V=gO(l0(G,{human_context:k8($)}),Q),Y=vO(yO(Z,Q,H)?kO(v3(V,Q),Q,X):v3(V,Q),Q);return k9(g9(Z,Y))}function yO($,Z,Q){if(!o(H0(Z,"project.type"))){let X=a$($)?.text;return X===void 0||!g3(X)}return!(Q._meta?.found??[]).includes(y2)}function N1($){return $.canonical?[$.path,$.canonical]:[$.path]}function H0($,Z){let[Q,z]=Z.split("."),X=$[Q];return u(X)?X[z]:void 0}function T2($,Z,Q){let[z,X]=Z.split("."),H=$[z];if(!u(H))return;if(Q===void 0?!(X in H):H[X]===Q)return;let U={...H};if(Q===void 0)delete U[X];else U[X]=Q;$[z]=U}var A2=($)=>typeof $==="string"&&$.trim()===L6;function xO($,Z){let Q=Z.map((z)=>H0($,z));return Q.some(A2)&&Q.every((z)=>o(z)||A2(z))}function v3($,Z){let Q={...$};for(let z of m){let X=N1(z);if(!xO(Z,X))continue;for(let H of X){let U=H0(Z,H);if(H0(Q,H)!==U)T2(Q,H,U)}}return Q}function C2($,Z){let[Q,z]=Z.split("."),X=$[Q];return u(X)&&Object.prototype.hasOwnProperty.call(X,z)}function gO($,Z){let Q={...$};for(let z of m){if(!z.canonical||!C2(Z,z.canonical)||C2(Z,z.path))continue;let X=H0(Q,z.path);T2(Q,z.path,void 0);let H=H0(Q,z.canonical);if(c8(X)&&o(H))T2(Q,z.canonical,X)}return Q}function vO($,Z){let Q={...$};for(let z of m){if(!z.canonical||!C2(Z,z.canonical)||C2(Z,z.path))continue;let X=H0(Q,z.canonical);if(c8(X)||A2(X))T2(Q,z.path,X)}return Q}function kO($,Z,Q={}){let z=$.project,X=u(z)?z.type:void 0,H={...$};for(let U of m){if(U.category==="human"||U.category==="project")continue;let J=x2(X,U);if(J===null)return $;if(J)hO(H,Z,U,U.path.startsWith("stack.")?Q[U.path.slice(6)]:void 0);else uO(H,U)}return H}function hO($,Z,Q,z){let X=N1(Q);for(let U of X)if(A2(H0($,U))&&!A2(H0(Z,U)))T2($,U,C2(Z,U)?H0(Z,U):"");if(!c8(z))return;let H=X.filter((U)=>C2($,U));if(H.some((U)=>!o(H0($,U))))return;for(let U of H.length>0?H:[Q.path])T2($,U,z)}function uO($,Z){let Q=N1(Z).filter((X)=>C2($,X)),z=(X)=>!o(H0($,X))&&!A2(H0($,X));if(Q.some(z))return;for(let X of Q.length>0?Q:[Z.path])if(o(H0($,X)))T2($,X,L6)}function fO($){let Z=$.project;if(Z===null||Z===void 0||u(Z)||Array.isArray(Z))return $;return{...$,project:{name:String(Z)}}}function mO($){let Z=$.project?.type??"library",Q=b2[Z]||b2.library;for(let z of m){if(Q.includes(z.category))continue;let[X,H]=z.path.split(".");if(X==="stack"&&$.stack)$.stack[H]="slotignored";if(X==="monorepo"&&$.monorepo)$.monorepo[H]="slotignored"}}function l0($,Z){return k3($,Z,"")}function pO($){let Z=g0.get($);return Z!==void 0&&Z.category!=="human"}function c8($){if(typeof $==="number"||typeof $==="boolean")return!0;return typeof $==="string"&&$.trim()!==""&&!o($)&&!A2($)}function lO($,Z){return pO($)&&c8(Z)}function k3($,Z,Q){let z={...$};for(let[X,H]of Object.entries(Z)){let U=z[X],J=Q?`${Q}.${X}`:X;if(J==="_meta"&&U!==void 0)continue;if(a8(U)){if(lO(J,H))z[X]=H;continue}if(o(U))z[X]=H;else if(u(H)&&u(U))z[X]=k3(U,H,J)}return z}function cO($){let Z=($??"").trim();if(!Z)throw Error("Please provide a GitHub URL.");if(/[\s;&|`$(){}<>\\^'"!*?[\]]/.test(Z))throw Error(`Refusing unsafe URL: ${JSON.stringify($)}`);let Q=Z.replace(/\/+$/,"").replace(/\.git$/i,""),z=Q.match(/^(?:github\.com\/)?([A-Za-z0-9][A-Za-z0-9._-]*)\/([A-Za-z0-9][A-Za-z0-9._-]*)$/);if(z)return`https://github.com/${z[1]}/${z[2]}.git`;if(/^https?:\/\/[A-Za-z0-9._\-/:@~%]+$/.test(Q))return`${Q}.git`;throw Error(`Not a recognized GitHub repo URL: ${JSON.stringify($)}`)}function h3($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function dO($,Z={}){let Q=R1($);if(Z.repoUrl&&Q.project&&!W0($)?.name&&Q.project.name===$.split("/").pop())Q.project.name=h3(Z.repoUrl);return Q}import{existsSync as u3,lstatSync as iO}from"fs";import{join as nO,basename as rO}from"path";import{createHash as sO}from"crypto";var B0=($)=>typeof $==="object"&&$!==null&&!Array.isArray($),R0=($)=>typeof $==="number"&&Number.isFinite($),F0=($)=>typeof $==="string",oO=/^v?\d+\.\d+\.\d+$/,aO=new Set(["birth","doubled","peak","current"]);function c3($){return B0($)&&F0($.version)&&oO.test($.version)&&R0($.score)}var tO=($)=>R0($.birthDNA)?$.birthDNA:R0($.birthWeight)?$.birthWeight:null,eO=($)=>B0($)&&R0($.birthDNA)&&F0($.born),f3=($)=>B0($)&&F0($.born)&&R0($.birthDNA)&&R0($.lastScore)&&F0($.endedAt),$_=($)=>Array.isArray($)&&$.length>0&&$.every(c3),Z_=($)=>B0($)&&R0($.score)&&F0($.version),Q_=($)=>B0($)&&Array.isArray($.milestones)&&$.milestones.every(B0);function m3($){return B0($)&&eO($.birthCertificate)&&$_($.versions)&&Z_($.current)&&Q_($.growth)}function T1($){try{return iO($),!0}catch{return!1}}var A1=($)=>`${JSON.stringify($,null,2)}
266
- `,z_=new Set(["version","score","lastSync"]),X_=new Set(["type","score","date","version","label","emoji"]),p3=($,Z)=>Object.keys($).every((Q)=>Z.has(Q)),C1={birth:{label:"Birth",emoji:"\uD83D\uDC23"},doubled:{label:"Doubled",emoji:"2️⃣"},peak:{label:"Peak",emoji:"\uD83C\uDFD4️"},current:{label:"Current",emoji:"\uD83D\uDCCD"}},d3=($)=>$.growth.milestones.filter((Z)=>Z.type==="peak"||Z.type==="current"),i3=($)=>p3($.current,z_)&&d3($).every((Z)=>p3(Z,X_)),H_=($)=>d3($).every((Z)=>Z.label===C1[Z.type].label&&Z.emoji===C1[Z.type].emoji);function U_($){return i3($)&&H_($)}var J_=".faf-dna is not in faf's shape: faf reads it and leaves it as it is.",G_=".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.",V_=".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.",Y_=".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.",W_=".faf-dna has no birth certificate faf can read: faf leaves it as it is.";function B_($){if(!Array.isArray($))return[];return $.filter((Z)=>B0(Z)&&F0(Z.type)&&aO.has(Z.type)&&R0(Z.score))}var j2=($,Z="")=>F0($)?$:Z;function q_($,Z){if(!Array.isArray($))return[];return $.filter(c3).map((Q)=>({version:Q.version,timestamp:j2(Q.timestamp),score:Q.score,changes:Array.isArray(Q.changes)?Q.changes.filter(F0):[],growth:R0(Q.growth)?Q.growth:Q.score-Z}))}function K_($,Z,Q,z){return{version:j2($.version,Z?.version??"v1.0.0"),score:R0($.score)?$.score:Z?.score??Q,lastSync:j2($.lastSync,z)}}function l3($){if(!B0($)||!B0($.birthCertificate))return null;let Z=$.birthCertificate,Q=tO(Z);if(Q===null)return null;let z=j2(Z.born),X=q_($.versions,Q),H=K_(B0($.current)?$.current:{},X[X.length-1],Q,z),U=B0($.growth)?$.growth:{};return{birthCertificate:{born:z,birthDNA:Q,birthDNASource:Z.birthDNASource==="legacy"||Z.birthWeightSource==="legacy"?"legacy":"init",projectDNA:j2(Z.projectDNA),certificate:j2(Z.certificate)},versions:X,current:H,growth:{totalGrowth:H.score-Q,daysActive:R0(U.daysActive)?U.daysActive:0,milestones:B_(Array.isArray(U.milestones)?U.milestones:$.milestones)},lastModified:j2($.lastModified,z),format:"faf-dna-v1",...Array.isArray($.priorLineage)&&$.priorLineage.some(f3)?{priorLineage:$.priorLineage.filter(f3)}:{}}}class n3{projectPath;dnaPath;dna=null;own=!1;text;reason=null;sawNoFile=!1;constructor($){this.projectPath=$,this.dnaPath=nO($,".faf-dna")}exists(){let $=u3(this.dnaPath);if(!$&&!T1(this.dnaPath))this.sawNoFile=!0;return $}endingLineage(){let Z=this.dna??(()=>{let z=this.read();return z===null?null:l3(z.raw)})();if(!Z)return[];let Q=Z.birthCertificate;return[...Z.priorLineage??[],{born:Q.born,birthDNA:Q.birthDNA,certificate:Q.certificate,projectDNA:Q.projectDNA,lastScore:Z.current.score,endedAt:new Date().toISOString()}]}birth($){let Z=this.endingLineage();if(!T1(this.dnaPath))this.sawNoFile=!0;let Q=new Date().toISOString();return this.own=!0,this.dna={birthCertificate:{born:Q,birthDNA:$,birthDNASource:"init",projectDNA:this.generateProjectDNA(),certificate:this.generateCertificate()},versions:[{version:"v1.0.0",timestamp:Q,score:$,changes:["Birth — initial context"],growth:0}],current:{version:"v1.0.0",score:$,lastSync:Q},growth:{totalGrowth:0,daysActive:0,milestones:[{type:"birth",score:$,date:Q,version:"v1.0.0",label:"Birth",emoji:"\uD83D\uDC23"}]},lastModified:Q,format:"faf-dna-v1",...Z.length>0?{priorLineage:Z}:{}},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 Q=this.dna;if($===Q.current.score)return Q;let z=new Date().toISOString(),X=Q.birthCertificate.birthDNA,H=$-X,U=this.incrementVersion(Q.versions[Q.versions.length-1].version);return Q.versions.push({version:U,timestamp:z,score:$,changes:Z,growth:H}),Q.current={version:U,score:$,lastSync:z},Q.growth.totalGrowth=H,Q.growth.daysActive=this.daysSince(Q.birthCertificate.born),this.updateMilestones($,U,z),this.save(),Q}getJourney(){if(!this.dna&&!this.load())return"";let $=this.dna,Z=$.birthCertificate.birthDNA,Q=$.growth.milestones.find((H)=>H.type==="peak"),z=$.current.score,X=`${Z}%`;if(Q&&Q.score!==Z){if(X+=` → ${Q.score}%`,z<Q.score)X+=` ← ${z}%`}else if(z!==Z)X+=` → ${z}%`;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:F0($.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",Q=F0($.timestamp)?$.timestamp.split("T")[0]:"",z=Array.isArray($.changes)?$.changes.filter(F0).join(", "):"";return`${$.version} — ${$.score}% ${Z} (${Q}) ${z}`})}load(){if(this.dna)return this.dna;if(!u3(this.dnaPath)){if(!T1(this.dnaPath))this.sawNoFile=!0;return null}let $=this.read();if($===null)return null;let{text:Z,raw:Q}=$;if(m3(Q)&&A1(Q)===Z&&U_(Q))this.own=!0,this.reason=null,this.dna=Q;else this.own=!1,this.dna=l3(Q),this.reason=!this.dna?W_:!m3(Q)?J_:A1(Q)!==Z?G_:i3(Q)?Y_:V_;return this.text=Z,this.dna}read(){let $;try{$=Z0(h(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 $=A1(this.dna),Z=this.text??(this.sawNoFile?null:I0(h(this.projectPath,".faf-dna")));e(this.dnaPath,$,{root:this.projectPath,expect:Z}),this.text=$,this.sawNoFile=!1}generateProjectDNA(){return sO("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(),Q=rO(this.projectPath).replace(/[^A-Z0-9]/gi,"").toUpperCase().substring(0,8).padEnd(4,"X");return`FAF-${$}-${Q}-${Z}`}incrementVersion($){let[Z,Q,z]=$.replace("v","").split(".").map(Number);return`v${Z}.${Q}.${z+1}`}daysSince($){return Math.floor((Date.now()-new Date($).getTime())/86400000)}updateMilestones($,Z,Q){if(!this.dna)return;let z=this.dna.growth.milestones,X=(G)=>z.some((V)=>V.type===G),H=(G)=>z.push({type:G,score:$,date:Q,version:Z,...C1[G]});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!X("doubled"))H("doubled");let U=z.find((G)=>G.type==="peak");if(!U||$>U.score){if(U)z.splice(z.indexOf(U),1);H("peak")}let J=z.findIndex((G)=>G.type==="current");if(J>=0)z.splice(J,1);H("current")}}import{join as n_}from"path";import{existsSync as m_,statSync as XA}from"fs";import{join as zz}from"path";import{dirname as e3,resolve as $z}from"path";var s3=100;var D_="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",L_=[/^<(script|pre|style|textarea)(?=\s|>|$)/i,/^<!--/,/^<\?/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp(`^</?(?:${D_})(?=\\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")],I_=[/<\/(?:script|pre|style|textarea)>/i,/-->/,/\?>/,/>/,/\]\]>/],O_=["","-->","?>",">","]]>"],__=/[#`~*+_=<>0-9-]/,M_=/(\d{1,9})([.)])/y,P_=/#{1,6}(?:[ \t]+|$)/y,F_=/`{3,}(?!.*`)|~{3,}/y,R_=/(?:`{3,}|~{3,})(?=[ \t]*$)/y,N_=/(?:=+|-+)[ \t]*$/y,T_=/[^ \t\f\v\r\n]/;function Y6($,Z,Q){return $.lastIndex=Q,$.exec(Z)}var A_=($)=>$==="quote"||$==="list"||$==="item";function C_($){let Z=new Uint8Array($.length),Q="*-_",z=[0,0,0],X=[!0,!0,!0];for(let H=$.length-1;H>=0;H--){let U=$[H],J=U===" "||U==="\t";for(let V=0;V<3;V++)if(U==="*-_"[V])z[V]++;else if(!J)X[V]=!1;let G="*-_".indexOf(U);Z[H]=G>=0&&X[G]&&z[G]>=3?1:0}return Z}var B$=($)=>$===" "||$==="\t";function j_($,Z){if($==="document"||$==="quote"||$==="item")return Z!=="item";return $==="list"&&Z==="item"}var r3=($)=>$==="paragraph"||$==="code"||$==="html";function w_($){if($.kind==="list"||$.kind==="item")return{...$,list:{...$.list}};if($.kind==="code")return{...$,fence:$.fence&&{...$.fence}};return{...$}}class N0{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 N0(this.containers);return $.stack=this.stack.map(w_),$.deep=this.deep,$}overflowAt($,Z){let Q=this.clone();return Q.limit=Z,Q.line($),Q.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 Q=this.openBlocks(Z);if(this.deep)return null;if(!this.allClosed&&!this.blank&&this.tip.kind==="paragraph")return null;return this.closeUnmatched(),this.addText(Q),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}>`:O_[$.type-1]}get tip(){return this.stack[this.stack.length-1]}continueContainers(){let $=this.stack.length-1,Z=0;while(Z<$){this.findNextNonspace();let Q=this.continues(this.stack[Z+1],Z+1);if(Q===2)return-1;if(Q===1)break;Z++}return this.allClosed=Z===$,this.matched=Z,Z}openBlocks($){let Z=this.stack[$],Q=Z.kind!=="paragraph"&&r3(Z.kind);while(!Q&&!this.deep){this.findNextNonspace();let z=this.nextNonspace;if(!this.indented&&!__.test(this.ln.charAt(z)))break;let X=0;for(let H of this.starts)if(X=H(Z),X!==0)break;if(X===0)break;this.noteOverflow(z,X),Z=this.tip,Q=X===2}if(!Q)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(!r3($.kind)&&this.offset<this.ln.length&&!this.blank)this.addChild({kind:"paragraph"})}addHtmlLine($){if($.type>5)return;let Z=I_[$.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),B$(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 Q=this.indent<=3&&this.ch===$.char?Y6(R_,this.ln,this.nextNonspace):null;if(Q&&Q[0].length>=$.len)return this.stack.length=Z,this.hiddenIn="code fence",2;for(let z=$.offset;z>0&&B$(this.ln[this.offset]);z--)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??=C_(this.ln),this.breaks[this.nextNonspace]===1}startQuote(){if(!this.containers||this.indented||this.ch!==">")return 0;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),B$(this.ln[this.offset]))this.advanceOffset(1,!0);return this.closeUnmatched(),this.addChild({kind:"quote"}),1}startHeading(){if(this.indented||this.ch!=="#"||!Y6(P_,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:Y6(F_,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",Q=$.kind!=="paragraph"&&!Z,z=this.ln.slice(this.nextNonspace);for(let X=1;X<=(Q?7:6);X++){let H=L_[X-1].exec(z);if(H)return this.closeUnmatched(),this.addChild({kind:"html",type:X,tag:X===1?H[1].toLowerCase():""}),this.htmlStarted=!0,2}return 0}startSetext($){let Z=this.ch;if(this.indented||$.kind!=="paragraph"||Z!=="="&&Z!=="-"||!Y6(N_,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 Q=this.tip;if(Q.kind!=="list"||Q.list.bullet!==Z.bullet||Q.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 Q=this.indent;return this.advanceNextNonspace(),this.advanceOffset(Z.width,!0),{...Z.kind,markerOffset:Q,padding:this.paddingAfter(Z.width)}}markerAt($){let Z=$.kind==="paragraph",Q=this.markerKind(Z);if(!Q)return null;let z=this.ln[this.nextNonspace+Q.width];if(!(z===void 0||B$(z)))return null;if(Z&&!T_.test(this.ln.slice(this.nextNonspace+Q.width)))return null;return Q}markerKind($){let Z=this.ch;if(Z==="*"||Z==="+"||Z==="-")return{width:1,kind:{bullet:Z,delimiter:null}};let Q=Z>="0"&&Z<="9"?Y6(M_,this.ln,this.nextNonspace):null;if(!Q||$&&Number(Q[1])!==1)return null;return{width:Q[0].length,kind:{bullet:null,delimiter:Q[2]}}}paddingAfter($){let Z=this.column,Q=this.offset;do this.advanceOffset(1,!0);while(this.column-Z<5&&B$(this.ln[this.offset]));let z=this.column-Z;if(z>=1&&z<5&&this.ln[this.offset]!==void 0)return $+z;if(this.column=Z,this.offset=Q,B$(this.ln[this.offset]))this.advanceOffset(1,!0);return $+1}addChild($){while(!j_(this.tip.kind,$.kind))this.stack.pop();if(this.tip.hasChild=!0,this.stack.push($),A_($.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,Q=this.column;if(this.scannedFrom!==-1&&this.offset>=this.scannedFrom&&this.offset<=this.nextNonspace)Z=this.nextNonspace,Q=this.nextNonspaceColumn;else{this.scannedFrom=this.offset;for(;Z<$.length;Z++)if($[Z]===" ")Q++;else if($[Z]==="\t")Q+=4-Q%4;else break}this.blank=Z>=$.length,this.nextNonspace=Z,this.nextNonspaceColumn=Q,this.indent=Q-this.column,this.indented=this.indent>=4}advanceNextNonspace(){this.offset=this.nextNonspace,this.column=this.nextNonspaceColumn}advanceOffset($,Z){let Q=$;while(Q>0&&this.offset<this.ln.length){if(this.ln[this.offset]!=="\t"){this.offset++,this.column++,Q--;continue}let z=4-this.column%4,X=Z&&z>Q;this.column+=X?Q:z,this.offset+=X?0:1,Q-=Z?Math.min(z,Q):1}}}var b0="<!-- faf:start -->",y0="<!-- faf:end -->",o3="\uFEFF";function B6($){return $.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter((Z,Q,z)=>Z!==""||Q<z.length-1)??[]}var q$=($)=>$.replace(/\r?\n$|\r$/,""),Zz=($)=>q$($).replace(/^\uFEFF/,"").trimEnd();function*j1($){let Z=0;for(let Q of B6($)){let z=q$(Q),X=Z===0&&z.charCodeAt(0)===65279?1:0;yield{offset:Z,from:Z+X,to:Z+z.length,content:z.slice(X)},Z+=Q.length}}function S_($,Z,Q,z){let X=$.some((U)=>U.start!==-1)&&z(Z.content),H=Q(Z.content);for(let U of $)if(U.start!==-1&&X)U.found={start:U.start,end:Z.to};else if(H)U.start=Z.from}function w1($,Z,Q){let[z,X]=[new N0(!0),new N0(!1)].map((H)=>({reader:H,start:-1,found:null}));for(let H of j1($)){let U=[z,X].map((G)=>G.reader.line(H.content));if(z.reader.tooDeep)return null;let J=[z,X].filter((G,V)=>U[V]===null);if(J.length>0)S_(J,H,Z,Q);if(z.found||X.found)return z.found&&X.found&&z.found.start===X.found.start?z.found:null}return null}var a3=($)=>(Z)=>Z===$;function w2($,Z=b0,Q=y0){return w1($,a3(Z),a3(Q))}function t3($,Z){let Q=[];for(let z of[!0,!1]){let X=new N0(z);for(let H of B6($))X.line(q$(H));if(X.clone().line(Z)!==null)Q.push(X.closer())}return Q}var E_=16;function b_($){let Z=new N0(!0);return $.map((Q)=>{let z=Z.overflowAt(q$(Q),E_),X=Q;if(z>=0){let H=/^\d{1,9}(?=[.)])/.exec(Q.slice(z)),U=H?z+H[0].length:z;X=`${Q.slice(0,U)}\\${Q.slice(U)}`}return Z.line(q$(X)),X})}function y_($,Z,Q){let X=b_(B6($).map((U)=>{let J=Zz(U);return J===Z||J===Q?` ${U}`:U})).join(""),H=t3(X,Q);while(H.length>0&&H[0]!==null){let U=`${X}
267
- ${H[0]}`,J=t3(U,Q);if(J.length>=H.length)break;X=U,H=J}return X}function x_($,Z,Q){let z=$.slice(Z.length+1,$.length-Q.length-1),X=B6(z).map((H)=>q$(H)===""?`>${H}`:`> ${H}`).join("");return`${Z}
264
+ `),z=0;while(z<Q.length){let H=Q[z].trim().match(/^(#{1,6})\s+(.+)$/);if(H&&Z.test(H[2])){let U=H[1].length,J=[];z++;while(z<Q.length){let G=Q[z].trim(),V=G.match(/^(#{1,6})\s+/);if(V&&V[1].length<=U)break;if(G===""){if(J.length>0)break;z++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(G))break;J.push(G),z++}if(J.length===0)return null;return J.join(" ").trim()}z++}return null}function KO($){let Z=N2($,/^(use\s+cases?|goal)\b/i);if(Z&&P0(Z))return Z;let Q=qO($);if(Q&&P0(Q))return Q;return}function DO($){let Z=N2($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&P0(Z))return Z;return}function LO($){let Z=N2($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&P0(Z))return Z;return}function IO($){let Z=N2($,/^(why|motivation|problem|rationale)\b/i);if(Z&&P0(Z))return Z;return}function OO($){let Z=N2($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&P0(Z))return Z;return}function _O($){let Z=N2($,/^(status|history|timeline|since|launched)\b/i);if(Z&&P0(Z))return Z;return}function MO($){let Z=N2($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&P0(Z))return Z;return}function L1($){let Z=["README.md","README.MD","Readme.md","readme.md"],Q=null;for(let K of Z)if(I($,K)){Q=K;break}if(!Q)return{};let z=S($,Q);if(z===null)return{};z=z.replace(/<!--[\s\S]*?-->/g,"");let X={},H=KO(z);if(H)X.project={goal:H};let U={},J=DO(z);if(J)U.what=J;let G=LO(z);if(G)U.who=G;let V=IO(z);if(V)U.why=V;let Y=OO(z);if(Y)U.where=Y;let W=_O(z);if(W)U.when=W;let B=MO(z);if(B)U.how=B;if(Object.keys(U).length>0)X.human_context=U;return X}function PO($,Z){let Q=$.split(`
265
+ `),z=!1;for(let X of Q){let H=X.trim();if(/^\[/.test(H)){z=H==="[package]";continue}if(!z)continue;let U=H.match(new RegExp(`^${Z}\\s*=\\s*(.+)$`));if(U){let J=U[1].trim();J=J.replace(/\s*#.*$/,"").trim();let G=J.match(/^"((?:[^"\\]|\\.)*)"$/)||J.match(/^'((?:[^'\\]|\\.)*)'$/);if(G)return G[1];return J}}return null}function I1($){let Z=S($,"Cargo.toml");if(Z===null)return{};let Q=PO(Z,"description");if(Q&&P0(Q))return{project:{goal:Q}};return{}}import{join as x3}from"path";var FO=[{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"}],RO=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function NO($){let Z=[],Q=(z,X)=>{for(let H of v($,z)??[])if(H.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(H.name))Z.push(x3(z,H.name));else if(H.isDirectory()&&X>0&&!H.name.startsWith(".")&&!RO.has(H.name))Q(x3(z,H.name),X-1)};return Q(".",1),Z}function V6($){return[...$].join(" · ")}function O1($){let Z=NO($);if(Z.length===0)return{};let Q={database:new Set,cache:new Set,search:new Set,storage:new Set,runtime:new Set};for(let X of Z){let H=S($,X);if(H===null)continue;for(let U of H.matchAll(/^\s*image:\s*["']?([^\s"'#]+)/gm)){let J=U[1].toLowerCase(),G=J.replace(/:[^/]*$/,"").split("/").pop()??J,V=J.replace(/:[^/]*$/,"");for(let{re:Y,slot:W,label:B}of FO)if(Y.test(G)||Y.test(V))Q[W].add(B)}}let z={};if(Q.database.size)z.database=V6(Q.database);if(Q.cache.size)z.cache=V6(Q.cache);if(Q.search.size)z.search=V6(Q.search);if(Q.storage.size)z.storage=V6(Q.storage);if(Q.runtime.size)z.runtime=`Docker Compose (${V6(Q.runtime)})`;if(Object.keys(z).length===0&&!Q.runtime.size)return{stack:{hosting:"Docker Compose"}};return z.hosting="Docker Compose",{stack:z}}import{join as TO}from"path";var AO=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),CO=[{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((Q)=>Q[1])}}];function _1($,Z){for(let Q of Z){let z=$.find((X)=>Q.test(X));if(z)return z}return null}function jO($){let Z=[$];for(let Q of v($)??[])if(Q.isDirectory()&&!Q.name.startsWith(".")&&!AO.has(Q.name))Z.push(TO($,Q.name));return Z}function wO($){let Z=0;if(I($,"manage.py")||I($,"pyproject.toml")||I($,"Gemfile"))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function M1($){return e2($,()=>SO($))}function SO($){let Z=[];for(let z of jO($)){let X=z===$,H=X?"":`cd ${z.slice($.length+1)} && `;for(let U of CO){let J=S(z,U.file);if(J===null)continue;let G=U.targets(J);if(G.length===0)continue;let V={},Y=_1(G,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),W=_1(G,[/^build$/i,/^compile$/i,/^build/i]),B=_1(G,[/^check-all$/i,/^check$/i,/^lint$/i,/^lint/i,/^fmt$/i,/^format$/i]);if(Y)V.test=`${H}${U.runner} ${Y}`;if(W)V.build=`${H}${U.runner} ${W}`;if(B)V.lint=`${H}${U.runner} ${B}`;if(Object.keys(V).length===0)continue;Z.push({score:Object.keys(V).length+(X?10:wO(z)),commands:V})}}let Q=Z.sort((z,X)=>X.score-z.score)[0];return Q?{commands:Q.commands}:{}}var EO=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function P1($){for(let Z of EO)if(I($,Z))return{security:{secrets:".env",example:Z}};return{}}function bO($,Z){let Q={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(Q[z]&&Object.keys(Q[z]).length===0)delete Q[z];return Q}function F1($){return[L1($),I1($),O1($),M1($),P1($)].reduce(bO,{})}function g3($){try{let Z=s2($,{logLevel:"error"}).getIn(["project","type"],!0);return s(Z)&&typeof Z.comment==="string"&&Z.comment.includes(y2)}catch{return!1}}function R1($){let Z=b3($),Q=F1($),z={};if(Q.stack)z.stack=Q.stack;if(Q.commands)z.commands=Q.commands;if(Q.security)z.security=Q.security;let X={};if(Q.project)X.project=Q.project;if(Q.human_context)X.human_context=Q.human_context;let H=l0(l0(z,Z),X);pO(H);let J=(Z._meta?.found??[]).some((V)=>V.startsWith("polyglot:")),G=l0(H,v8($));return l0(G,{human_context:k8($,{toolingRoot:J})})}function yO($,Z){let Q=mO(Y8(Z,"updateExistingFaf: the existing .faf")),{data:z,facts:X}=D1($),H=z,U=l0(Q,F1($)),J=l0(U,H),G=l0(J,v8($)),V=vO(l0(G,{human_context:k8($)}),Q),Y=kO(xO(Z,Q,H)?hO(v3(V,Q),Q,X):v3(V,Q),Q);return k9(g9(Z,Y))}function xO($,Z,Q){if(!o(H0(Z,"project.type"))){let X=a$($)?.text;return X===void 0||!g3(X)}return!(Q._meta?.found??[]).includes(y2)}function N1($){return $.canonical?[$.path,$.canonical]:[$.path]}function H0($,Z){let[Q,z]=Z.split("."),X=$[Q];return u(X)?X[z]:void 0}function T2($,Z,Q){let[z,X]=Z.split("."),H=$[z];if(!u(H))return;if(Q===void 0?!(X in H):H[X]===Q)return;let U={...H};if(Q===void 0)delete U[X];else U[X]=Q;$[z]=U}var A2=($)=>typeof $==="string"&&$.trim()===L6;function gO($,Z){let Q=Z.map((z)=>H0($,z));return Q.some(A2)&&Q.every((z)=>o(z)||A2(z))}function v3($,Z){let Q={...$};for(let z of m){let X=N1(z);if(!gO(Z,X))continue;for(let H of X){let U=H0(Z,H);if(H0(Q,H)!==U)T2(Q,H,U)}}return Q}function C2($,Z){let[Q,z]=Z.split("."),X=$[Q];return u(X)&&Object.prototype.hasOwnProperty.call(X,z)}function vO($,Z){let Q={...$};for(let z of m){if(!z.canonical||!C2(Z,z.canonical)||C2(Z,z.path))continue;let X=H0(Q,z.path);T2(Q,z.path,void 0);let H=H0(Q,z.canonical);if(c8(X)&&o(H))T2(Q,z.canonical,X)}return Q}function kO($,Z){let Q={...$};for(let z of m){if(!z.canonical||!C2(Z,z.canonical)||C2(Z,z.path))continue;let X=H0(Q,z.canonical);if(c8(X)||A2(X))T2(Q,z.path,X)}return Q}function hO($,Z,Q={}){let z=$.project,X=u(z)?z.type:void 0,H={...$};for(let U of m){if(U.category==="human"||U.category==="project")continue;let J=x2(X,U);if(J===null)return $;if(J)uO(H,Z,U,U.path.startsWith("stack.")?Q[U.path.slice(6)]:void 0);else fO(H,U)}return H}function uO($,Z,Q,z){let X=N1(Q);for(let U of X)if(A2(H0($,U))&&!A2(H0(Z,U)))T2($,U,C2(Z,U)?H0(Z,U):"");if(!c8(z))return;let H=X.filter((U)=>C2($,U));if(H.some((U)=>!o(H0($,U))))return;for(let U of H.length>0?H:[Q.path])T2($,U,z)}function fO($,Z){let Q=N1(Z).filter((X)=>C2($,X)),z=(X)=>!o(H0($,X))&&!A2(H0($,X));if(Q.some(z))return;for(let X of Q.length>0?Q:[Z.path])if(o(H0($,X)))T2($,X,L6)}function mO($){let Z=$.project;if(Z===null||Z===void 0||u(Z)||Array.isArray(Z))return $;return{...$,project:{name:String(Z)}}}function pO($){let Z=$.project?.type??"library",Q=b2[Z]||b2.library;for(let z of m){if(Q.includes(z.category))continue;let[X,H]=z.path.split(".");if(X==="stack"&&$.stack)$.stack[H]="slotignored";if(X==="monorepo"&&$.monorepo)$.monorepo[H]="slotignored"}}function l0($,Z){return k3($,Z,"")}function lO($){let Z=g0.get($);return Z!==void 0&&Z.category!=="human"}function c8($){if(typeof $==="number"||typeof $==="boolean")return!0;return typeof $==="string"&&$.trim()!==""&&!o($)&&!A2($)}function cO($,Z){return lO($)&&c8(Z)}function k3($,Z,Q){let z={...$};for(let[X,H]of Object.entries(Z)){let U=z[X],J=Q?`${Q}.${X}`:X;if(J==="_meta"&&U!==void 0)continue;if(a8(U)){if(cO(J,H))z[X]=H;continue}if(o(U))z[X]=H;else if(u(H)&&u(U))z[X]=k3(U,H,J)}return z}function dO($){let Z=($??"").trim();if(!Z)throw Error("Please provide a GitHub URL.");if(/[\s;&|`$(){}<>\\^'"!*?[\]]/.test(Z))throw Error(`Refusing unsafe URL: ${JSON.stringify($)}`);let Q=Z.replace(/\/+$/,"").replace(/\.git$/i,""),z=Q.match(/^(?:github\.com\/)?([A-Za-z0-9][A-Za-z0-9._-]*)\/([A-Za-z0-9][A-Za-z0-9._-]*)$/);if(z)return`https://github.com/${z[1]}/${z[2]}.git`;if(/^https?:\/\/[A-Za-z0-9._\-/:@~%]+$/.test(Q))return`${Q}.git`;throw Error(`Not a recognized GitHub repo URL: ${JSON.stringify($)}`)}function h3($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function iO($,Z={}){let Q=R1($);if(Z.repoUrl&&Q.project&&!W0($)?.name&&Q.project.name===$.split("/").pop())Q.project.name=h3(Z.repoUrl);return Q}import{existsSync as u3,lstatSync as nO}from"fs";import{join as rO,basename as sO}from"path";import{createHash as oO}from"crypto";var B0=($)=>typeof $==="object"&&$!==null&&!Array.isArray($),R0=($)=>typeof $==="number"&&Number.isFinite($),F0=($)=>typeof $==="string",aO=/^v?\d+\.\d+\.\d+$/,tO=new Set(["birth","doubled","peak","current"]);function c3($){return B0($)&&F0($.version)&&aO.test($.version)&&R0($.score)}var eO=($)=>R0($.birthDNA)?$.birthDNA:R0($.birthWeight)?$.birthWeight:null,$_=($)=>B0($)&&R0($.birthDNA)&&F0($.born),f3=($)=>B0($)&&F0($.born)&&R0($.birthDNA)&&R0($.lastScore)&&F0($.endedAt),Z_=($)=>Array.isArray($)&&$.length>0&&$.every(c3),Q_=($)=>B0($)&&R0($.score)&&F0($.version),z_=($)=>B0($)&&Array.isArray($.milestones)&&$.milestones.every(B0);function m3($){return B0($)&&$_($.birthCertificate)&&Z_($.versions)&&Q_($.current)&&z_($.growth)}function T1($){try{return nO($),!0}catch{return!1}}var A1=($)=>`${JSON.stringify($,null,2)}
266
+ `,X_=new Set(["version","score","lastSync"]),H_=new Set(["type","score","date","version","label","emoji"]),p3=($,Z)=>Object.keys($).every((Q)=>Z.has(Q)),C1={birth:{label:"Birth",emoji:"\uD83D\uDC23"},doubled:{label:"Doubled",emoji:"2️⃣"},peak:{label:"Peak",emoji:"\uD83C\uDFD4️"},current:{label:"Current",emoji:"\uD83D\uDCCD"}},d3=($)=>$.growth.milestones.filter((Z)=>Z.type==="peak"||Z.type==="current"),i3=($)=>p3($.current,X_)&&d3($).every((Z)=>p3(Z,H_)),U_=($)=>d3($).every((Z)=>Z.label===C1[Z.type].label&&Z.emoji===C1[Z.type].emoji);function J_($){return i3($)&&U_($)}var G_=".faf-dna is not in faf's shape: faf reads it and leaves it as it is.",V_=".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.",Y_=".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.",W_=".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.",B_=".faf-dna has no birth certificate faf can read: faf leaves it as it is.";function q_($){if(!Array.isArray($))return[];return $.filter((Z)=>B0(Z)&&F0(Z.type)&&tO.has(Z.type)&&R0(Z.score))}var j2=($,Z="")=>F0($)?$:Z;function K_($,Z){if(!Array.isArray($))return[];return $.filter(c3).map((Q)=>({version:Q.version,timestamp:j2(Q.timestamp),score:Q.score,changes:Array.isArray(Q.changes)?Q.changes.filter(F0):[],growth:R0(Q.growth)?Q.growth:Q.score-Z}))}function D_($,Z,Q,z){return{version:j2($.version,Z?.version??"v1.0.0"),score:R0($.score)?$.score:Z?.score??Q,lastSync:j2($.lastSync,z)}}function l3($){if(!B0($)||!B0($.birthCertificate))return null;let Z=$.birthCertificate,Q=eO(Z);if(Q===null)return null;let z=j2(Z.born),X=K_($.versions,Q),H=D_(B0($.current)?$.current:{},X[X.length-1],Q,z),U=B0($.growth)?$.growth:{};return{birthCertificate:{born:z,birthDNA:Q,birthDNASource:Z.birthDNASource==="legacy"||Z.birthWeightSource==="legacy"?"legacy":"init",projectDNA:j2(Z.projectDNA),certificate:j2(Z.certificate)},versions:X,current:H,growth:{totalGrowth:H.score-Q,daysActive:R0(U.daysActive)?U.daysActive:0,milestones:q_(Array.isArray(U.milestones)?U.milestones:$.milestones)},lastModified:j2($.lastModified,z),format:"faf-dna-v1",...Array.isArray($.priorLineage)&&$.priorLineage.some(f3)?{priorLineage:$.priorLineage.filter(f3)}:{}}}class n3{projectPath;dnaPath;dna=null;own=!1;text;reason=null;sawNoFile=!1;constructor($){this.projectPath=$,this.dnaPath=rO($,".faf-dna")}exists(){let $=u3(this.dnaPath);if(!$&&!T1(this.dnaPath))this.sawNoFile=!0;return $}endingLineage(){let Z=this.dna??(()=>{let z=this.read();return z===null?null:l3(z.raw)})();if(!Z)return[];let Q=Z.birthCertificate;return[...Z.priorLineage??[],{born:Q.born,birthDNA:Q.birthDNA,certificate:Q.certificate,projectDNA:Q.projectDNA,lastScore:Z.current.score,endedAt:new Date().toISOString()}]}birth($){let Z=this.endingLineage();if(!T1(this.dnaPath))this.sawNoFile=!0;let Q=new Date().toISOString();return this.own=!0,this.dna={birthCertificate:{born:Q,birthDNA:$,birthDNASource:"init",projectDNA:this.generateProjectDNA(),certificate:this.generateCertificate()},versions:[{version:"v1.0.0",timestamp:Q,score:$,changes:["Birth — initial context"],growth:0}],current:{version:"v1.0.0",score:$,lastSync:Q},growth:{totalGrowth:0,daysActive:0,milestones:[{type:"birth",score:$,date:Q,version:"v1.0.0",label:"Birth",emoji:"\uD83D\uDC23"}]},lastModified:Q,format:"faf-dna-v1",...Z.length>0?{priorLineage:Z}:{}},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 Q=this.dna;if($===Q.current.score)return Q;let z=new Date().toISOString(),X=Q.birthCertificate.birthDNA,H=$-X,U=this.incrementVersion(Q.versions[Q.versions.length-1].version);return Q.versions.push({version:U,timestamp:z,score:$,changes:Z,growth:H}),Q.current={version:U,score:$,lastSync:z},Q.growth.totalGrowth=H,Q.growth.daysActive=this.daysSince(Q.birthCertificate.born),this.updateMilestones($,U,z),this.save(),Q}getJourney(){if(!this.dna&&!this.load())return"";let $=this.dna,Z=$.birthCertificate.birthDNA,Q=$.growth.milestones.find((H)=>H.type==="peak"),z=$.current.score,X=`${Z}%`;if(Q&&Q.score!==Z){if(X+=` → ${Q.score}%`,z<Q.score)X+=` ← ${z}%`}else if(z!==Z)X+=` → ${z}%`;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:F0($.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",Q=F0($.timestamp)?$.timestamp.split("T")[0]:"",z=Array.isArray($.changes)?$.changes.filter(F0).join(", "):"";return`${$.version} — ${$.score}% ${Z} (${Q}) ${z}`})}load(){if(this.dna)return this.dna;if(!u3(this.dnaPath)){if(!T1(this.dnaPath))this.sawNoFile=!0;return null}let $=this.read();if($===null)return null;let{text:Z,raw:Q}=$;if(m3(Q)&&A1(Q)===Z&&J_(Q))this.own=!0,this.reason=null,this.dna=Q;else this.own=!1,this.dna=l3(Q),this.reason=!this.dna?B_:!m3(Q)?G_:A1(Q)!==Z?V_:i3(Q)?W_:Y_;return this.text=Z,this.dna}read(){let $;try{$=Z0(h(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 $=A1(this.dna),Z=this.text??(this.sawNoFile?null:I0(h(this.projectPath,".faf-dna")));e(this.dnaPath,$,{root:this.projectPath,expect:Z}),this.text=$,this.sawNoFile=!1}generateProjectDNA(){return oO("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(),Q=sO(this.projectPath).replace(/[^A-Z0-9]/gi,"").toUpperCase().substring(0,8).padEnd(4,"X");return`FAF-${$}-${Q}-${Z}`}incrementVersion($){let[Z,Q,z]=$.replace("v","").split(".").map(Number);return`v${Z}.${Q}.${z+1}`}daysSince($){return Math.floor((Date.now()-new Date($).getTime())/86400000)}updateMilestones($,Z,Q){if(!this.dna)return;let z=this.dna.growth.milestones,X=(G)=>z.some((V)=>V.type===G),H=(G)=>z.push({type:G,score:$,date:Q,version:Z,...C1[G]});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!X("doubled"))H("doubled");let U=z.find((G)=>G.type==="peak");if(!U||$>U.score){if(U)z.splice(z.indexOf(U),1);H("peak")}let J=z.findIndex((G)=>G.type==="current");if(J>=0)z.splice(J,1);H("current")}}import{join as r_}from"path";import{existsSync as p_,statSync as HA}from"fs";import{join as zz}from"path";import{dirname as e3,resolve as $z}from"path";var s3=100;var L_="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",I_=[/^<(script|pre|style|textarea)(?=\s|>|$)/i,/^<!--/,/^<\?/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp(`^</?(?:${L_})(?=\\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")],O_=[/<\/(?:script|pre|style|textarea)>/i,/-->/,/\?>/,/>/,/\]\]>/],__=["","-->","?>",">","]]>"],M_=/[#`~*+_=<>0-9-]/,P_=/(\d{1,9})([.)])/y,F_=/#{1,6}(?:[ \t]+|$)/y,R_=/`{3,}(?!.*`)|~{3,}/y,N_=/(?:`{3,}|~{3,})(?=[ \t]*$)/y,T_=/(?:=+|-+)[ \t]*$/y,A_=/[^ \t\f\v\r\n]/;function Y6($,Z,Q){return $.lastIndex=Q,$.exec(Z)}var C_=($)=>$==="quote"||$==="list"||$==="item";function j_($){let Z=new Uint8Array($.length),Q="*-_",z=[0,0,0],X=[!0,!0,!0];for(let H=$.length-1;H>=0;H--){let U=$[H],J=U===" "||U==="\t";for(let V=0;V<3;V++)if(U==="*-_"[V])z[V]++;else if(!J)X[V]=!1;let G="*-_".indexOf(U);Z[H]=G>=0&&X[G]&&z[G]>=3?1:0}return Z}var B$=($)=>$===" "||$==="\t";function w_($,Z){if($==="document"||$==="quote"||$==="item")return Z!=="item";return $==="list"&&Z==="item"}var r3=($)=>$==="paragraph"||$==="code"||$==="html";function S_($){if($.kind==="list"||$.kind==="item")return{...$,list:{...$.list}};if($.kind==="code")return{...$,fence:$.fence&&{...$.fence}};return{...$}}class N0{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 N0(this.containers);return $.stack=this.stack.map(S_),$.deep=this.deep,$}overflowAt($,Z){let Q=this.clone();return Q.limit=Z,Q.line($),Q.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 Q=this.openBlocks(Z);if(this.deep)return null;if(!this.allClosed&&!this.blank&&this.tip.kind==="paragraph")return null;return this.closeUnmatched(),this.addText(Q),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}>`:__[$.type-1]}get tip(){return this.stack[this.stack.length-1]}continueContainers(){let $=this.stack.length-1,Z=0;while(Z<$){this.findNextNonspace();let Q=this.continues(this.stack[Z+1],Z+1);if(Q===2)return-1;if(Q===1)break;Z++}return this.allClosed=Z===$,this.matched=Z,Z}openBlocks($){let Z=this.stack[$],Q=Z.kind!=="paragraph"&&r3(Z.kind);while(!Q&&!this.deep){this.findNextNonspace();let z=this.nextNonspace;if(!this.indented&&!M_.test(this.ln.charAt(z)))break;let X=0;for(let H of this.starts)if(X=H(Z),X!==0)break;if(X===0)break;this.noteOverflow(z,X),Z=this.tip,Q=X===2}if(!Q)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(!r3($.kind)&&this.offset<this.ln.length&&!this.blank)this.addChild({kind:"paragraph"})}addHtmlLine($){if($.type>5)return;let Z=O_[$.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),B$(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 Q=this.indent<=3&&this.ch===$.char?Y6(N_,this.ln,this.nextNonspace):null;if(Q&&Q[0].length>=$.len)return this.stack.length=Z,this.hiddenIn="code fence",2;for(let z=$.offset;z>0&&B$(this.ln[this.offset]);z--)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??=j_(this.ln),this.breaks[this.nextNonspace]===1}startQuote(){if(!this.containers||this.indented||this.ch!==">")return 0;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),B$(this.ln[this.offset]))this.advanceOffset(1,!0);return this.closeUnmatched(),this.addChild({kind:"quote"}),1}startHeading(){if(this.indented||this.ch!=="#"||!Y6(F_,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:Y6(R_,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",Q=$.kind!=="paragraph"&&!Z,z=this.ln.slice(this.nextNonspace);for(let X=1;X<=(Q?7:6);X++){let H=I_[X-1].exec(z);if(H)return this.closeUnmatched(),this.addChild({kind:"html",type:X,tag:X===1?H[1].toLowerCase():""}),this.htmlStarted=!0,2}return 0}startSetext($){let Z=this.ch;if(this.indented||$.kind!=="paragraph"||Z!=="="&&Z!=="-"||!Y6(T_,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 Q=this.tip;if(Q.kind!=="list"||Q.list.bullet!==Z.bullet||Q.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 Q=this.indent;return this.advanceNextNonspace(),this.advanceOffset(Z.width,!0),{...Z.kind,markerOffset:Q,padding:this.paddingAfter(Z.width)}}markerAt($){let Z=$.kind==="paragraph",Q=this.markerKind(Z);if(!Q)return null;let z=this.ln[this.nextNonspace+Q.width];if(!(z===void 0||B$(z)))return null;if(Z&&!A_.test(this.ln.slice(this.nextNonspace+Q.width)))return null;return Q}markerKind($){let Z=this.ch;if(Z==="*"||Z==="+"||Z==="-")return{width:1,kind:{bullet:Z,delimiter:null}};let Q=Z>="0"&&Z<="9"?Y6(P_,this.ln,this.nextNonspace):null;if(!Q||$&&Number(Q[1])!==1)return null;return{width:Q[0].length,kind:{bullet:null,delimiter:Q[2]}}}paddingAfter($){let Z=this.column,Q=this.offset;do this.advanceOffset(1,!0);while(this.column-Z<5&&B$(this.ln[this.offset]));let z=this.column-Z;if(z>=1&&z<5&&this.ln[this.offset]!==void 0)return $+z;if(this.column=Z,this.offset=Q,B$(this.ln[this.offset]))this.advanceOffset(1,!0);return $+1}addChild($){while(!w_(this.tip.kind,$.kind))this.stack.pop();if(this.tip.hasChild=!0,this.stack.push($),C_($.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,Q=this.column;if(this.scannedFrom!==-1&&this.offset>=this.scannedFrom&&this.offset<=this.nextNonspace)Z=this.nextNonspace,Q=this.nextNonspaceColumn;else{this.scannedFrom=this.offset;for(;Z<$.length;Z++)if($[Z]===" ")Q++;else if($[Z]==="\t")Q+=4-Q%4;else break}this.blank=Z>=$.length,this.nextNonspace=Z,this.nextNonspaceColumn=Q,this.indent=Q-this.column,this.indented=this.indent>=4}advanceNextNonspace(){this.offset=this.nextNonspace,this.column=this.nextNonspaceColumn}advanceOffset($,Z){let Q=$;while(Q>0&&this.offset<this.ln.length){if(this.ln[this.offset]!=="\t"){this.offset++,this.column++,Q--;continue}let z=4-this.column%4,X=Z&&z>Q;this.column+=X?Q:z,this.offset+=X?0:1,Q-=Z?Math.min(z,Q):1}}}var b0="<!-- faf:start -->",y0="<!-- faf:end -->",o3="\uFEFF";function B6($){return $.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter((Z,Q,z)=>Z!==""||Q<z.length-1)??[]}var q$=($)=>$.replace(/\r?\n$|\r$/,""),Zz=($)=>q$($).replace(/^\uFEFF/,"").trimEnd();function*j1($){let Z=0;for(let Q of B6($)){let z=q$(Q),X=Z===0&&z.charCodeAt(0)===65279?1:0;yield{offset:Z,from:Z+X,to:Z+z.length,content:z.slice(X)},Z+=Q.length}}function E_($,Z,Q,z){let X=$.some((U)=>U.start!==-1)&&z(Z.content),H=Q(Z.content);for(let U of $)if(U.start!==-1&&X)U.found={start:U.start,end:Z.to};else if(H)U.start=Z.from}function w1($,Z,Q){let[z,X]=[new N0(!0),new N0(!1)].map((H)=>({reader:H,start:-1,found:null}));for(let H of j1($)){let U=[z,X].map((G)=>G.reader.line(H.content));if(z.reader.tooDeep)return null;let J=[z,X].filter((G,V)=>U[V]===null);if(J.length>0)E_(J,H,Z,Q);if(z.found||X.found)return z.found&&X.found&&z.found.start===X.found.start?z.found:null}return null}var a3=($)=>(Z)=>Z===$;function w2($,Z=b0,Q=y0){return w1($,a3(Z),a3(Q))}function t3($,Z){let Q=[];for(let z of[!0,!1]){let X=new N0(z);for(let H of B6($))X.line(q$(H));if(X.clone().line(Z)!==null)Q.push(X.closer())}return Q}var b_=16;function y_($){let Z=new N0(!0);return $.map((Q)=>{let z=Z.overflowAt(q$(Q),b_),X=Q;if(z>=0){let H=/^\d{1,9}(?=[.)])/.exec(Q.slice(z)),U=H?z+H[0].length:z;X=`${Q.slice(0,U)}\\${Q.slice(U)}`}return Z.line(q$(X)),X})}function x_($,Z,Q){let X=y_(B6($).map((U)=>{let J=Zz(U);return J===Z||J===Q?` ${U}`:U})).join(""),H=t3(X,Q);while(H.length>0&&H[0]!==null){let U=`${X}
267
+ ${H[0]}`,J=t3(U,Q);if(J.length>=H.length)break;X=U,H=J}return X}function g_($,Z,Q){let z=$.slice(Z.length+1,$.length-Q.length-1),X=B6(z).map((H)=>q$(H)===""?`>${H}`:`> ${H}`).join("");return`${Z}
268
268
  ${X}
269
- ${Q}`}function W6($,Z,Q,z=b0,X=y0,H="the file"){let U=(G)=>{let V=`${$}${G}${Q}`,Y=w2(V,z,X);return Y&&Y.start===$.length&&Y.end===$.length+G.length?V:null},J=U(Z)??U(x_(Z,z,X));if(J===null)throw new b("unplaceable",H,`${H}: faf could not place its block where the next run finds it again — faf left it unchanged`,{onWrite:!0});return J}function S1($,Z=b0,Q=y0){return`${Z}
270
- ${y_($.trim(),Z,Q)}
269
+ ${Q}`}function W6($,Z,Q,z=b0,X=y0,H="the file"){let U=(G)=>{let V=`${$}${G}${Q}`,Y=w2(V,z,X);return Y&&Y.start===$.length&&Y.end===$.length+G.length?V:null},J=U(Z)??U(g_(Z,z,X));if(J===null)throw new b("unplaceable",H,`${H}: faf could not place its block where the next run finds it again — faf left it unchanged`,{onWrite:!0});return J}function S1($,Z=b0,Q=y0){return`${Z}
270
+ ${x_($.trim(),Z,Q)}
271
271
  ${Q}`}function d8($,Z,Q=b0,z=y0,X){if($===null)return W6("",Z,`
272
272
  `,Q,z,X);let H=w2($,Q,z);if(H)return W6($.slice(0,H.start),Z,$.slice(H.end),Q,z,X);let U=$.startsWith(o3)?o3:"";return W6(U,Z,`
273
273
 
274
- ${$.slice(U.length)}`,Q,z,X)}function q6($){try{return Z0($)}catch(Z){if(Z.code==="ENOENT")return null;throw Z}}function T0($,Z,Q=b0,z=y0,X={}){let H=S1(Z,Q,z),U=$z($),J=X.root??e3(U),G=h(J,U),V=q6(G);e(G,d8(V,H,Q,z,U),{root:J,expect:V})}var g_="<!-- faf:";function v_($){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 k_($,Z){let Q=[new N0(!0),new N0(!1)],z=!1;for(let{content:X}of j1($)){if(z){if(X===Z)return"too deep";continue}let[H,U]=Q.map((G)=>G.line(X));z=Q[0].tooDeep;let J=H??U;if(X===Z&&(z||J!==null))return z?"too deep":J}return null}function h_($,Z,Q){let z=[new N0(!0),new N0(!1)];for(let{content:X}of j1($)){let H=z.map((U)=>U.line(X));if(z[0].tooDeep)return!1;if((X===Z||X===Q)&&H.some((U)=>U===null))return!0}return!1}function i8($,Z,Q=b0,z=y0){if(Z===null||w2(Z,Q,z))return null;let X=Zz(B6(Z)[0]??"");if(X.startsWith(g_)&&X!==Q&&X!==z)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 H=k_(Z,Q);if(H==="too deep")return`${$}: faf's block is now on top; the file nests more than ${s3} 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.`;if(H!==null)return`${$}: faf's block is now on top; an older faf block below sits inside ${v_(H)} and is left as you had it — delete it by hand if you no longer want it.`;if(h_(Z,Q,z))return`${$}: faf's block is now on top; an older faf marker line below it has no matching pair, so the text there is left as you had it — delete it by hand if you no longer want it.`;return null}function u_($,Z,Q=b0,z=y0,X={}){try{let H=$z($);return i8(Z,q6(h(X.root??e3(H),H)),Q,z)}catch{return null}}var f_=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 E1($){return $.split("_").map((Z)=>{if(!Z)return Z;let Q=Z.toUpperCase();return f_.has(Q)?Q:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function i($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function Q0($){let Z=g0.get($);if(Z?.label)return Z.label;let Q=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return E1(Q)}var b1=t.claude,p_="STATUS: SYNC ACTIVE";function l_($){let Z=zz($,b1);if(!m_(Z))return null;return Z0(h($,b1))}function c_($,Z){T0(zz($,b1),Z)}function x0($,Z={}){let Q=String($.project?.name??"").trim(),z=String($.project?.main_language??"").trim(),X=String($.project?.type??"").trim(),H=String($.project?.goal??"").trim(),U=`<!-- faf: ${[Q,z,X,H].join(" | ")} -->`,J=[];if(Z.doc)J.push(`doc=${Z.doc}`);else J.push(`claim=${Z.claim??"project.faf"}`);if(typeof Z.score==="number")J.push(`score=${Z.score}`);if(J.push(`family=${Z.family??"FAF"}`),Z.siblings&&Z.siblings.length>0)J.push(`siblings=${Z.siblings.join(",")}`);let G=`<!-- faf: ${J.join(" | ")} -->`;return`${U}
275
- ${G}`}function d_($){let Z=[],Q=$.project?.name??"Project",z=$.project?.main_language??"",X=$.project?.goal??"";if(Z.push(x0($)),Z.push(""),Z.push(`# CLAUDE.md — ${Q}`),Z.push(""),X)Z.push("## What This Is"),Z.push(""),Z.push(X),Z.push("");let H=$.stack??{},U=[];if(z)U.push(`**Language:** ${z}`);for(let[V,Y]of Object.entries(H))if(Y&&Y!=="slotignored"&&String(Y).trim())U.push(`**${Q0(`stack.${V}`)}:** ${Y}`);if(U.length>0){Z.push("## Stack"),Z.push("");for(let V of U)Z.push(`- ${V}`);Z.push("")}let J=$.human_context??{},G=[["who",J.who],["what",J.what],["why",J.why],["where",J.where],["when",J.when],["how",J.how]].filter(([,V])=>V&&String(V).trim()).map(([V,Y])=>`- **${Q0(`human_context.${V}`)}:** ${Y}`);if(G.length>0)Z.push("## Context"),Z.push(""),Z.push(...G),Z.push("");return Z.push("---"),Z.push(""),Z.push(`*${p_} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
276
- `)}function Qz($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function i_($){let Z={project:{}},Q=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(Q)Z.project.name=Qz(Q[1].trim());if(!Z.project.name){let H=$.match(/\*\*Name:\*\*\s*(.+)/);if(H)Z.project.name=Qz(H[1].trim())}let z=$.match(/## What This Is\s*\n\s*\n(.+)/);if(z)Z.project.goal=z[1].trim();if(!Z.project.goal){let H=$.match(/\*\*What Building:\*\*\s*(.+)/);if(H)Z.project.goal=H[1].trim()}let X=$.match(/\*\*Language:\*\*\s*(.+)/);if(X)Z.project.main_language=X[1].trim();if(!Z.project.main_language){let H=$.match(/\*\*Main Language:\*\*\s*(.+)/);if(H)Z.project.main_language=H[1].trim()}return Z}function S2($){let Z=String($??"").trim(),Q=Z.indexOf(" — ");if(Q<=0)return{cmd:Z,note:null};let z=Z.slice(0,Q).trim(),X=Z.slice(Q+3).trim();if(!z||!X)return{cmd:Z,note:null};return{cmd:z,note:X}}function X2($){return S2($).cmd}var U0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),Xz=($)=>Array.isArray($)?$.join(", "):String($),r_=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),s_=new Set(["target_user","core_problem","mission_purpose"]);function Hz($){let Z=[],Q=(A="")=>Z.push(A),z=$.ai_instructions,X=$.preferences,H=$.instant_context,U=$.security,J=$.commands,G=$.key_files??H?.key_files,V=U0($.project?.default_branch)?String($.project?.default_branch):"main",Y=J?Object.entries(J).filter(([,A])=>U0(A)):[],W=Y.filter(([A])=>/test/i.test(A)),B=Y.filter(([A])=>/lint|check/i.test(A)&&!/test/i.test(A)),K=Y.filter(([A])=>!/test|lint|check/i.test(A)),L=(A)=>{let j=A.toLowerCase();if(/install|deps/.test(j))return 0;if(/^build$|build/.test(j)&&!/rebuild/.test(j))return 1;if(/^dev$|develop/.test(j))return 2;if(/^start$|run/.test(j))return 3;return 4},q=[...K].sort((A,j)=>L(A[0])-L(j[0])||A[0].localeCompare(j[0])),D=[...W,...B],O=q.find(([A])=>/build/i.test(A)),_=W[0]?X2(W[0][1]):void 0,C=O?X2(O[1]):void 0;Q(x0($)),Q(),Q(`# AGENTS.md — ${$.project?.name??"Project"}`),Q();let F=[];if($.project?.main_language)F.push(String($.project.main_language));if(U0($.project?.type))F.push(`type: ${String($.project?.type)}`);if(U0($.project?.version))F.push(`v${String($.project?.version)}`);let R=$.project?.goal?String($.project.goal).trim():"";if(F.length)R+=(R?" — ":"")+F.join(" · ");if(R)Q(R),Q();if(Q("> Authored by faf — do not edit the managed block; refresh with `faf export --agents`. Hand-written content outside the managed block is preserved."),Q(),q.length){Q("## Setup & build"),Q(),Q("```bash");for(let[A,j]of q){let{cmd:c,note:q0}=S2(j);Q(`${c} # ${q0??A}`)}Q("```"),Q()}if(D.length){Q("## Run the tests"),Q(),Q("```bash");for(let[,A]of D){let{cmd:j,note:c}=S2(A);Q(c?`${j} # ${c}`:j)}Q("```"),Q()}if(G&&G.length){Q("## Where things live"),Q();let A=G.map((j)=>{let c=String(j),q0=c.indexOf(" — ");return q0>0?{path:c.slice(0,q0),role:c.slice(q0+3)}:{path:c,role:""}});if(A.some((j)=>j.role)){Q("| Path | Role |"),Q("|------|------|");for(let j of A)Q(`| \`${j.path}\` | ${j.role} |`)}else for(let j of A)Q(`- \`${j.path}\``);Q()}let N=new Map,w=(A)=>{if(!A)return;for(let[j,c]of Object.entries(A)){if(r_.has(j)||!U0(c))continue;let q0=E1(j);if(!N.has(q0))N.set(q0,Xz(c))}};w(z?.working_style),w(X);let P=$.conventions??[];if(N.size||P.length){Q("## Conventions"),Q();for(let[A,j]of N)Q(`- **${A}:** ${j}`);for(let A of P)if(U0(A))Q(`- ${A}`);Q()}let E=(z?.warnings??[]).filter((A)=>U0(A)),n=["read the tree"];if(_)n.push(`run the tests (\`${_}\`)`);if(C)n.push("build the project");for(let[,A]of B.slice(0,1))n.push(`\`${X2(A)}\``);Q("## Guardrails"),Q();for(let A of E)Q(`- ${A}`);Q(`- **Always OK:** ${[...new Set(n)].join(" · ")}.`),Q("- **Ask first:** dependency installs, deletions, migrations, schema changes, publish/release."),Q(`- **Never:** force-push · push straight to \`${V}\` (branch and open a PR) · commit secrets.`),Q();let a=[];for(let[,A]of B)a.push(`\`${X2(A)}\` exits 0`);for(let[,A]of W)a.push(`\`${X2(A)}\` passes`);if(a.push("changes committed with a conventional message"),Q("## Definition of Done"),Q(),Q(`Done when: ${[...new Set(a)].join(" · ")}.`),Q(),Q("## When stuck"),Q(),Q(`Ask a clarifying question, propose a short plan, or open a draft PR with notes — do not push large speculative changes to \`${V}\`.`),Q(),U&&(U0(U.secrets)||(U.never??[]).length)){if(Q("## Security & secrets"),Q(),U0(U.secrets)){let A=U0(U.example)?` (see \`${U.example}\`)`:"";Q(`- Secrets live in \`${U.secrets}\`${A}. Never read or commit them.`)}for(let A of U.never??[])if(U0(A))Q(`- Never read or commit \`${A}\`.`);Q()}if(Q("## Commit & PR"),Q(),X&&U0(X.commit_style))Q(`- Commit style: ${Xz(X.commit_style)}`);else Q("- Conventional Commits preferred (`feat:`, `fix:`, `chore:`, …).");if(Q(`- Branch off \`${V}\` and open a PR — never commit to \`${V}\` directly.`),Q("- If build/test scripts or layout change, refresh this file in the **same PR** (`faf export --agents`)."),Q(),$.stack){let A=[];for(let[j,c]of Object.entries($.stack)){if(s_.has(j))continue;if(i(c))A.push(`- **${Q0(`stack.${j}`)}:** ${c.trim()}`)}if(A.length){Q("## Stack"),Q();for(let j of A)Q(j);Q()}}let g=$.generated;if(U0(g))Q(`*Context authored: ${String(g)}*`);return Z.join(`
277
- `)}function o_($,Z){T0(n_($,t.agents),Hz(Z))}import{join as a_}from"path";var t_=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),e_=new Set(["target_user","core_problem","mission_purpose"]);function Uz($){let Z=[],Q=$.instant_context,z=$.commands,X=$.key_files??Q?.key_files,H=z?Object.entries(z).filter(([,B])=>t_(B)):[],U=H.filter(([B])=>/test/i.test(B)),J=H.filter(([B])=>/lint|check/i.test(B)&&!/test/i.test(B)),G=H.filter(([B])=>!/test|lint|check/i.test(B)),V=(B)=>{let K=B.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},Y=[...G].sort((B,K)=>V(B[0])-V(K[0])||B[0].localeCompare(K[0])),W=[...U,...J];if(Z.push(x0($)),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(Y.length){Z.push(""),Z.push("## Setup & build"),Z.push(""),Z.push("```bash");for(let[B,K]of Y){let{cmd:L,note:q}=S2(K);Z.push(`${L} # ${q??B}`)}Z.push("```")}if(W.length){Z.push(""),Z.push("## Test & verify"),Z.push(""),Z.push("```bash");for(let[,B]of W){let{cmd:K,note:L}=S2(B);Z.push(L?`${K} # ${L}`:K)}Z.push("```")}if(X&&X.length){Z.push(""),Z.push("## Where things live"),Z.push("");for(let B of X)Z.push(`- \`${B}\``)}if($.stack){let B=[];for(let[K,L]of Object.entries($.stack)){if(e_.has(K))continue;if(i(L))B.push(`- ${Q0(`stack.${K}`)}: ${L.trim()}`)}if(B.length){Z.push(""),Z.push("## Stack");for(let K of B)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(`
278
- `)}function $M($,Z){T0(a_($,t.gemini),Uz(Z))}import{join as ZM}from"path";function Jz($){let Z=[];if(Z.push(x0($)),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[Q,z]of Object.entries($.stack))if(i(z))Z.push(`# ${Q0(`stack.${Q}`)}: ${z.trim()}`)}return Z.push(""),Z.join(`
279
- `)}function QM($,Z){T0(ZM($,t.cursorrules),Jz(Z),"# faf:start","# faf:end")}import{join as zM}from"path";var Gz=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],XM=new Set([...Gz.map(([$])=>$),"cicd"]);function Vz($){let Z=[],Q=$.project?.name??"Project";if(Z.push(x0($)),Z.push(""),Z.push(`# GitHub Copilot Instructions — ${Q}`),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(""),i($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let z=$.stack??{},X=[];if(i($.project?.main_language))X.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[V,Y]of Object.entries(z)){if(XM.has(V))continue;if(i(Y))X.push(`- **${Q0(`stack.${V}`)}:** ${Y.trim()}`)}if(X.length>0)Z.push("## Tech stack","",...X,"");let H=[];for(let[V,Y]of Gz){let W=z[V];if(i(W))H.push(`- ${Y} \`${W.trim()}\`.`)}if(i(z.cicd))H.push(`- CI runs on ${z.cicd.trim()}.`);if(H.length>0)Z.push("## Build & run","",...H,"");let U=$.human_context??{},G=[["who",U.who],["what",U.what],["why",U.why],["where",U.where],["when",U.when],["how",U.how]].filter(([,V])=>i(V)).map(([V,Y])=>`- **${Q0(`human_context.${V}`)}:** ${Y.trim()}`);if(G.length>0)Z.push("## Project context","",...G,"");return Z.join(`
280
- `)}function HM($,Z){$$($,".github"),T0(zM($,".github",t.copilot),Vz(Z),b0,y0,{root:$})}import{existsSync as UM,lstatSync as Kz,readFileSync as r8,realpathSync as y1,statSync as JM}from"fs";import{homedir as GM}from"os";import{basename as VM,dirname as x1,join as A0,resolve as E2}from"path";var Yz=200,Wz=200,Bz=12,YM="# Project Context (from project.faf)",WM="*This section is managed by tri-sync.";function BM($){let Z=0;for(let Q=0;Q<$.length;Q++)Z=(Z<<5)-Z+$.charCodeAt(Q)|0;return Z}function Dz($){let Z=$.replace(/[^a-zA-Z0-9]/g,"-");if(Z.length<=Yz)return Z;return`${Z.slice(0,Yz)}-${Math.abs(BM($)).toString(36)}`}function Lz($){try{let Z=Kz($);if(Z.isSymbolicLink()){let Q=JM($);return Q.isDirectory()||Q.isFile()}return Z.isDirectory()||Z.isFile()}catch{return!1}}function qz($){try{return Kz($).isFile()}catch{return!1}}function qM($){let Z=$;for(;;){if(Lz(A0(Z,".git")))return Z;let Q=x1(Z);if(Q===Z)return null;Z=Q}}function KM($){let Z;try{Z=r8(A0($,".git"),"utf-8").trim()}catch{return $}try{if(!Z.startsWith("gitdir:"))return $;let Q=E2($,Z.slice(7).trim()),z=A0(Q,"commondir");if(!qz(z))return $;let X=E2(Q,r8(z,"utf-8").trim());if(E2(x1(Q))!==A0(X,"worktrees"))return $;let H=A0(Q,"gitdir");if(!qz(H))return $;let U=r8(H,"utf-8").trim();if(y1(E2(Q,U))!==A0(y1($),".git"))return $;if(VM(X)!==".git")return Lz(A0(X,".git"))?$:X;return x1(X)}catch{return $}}function Iz($){let Z=E2($);try{Z=y1.native(Z)}catch{}let Q=qM(Z);return(Q?KM(Q):Z).normalize("NFC")}function o8($,Z={}){if(Z.memoryDir)return E2(Z.memoryDir);let Q=Z.configDir||process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR||process.env.CLAUDE_CONFIG_DIR||A0(GM(),".claude");return A0(E2(Q),"projects",Dz(Iz($)),"memory").normalize("NFC")}function DM($,Z={}){return A0(o8($,Z),t.memory)}var LM=new Set(["target_user","core_problem","mission_purpose"]),IM=["who","what","why","where","when","how"];function Oz($){let Z=$.project??{},Q=[["Goal",Z.goal],["Language",Z.main_language],["Type",Z.type]],z=$.human_context??{},X=Array.isArray($.key_files)?$.key_files:[];return["## Project context — from project.faf","",`- **Name:** ${i(Z.name)?Z.name:"Project"}`,...Q.filter(([,U])=>i(U)).map(([U,J])=>`- **${U}:** ${J}`),...n8("Stack",Object.entries($.stack??{}).filter(([U,J])=>!LM.has(U)&&i(J)).map(([U,J])=>`- **${Q0(`stack.${U}`)}:** ${J}`)),...n8("Context",IM.filter((U)=>i(z[U])).map((U)=>`- **${Q0(`human_context.${U}`)}:** ${z[U]}`)),...n8("Commands",Object.entries($.commands??{}).filter(([,U])=>i(U)).slice(0,Bz).map(([U,J])=>`- ${U}: \`${X2(J)}\``)),...n8("Key files",X.filter(i).slice(0,Bz).map((U)=>`- ${U}`)),"","*faf keeps this block in step with project.faf. Everything outside it is Claude's own and is kept as written.*"].join(`
281
- `)}function n8($,Z){return Z.length>0?["",`### ${$}`,...Z]:[]}function _z($){return w1($,(Z)=>Z.trimEnd()===YM,(Z)=>Z.startsWith(WM))}function s8($){if($==="")return 0;let Z=$.match(/\r\n|\r|\n/g)?.length??0;return/(\r\n|\r|\n)$/.test($)?Z:Z+1}function OM($,Z,Q){if($===null)return{text:d8(null,Z,void 0,void 0,Q),action:"created",head:"",tail:""};let z=w2($),X=z??_z($);if(X){let U=$.slice(0,X.start),J=$.slice(X.end);return{text:W6(U,Z,J,void 0,void 0,Q),action:z?"updated":"migrated",head:U,tail:J}}let H=$.startsWith("\uFEFF")?"\uFEFF":"";return{text:d8($,Z,void 0,void 0,Q),action:"added",head:H,tail:$.slice(H.length)}}function g1($){return $>Wz?[`MEMORY.md is ${$} lines. Claude Code loads the first ${Wz}; lines after that are kept in the file but not loaded.`]:[]}function _M($,Z={}){let Q=o8($,Z),z=A0(Q,t.memory),X={path:z,exists:!1,lines:0,hasBlock:!1,blockLines:0,hasLegacySection:!1,otherLines:0,warnings:[]};if(!UM(Q))return X;let H=q6(h(Q,t.memory));if(H===null)return X;let U=w2(H),J=U?`${H.slice(0,U.start)}${H.slice(U.end)}`:H,G=s8(H);return{path:z,exists:!0,lines:G,hasBlock:U!==null,blockLines:U?s8(H.slice(U.start,U.end)):0,hasLegacySection:!U&&_z(H)!==null,otherLines:J.split(/\r\n|\r|\n/).filter((V)=>V.replace(/^\uFEFF/,"").trim()!=="").length,warnings:g1(G)}}function MM($,Z,Q={}){let z=o8($,Q);$$(z);let X=h(z,t.memory),H=q6(X),U=OM(H,S1(Oz(Z)),X);if(U.text===H){let B=s8(H);return{path:X,action:"unchanged",written:!1,preserved:!0,lines:B,warnings:g1(B)}}let J=e(X,U.text,{root:z,expect:H}),G=r8(J,"utf-8"),V=G===U.text&&G.startsWith(U.head)&&G.endsWith(U.tail),Y=s8(G),W=U.action==="added"?i8(t.memory,H):null;return{path:J,action:U.action,written:!0,preserved:V,lines:Y,warnings:[...W?[W]:[],...g1(Y)]}}function PM($,Z){let Q=[],z=(G)=>I($,G),X=(G)=>S($,G)??"";if(z("tsconfig.json")&&/"strict"\s*:\s*true/.test(X("tsconfig.json")))Q.push("TypeScript strict mode (tsconfig.json)");if(Z?.type==="module")Q.push("ESM modules (`type: module`)");let H=[],U=Z?.devDependencies??{};if(z(".eslintrc")||z(".eslintrc.json")||z(".eslintrc.cjs")||z("eslint.config.js")||z("eslint.config.mjs")||"eslint"in U)H.push("ESLint");if(z(".prettierrc")||z(".prettierrc.json")||z("prettier.config.js")||"prettier"in U)H.push("Prettier");let J=z("pyproject.toml")?X("pyproject.toml"):"";if(/\[tool\.black\]/.test(J))H.push("black");if(/\[tool\.ruff\]/.test(J))H.push("ruff");if(/\[tool\.mypy\]/.test(J))H.push("mypy");if(z("rustfmt.toml")||z(".rustfmt.toml"))H.push("rustfmt");if(H.length)Q.push(`Style enforced by ${H.join(" · ")} — obey the configs`);return Q}function FM($,Z){let Q={...Z},z=null,X=S($,"package.json");if(X!==null)try{z=JSON.parse(X)}catch{z=null}let H=l8($,z);if(Object.keys(H).length)Q.commands={...H,...Z.commands??{}};let U=Z.key_files??Z.instant_context?.key_files;if(!U||U.length===0){let J=p8($);if(J.length)Q.key_files=J}if(!Z.security){let G=[".env",".env.local",".env.development"].find((V)=>I($,V));if(G){let V=[".env.example",".env.sample",".env.template"].find((Y)=>I($,Y));Q.security={secrets:G,...V?{example:V}:{}}}}if(!Z.conventions){let J=PM($,z);if(J.length)Q.conventions=J}return Q}export{oK as writeServerCard,NK as writeProjectHtml,$M as writeGeminiMd,hq as writeFaf,QM as writeCursorrules,HM as writeCopilotInstructions,MM as writeClaudeMemory,c_ as writeClaudeMd,o_ as writeAgentsMd,uz as validateFaf,M2 as utcNow,JD as upsertCatalog,yq as updateFafFile,bO as updateExistingFaf,v8 as turboCatSlots,L3 as turboCatScan,Tz as slotsByCategory,d9 as serializeFaf,oQ as seedSixWsFromGoal,hz as scoreText,X5 as scoreFafYaml,e as safeWriteFile,oB as safeUnlink,V9 as safeReplaceOwned,xD as runLoop,h as resolveInside,DM as resolveClaudeMemoryPath,o8 as resolveClaudeMemoryDir,h3 as repoNameFromUrl,mZ as renderProjectHtml,Uz as renderGeminiMd,Jz as renderCursorrules,Vz as renderCopilotInstructions,Oz as renderClaudeMemory,d_ as renderClaudeMd,Hz as renderAgentsMd,O3 as relentlessContextDetailed,k8 as relentlessContext,A8 as registryTitle,aZ as registryName,I2 as registryMeta,Z0 as readUtf8,QD as readFafa,r9 as readFafRaw,bq as readFaf,l_ as readClaudeMd,H1 as questionForSlot,uD as publicQuestions,FQ as projectServerJson,R8 as projectServerCard,TQ as projectPack,VD as projectCards,NQ as projectArd,RQ as projectAiCatalog,F8 as projectA2ACard,aK as patchServerJson,i_ as parseClaudeMd,cO as normalizeGitUrl,w8 as normalizeAnswer,nZ as mcpName,$$ as makeDirInside,eQ as loopVerdict,u_ as legacyStampNoteAt,i8 as legacyStampNote,z5 as kernel,o as isPlaceholder,pq as isNonProjectRoot,aQ as isHumanSlot,jz as isExplicitNone,j8 as isEmptyValue,jD as interviewForMissing,T0 as injectFafBlock,fD as gradeAnswers,O$ as getTier,Sz as getNextTier,tK as generateServerCard,TK as generateProjectHtml,XD as generateA2ACard,pQ as fromClaudeDir,zD as findFafaFile,s9 as findFafFile,w2 as findFafBlock,l0 as fillEmpties,IQ as fafaYaml,z$ as fafaDomain,x0 as fafMetaTag,S0 as fafContextBlock,l1 as enrichScore,FM as enrichFromRepo,hD as deriveQuestionSet,rq as computeDrift,Iz as claudeProjectRoot,Dz as claudeProjectId,_M as claudeMemoryStatus,tQ as classifyGaps,U$ as canonicalPriority,bD as buildTableOf8,Z6 as buildServerCard,mD as buildReceipt,lK as buildPack,tZ as buildA2ACard,dO as authorFafFromRepo,R1 as assembleFreshFaf,LQ as answersToFafa,z3 as answersMatch,v0 as TIERS,b as SafePathError,rQ as STACK_INTERVIEW,g0 as SLOT_BY_PATH,m as SLOTS,L6 as SLOTIGNORED,X1 as SIX_WS_INTERVIEW,BQ as SERVER_JSON_SCHEMA,P8 as SERVER_CARD_SCHEMA,pZ as REGISTRY_PUBLISHER_KEY,z2 as PRIORITY_RANK,eZ as PRIORITY_ORDER,D6 as PLACEHOLDERS,C8 as KNOWLEDGE_TYPES,nQ as INTERVIEW_VERSION,CD as INTERVIEW_PATHS,sQ as INTERVIEW_BY_PATH,G$ as INTERVIEW,Y0 as FafmSoul,n3 as FafDNAManager,b0 as FAF_START,L$ as FAF_HEX,y0 as FAF_END,u1 as EXPLICIT_NONE,Cz as ENTERPRISE_SLOTS,J1 as BENCH_VERSION,Az as BASE_SLOTS,Q3 as ALIAS_GROUPS,Q$ as A2A_CONTEXT_URI};
274
+ ${$.slice(U.length)}`,Q,z,X)}function q6($){try{return Z0($)}catch(Z){if(Z.code==="ENOENT")return null;throw Z}}function T0($,Z,Q=b0,z=y0,X={}){let H=S1(Z,Q,z),U=$z($),J=X.root??e3(U),G=h(J,U),V=q6(G);e(G,d8(V,H,Q,z,U),{root:J,expect:V})}var v_="<!-- faf:";function k_($){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 h_($,Z){let Q=[new N0(!0),new N0(!1)],z=!1;for(let{content:X}of j1($)){if(z){if(X===Z)return"too deep";continue}let[H,U]=Q.map((G)=>G.line(X));z=Q[0].tooDeep;let J=H??U;if(X===Z&&(z||J!==null))return z?"too deep":J}return null}function u_($,Z,Q){let z=[new N0(!0),new N0(!1)];for(let{content:X}of j1($)){let H=z.map((U)=>U.line(X));if(z[0].tooDeep)return!1;if((X===Z||X===Q)&&H.some((U)=>U===null))return!0}return!1}function i8($,Z,Q=b0,z=y0){if(Z===null||w2(Z,Q,z))return null;let X=Zz(B6(Z)[0]??"");if(X.startsWith(v_)&&X!==Q&&X!==z)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 H=h_(Z,Q);if(H==="too deep")return`${$}: faf's block is now on top; the file nests more than ${s3} 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.`;if(H!==null)return`${$}: faf's block is now on top; an older faf block below sits inside ${k_(H)} and is left as you had it — delete it by hand if you no longer want it.`;if(u_(Z,Q,z))return`${$}: faf's block is now on top; an older faf marker line below it has no matching pair, so the text there is left as you had it — delete it by hand if you no longer want it.`;return null}function f_($,Z,Q=b0,z=y0,X={}){try{let H=$z($);return i8(Z,q6(h(X.root??e3(H),H)),Q,z)}catch{return null}}var m_=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 E1($){return $.split("_").map((Z)=>{if(!Z)return Z;let Q=Z.toUpperCase();return m_.has(Q)?Q:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function i($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function Q0($){let Z=g0.get($);if(Z?.label)return Z.label;let Q=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return E1(Q)}var b1=t.claude,l_="STATUS: SYNC ACTIVE";function c_($){let Z=zz($,b1);if(!p_(Z))return null;return Z0(h($,b1))}function d_($,Z){T0(zz($,b1),Z)}function x0($,Z={}){let Q=String($.project?.name??"").trim(),z=String($.project?.main_language??"").trim(),X=String($.project?.type??"").trim(),H=String($.project?.goal??"").trim(),U=`<!-- faf: ${[Q,z,X,H].join(" | ")} -->`,J=[];if(Z.doc)J.push(`doc=${Z.doc}`);else J.push(`claim=${Z.claim??"project.faf"}`);if(typeof Z.score==="number")J.push(`score=${Z.score}`);if(J.push(`family=${Z.family??"FAF"}`),Z.siblings&&Z.siblings.length>0)J.push(`siblings=${Z.siblings.join(",")}`);let G=`<!-- faf: ${J.join(" | ")} -->`;return`${U}
275
+ ${G}`}function i_($){let Z=[],Q=$.project?.name??"Project",z=$.project?.main_language??"",X=$.project?.goal??"";if(Z.push(x0($)),Z.push(""),Z.push(`# CLAUDE.md — ${Q}`),Z.push(""),X)Z.push("## What This Is"),Z.push(""),Z.push(X),Z.push("");let H=$.stack??{},U=[];if(z)U.push(`**Language:** ${z}`);for(let[V,Y]of Object.entries(H))if(Y&&Y!=="slotignored"&&String(Y).trim())U.push(`**${Q0(`stack.${V}`)}:** ${Y}`);if(U.length>0){Z.push("## Stack"),Z.push("");for(let V of U)Z.push(`- ${V}`);Z.push("")}let J=$.human_context??{},G=[["who",J.who],["what",J.what],["why",J.why],["where",J.where],["when",J.when],["how",J.how]].filter(([,V])=>V&&String(V).trim()).map(([V,Y])=>`- **${Q0(`human_context.${V}`)}:** ${Y}`);if(G.length>0)Z.push("## Context"),Z.push(""),Z.push(...G),Z.push("");return Z.push("---"),Z.push(""),Z.push(`*${l_} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
276
+ `)}function Qz($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function n_($){let Z={project:{}},Q=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(Q)Z.project.name=Qz(Q[1].trim());if(!Z.project.name){let H=$.match(/\*\*Name:\*\*\s*(.+)/);if(H)Z.project.name=Qz(H[1].trim())}let z=$.match(/## What This Is\s*\n\s*\n(.+)/);if(z)Z.project.goal=z[1].trim();if(!Z.project.goal){let H=$.match(/\*\*What Building:\*\*\s*(.+)/);if(H)Z.project.goal=H[1].trim()}let X=$.match(/\*\*Language:\*\*\s*(.+)/);if(X)Z.project.main_language=X[1].trim();if(!Z.project.main_language){let H=$.match(/\*\*Main Language:\*\*\s*(.+)/);if(H)Z.project.main_language=H[1].trim()}return Z}function S2($){let Z=String($??"").trim(),Q=Z.indexOf(" — ");if(Q<=0)return{cmd:Z,note:null};let z=Z.slice(0,Q).trim(),X=Z.slice(Q+3).trim();if(!z||!X)return{cmd:Z,note:null};return{cmd:z,note:X}}function X2($){return S2($).cmd}var U0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),Xz=($)=>Array.isArray($)?$.join(", "):String($),s_=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),o_=new Set(["target_user","core_problem","mission_purpose"]);function Hz($){let Z=[],Q=(A="")=>Z.push(A),z=$.ai_instructions,X=$.preferences,H=$.instant_context,U=$.security,J=$.commands,G=$.key_files??H?.key_files,V=U0($.project?.default_branch)?String($.project?.default_branch):"main",Y=J?Object.entries(J).filter(([,A])=>U0(A)):[],W=Y.filter(([A])=>/test/i.test(A)),B=Y.filter(([A])=>/lint|check/i.test(A)&&!/test/i.test(A)),K=Y.filter(([A])=>!/test|lint|check/i.test(A)),L=(A)=>{let j=A.toLowerCase();if(/install|deps/.test(j))return 0;if(/^build$|build/.test(j)&&!/rebuild/.test(j))return 1;if(/^dev$|develop/.test(j))return 2;if(/^start$|run/.test(j))return 3;return 4},q=[...K].sort((A,j)=>L(A[0])-L(j[0])||A[0].localeCompare(j[0])),D=[...W,...B],O=q.find(([A])=>/build/i.test(A)),_=W[0]?X2(W[0][1]):void 0,C=O?X2(O[1]):void 0;Q(x0($)),Q(),Q(`# AGENTS.md — ${$.project?.name??"Project"}`),Q();let F=[];if($.project?.main_language)F.push(String($.project.main_language));if(U0($.project?.type))F.push(`type: ${String($.project?.type)}`);if(U0($.project?.version))F.push(`v${String($.project?.version)}`);let R=$.project?.goal?String($.project.goal).trim():"";if(F.length)R+=(R?" — ":"")+F.join(" · ");if(R)Q(R),Q();if(Q("> Authored by faf — do not edit the managed block; refresh with `faf export --agents`. Hand-written content outside the managed block is preserved."),Q(),q.length){Q("## Setup & build"),Q(),Q("```bash");for(let[A,j]of q){let{cmd:c,note:q0}=S2(j);Q(`${c} # ${q0??A}`)}Q("```"),Q()}if(D.length){Q("## Run the tests"),Q(),Q("```bash");for(let[,A]of D){let{cmd:j,note:c}=S2(A);Q(c?`${j} # ${c}`:j)}Q("```"),Q()}if(G&&G.length){Q("## Where things live"),Q();let A=G.map((j)=>{let c=String(j),q0=c.indexOf(" — ");return q0>0?{path:c.slice(0,q0),role:c.slice(q0+3)}:{path:c,role:""}});if(A.some((j)=>j.role)){Q("| Path | Role |"),Q("|------|------|");for(let j of A)Q(`| \`${j.path}\` | ${j.role} |`)}else for(let j of A)Q(`- \`${j.path}\``);Q()}let N=new Map,w=(A)=>{if(!A)return;for(let[j,c]of Object.entries(A)){if(s_.has(j)||!U0(c))continue;let q0=E1(j);if(!N.has(q0))N.set(q0,Xz(c))}};w(z?.working_style),w(X);let P=$.conventions??[];if(N.size||P.length){Q("## Conventions"),Q();for(let[A,j]of N)Q(`- **${A}:** ${j}`);for(let A of P)if(U0(A))Q(`- ${A}`);Q()}let E=(z?.warnings??[]).filter((A)=>U0(A)),n=["read the tree"];if(_)n.push(`run the tests (\`${_}\`)`);if(C)n.push("build the project");for(let[,A]of B.slice(0,1))n.push(`\`${X2(A)}\``);Q("## Guardrails"),Q();for(let A of E)Q(`- ${A}`);Q(`- **Always OK:** ${[...new Set(n)].join(" · ")}.`),Q("- **Ask first:** dependency installs, deletions, migrations, schema changes, publish/release."),Q(`- **Never:** force-push · push straight to \`${V}\` (branch and open a PR) · commit secrets.`),Q();let a=[];for(let[,A]of B)a.push(`\`${X2(A)}\` exits 0`);for(let[,A]of W)a.push(`\`${X2(A)}\` passes`);if(a.push("changes committed with a conventional message"),Q("## Definition of Done"),Q(),Q(`Done when: ${[...new Set(a)].join(" · ")}.`),Q(),Q("## When stuck"),Q(),Q(`Ask a clarifying question, propose a short plan, or open a draft PR with notes — do not push large speculative changes to \`${V}\`.`),Q(),U&&(U0(U.secrets)||(U.never??[]).length)){if(Q("## Security & secrets"),Q(),U0(U.secrets)){let A=U0(U.example)?` (see \`${U.example}\`)`:"";Q(`- Secrets live in \`${U.secrets}\`${A}. Never read or commit them.`)}for(let A of U.never??[])if(U0(A))Q(`- Never read or commit \`${A}\`.`);Q()}if(Q("## Commit & PR"),Q(),X&&U0(X.commit_style))Q(`- Commit style: ${Xz(X.commit_style)}`);else Q("- Conventional Commits preferred (`feat:`, `fix:`, `chore:`, …).");if(Q(`- Branch off \`${V}\` and open a PR — never commit to \`${V}\` directly.`),Q("- If build/test scripts or layout change, refresh this file in the **same PR** (`faf export --agents`)."),Q(),$.stack){let A=[];for(let[j,c]of Object.entries($.stack)){if(o_.has(j))continue;if(i(c))A.push(`- **${Q0(`stack.${j}`)}:** ${c.trim()}`)}if(A.length){Q("## Stack"),Q();for(let j of A)Q(j);Q()}}let g=$.generated;if(U0(g))Q(`*Context authored: ${String(g)}*`);return Z.join(`
277
+ `)}function a_($,Z){T0(r_($,t.agents),Hz(Z))}import{join as t_}from"path";var e_=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),$M=new Set(["target_user","core_problem","mission_purpose"]);function Uz($){let Z=[],Q=$.instant_context,z=$.commands,X=$.key_files??Q?.key_files,H=z?Object.entries(z).filter(([,B])=>e_(B)):[],U=H.filter(([B])=>/test/i.test(B)),J=H.filter(([B])=>/lint|check/i.test(B)&&!/test/i.test(B)),G=H.filter(([B])=>!/test|lint|check/i.test(B)),V=(B)=>{let K=B.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},Y=[...G].sort((B,K)=>V(B[0])-V(K[0])||B[0].localeCompare(K[0])),W=[...U,...J];if(Z.push(x0($)),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(Y.length){Z.push(""),Z.push("## Setup & build"),Z.push(""),Z.push("```bash");for(let[B,K]of Y){let{cmd:L,note:q}=S2(K);Z.push(`${L} # ${q??B}`)}Z.push("```")}if(W.length){Z.push(""),Z.push("## Test & verify"),Z.push(""),Z.push("```bash");for(let[,B]of W){let{cmd:K,note:L}=S2(B);Z.push(L?`${K} # ${L}`:K)}Z.push("```")}if(X&&X.length){Z.push(""),Z.push("## Where things live"),Z.push("");for(let B of X)Z.push(`- \`${B}\``)}if($.stack){let B=[];for(let[K,L]of Object.entries($.stack)){if($M.has(K))continue;if(i(L))B.push(`- ${Q0(`stack.${K}`)}: ${L.trim()}`)}if(B.length){Z.push(""),Z.push("## Stack");for(let K of B)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(`
278
+ `)}function ZM($,Z){T0(t_($,t.gemini),Uz(Z))}import{join as QM}from"path";function Jz($){let Z=[];if(Z.push(x0($)),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[Q,z]of Object.entries($.stack))if(i(z))Z.push(`# ${Q0(`stack.${Q}`)}: ${z.trim()}`)}return Z.push(""),Z.join(`
279
+ `)}function zM($,Z){T0(QM($,t.cursorrules),Jz(Z),"# faf:start","# faf:end")}import{join as XM}from"path";var Gz=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],HM=new Set([...Gz.map(([$])=>$),"cicd"]);function Vz($){let Z=[],Q=$.project?.name??"Project";if(Z.push(x0($)),Z.push(""),Z.push(`# GitHub Copilot Instructions — ${Q}`),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(""),i($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let z=$.stack??{},X=[];if(i($.project?.main_language))X.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[V,Y]of Object.entries(z)){if(HM.has(V))continue;if(i(Y))X.push(`- **${Q0(`stack.${V}`)}:** ${Y.trim()}`)}if(X.length>0)Z.push("## Tech stack","",...X,"");let H=[];for(let[V,Y]of Gz){let W=z[V];if(i(W))H.push(`- ${Y} \`${W.trim()}\`.`)}if(i(z.cicd))H.push(`- CI runs on ${z.cicd.trim()}.`);if(H.length>0)Z.push("## Build & run","",...H,"");let U=$.human_context??{},G=[["who",U.who],["what",U.what],["why",U.why],["where",U.where],["when",U.when],["how",U.how]].filter(([,V])=>i(V)).map(([V,Y])=>`- **${Q0(`human_context.${V}`)}:** ${Y.trim()}`);if(G.length>0)Z.push("## Project context","",...G,"");return Z.join(`
280
+ `)}function UM($,Z){$$($,".github"),T0(XM($,".github",t.copilot),Vz(Z),b0,y0,{root:$})}import{existsSync as JM,lstatSync as Kz,readFileSync as r8,realpathSync as y1,statSync as GM}from"fs";import{homedir as VM}from"os";import{basename as YM,dirname as x1,join as A0,resolve as E2}from"path";var Yz=200,Wz=200,Bz=12,WM="# Project Context (from project.faf)",BM="*This section is managed by tri-sync.";function qM($){let Z=0;for(let Q=0;Q<$.length;Q++)Z=(Z<<5)-Z+$.charCodeAt(Q)|0;return Z}function Dz($){let Z=$.replace(/[^a-zA-Z0-9]/g,"-");if(Z.length<=Yz)return Z;return`${Z.slice(0,Yz)}-${Math.abs(qM($)).toString(36)}`}function Lz($){try{let Z=Kz($);if(Z.isSymbolicLink()){let Q=GM($);return Q.isDirectory()||Q.isFile()}return Z.isDirectory()||Z.isFile()}catch{return!1}}function qz($){try{return Kz($).isFile()}catch{return!1}}function KM($){let Z=$;for(;;){if(Lz(A0(Z,".git")))return Z;let Q=x1(Z);if(Q===Z)return null;Z=Q}}function DM($){let Z;try{Z=r8(A0($,".git"),"utf-8").trim()}catch{return $}try{if(!Z.startsWith("gitdir:"))return $;let Q=E2($,Z.slice(7).trim()),z=A0(Q,"commondir");if(!qz(z))return $;let X=E2(Q,r8(z,"utf-8").trim());if(E2(x1(Q))!==A0(X,"worktrees"))return $;let H=A0(Q,"gitdir");if(!qz(H))return $;let U=r8(H,"utf-8").trim();if(y1(E2(Q,U))!==A0(y1($),".git"))return $;if(YM(X)!==".git")return Lz(A0(X,".git"))?$:X;return x1(X)}catch{return $}}function Iz($){let Z=E2($);try{Z=y1.native(Z)}catch{}let Q=KM(Z);return(Q?DM(Q):Z).normalize("NFC")}function o8($,Z={}){if(Z.memoryDir)return E2(Z.memoryDir);let Q=Z.configDir||process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR||process.env.CLAUDE_CONFIG_DIR||A0(VM(),".claude");return A0(E2(Q),"projects",Dz(Iz($)),"memory").normalize("NFC")}function LM($,Z={}){return A0(o8($,Z),t.memory)}var IM=new Set(["target_user","core_problem","mission_purpose"]),OM=["who","what","why","where","when","how"];function Oz($){let Z=$.project??{},Q=[["Goal",Z.goal],["Language",Z.main_language],["Type",Z.type]],z=$.human_context??{},X=Array.isArray($.key_files)?$.key_files:[];return["## Project context — from project.faf","",`- **Name:** ${i(Z.name)?Z.name:"Project"}`,...Q.filter(([,U])=>i(U)).map(([U,J])=>`- **${U}:** ${J}`),...n8("Stack",Object.entries($.stack??{}).filter(([U,J])=>!IM.has(U)&&i(J)).map(([U,J])=>`- **${Q0(`stack.${U}`)}:** ${J}`)),...n8("Context",OM.filter((U)=>i(z[U])).map((U)=>`- **${Q0(`human_context.${U}`)}:** ${z[U]}`)),...n8("Commands",Object.entries($.commands??{}).filter(([,U])=>i(U)).slice(0,Bz).map(([U,J])=>`- ${U}: \`${X2(J)}\``)),...n8("Key files",X.filter(i).slice(0,Bz).map((U)=>`- ${U}`)),"","*faf keeps this block in step with project.faf. Everything outside it is Claude's own and is kept as written.*"].join(`
281
+ `)}function n8($,Z){return Z.length>0?["",`### ${$}`,...Z]:[]}function _z($){return w1($,(Z)=>Z.trimEnd()===WM,(Z)=>Z.startsWith(BM))}function s8($){if($==="")return 0;let Z=$.match(/\r\n|\r|\n/g)?.length??0;return/(\r\n|\r|\n)$/.test($)?Z:Z+1}function _M($,Z,Q){if($===null)return{text:d8(null,Z,void 0,void 0,Q),action:"created",head:"",tail:""};let z=w2($),X=z??_z($);if(X){let U=$.slice(0,X.start),J=$.slice(X.end);return{text:W6(U,Z,J,void 0,void 0,Q),action:z?"updated":"migrated",head:U,tail:J}}let H=$.startsWith("\uFEFF")?"\uFEFF":"";return{text:d8($,Z,void 0,void 0,Q),action:"added",head:H,tail:$.slice(H.length)}}function g1($){return $>Wz?[`MEMORY.md is ${$} lines. Claude Code loads the first ${Wz}; lines after that are kept in the file but not loaded.`]:[]}function MM($,Z={}){let Q=o8($,Z),z=A0(Q,t.memory),X={path:z,exists:!1,lines:0,hasBlock:!1,blockLines:0,hasLegacySection:!1,otherLines:0,warnings:[]};if(!JM(Q))return X;let H=q6(h(Q,t.memory));if(H===null)return X;let U=w2(H),J=U?`${H.slice(0,U.start)}${H.slice(U.end)}`:H,G=s8(H);return{path:z,exists:!0,lines:G,hasBlock:U!==null,blockLines:U?s8(H.slice(U.start,U.end)):0,hasLegacySection:!U&&_z(H)!==null,otherLines:J.split(/\r\n|\r|\n/).filter((V)=>V.replace(/^\uFEFF/,"").trim()!=="").length,warnings:g1(G)}}function PM($,Z,Q={}){let z=o8($,Q);$$(z);let X=h(z,t.memory),H=q6(X),U=_M(H,S1(Oz(Z)),X);if(U.text===H){let B=s8(H);return{path:X,action:"unchanged",written:!1,preserved:!0,lines:B,warnings:g1(B)}}let J=e(X,U.text,{root:z,expect:H}),G=r8(J,"utf-8"),V=G===U.text&&G.startsWith(U.head)&&G.endsWith(U.tail),Y=s8(G),W=U.action==="added"?i8(t.memory,H):null;return{path:J,action:U.action,written:!0,preserved:V,lines:Y,warnings:[...W?[W]:[],...g1(Y)]}}function FM($,Z){let Q=[],z=(G)=>I($,G),X=(G)=>S($,G)??"";if(z("tsconfig.json")&&/"strict"\s*:\s*true/.test(X("tsconfig.json")))Q.push("TypeScript strict mode (tsconfig.json)");if(Z?.type==="module")Q.push("ESM modules (`type: module`)");let H=[],U=Z?.devDependencies??{};if(z(".eslintrc")||z(".eslintrc.json")||z(".eslintrc.cjs")||z("eslint.config.js")||z("eslint.config.mjs")||"eslint"in U)H.push("ESLint");if(z(".prettierrc")||z(".prettierrc.json")||z("prettier.config.js")||"prettier"in U)H.push("Prettier");let J=z("pyproject.toml")?X("pyproject.toml"):"";if(/\[tool\.black\]/.test(J))H.push("black");if(/\[tool\.ruff\]/.test(J))H.push("ruff");if(/\[tool\.mypy\]/.test(J))H.push("mypy");if(z("rustfmt.toml")||z(".rustfmt.toml"))H.push("rustfmt");if(H.length)Q.push(`Style enforced by ${H.join(" · ")} — obey the configs`);return Q}function RM($,Z){let Q={...Z},z=null,X=S($,"package.json");if(X!==null)try{z=JSON.parse(X)}catch{z=null}let H=l8($,z);if(Object.keys(H).length)Q.commands={...H,...Z.commands??{}};let U=Z.key_files??Z.instant_context?.key_files;if(!U||U.length===0){let J=p8($);if(J.length)Q.key_files=J}if(!Z.security){let G=[".env",".env.local",".env.development"].find((V)=>I($,V));if(G){let V=[".env.example",".env.sample",".env.template"].find((Y)=>I($,Y));Q.security={secrets:G,...V?{example:V}:{}}}}if(!Z.conventions){let J=FM($,z);if(J.length)Q.conventions=J}return Q}export{aK as writeServerCard,NK as writeProjectHtml,ZM as writeGeminiMd,hq as writeFaf,zM as writeCursorrules,UM as writeCopilotInstructions,PM as writeClaudeMemory,d_ as writeClaudeMd,a_ as writeAgentsMd,uz as validateFaf,M2 as utcNow,GD as upsertCatalog,yq as updateFafFile,yO as updateExistingFaf,v8 as turboCatSlots,L3 as turboCatScan,Tz as slotsByCategory,d9 as serializeFaf,oQ as seedSixWsFromGoal,hz as scoreText,X5 as scoreFafYaml,e as safeWriteFile,oB as safeUnlink,V9 as safeReplaceOwned,gD as runLoop,h as resolveInside,LM as resolveClaudeMemoryPath,o8 as resolveClaudeMemoryDir,h3 as repoNameFromUrl,mZ as renderProjectHtml,Uz as renderGeminiMd,Jz as renderCursorrules,Vz as renderCopilotInstructions,Oz as renderClaudeMemory,i_ as renderClaudeMd,Hz as renderAgentsMd,O3 as relentlessContextDetailed,k8 as relentlessContext,A8 as registryTitle,aZ as registryName,I2 as registryMeta,Z0 as readUtf8,zD as readFafa,r9 as readFafRaw,bq as readFaf,c_ as readClaudeMd,H1 as questionForSlot,fD as publicQuestions,FQ as projectServerJson,R8 as projectServerCard,TQ as projectPack,YD as projectCards,NQ as projectArd,RQ as projectAiCatalog,F8 as projectA2ACard,tK as patchServerJson,n_ as parseClaudeMd,dO as normalizeGitUrl,w8 as normalizeAnswer,nZ as mcpName,$$ as makeDirInside,eQ as loopVerdict,f_ as legacyStampNoteAt,i8 as legacyStampNote,z5 as kernel,o as isPlaceholder,pq as isNonProjectRoot,aQ as isHumanSlot,jz as isExplicitNone,j8 as isEmptyValue,wD as interviewForMissing,T0 as injectFafBlock,mD as gradeAnswers,O$ as getTier,Sz as getNextTier,eK as generateServerCard,TK as generateProjectHtml,HD as generateA2ACard,pQ as fromClaudeDir,XD as findFafaFile,s9 as findFafFile,w2 as findFafBlock,l0 as fillEmpties,IQ as fafaYaml,z$ as fafaDomain,x0 as fafMetaTag,S0 as fafContextBlock,l1 as enrichScore,RM as enrichFromRepo,uD as deriveQuestionSet,rq as computeDrift,Iz as claudeProjectRoot,Dz as claudeProjectId,MM as claudeMemoryStatus,tQ as classifyGaps,U$ as canonicalPriority,yD as buildTableOf8,Z6 as buildServerCard,pD as buildReceipt,cK as buildPack,tZ as buildA2ACard,iO as authorFafFromRepo,R1 as assembleFreshFaf,LQ as answersToFafa,z3 as answersMatch,v0 as TIERS,b as SafePathError,rQ as STACK_INTERVIEW,g0 as SLOT_BY_PATH,m as SLOTS,L6 as SLOTIGNORED,X1 as SIX_WS_INTERVIEW,BQ as SERVER_JSON_SCHEMA,P8 as SERVER_CARD_SCHEMA,pZ as REGISTRY_PUBLISHER_KEY,z2 as PRIORITY_RANK,eZ as PRIORITY_ORDER,D6 as PLACEHOLDERS,C8 as KNOWLEDGE_TYPES,nQ as INTERVIEW_VERSION,jD as INTERVIEW_PATHS,sQ as INTERVIEW_BY_PATH,G$ as INTERVIEW,Y0 as FafmSoul,n3 as FafDNAManager,b0 as FAF_START,L$ as FAF_HEX,y0 as FAF_END,u1 as EXPLICIT_NONE,Cz as ENTERPRISE_SLOTS,J1 as BENCH_VERSION,Az as BASE_SLOTS,Q3 as ALIAS_GROUPS,Q$ as A2A_CONTEXT_URI};
282
282
 
283
- //# debugId=043A6E313BD0AEBA64756E2164756E21
283
+ //# debugId=2B445F33F307665464756E2164756E21
284
284
  //# sourceMappingURL=index.js.map