faf 8.7.0 → 8.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cli.js +287 -280
- package/dist/cli.js.map +5 -5
- package/dist/index.js +5 -5
- package/dist/index.js.map +3 -3
- package/dist/ui/colors.d.ts +11 -5
- package/package.json +1 -1
- package/project.faf +3 -3
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)){J8(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(s7(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)){J8(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=U8(Q),X=n2(z);r7($);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=U8($),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=U8($),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()}}}dW.Parser=o7});var Z9=_(($B)=>{var a7=UZ(),nW=g$(),m$=v$(),rW=L5(),sW=g(),oW=LZ(),t7=IZ();function e7($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new oW.LineCounter||null,prettyErrors:Z}}function aW($,Z={}){let{lineCounter:Q,prettyErrors:z}=e7(Z),X=new t7.Parser(Q?.addNewLine),H=new a7.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 $9($,Z={}){let{lineCounter:Q,prettyErrors:z}=e7(Z),X=new t7.Parser(Q?.addNewLine),H=new a7.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 tW($,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=$9($,Q);if(!X)return null;if(X.warnings.forEach((H)=>rW.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 eW($,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(sW.isDocument($)&&!z)return $.toString(Q);return new nW.Document($,z,Q).toString(Q)}$B.parse=tW;$B.parseAllDocuments=aW;$B.parseDocument=$9;$B.stringify=eW});var p=[{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(p.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),m1=new Map(p.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),m_=new Map(p.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function p1($,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 bz($){return p.filter((Z)=>Z.category===$)}var yz=p.filter(($)=>$.index<=21),xz=p,D6=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","tbd","todo","n/a","not applicable"]),l1=new Set(["none","n/a","not applicable"]),L6="slotignored";function gz($){return typeof $==="string"&&l1.has($.trim().toLowerCase())}function $5($){return typeof $==="string"&&$.trim()!==""&&r($)}function r($){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",vz=new Set(["stack.css_framework","stack.ui_library","stack.database","stack.connection","stack.hosting"]),I6={skills:new Set(["stack.frontend"]),"skills-plugin":new Set(["stack.frontend","stack.runtime"])};function x2($,Z){if(typeof $!=="string"||!Object.prototype.hasOwnProperty.call(b2,$))return null;if(I6[$]?.has(Z.path))return!0;if(!b2[$].includes(Z.category))return!1;return!($==="framework"&&vz.has(Z.path))}var b2={documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],skills:["project","human"],cli:["project","human","universal"],"skills-plugin":["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"]};function kz(){let $=process.env.FORCE_COLOR;if($!==void 0&&$!==""&&$!=="0"&&$!=="false")return!0;if(process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!=="")return!1;return Boolean(process.stdout.isTTY)}var O6=($,Z)=>kz()?`\x1B[${$}m${Z}\x1B[0m`:Z,Z5=($)=>(Z)=>O6($,Z),D$=Z5("1"),g2=Z5("2"),l_=Z5("3"),L$={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"},I$=($)=>O6("38;2;0;212;212",$),Q5=($)=>O6("38;2;14;140;140",$),v2=($)=>O6("38;5;208",$);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:`${Q5("◇")} ${Q5("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 hz($){let Z=O$($),Q=v0.indexOf(Z);return Q>0?v0[Q-1]:null}var U5={};Sz(U5,{validate:()=>fz,sdkVersion:()=>dz,scoreFafb:()=>cz,scoreEnterprise:()=>uz,score:()=>H5,fafbInfo:()=>lz,decompile:()=>pz,compile:()=>mz});var z5=null;function c0(){if(z5)return z5;try{let $=K$("faf-scoring-kernel");return z5=$,$}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=U8($),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=U8($),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()}}}dW.Parser=o7});var Z9=_(($B)=>{var a7=UZ(),nW=g$(),m$=v$(),rW=L5(),sW=g(),oW=LZ(),t7=IZ();function e7($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new oW.LineCounter||null,prettyErrors:Z}}function aW($,Z={}){let{lineCounter:Q,prettyErrors:z}=e7(Z),X=new t7.Parser(Q?.addNewLine),H=new a7.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 $9($,Z={}){let{lineCounter:Q,prettyErrors:z}=e7(Z),X=new t7.Parser(Q?.addNewLine),H=new a7.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 tW($,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=$9($,Q);if(!X)return null;if(X.warnings.forEach((H)=>rW.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 eW($,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(sW.isDocument($)&&!z)return $.toString(Q);return new nW.Document($,z,Q).toString(Q)}$B.parse=tW;$B.parseAllDocuments=aW;$B.parseDocument=$9;$B.stringify=eW});var p=[{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(p.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),m1=new Map(p.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),m_=new Map(p.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function p1($,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 bz($){return p.filter((Z)=>Z.category===$)}var yz=p.filter(($)=>$.index<=21),xz=p,D6=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","tbd","todo","n/a","not applicable"]),l1=new Set(["none","n/a","not applicable"]),L6="slotignored";function gz($){return typeof $==="string"&&l1.has($.trim().toLowerCase())}function $5($){return typeof $==="string"&&$.trim()!==""&&r($)}function r($){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",vz=new Set(["stack.css_framework","stack.ui_library","stack.database","stack.connection","stack.hosting"]),I6={skills:new Set(["stack.frontend"]),"skills-plugin":new Set(["stack.frontend","stack.runtime"])};function x2($,Z){if(typeof $!=="string"||!Object.prototype.hasOwnProperty.call(b2,$))return null;if(I6[$]?.has(Z.path))return!0;if(!b2[$].includes(Z.category))return!1;return!($==="framework"&&vz.has(Z.path))}var b2={documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],skills:["project","human"],cli:["project","human","universal"],"skills-plugin":["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"]};function kz($=process.stdout){let Z=process.env.FORCE_COLOR;if(Z!==void 0)return Z!=="0"&&Z!=="false";if(process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!=="")return!1;return Boolean($.isTTY)}var l_=new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`,"g");var O6=($,Z)=>kz()?`\x1B[${$}m${Z}\x1B[0m`:Z,Z5=($)=>(Z)=>O6($,Z),D$=Z5("1"),g2=Z5("2"),c_=Z5("3"),L$={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"},I$=($)=>O6("38;2;0;212;212",$),Q5=($)=>O6("38;2;14;140;140",$),v2=($)=>O6("38;5;208",$);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:`${Q5("◇")} ${Q5("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 hz($){let Z=O$($),Q=v0.indexOf(Z);return Q>0?v0[Q-1]:null}var U5={};Sz(U5,{validate:()=>fz,sdkVersion:()=>dz,scoreFafb:()=>cz,scoreEnterprise:()=>uz,score:()=>H5,fafbInfo:()=>lz,decompile:()=>pz,compile:()=>mz});var z5=null;function c0(){if(z5)return z5;try{let $=K$("faf-scoring-kernel");return z5=$,$}catch{throw Error(`faf-scoring-kernel not installed.
|
|
140
140
|
|
|
141
141
|
Run: npm install faf-scoring-kernel
|
|
142
|
-
`)}}var M6=($)=>$.startsWith("\uFEFF")?$.slice(1):$;function X5($){let Z={};for(let[Q,z]of Object.entries($.slots??{}))Z[m1.get(Q)??Q]=z;return{...$,slots:Z}}function H5($){return X5(JSON.parse(c0().score_faf(M6($))))}function uz($){return X5(JSON.parse(c0().score_faf_enterprise(M6($))))}function fz($){return c0().validate_faf(M6($))}function mz($){return c0().compile_fafb(M6($))}function pz($){return JSON.parse(c0().decompile_fafb($))}function lz($){return JSON.parse(c0().fafb_info($))}function cz($){return X5(JSON.parse(c0().score_fafb($)))}function dz(){return c0().sdk_version()}var c1=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function d1($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function i1($){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 iz($){return $.unknown?"unknown (—)":`${$.score}%`}function n1($){return{score:$.score,tier:O$($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function J5($){let Z=i1($);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 n1(H5($))}function nz($){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(!d1(Q)||typeof Q.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!c1.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 i9}from"fs";import{join as l9,dirname as hZ,basename as yF,resolve as t$}from"path";var HB=UZ(),UB=g$(),JB=c5(),OZ=v$(),GB=P$(),e0=g(),VB=r0(),YB=d(),WB=o0(),BB=a0(),IF=X8(),qB=DZ(),KB=LZ(),DB=IZ(),G8=Z9(),Q9=M$();var LB=HB.Composer,V8=UB.Document,IB=JB.Schema,OB=OZ.YAMLError,Y8=OZ.YAMLParseError,MB=OZ.YAMLWarning,_B=GB.Alias,u0=e0.isAlias,K2=e0.isCollection,PB=e0.isDocument,l=e0.isMap,L0=e0.isNode,FB=e0.isPair,o=e0.isScalar,f0=e0.isSeq,RB=VB.Pair,NB=YB.Scalar,r2=WB.YAMLMap,p$=BB.YAMLSeq;var TB=qB.Lexer,AB=KB.LineCounter,CB=DB.Parser,m0=G8.parse,jB=G8.parseAllDocuments,s2=G8.parseDocument,D2=G8.stringify,wB=Q9.visit,SB=Q9.visitAsync;import{accessSync as z9,closeSync as FZ,constants as X9,existsSync as EB,fchmodSync as H9,fchownSync as bB,fsyncSync as U9,lstatSync as RZ,mkdirSync as J9,mkdtempSync as _F,openSync as G9,readdirSync as yB,readFileSync as NZ,readlinkSync as xB,realpathSync as gB,renameSync as vB,rmSync as PF,statSync as o2,unlinkSync as V9,writeFileSync as kB}from"fs";import{randomBytes as hB}from"crypto";import{basename as $2,dirname as L2,isAbsolute as Y9,join as a2,relative as TZ,resolve as V0,sep as W8}from"path";class E 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"}),uB=new Set(Object.values(t).map(($)=>$.toLowerCase())),fB=($,Z)=>$.toLowerCase()===Z.toLowerCase(),MZ=($)=>uB.has($.toLowerCase());function t2($){return $.split(/[\\/]/).some((Z)=>Z.toLowerCase()===".git")}var mB=/\.fafm?$/i,pB=/^[a-z][a-z0-9-]*$/,w0=($)=>gB.native($),Z2=($)=>$?.code;function c$($,Z){let Q=TZ($,Z);return Q===""||Q!==".."&&!Q.startsWith(`..${W8}`)&&!Y9(Q)}function W9($){try{return xB($)}catch{return"?"}}function lB($,Z,Q,z){let X;try{X=w0(Q)}catch(H){let U=Z2(H);if(U==="ENOENT"||U==="ELOOP"||U==="ENOTDIR")throw new E("dangling",Z,`${Z} is a link to ${W9(Q)}, which does not exist. faf does not create files through a link — refused.`);throw H}if(!c$($,X))throw new E("outside",Z,`${Z} is a link to ${X}, outside ${$} — refused.`);if(t2(X)&&!(z.inGit&&L2(X)===$))throw new E("git",Z,`${Z} is a link to ${X}, inside .git/ — refused.`);if(!o2(X).isFile())throw new E("not-a-file",Z,`${Z} is a link to ${X}, which is not a regular file — refused.`);return cB(Z,X,z.read),X}function cB($,Z,Q){let z=$2($),X=$2(Z),H=MZ(z)&&MZ(X);if(Q&&!mB.test(X)&&!H){let U=MZ(z)?"a .faf or .fafm file, nor another AI context file":"a .faf or .fafm file";throw new E("not-faf",$,`${$} is a link to ${Z}, which is not ${U} — refused.`)}if(!Q&&!fB(z,X)&&!H)throw new E("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 dB($,Z,Q,z){if($2(V0($))!=="hooks"||!pB.test($2(Z)))throw new E("git",Z,`${Z} is not a git hook in a hooks folder — refused.`);if(z!==Q)throw new E("git",Z,`${Z} is not directly in the hooks folder ${Q} — refused.`)}function iB($,Z,Q){if($2($)!=="config"||Q!==Z)throw new E("git",$,`${$} is not the git config file directly in ${Z} — refused.`)}function u($,Z,Q={}){let z=w0(V0($)),X=V0($,Z),H=w0(L2(X));if(!c$(z,H))throw new E("outside",X,`${X} is in ${H}, outside ${z} — refused.`);let U=Q.allowGitHooks===!0,J=Q.allowGitConfig===!0;if(U)dB($,X,z,H);if(J)iB(X,z,H);let G=a2(H,$2(X));if(t2(G)&&!U&&!J)throw new E("git",X,G===X?`${X} is inside .git/ — refused.`:`${X} resolves to ${G}, inside .git/ — refused.`);let V;try{V=RZ(G)}catch(Y){if(Z2(Y)==="ENOENT")return G;throw Y}if(V.isSymbolicLink())return lB(z,X,G,{read:Q.read===!0,inGit:U||J});if(!V.isFile())throw new E("not-a-file",X,`${X} is not a regular file — refused.`);return w0(G)}var nB=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function rB($,Z){if(!($.length>=2&&($[0]===255&&$[1]===254||$[0]===254&&$[1]===255)))try{return nB.decode($)}catch{}throw new E("not-utf8",Z,`${Z} is not UTF-8 — faf left it unchanged`)}function Q0($){return rB(NZ($),$)}function I0($){try{return NZ($)}catch(Z){if(Z2(Z)==="ENOENT")return null;throw Z}}function l$($,Z){let Q=V0(a2($,Z));if(!EB(Q))return null;let z,X;try{z=w0(sB($)),X=w0(Q)}catch{return null}if(!c$(z,X)||t2(TZ(z,X)))return null;return X}var PZ=[];function sB($){let Z=V0($);return PZ.find((Q)=>Z===Q||Z.startsWith(Q.endsWith(W8)?Q:Q+W8))??Z}function e2($,Z){PZ.push(V0($));try{return Z()}finally{PZ.pop()}}function I($,Z){return l$($,Z)!==null}function w($,Z){let Q=l$($,Z);if(Q===null)return null;try{return o2(Q).isFile()?NZ(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 k($,Z="."){let Q=l$($,Z);if(Q===null)return null;let z;try{z=yB(Q,{withFileTypes:!0})}catch{return null}return z.filter((X)=>!X.isSymbolicLink()||l$($,a2(Z,X.name))!==null)}function oB($){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 B9 extends Error{path;constructor($,Z,Q={}){super(Z,{cause:Q.cause});this.path=$}}var _Z=($)=>new E("changed",$,`${$} changed on disk while faf was writing — not written; original kept`,{onWrite:!0});function AZ($,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 _Z($)}if(!Q)return;let z;try{z=o2($)}catch(X){if(Z2(X)==="ENOENT")return;throw X}if((z.mode&4095)!==Q.perm)throw _Z($);try{z9($,X9.W_OK)}catch{throw _Z($)}}function aB($,Z){if(process.platform!=="win32")try{bB($,Z.uid,Z.gid)}catch{}H9($,Z.mode)}function tB($){if(process.platform==="win32")return;try{let Z=G9($,"r");try{U9(Z)}finally{FZ(Z)}}catch{}}function eB($,Z,Q,z){if($.fd=G9($.path,"wx",z??Q?.mode??438),$.created=!0,kB($.fd,Z),Q)aB($.fd,Q);if(z!==void 0)H9($.fd,z);U9($.fd),FZ($.fd),$.fd=void 0}function $q($){if($.fd!==void 0)try{FZ($.fd)}catch{}if($.created)try{V9($.path)}catch{}}function Zq($,Z,Q){let z=L2($),X={path:a2(z,`.${$2($).slice(0,100)}.${process.pid}.${hB(6).toString("hex")}.faf-tmp`),created:!1},H=oB($);try{if(H)z9($,X9.W_OK);eB(X,Z,H,Q.mode),AZ($,Q.expect,H),vB(X.path,$)}catch(U){if($q(X),U instanceof E)throw U;let J=Z2(U)??(U instanceof Error?U.message:String(U));throw new B9($,`${$}: not written${H?"; original kept":""} (${J})`,{cause:U})}tB(z)}function Qq($){return $ instanceof E&&!$.onWrite?new E($.reason,$.path,$.message,{onWrite:!0}):$}function e($,Z,Q={}){let z=V0($),X;try{X=u(Q.root??L2(z),z,{allowGitHooks:Q.allowGitHooks,allowGitConfig:Q.allowGitConfig})}catch(H){throw Qq(H)}return Zq(X,Z,Q),X}function q9($,Z,Q){let z=V0($),X=Q.root??L2(z),H=u(X,z),U=I0(H);if(Q.expect!==void 0)AZ(H,Q.expect,void 0);if(U!==null&&Q.force!==!0&&!Q.owns(U))throw new E("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($);J9(Q,{recursive:!0});let z=w0(Q),X=V0(Q,Z),H=TZ(Q,X);if(H===".."||H.startsWith(`..${W8}`)||Y9(H))throw new E("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 E("git",X,`${X} runs through ${G}, inside .git/ — refused.`,{onWrite:!0});U=zq(z,X,G)}return U}function zq($,Z,Q){let z;try{z=RZ(Q)}catch(H){if(Z2(H)!=="ENOENT")throw H;return J9(Q),Q}let X=Q;if(z.isSymbolicLink()){try{X=w0(Q)}catch{throw new E("dangling",Z,`${Q} is a link to ${W9(Q)}, which does not exist. faf does not create folders through a link — refused.`,{onWrite:!0})}if(!c$($,X))throw new E("outside",Z,`${Q} is a link to ${X}, outside ${$} — refused.`,{onWrite:!0});if(t2(X))throw new E("git",Z,`${Q} is a link to ${X}, inside .git/ — refused.`,{onWrite:!0})}if(!o2(X).isDirectory())throw new E("not-a-file",Z,`${Q} is not a folder — refused.`,{onWrite:!0});return X}function Xq($,Z){let Q=V0($),z=w0(V0(Z.root??L2(Q))),X=w0(L2(Q));if(!c$(z,X))throw new E("outside",Q,`${Q} is in ${X}, outside ${z} — refused.`,{onWrite:!0});let H=a2(X,$2(Q));if(t2(H))throw new E("git",Q,`${Q} is inside .git/ — refused.`,{onWrite:!0});let U;try{U=RZ(H)}catch(J){if(Z2(J)==="ENOENT")return!1;throw J}if(!U.isFile())throw new E("not-a-file",Q,`${Q} is not a regular file faf wrote — left as it is.`,{onWrite:!0});return AZ(H,Z.expect,void 0),V9(H),!0}function f($){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 B8($,Z){if($===null||$===void 0)return{};if(!f($))throw new E("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 M9=new Set(["tag:yaml.org,2002:int","tag:yaml.org,2002:float"]);function K9($){return typeof $==="object"&&$.collection===void 0}function Hq($,Z){let Q=$.source;if(typeof Q!=="string"||Q.includes(`
|
|
142
|
+
`)}}var M6=($)=>$.startsWith("\uFEFF")?$.slice(1):$;function X5($){let Z={};for(let[Q,z]of Object.entries($.slots??{}))Z[m1.get(Q)??Q]=z;return{...$,slots:Z}}function H5($){return X5(JSON.parse(c0().score_faf(M6($))))}function uz($){return X5(JSON.parse(c0().score_faf_enterprise(M6($))))}function fz($){return c0().validate_faf(M6($))}function mz($){return c0().compile_fafb(M6($))}function pz($){return JSON.parse(c0().decompile_fafb($))}function lz($){return JSON.parse(c0().fafb_info($))}function cz($){return X5(JSON.parse(c0().score_fafb($)))}function dz(){return c0().sdk_version()}var c1=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function d1($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function i1($){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 iz($){return $.unknown?"unknown (—)":`${$.score}%`}function n1($){return{score:$.score,tier:O$($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function J5($){let Z=i1($);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 n1(H5($))}function nz($){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(!d1(Q)||typeof Q.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!c1.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 i9}from"fs";import{join as l9,dirname as hZ,basename as xF,resolve as t$}from"path";var HB=UZ(),UB=g$(),JB=c5(),OZ=v$(),GB=P$(),e0=g(),VB=r0(),YB=d(),WB=o0(),BB=a0(),OF=X8(),qB=DZ(),KB=LZ(),DB=IZ(),G8=Z9(),Q9=M$();var LB=HB.Composer,V8=UB.Document,IB=JB.Schema,OB=OZ.YAMLError,Y8=OZ.YAMLParseError,MB=OZ.YAMLWarning,_B=GB.Alias,u0=e0.isAlias,K2=e0.isCollection,PB=e0.isDocument,l=e0.isMap,L0=e0.isNode,FB=e0.isPair,o=e0.isScalar,f0=e0.isSeq,RB=VB.Pair,NB=YB.Scalar,r2=WB.YAMLMap,p$=BB.YAMLSeq;var TB=qB.Lexer,AB=KB.LineCounter,CB=DB.Parser,m0=G8.parse,jB=G8.parseAllDocuments,s2=G8.parseDocument,D2=G8.stringify,wB=Q9.visit,SB=Q9.visitAsync;import{accessSync as z9,closeSync as FZ,constants as X9,existsSync as EB,fchmodSync as H9,fchownSync as bB,fsyncSync as U9,lstatSync as RZ,mkdirSync as J9,mkdtempSync as PF,openSync as G9,readdirSync as yB,readFileSync as NZ,readlinkSync as xB,realpathSync as gB,renameSync as vB,rmSync as FF,statSync as o2,unlinkSync as V9,writeFileSync as kB}from"fs";import{randomBytes as hB}from"crypto";import{basename as $2,dirname as L2,isAbsolute as Y9,join as a2,relative as TZ,resolve as V0,sep as W8}from"path";class E 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"}),uB=new Set(Object.values(t).map(($)=>$.toLowerCase())),fB=($,Z)=>$.toLowerCase()===Z.toLowerCase(),MZ=($)=>uB.has($.toLowerCase());function t2($){return $.split(/[\\/]/).some((Z)=>Z.toLowerCase()===".git")}var mB=/\.fafm?$/i,pB=/^[a-z][a-z0-9-]*$/,w0=($)=>gB.native($),Z2=($)=>$?.code;function c$($,Z){let Q=TZ($,Z);return Q===""||Q!==".."&&!Q.startsWith(`..${W8}`)&&!Y9(Q)}function W9($){try{return xB($)}catch{return"?"}}function lB($,Z,Q,z){let X;try{X=w0(Q)}catch(H){let U=Z2(H);if(U==="ENOENT"||U==="ELOOP"||U==="ENOTDIR")throw new E("dangling",Z,`${Z} is a link to ${W9(Q)}, which does not exist. faf does not create files through a link — refused.`);throw H}if(!c$($,X))throw new E("outside",Z,`${Z} is a link to ${X}, outside ${$} — refused.`);if(t2(X)&&!(z.inGit&&L2(X)===$))throw new E("git",Z,`${Z} is a link to ${X}, inside .git/ — refused.`);if(!o2(X).isFile())throw new E("not-a-file",Z,`${Z} is a link to ${X}, which is not a regular file — refused.`);return cB(Z,X,z.read),X}function cB($,Z,Q){let z=$2($),X=$2(Z),H=MZ(z)&&MZ(X);if(Q&&!mB.test(X)&&!H){let U=MZ(z)?"a .faf or .fafm file, nor another AI context file":"a .faf or .fafm file";throw new E("not-faf",$,`${$} is a link to ${Z}, which is not ${U} — refused.`)}if(!Q&&!fB(z,X)&&!H)throw new E("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 dB($,Z,Q,z){if($2(V0($))!=="hooks"||!pB.test($2(Z)))throw new E("git",Z,`${Z} is not a git hook in a hooks folder — refused.`);if(z!==Q)throw new E("git",Z,`${Z} is not directly in the hooks folder ${Q} — refused.`)}function iB($,Z,Q){if($2($)!=="config"||Q!==Z)throw new E("git",$,`${$} is not the git config file directly in ${Z} — refused.`)}function u($,Z,Q={}){let z=w0(V0($)),X=V0($,Z),H=w0(L2(X));if(!c$(z,H))throw new E("outside",X,`${X} is in ${H}, outside ${z} — refused.`);let U=Q.allowGitHooks===!0,J=Q.allowGitConfig===!0;if(U)dB($,X,z,H);if(J)iB(X,z,H);let G=a2(H,$2(X));if(t2(G)&&!U&&!J)throw new E("git",X,G===X?`${X} is inside .git/ — refused.`:`${X} resolves to ${G}, inside .git/ — refused.`);let V;try{V=RZ(G)}catch(Y){if(Z2(Y)==="ENOENT")return G;throw Y}if(V.isSymbolicLink())return lB(z,X,G,{read:Q.read===!0,inGit:U||J});if(!V.isFile())throw new E("not-a-file",X,`${X} is not a regular file — refused.`);return w0(G)}var nB=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function rB($,Z){if(!($.length>=2&&($[0]===255&&$[1]===254||$[0]===254&&$[1]===255)))try{return nB.decode($)}catch{}throw new E("not-utf8",Z,`${Z} is not UTF-8 — faf left it unchanged`)}function Q0($){return rB(NZ($),$)}function I0($){try{return NZ($)}catch(Z){if(Z2(Z)==="ENOENT")return null;throw Z}}function l$($,Z){let Q=V0(a2($,Z));if(!EB(Q))return null;let z,X;try{z=w0(sB($)),X=w0(Q)}catch{return null}if(!c$(z,X)||t2(TZ(z,X)))return null;return X}var PZ=[];function sB($){let Z=V0($);return PZ.find((Q)=>Z===Q||Z.startsWith(Q.endsWith(W8)?Q:Q+W8))??Z}function e2($,Z){PZ.push(V0($));try{return Z()}finally{PZ.pop()}}function I($,Z){return l$($,Z)!==null}function w($,Z){let Q=l$($,Z);if(Q===null)return null;try{return o2(Q).isFile()?NZ(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 k($,Z="."){let Q=l$($,Z);if(Q===null)return null;let z;try{z=yB(Q,{withFileTypes:!0})}catch{return null}return z.filter((X)=>!X.isSymbolicLink()||l$($,a2(Z,X.name))!==null)}function oB($){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 B9 extends Error{path;constructor($,Z,Q={}){super(Z,{cause:Q.cause});this.path=$}}var _Z=($)=>new E("changed",$,`${$} changed on disk while faf was writing — not written; original kept`,{onWrite:!0});function AZ($,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 _Z($)}if(!Q)return;let z;try{z=o2($)}catch(X){if(Z2(X)==="ENOENT")return;throw X}if((z.mode&4095)!==Q.perm)throw _Z($);try{z9($,X9.W_OK)}catch{throw _Z($)}}function aB($,Z){if(process.platform!=="win32")try{bB($,Z.uid,Z.gid)}catch{}H9($,Z.mode)}function tB($){if(process.platform==="win32")return;try{let Z=G9($,"r");try{U9(Z)}finally{FZ(Z)}}catch{}}function eB($,Z,Q,z){if($.fd=G9($.path,"wx",z??Q?.mode??438),$.created=!0,kB($.fd,Z),Q)aB($.fd,Q);if(z!==void 0)H9($.fd,z);U9($.fd),FZ($.fd),$.fd=void 0}function $q($){if($.fd!==void 0)try{FZ($.fd)}catch{}if($.created)try{V9($.path)}catch{}}function Zq($,Z,Q){let z=L2($),X={path:a2(z,`.${$2($).slice(0,100)}.${process.pid}.${hB(6).toString("hex")}.faf-tmp`),created:!1},H=oB($);try{if(H)z9($,X9.W_OK);eB(X,Z,H,Q.mode),AZ($,Q.expect,H),vB(X.path,$)}catch(U){if($q(X),U instanceof E)throw U;let J=Z2(U)??(U instanceof Error?U.message:String(U));throw new B9($,`${$}: not written${H?"; original kept":""} (${J})`,{cause:U})}tB(z)}function Qq($){return $ instanceof E&&!$.onWrite?new E($.reason,$.path,$.message,{onWrite:!0}):$}function e($,Z,Q={}){let z=V0($),X;try{X=u(Q.root??L2(z),z,{allowGitHooks:Q.allowGitHooks,allowGitConfig:Q.allowGitConfig})}catch(H){throw Qq(H)}return Zq(X,Z,Q),X}function q9($,Z,Q){let z=V0($),X=Q.root??L2(z),H=u(X,z),U=I0(H);if(Q.expect!==void 0)AZ(H,Q.expect,void 0);if(U!==null&&Q.force!==!0&&!Q.owns(U))throw new E("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($);J9(Q,{recursive:!0});let z=w0(Q),X=V0(Q,Z),H=TZ(Q,X);if(H===".."||H.startsWith(`..${W8}`)||Y9(H))throw new E("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 E("git",X,`${X} runs through ${G}, inside .git/ — refused.`,{onWrite:!0});U=zq(z,X,G)}return U}function zq($,Z,Q){let z;try{z=RZ(Q)}catch(H){if(Z2(H)!=="ENOENT")throw H;return J9(Q),Q}let X=Q;if(z.isSymbolicLink()){try{X=w0(Q)}catch{throw new E("dangling",Z,`${Q} is a link to ${W9(Q)}, which does not exist. faf does not create folders through a link — refused.`,{onWrite:!0})}if(!c$($,X))throw new E("outside",Z,`${Q} is a link to ${X}, outside ${$} — refused.`,{onWrite:!0});if(t2(X))throw new E("git",Z,`${Q} is a link to ${X}, inside .git/ — refused.`,{onWrite:!0})}if(!o2(X).isDirectory())throw new E("not-a-file",Z,`${Q} is not a folder — refused.`,{onWrite:!0});return X}function Xq($,Z){let Q=V0($),z=w0(V0(Z.root??L2(Q))),X=w0(L2(Q));if(!c$(z,X))throw new E("outside",Q,`${Q} is in ${X}, outside ${z} — refused.`,{onWrite:!0});let H=a2(X,$2(Q));if(t2(H))throw new E("git",Q,`${Q} is inside .git/ — refused.`,{onWrite:!0});let U;try{U=RZ(H)}catch(J){if(Z2(J)==="ENOENT")return!1;throw J}if(!U.isFile())throw new E("not-a-file",Q,`${Q} is not a regular file faf wrote — left as it is.`,{onWrite:!0});return AZ(H,Z.expect,void 0),V9(H),!0}function f($){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 B8($,Z){if($===null||$===void 0)return{};if(!f($))throw new E("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 M9=new Set(["tag:yaml.org,2002:int","tag:yaml.org,2002:float"]);function K9($){return typeof $==="object"&&$.collection===void 0}function Hq($,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||!M9.has(z.tag))return;let X;try{X=z.resolve(Q,()=>{return},{})}catch{return}return Object.is(o(X)?X.value:X,$.value)?Q:void 0}function Uq($){let Z=$.filter(K9);return $.map((Q)=>{if(!K9(Q)||!M9.has(Q.tag)||!Q.stringify)return Q;let z=Q.stringify;return{...Q,stringify:(X,H,U,J)=>Hq(X,Z)??z(X,H,U,J)}})}var q8={keepSourceTokens:!0,customTags:Uq};function Jq($,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 Gq($){let Z=$.split(/\r?\n/),Q,z;for(let X=0;X+1<Z.length;X++){let H=Jq(Z[X],Z[X+1]);Q??=H.indent,z??=H.indentSeq}return{indent:Q??2,indentSeq:z??!0}}function EZ($,Z){let Q=s2($,q8);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 I2($,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 _9($,Z){if(Z>0&&$[Z-1]===`
|
|
@@ -249,7 +249,7 @@ Rendered on-demand from your current <strong>${Z$(Q)}</strong><br>
|
|
|
249
249
|
`}var SK='<meta name="description" content="Visual render of project.faf.';function EK($){return new TextDecoder().decode($).split(/\r?\n/).some((Z)=>Z.trim().startsWith(SK)&&Z.includes(" by faf"))}function bK($,Z,Q,z="project.faf",X={}){$6(FK($,"project.html"),dZ(Z,Q,z),{root:$,format:"html",hasMark:EK,mark:"faf mark (the `Visual render of project.faf` description line)",force:X.force})}var yK=RK(dZ,"faf-cli: generateProjectHtml is deprecated, use renderProjectHtml","FAF0001");import{join as ZD}from"path";import{deprecate as QD}from"node:util";var Q$="https://faf.one/ext/context/v1",iZ="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 M2($,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 DQ="JSONRPC",sZ="1.0",F8=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],R8="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",LQ="https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",IQ="1.0",OQ="1.0",nZ={a2a:"application/a2a-agent-card+json",server_card:"application/mcp-server-card+json",fafa:"application/vnd.fafa+yaml"};function MQ($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function _2($,Z={}){let Q=MQ($);if(Q.length>0)return Q;let z=Z.doorUrl?.trim();if(z)return[{protocol:"a2a",location:z,version:sZ}];return[]}function xK($){try{return`https://${z$($)}/.well-known/fafa`}catch{return}}function oZ($,Z,Q={}){let z=S0(Z,Q),X=$.agent??{},H={fafaSpecVersion:String($.version??OQ),mediaTypes:[...F8],provenance:{faf:z.faf,mediaType:z.mediaType},generated:z.generated};if(X.id)H.agentId=X.id;let U=xK($);if(U)H.passport=U;return{uri:Q$,description:"FAF passport and project DNA as typed parts",required:!1,params:H}}function gK($){let Z=new Set;for(let Q of $.capabilities??[])if(Q.cites_spec&&F8.includes(Q.cites_spec))Z.add(Q.cites_spec);return["text/plain",...Z]}function N8($,Z={}){let Q=$.agent??{},z=_2($,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&&F8.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:DQ,protocolVersion:String(W.version??sZ)})),...V?{provider:V}:{},version:U,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[...Z.extensions??[]]},defaultInputModes:gK($),defaultOutputModes:["text/plain","application/json"],skills:Y}}var vK=["mcp","cli","library"],kK=/^[a-z0-9][a-z0-9._-]*$/,hK=/^(@[a-z0-9~][a-z0-9-._~]*\/)?[a-z0-9~][a-z0-9-._~]*$/,uK=/^[A-Za-z0-9]([A-Za-z0-9._-]*[A-Za-z0-9])?$/,fK=/^[A-Za-z0-9][^\s]*$/,mK=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,pK=["a2a","mcp"],lK=/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/;function R($){return String($??"").trim()}function P8($){return Array.isArray($)?$.map(R).filter(Boolean):[]}function cK($){return R($).toLowerCase().replace(/^https?:\/\//,"").replace(/\/.*$/,"").replace(/^www\./,"")}function dK($,Z,Q){let z=["display_name","description","version"].filter((X)=>!R($[X]));if(z.length)throw Error(`Missing answer: ${z.join(", ")}`);if(!kK.test(Z))throw Error("Short name: lowercase letters, digits, dots, hyphens or underscores.");if(!lK.test(Q))throw Error(`Domain "${$.domain}" is not a domain name (e.g. example.com).`)}function iK($,Z){return($.skills??[]).filter((Q)=>R(Q.name)).map((Q)=>({name:R(Q.name),type:R(Q.type)||"tool",description:R(Q.description)||R(Q.name),tags:Z.length?Z:[R(Q.name).toLowerCase()]}))}function nK($){let Z=($.packages??[]).filter((Q)=>R(Q.registryType)&&R(Q.identifier));for(let Q of Z){let z=R(Q.registryType),X=R(Q.identifier);if(z==="npm"&&!hK.test(X))throw Error(`Package "${X}" is not an npm package name (e.g. weather-mcp or @acme/weather).`);if(z==="pypi"&&!uK.test(X))throw Error(`Package "${X}" is not a PyPI package name (e.g. weather-mcp or weather_mcp).`);if(z==="cargo"&&!mK.test(X))throw Error(`Package "${X}" is not a crate name (e.g. weather-mcp or weather_mcp).`);if(z!=="npm"&&z!=="pypi"&&z!=="cargo"&&!fK.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:R(Q.registryType),identifier:R(Q.identifier),...R(Q.version)?{version:R(Q.version)}:{}}))}function _Q($){if(/\s/.test($))return!1;try{let Z=new URL($);return(Z.protocol==="http:"||Z.protocol==="https:")&&Z.hostname!==""}catch{return!1}}function rK($){if(!_Q(R($.url)))throw Error(`Where it runs: "${R($.url)}" is not an http(s) URL (or give an npm package).`);if(!pK.includes(R($.protocol).toLowerCase()))throw Error(`Protocol "${R($.protocol)}": a2a or mcp.`)}function sK($){let Z=R($.package_kind).toLowerCase()||"mcp";if(!vK.includes(Z))throw Error(`Kind "${R($.package_kind)}" is not one faf knows: mcp, cli or library.`);return Z}function oK($,Z){let Q=($.endpoints??[]).filter((H)=>R(H.url));Q.forEach(rK);let z=sK($),X=[...Q.map((H)=>({protocol:R(H.protocol).toLowerCase(),transport:"http",location:R(H.url)})),...Z.map((H)=>({protocol:z,transport:"stdio",location:H.identifier}))];if(X.length===0)throw Error("Missing answer: endpoints (a URL, or a package people install)");return X}function aK($,Z,Q,z){let X={domain:Z},H=[["repository",R($.repository)],["icon",R($.icon)],["organizationUrl",R($.organization_url)]];for(let[J,G]of H)if(G)X[J]=G;if(Q.length)X.keywords=Q;let U=P8($.example_requests);if(U.length)X.examples=U;if(z.length)X.packages=z;return X}function PQ($){let Z=R($.handle).toLowerCase(),Q=cK($.domain);dK($,Z,Q);let z=P8($.tags),X=nK($),H=R($.homepage);if(H&&!_Q(H))throw Error(`Homepage: "${H}" is not an http(s) URL.`);let U={name:Z,displayName:R($.display_name),id:`urn:air:${Q}:agent:${Z}`,...R($.organization)?{vendor:R($.organization)}:{},version:R($.version),description:R($.description),homepage:H||`https://${Q}`,...R($.license)?{license:R($.license)}:{}};return{version:OQ,agent:U,capabilities:iK($,z),endpoints:oK($,X),metadata:{cards:aK($,Q,z,X)}}}function FQ($){return D2($,{lineWidth:0})}function z$($){let Z=R($.agent?.id),Q=/^urn:air:([^:]+):/.exec(Z);if(Q)return Q[1];let z=R($.metadata?.cards?.domain);if(z)return z;try{return new URL(R($.agent?.homepage)).hostname.replace(/^www\./,"")}catch{throw Error("The .fafa names no domain (agent.id urn:air, metadata.cards.domain or agent.homepage).")}}function RQ($){let Z=R($.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 aZ($){return`${z$($).split(".").reverse().join(".")}/${RQ($)}`}function rZ($){let Z=$.replace(/\s+/g," ").trim();return Z.length<=100?Z:`${Z.slice(0,97).trimEnd()}...`}function P2($){return($.endpoints??[]).filter((Z)=>R(Z.protocol).toLowerCase()==="mcp"&&/^https?:\/\//.test(R(Z.location))).map((Z)=>({type:"streamable-http",url:R(Z.location)}))}function tK($){if(!$)return;try{let Z=new URL($).hostname.replace(/^www\./,"");return{url:$,source:Z.split(".")[0]}}catch{return}}function NQ($){let Z=$.agent??{},Q=$.metadata?.cards??{},z=R(Z.description),X=R(Z.version);if(!z||!X)throw Error("An MCP card needs agent.description and agent.version in .fafa");let H={name:aZ($),version:X,description:rZ(z)},U=R(Z.displayName);if(U)H.title=rZ(U);let J=R(Z.homepage);if(J)H.websiteUrl=J;let G=tK(R(Q.repository));if(G)H.repository=G;if(R(Q.icon))H.icons=[{src:R(Q.icon)}];return H}function TQ($){return($.metadata?.cards?.packages??[]).map((Z)=>({registryType:R(Z.registryType),identifier:R(Z.identifier),...R(Z.version)?{version:R(Z.version)}:{},transport:{type:"stdio"}}))}function T8($){return($.endpoints??[]).some((Z)=>R(Z.protocol).toLowerCase()==="mcp")}function tZ($){return T8($)&&(P2($).length>0||TQ($).length>0)}function AQ($){let Z=R($.agent?.displayName);return{name:aZ($),...Z?{title:rZ(Z)}:{}}}function A8($,Z,Q={}){let z=P2($);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:R8,...NQ($),remotes:z,...Z?{_meta:{"one.faf/context":S0(Z,Q)}}:{}}}function CQ($,Z,Q={}){let z=P2($),X=TQ($);if(z.length===0&&X.length===0)throw Error("A registry entry needs a package people install or a remote MCP URL.");if(!T8($))throw Error("A registry entry describes an MCP server: the .fafa has no mcp endpoint.");return{$schema:LQ,...NQ($),...X.length?{packages:X}:{},...z.length?{remotes:z}:{},...Z?{_meta:M2(Z,Q)}:{}}}function eK($,Z,Q){if(!Z.includes("a2a")||_2($,Q).length===0)return;return Q.a2aCardUrl??`https://${z$($)}/.well-known/agent-card.json`}function C8($,Z,Q={}){let z=z$($),X=RQ($),H=$.agent??{},U=R(H.displayName)||R(H.name),J=R(H.description),G=R(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=eK($,Z,Q);if(B)W.push(Y("a2a",nZ.a2a,B));if(Z.includes("server_card")){let K=P2($)[0];if(K)W.push(Y("mcp",nZ.server_card,`${K.url.replace(/\/+$/,"")}/server-card`))}if(Q.listFafa!==!1)W.push(Y("agent",nZ.fafa,`https://${z}/.well-known/fafa`));return W}function j8($){let Z=$.agent??{},Q=R(Z.vendor)||R(Z.displayName)||R(Z.name);if(!Q)return;let z;try{z=z$($)}catch{z=void 0}return{displayName:Q,...z?{identifier:z}:{}}}function jQ($,Z,Q={}){let z=j8($);return{specVersion:IQ,...z?{host:z}:{},entries:C8($,Z,Q)}}function eZ($){let Z=$.metadata?.cards??{},Q=P8(Z.keywords),z=P8(Z.examples);return{...Q.length?{tags:Q}:{},...z.length?{representativeQueries:z}:{}}}function wQ($,Z,Q={}){let z=j8($),X=eZ($);return{specVersion:IQ,...z?{host:z}:{},entries:C8($,Z,Q).map((H)=>({...H,...X}))}}function SQ($,Z){let Q=new Set(Z.cards),z={fafa:$,fafaText:FQ($)},{faf:X}=Z;if(Q.has("a2a")){let U=[...Z.a2aExtensions??[],...X?[oZ($,X,Z)]:[]];z.a2a=N8($,{extensions:U})}if(Q.has("server_card"))z.server_card=A8($,X,Z);if(Q.has("server_json"))z.server_json=CQ($,X,Z);let H={now:Z.now,listFafa:Z.listFafa};if(Q.has("ai_catalog"))z.ai_catalog=jQ($,Z.cards,H);if(Q.has("ard"))z.ard=wQ($,Z.cards,H);return z}function $D($,Z){return SQ(PQ($),Z)}var zD=R8,XD=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function EQ($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&XD.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 HD($){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:zD,name:EQ($),version:String($.project?.version??"0.1.0"),description:HD($)},z=w8($)??$.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 Z1($){return EQ($)}function w8($){let Z=$.project?.title;if(typeof Z==="string"){let Q=Z.trim();if(Q&&Q.length<=100)return Q}return}function UD($){try{return JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return}}var $1=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function bQ($){let Z=UD($);return $1(Z)&&$1(Z._meta)&&$1(Z._meta["one.faf/context"])}function JD($,Z,Q={},z={}){let X=Z6(Z,Q),H=ZD($,"server-card");return $6(H,`${JSON.stringify(X,null,2)}
|
|
250
250
|
`,{root:$,format:"json",hasMark:bQ,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:z.force}),H}function GD($,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 VD=QD(Z6,"faf-cli: generateServerCard is deprecated, use buildServerCard","FAF0002");import{existsSync as yQ}from"fs";import{basename as YD,dirname as gQ,join as xQ}from"path";import{deprecate as WD}from"node:util";var BD=["a2a","mcp","registry","catalog","ard"];function qD($){return m0(Q0(u(gQ($),YD($))))}function KD($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let z of Z){let X=xQ($,z);if(yQ(X))return X}let Q=gQ($);if(Q!==$)for(let z of Z){let X=xQ(Q,z);if(yQ(X))return X}return null}function Q1($,Z,Q={}){if(_2($,Q).length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");return N8($,{doorUrl:Q.doorUrl,extensions:Z?[oZ($,Z,Q)]:[]})}var DD=WD(Q1,"faf-cli: generateA2ACard is deprecated, use buildA2ACard","FAF0003");function LD($,Z={},Q={}){return C8($,["a2a","server_card"],{now:Q.now??Z.generated??new Date().toISOString(),a2aCardUrl:Q.a2aCardUrl,doorUrl:Q.doorUrl})}function ID($,Z){return $.findIndex((Q)=>Q.identifier===Z.identifier)}function OD($,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=ID(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}var MD="no mcp endpoint in agent.fafa";function _D($){return $!==void 0&&!T8($)}function PD($){let Z=$.project?.type??$.app_type;return typeof Z==="string"&&Z.trim()!==""?Z.trim():void 0}function FD($,Z){if($===void 0||Z!==void 0)return!1;let Q=PD($);return Q!==void 0&&!/^mcp/i.test(Q)}function RD($,Z={}){return[..._2($,Z).length>0?["a2a"]:[],...P2($).length>0?["mcp"]:[],...tZ($)?["registry"]:[],"catalog","ard"]}function ND($){let Z=$.opts??{},Q=$.faf,z=$.fafa,X=_D(z),H=$.targets?.filter((Y)=>Y==="mcp"||Y==="registry")??[];if(X&&H.length)throw Error(`${H.join(", ")}: ${MD} — these cards describe an MCP server.`);let U=FD(Q,z),J=(Q?BD:z?RD(z,Z):[]).filter((Y)=>!(X||U)||Y!=="mcp"&&Y!=="registry"),G=new Set($.targets?.length?$.targets:J),V={};if(Q)V.block=S0(Q,Z);if(G.has("mcp"))if(z&&P2(z).length>0)V.mcp=A8(z,Q,Z);else if(Q)V.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(G.has("registry"))if(z&&tZ(z))V.registry={...AQ(z),...Q?{_meta:M2(Q,Z)}:{}};else if(Q){let Y=w8(Q);V.registry={name:Z1(Q),...Y?{title:Y}:{},_meta:M2(Q,Z)}}else throw Error("A registry entry needs a package or a remote MCP URL in the .fafa, or a project.faf.");if(G.has("a2a")||G.has("catalog")||G.has("ard")){if(!$.fafa){if($.targets?.some((Y)=>Y==="a2a"||Y==="catalog"||Y==="ard"))throw Error("A2A/catalog/ARD require a .fafa (agent.fafa). Will not invent an agent.")}}if(G.has("a2a")&&$.fafa)if(_2($.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 V.a2a=Q1($.fafa,Q,Z);if((G.has("catalog")||G.has("ard"))&&$.fafa){let Y=LD($.fafa,Q,Z);if(G.has("catalog"))V.catalog=Y;if(G.has("ard")){let B=eZ($.fafa);V.ard=Y.map((K)=>({...K,...B}))}let W=j8($.fafa);if(W)V.catalogHost=W}return TD(V),V}function TD($){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 z1=["ephemeral","standard","high","critical"],z2=Object.fromEntries(z1.map(($,Z)=>[$,Z])),S8=new Set(["user","feedback","project","reference"]),X1=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),H1=new Set(["facts","sessions","preferences","custom"]),U1={low:"ephemeral",medium:"standard"};import{existsSync as AD}from"fs";import{dirname as mQ,resolve as pQ}from"path";function F2(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function m($){return $===null||$===void 0}function CD($){if(Array.isArray($))return`a list (${$.length} item${$.length===1?"":"s"})`;if(m($))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 jD($){let Z=pQ($),Q=u(mQ(Z),Z,{read:!0});return{real:Q,text:Q0(Q)}}function vQ($,Z,Q,z){let X=pQ($),H=u(mQ(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 E("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(m($))return"standard";if(U1[$])return U1[$];if($ in z2)return $;return"standard"}var wD=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function J1($){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(!wD.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(m($.id)&&m($.type)&&$.tags.length===0&&$.links.length===0&&m($.timestamp)&&m($.source)&&Object.keys($.extra).length===0&&$.priority==="standard")return $.text;let Q={text:$.text};if(!m($.id))Q.id=$.id;if(!m($.type))Q.type=$.type;if(Q.priority=$.priority,$.tags.length)Q.tags=$.tags;if($.links.length)Q.links=$.links;if(!m($.timestamp))Q.timestamp=$.timestamp;if(!m($.source))Q.source=$.source;return Object.assign(Q,$.extra),Q}function kQ($){let Z=$;return H$($)&&typeof Z.text==="string"&&Array.isArray(Z.tags)&&Array.isArray(Z.links)&&H$(Z.extra)&&typeof Z.priority==="string"?Z:J1($)}function SD($){if(typeof $==="string"||H$($)&&"text"in $)return J1($);return null}var hQ=["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??F2(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.map(kQ):[],this._byId=new Map,this._facts.forEach((Q,z)=>{if(!m(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||c(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(!AD($))throw Error(`soul file not found: ${$}`);let{real:Z,text:Q}=jD($);return Y0.fromText(Q,$,Z)}static fromText($,Z,Q){let z=EZ($,Z).toJS();if(!H$(z))throw Error(`soul is not a YAML mapping: ${Z} is ${CD(z)}`);let X=new lQ,H=X.pick("memory",z.memory,f)??{},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=SD(J);if(V)U.adopt(V,G)}),U.last_etched=String(z.last_etched??U.created),U._version=m(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($),!m($.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(!H1.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(!X1.has(Q))Z[Q]=structuredClone(z);return Z}toYaml(){return D2(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")&&c(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&&c(this._index,this._indexAtRecord));if(Q)this.rebuildIndex();let z=Z.replace===!0,X=this._origin;if(!X){let G=this.toYaml(),V=vQ($,G,void 0,z);return this.settle($,G,new Map(this._facts.map((Y,W)=>[Y,W])),V),$}let H=new Map,{text:U}=D8(X.text,(G)=>{H=this.applyTo(G,X,Q)},$),J=vQ($,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(hQ.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 hQ)if(z.top[U]!==X.top[U])$.set(U,X.top[U]);if(!c(z.index,X.index)){if(Z.residual.has("index")&&!Q)Y0.refuse(Z,"index","replace it");I8($,["index"],Z.residual.has("index")?void 0:z.index,X.index,H)}for(let U of fQ(z.extra,X.extra))I8($,[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],...fQ(Q.memoryExtra,z.memoryExtra).map((H)=>[H,Q.memoryExtra[H],z.memoryExtra[H]])];for(let[H,U,J]of X){if(c(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");I8($,["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])=>!c(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=v9($,["memory","facts"],Z.path);for(let[V,Y]of U)G.items[Y]=bD($,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=kQ($);if(!m(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),!m(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=m(Z.id)?null:this.getFact(Z.id);if(Q)return this.add(ED(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:F2(),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(!m(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(!m(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(!m(Q.id))this._byId.set(Q.id,z)}),!0}}function ED($,Z,Q){let z=(X,H)=>m(X)?H:X;return{...$,text:Z,type:z(Q.type,$.type),priority:m(Q.priority)?$.priority:U$(Q.priority),tags:z(Q.tags,$.tags).slice(),links:z(Q.links,$.links).slice(),source:z(Q.source,$.source),timestamp:F2(),extra:{...$.extra}}}class lQ{residual=new Map;pick($,Z,Q){if(m(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,f)??{}),custom:structuredClone(this.pick("memory.custom",Z.custom,f)??{}),extra:uQ($,X1),memoryExtra:uQ(Z,H1)}}}function uQ($,Z){let Q={};for(let[z,X]of Object.entries($))if(!Z.has(z))Q[z]=structuredClone(X);return Q}function fQ($,Z){return[...new Set([...Object.keys($),...Object.keys(Z)])]}function bD($,Z,Q,z){if(!l(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 yD,readFileSync as xD,statSync as cQ,existsSync as gD}from"fs";import{join as vD,basename as dQ,resolve as kD}from"path";var iQ=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),hD=/\[\[([^\]]+)\]\]/g;function uD($){let Z=cQ($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function fD($){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 mD($,Z,Q){if(!Q.name)return null;let z=Q.metadata&&typeof Q.metadata==="object"?Q.metadata:{},X=z.type;if(typeof X!=="string"||!S8.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(hD)].map((Y)=>Y[1]))].sort();return{text:J,id:H,type:X,priority:"standard",tags:[],links:V,timestamp:uD($),source:`claude-code memory: ${dQ($)}`,extra:G}}function nQ($,Z={}){let Q=kD($);if(!gD(Q))throw Error(`Claude memory directory not found: ${Q}`);if(!cQ(Q).isDirectory())throw Error(`Claude memory path is not a directory: ${Q}`);let z=Z.skip??iQ,X=Z.namepoint??`@claude-code:${dQ(Q)}`,H=[],U=yD(Q).filter((W)=>W.endsWith(".md")).sort();for(let W of U){if(z.has(W))continue;let B=vD(Q,W),K;try{K=xD(B,"utf-8")}catch{continue}let{fm:L,body:q}=fD(K);if(!L)continue;let D=mD(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):F2(),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 tQ="faf-interview/1",J$="(terse — 3-4 words)",G1=[{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}],eQ=[{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$=[...G1,...eQ],$3=new Map(G$.map(($)=>[$.path,$])),pD=Object.fromEntries(G$.map(($)=>[$.path,$]));function V1($){let Z=$3.get($);if(Z)return Z.question;let Q=g0.get($)??p.find((z)=>z.canonical===$);return Q?`${Q.description}?`.replace(/\?\?$/,"?"):`${$}?`}function lD($,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 cD=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"]),dD=[["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]],rQ=($)=>cD.has($.toLowerCase().trim()),iD=/^(?:with|and|or|using|for|to|that|who|whom|whose|the|a|an|in|on|of|via|by|&)$/i;function sQ($,Z=5){let Q=$.trim().split(/\s+/).filter(Boolean).slice(0,Z);while(Q.length&&iD.test(Q[Q.length-1].replace(/[.,;:]+$/,"")))Q.pop();return Q.join(" ")}function Z3($){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=sQ(z);if(X.split(/\s+/).filter(Boolean).length>=2&&!rQ(X))Z.what=X;let H=dD.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=sQ((U?.[1]||"").trim().replace(/\s+/g," "));if(J&&!rQ(J))Z.who=J;return Z}function oQ($,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(typeof $!=="string")return!1;let Z=$.trim();if(!Z||Z==="slotignored")return!1;return!r(Z)}function nD($,Z={}){let Q=$&&typeof $==="object"?$:{},z=oQ(Q,"project.goal"),X=(aQ(z)?String(z).trim():"")||(Z.goal??"").trim(),H=Z3(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=G1.map((K,L)=>{let q={n:L+1,path:K.path,header:K.header,question:K.question},D=oQ(Q,K.path);if(aQ(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:tQ,rows:V,filledCount:Y,seededCount:W,emptyCount:B,complete:B===0}}function E8($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||r(Z)}return!1}function rD($,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 Q3($){if($==="project.goal")return!0;return g0.get($)?.category==="human"}function z3($,Z=E8){let Q=[],z=[];for(let X of G$){let H=rD($,X.path);if(H==="slotignored")continue;if(!Z(H))continue;(Q3(X.path)?Q:z).push(X.path)}return{human:Q,sourceable:z}}function X3($,Z,Q=E8){let z=z3(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"?Y1(z):[];return{status:X,score:$,gaps:z,ask:H}}function Y1($){return $.human.map((Z)=>({path:Z,question:V1(Z)}))}function sD($,Z={}){let Q=Math.max(1,Z.maxRounds??5),z=Z.isEmpty??E8,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=X3(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:Y1(Y.gaps)}:{status:"stuck",score:V,rounds:H,history:X,ask:[]};if(H>=Q)return{status:"capped",score:V,rounds:H,history:X,ask:Y1(Y.gaps)};$.runAuto(),H++}return{status:"capped",score:X[X.length-1]??0,rounds:H,history:X,ask:[]}}import{createHash as U3}from"crypto";var W1="faf-bench/1",oD={"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 aD($,Z){return oD[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var J3=[["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;J3.forEach(($,Z)=>$.forEach((Q)=>Q6.set(Q,Z)));var tD=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function b8($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function H3($){return b8($).split(" ").filter((Z)=>Z&&!tD.has(Z))}function G3($,Z){let Q=b8($),z=b8(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=H3($);if(H.length===0)return!1;let U=new Set(H3(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 eD($){let Z=J5($),Q=m0($),z=[],X={},H=0;for(let G of p){if(Z.slots[G.path]!=="populated")continue;let V=p1(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:aD(G.path,G.description)}),X[H]=Y}let U=JSON.stringify({v:W1,q:z.map((G)=>[G.path,G.question])}),J=U3("sha256").update(U).digest("hex").slice(0,12);return{version:W1,qsetHash:J,questions:z,answers:X}}function $L($){return{version:$.version,qsetHash:$.qsetHash,questions:$.questions}}function ZL($,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()!==""&&G3($.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 QL($,Z){let Q=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:Q,hash:U3("sha256").update(Q).digest("hex")}}import{join as jI,extname as wI,resolve as SI}from"path";var B1={"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 XL}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 HL=V$.flutterDeps,UL=V$.mcpDeps,JL=V$.serverFrameworks,GL=V$.stateManagement,VL=V$.routing;function YL($){let Z=new Set,Q=!1;for(let z of $.split(`
|
|
251
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 y8($){let Z=w($,"pubspec.yaml");if(Z===null)return null;let Q=YL(Z),z=(M)=>Q.has(M.toLowerCase()),X=HL.some(z)||/^flutter:\s*$/m.test(Z)||/\bsdk:\s*flutter\b/.test(Z),H=UL.find(z),U=JL.find(([M])=>z(M)),J=GL.find(([M])=>z(M)),G=J?J[1]:"",V=VL.find(([M])=>z(M)),Y=V?V[1]:"",W=z("flutter_test")?"flutter_test":z("test")?"test":"",B=/^executables:\s*$/m.test(Z),K=(k($,"bin")??[]).some((M)=>M.name.endsWith(".dart")),L=B||K,q,D="",O;if(X)if(D="Flutter",I($,XL("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 BL}from"path";var x8={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 qL=x8.mcpModules,KL=x8.serverFrameworks,DL=x8.cliFrameworks;function LL($){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 Y3($,Z){let Q=Z.toLowerCase();for(let z of $)if(z===Q||z.startsWith(`${Q}/`))return!0;return!1}function V3($,Z){let Q;for(let z of Z){if(!Y3($,z[0]))continue;if(!Q||z[0].length>Q[0].length)Q=z}return Q}function IL($,Z){let Q;for(let z of Z){if(!Y3($,z))continue;if(!Q||z.length>Q.length)Q=z}return Q}function OL($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function ML($){for(let{name:Z}of k($,"cmd")??[]){let Q=BL("cmd",Z),z=O0($,Q);if(z?.isDirectory()){if((k($,Q)??[]).some((X)=>X.name.endsWith(".go")))return!0}else if(z&&Z.endsWith(".go"))return!0}return!1}function _L($){let Z=w($,"main.go");return Z!==null&&/^package\s+main\b/m.test(Z)}function g8($){let Z=w($,"go.mod");if(Z===null)return null;let Q=OL(Z),z=LL(Z),X=IL(z,qL),H=V3(z,KL),U=V3(z,DL),J=ML($),G=_L($),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 R2={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 FL=R2.mcpPackages.map(($)=>$.toLowerCase()),RL=R2.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),NL=R2.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),TL=R2.grpcServerPackages.map(($)=>$.toLowerCase()),AL=R2.specializedSdks,W3=R2.baseSdk.toLowerCase();function CL($){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 q1($,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 B3($,Z){let Q;for(let[z,X]of Z){if(!q1($,z))continue;if(!Q||z.length>Q[0].length)Q=[z,X]}return Q}function jL($){let Z;for(let Q of FL){if(!q1($,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 wL($){let Z=$.toLowerCase();if(!Z)return;let Q;for(let z of AL){let X=z[0].toLowerCase();if(Z===X||Z.startsWith(`${X}/`)){if(!Q||X.length>Q[0].length)Q=z}}return Q}function v8($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function SL($,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 EL($,Z){let Q=Z.replace(/\.csproj$/i,""),{sdk:z,packages:X,frameworkRefs:H,outputType:U}=$,J,G="",V,Y=jL(X),W=wL(z),B=B3(X,NL),K=B3(X,RL),L=TL.some((D)=>q1(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&&v8(U))J="backend",G="ASP.NET Core",V=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(q&&!v8(U))J="library",G="ASP.NET Core",V=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(K&&(v8(U)||!U))J="cli",G=K[1],V=`${Z} + ${K[0]} (C# CLI)`;else if(v8(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()===W3||z.toLowerCase().startsWith(`${W3}/`))V=`${Z} (C# class library)`}return{appType:J,projectName:Q,targetFramework:$.targetFramework,sdk:z||"Microsoft.NET.Sdk",framework:G,found:V}}function Y$($){return(k($)??[]).map((Z)=>Z.name).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}function k8($){let Z=Y$($);if(Z.length===0)return null;let Q=null,z=999;for(let X of Z){let H=w($,X);if(H===null)continue;let U=CL(H),J=EL(U,X),G=SL(J.appType,J.framework);if(!Q||G<z)Q=J,z=G}return Q}import{join as N2}from"path";var _0={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 yL=_0.mcpArtifacts.map(($)=>$.toLowerCase()),xL=_0.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),gL=_0.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),vL=_0.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),
|
|
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 Y3($,Z){let Q=Z.toLowerCase();for(let z of $)if(z===Q||z.startsWith(`${Q}/`))return!0;return!1}function V3($,Z){let Q;for(let z of Z){if(!Y3($,z[0]))continue;if(!Q||z[0].length>Q[0].length)Q=z}return Q}function IL($,Z){let Q;for(let z of Z){if(!Y3($,z))continue;if(!Q||z.length>Q.length)Q=z}return Q}function OL($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function ML($){for(let{name:Z}of k($,"cmd")??[]){let Q=BL("cmd",Z),z=O0($,Q);if(z?.isDirectory()){if((k($,Q)??[]).some((X)=>X.name.endsWith(".go")))return!0}else if(z&&Z.endsWith(".go"))return!0}return!1}function _L($){let Z=w($,"main.go");return Z!==null&&/^package\s+main\b/m.test(Z)}function g8($){let Z=w($,"go.mod");if(Z===null)return null;let Q=OL(Z),z=LL(Z),X=IL(z,qL),H=V3(z,KL),U=V3(z,DL),J=ML($),G=_L($),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 R2={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 FL=R2.mcpPackages.map(($)=>$.toLowerCase()),RL=R2.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),NL=R2.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),TL=R2.grpcServerPackages.map(($)=>$.toLowerCase()),AL=R2.specializedSdks,W3=R2.baseSdk.toLowerCase();function CL($){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 q1($,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 B3($,Z){let Q;for(let[z,X]of Z){if(!q1($,z))continue;if(!Q||z.length>Q[0].length)Q=[z,X]}return Q}function jL($){let Z;for(let Q of FL){if(!q1($,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 wL($){let Z=$.toLowerCase();if(!Z)return;let Q;for(let z of AL){let X=z[0].toLowerCase();if(Z===X||Z.startsWith(`${X}/`)){if(!Q||X.length>Q[0].length)Q=z}}return Q}function v8($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function SL($,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 EL($,Z){let Q=Z.replace(/\.csproj$/i,""),{sdk:z,packages:X,frameworkRefs:H,outputType:U}=$,J,G="",V,Y=jL(X),W=wL(z),B=B3(X,NL),K=B3(X,RL),L=TL.some((D)=>q1(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&&v8(U))J="backend",G="ASP.NET Core",V=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(q&&!v8(U))J="library",G="ASP.NET Core",V=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(K&&(v8(U)||!U))J="cli",G=K[1],V=`${Z} + ${K[0]} (C# CLI)`;else if(v8(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()===W3||z.toLowerCase().startsWith(`${W3}/`))V=`${Z} (C# class library)`}return{appType:J,projectName:Q,targetFramework:$.targetFramework,sdk:z||"Microsoft.NET.Sdk",framework:G,found:V}}function Y$($){return(k($)??[]).map((Z)=>Z.name).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}function k8($){let Z=Y$($);if(Z.length===0)return null;let Q=null,z=999;for(let X of Z){let H=w($,X);if(H===null)continue;let U=CL(H),J=EL(U,X),G=SL(J.appType,J.framework);if(!Q||G<z)Q=J,z=G}return Q}import{join as N2}from"path";var _0={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 yL=_0.mcpArtifacts.map(($)=>$.toLowerCase()),xL=_0.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),gL=_0.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),vL=_0.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),yN=_0.androidPlugins.map(($)=>$.toLowerCase()),kL=_0.kmpPlugins.map(($)=>$.toLowerCase()),hL=_0.jvmKotlinPlugins.map(($)=>$.toLowerCase()),uL=_0.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),fL=_0.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),mL=_0.libraryPlugins.map(($)=>$.toLowerCase()),pL=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function K1($){return pL.some((Z)=>I($,Z))}function lL($){let Z=new Map,Q=new Map,z="";for(let X of $.split(`
|
|
253
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 cL($){let Z=w($,N2("gradle","libs.versions.toml"));if(!Z)return{plugins:new Map,libraries:new Map};return lL(Z)}function dL($){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 iL($,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 nL($,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 D3($){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 rL($){let Z;for(let Q of yL)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 L3($,Z){let Q=new Set,z=!1,X=!1,H=[N2(Z,"src"),N2(Z,"src","main")],U=(J,G)=>{if(G>4)return;let V=k($,J);if(!V)return;for(let{name:Y}of V){if(Y==="androidMain"||Y==="commonMain"||Y==="jvmMain"||Y==="iosMain")Q.add(Y);let W=N2(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 sL($){let Z=[],Q=$.plugins,z=$.artifacts,X=kL.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=rL(z),G=z6(Q,xL,"plugin"),V=z6($.parents,gL,"parent"),Y=z6(z,vL,"artifact"),W=z6(Q,uL,"plugin"),B=z6(z,fL,"artifact"),K=mL.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 M="Java";if($.kotlinSources&&$.javaSources)M="Java/Kotlin";else if($.kotlinSources||hL.some((F)=>p0(Q,F))||X)M="Kotlin";let C=[...new Set(Z)];return{appType:q,framework:D,facets:C,found:O,buildTool:$.buildTool,mainLanguage:M}}function oL($,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 q3($,Z,Q){let z=N2(Z,"build.gradle.kts"),X=N2(Z,"build.gradle"),H=I($,z)?z:I($,X)?X:null;if(!H)return null;let U=w($,H);if(!U)return null;let J=iL(U,Q),G=nL(U,Q),V=L3($,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 K3($,Z){let Q=w($,N2(Z,"pom.xml"));if(!Q)return null;let{packaging:z,parents:X,artifacts:H}=D3(Q),U=L3($,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(!K1($))return null;let Z=cL($),Q=[],z=null;for(let V of["settings.gradle.kts","settings.gradle"])if(I($,V)){z=w($,V);break}let X=z?dL(z):[],H=q3($,"",Z);if(H)Q.push(H);for(let V of X){let Y=q3($,V,Z);if(Y)Q.push(Y)}let U=K3($,"");if(U){Q.push(U);let V=w($,"pom.xml");if(V){let{modules:Y}=D3(V);for(let W of Y){let B=K3($,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=sL(V),W=oL(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 tL}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 eL=H6.mcpGems.map(($)=>$.toLowerCase()),$I=H6.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),I3=H6.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),ZI=H6.railsLayoutFiles;function QI($){return I($,"Gemfile")||I($,"gems.rb")||zI($)}function zI($){return(k($)??[]).some((Z)=>Z.name.endsWith(".gemspec"))}function XI($){let Z=new Set;for(let Q of $.split(`
|
|
254
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 HI($){let Z=new Set,Q=!1;for(let z of $.split(`
|
|
255
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 UI($){let Z=new Set;for(let Q of $.split(`
|
|
@@ -263,7 +263,7 @@ Rendered on-demand from your current <strong>${Z$(Q)}</strong><br>
|
|
|
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 A2($,Z){let Q=$.split(`
|
|
264
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 wO($){let Z=A2($,/^(use\s+cases?|goal)\b/i);if(Z&&P0(Z))return Z;let Q=jO($);if(Q&&P0(Q))return Q;return}function SO($){let Z=A2($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&P0(Z))return Z;return}function EO($){let Z=A2($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&P0(Z))return Z;return}function bO($){let Z=A2($,/^(why|motivation|problem|rationale)\b/i);if(Z&&P0(Z))return Z;return}function yO($){let Z=A2($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&P0(Z))return Z;return}function xO($){let Z=A2($,/^(status|history|timeline|since|launched)\b/i);if(Z&&P0(Z))return Z;return}function gO($){let Z=A2($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&P0(Z))return Z;return}function _1($){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=w($,Q);if(z===null)return{};z=z.replace(/<!--[\s\S]*?-->/g,"");let X={},H=wO(z);if(H)X.project={goal:H};let U={},J=SO(z);if(J)U.what=J;let G=EO(z);if(G)U.who=G;let V=bO(z);if(V)U.why=V;let Y=yO(z);if(Y)U.where=Y;let W=xO(z);if(W)U.when=W;let B=gO(z);if(B)U.how=B;if(Object.keys(U).length>0)X.human_context=U;return X}function vO($,Z){let Q=$.split(`
|
|
265
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 P1($){let Z=w($,"Cargo.toml");if(Z===null)return{};let Q=vO(Z,"description");if(Q&&P0(Q))return{project:{goal:Q}};return{}}import{join as m3}from"path";var kO=[{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"}],hO=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function uO($){let Z=[],Q=(z,X)=>{for(let H of k($,z)??[])if(H.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(H.name))Z.push(m3(z,H.name));else if(H.isDirectory()&&X>0&&!H.name.startsWith(".")&&!hO.has(H.name))Q(m3(z,H.name),X-1)};return Q(".",1),Z}function V6($){return[...$].join(" · ")}function F1($){let Z=uO($);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=w($,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 kO)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 fO}from"path";var mO=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),pO=[{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 R1($,Z){for(let Q of Z){let z=$.find((X)=>Q.test(X));if(z)return z}return null}function lO($){let Z=[$];for(let Q of k($)??[])if(Q.isDirectory()&&!Q.name.startsWith(".")&&!mO.has(Q.name))Z.push(fO($,Q.name));return Z}function cO($){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 N1($){return e2($,()=>dO($))}function dO($){let Z=[];for(let z of lO($)){let X=z===$,H=X?"":`cd ${z.slice($.length+1)} && `;for(let U of pO){let J=w(z,U.file);if(J===null)continue;let G=U.targets(J);if(G.length===0)continue;let V={},Y=R1(G,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),W=R1(G,[/^build$/i,/^compile$/i,/^build/i]),B=R1(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:cO(z)),commands:V})}}let Q=Z.sort((z,X)=>X.score-z.score)[0];return Q?{commands:Q.commands}:{}}var iO=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function T1($){for(let Z of iO)if(I($,Z))return{security:{secrets:".env",example:Z}};return{}}function nO($,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 A1($){return[_1($),P1($),F1($),N1($),T1($)].reduce(nO,{})}function p3($){try{let Z=s2($,{logLevel:"error"}).getIn(["project","type"],!0);return o(Z)&&typeof Z.comment==="string"&&Z.comment.includes(y2)}catch{return!1}}function C1($){let Z=u3($),Q=A1($),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);zM(H);let J=(Z._meta?.found??[]).some((V)=>V.startsWith("polyglot:")),G=l0(H,u8($));return l0(G,{human_context:f8($,{toolingRoot:J})})}function rO($,Z){let Q=QM(B8(Z,"updateExistingFaf: the existing .faf")),{data:z,facts:X}=M1($),H=z,U=l0(Q,A1($)),J=l0(U,H),G=l0(J,u8($)),V=aO(l0(G,{human_context:f8($)}),Q),Y=tO(sO(Z,Q,H)?eO(l3(V,Q),Q,X):l3(V,Q),Q);return m9(u9(Z,Y))}function sO($,Z,Q){if(!r(Z0(Z,"project.type"))){let X=a$($)?.text;return X===void 0||!p3(X)}return!(Q._meta?.found??[]).includes(y2)}function j1($){return $.canonical?[$.path,$.canonical]:[$.path]}function Z0($,Z){let[Q,z]=Z.split("."),X=$[Q];return f(X)?X[z]:void 0}function X2($,Z,Q){let[z,X]=Z.split("."),H=$[z];if(!f(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 H2=($)=>typeof $==="string"&&$.trim()===L6;function oO($,Z){let Q=Z.map((z)=>Z0($,z));return Q.some(H2)&&Q.every((z)=>r(z)||H2(z))}function l3($,Z){let Q={...$};for(let z of p){let X=j1(z);if(!oO(Z,X))continue;for(let H of X){let U=Z0(Z,H);if(Z0(Q,H)!==U)X2(Q,H,U)}}return Q}function C2($,Z){let[Q,z]=Z.split("."),X=$[Q];return f(X)&&Object.prototype.hasOwnProperty.call(X,z)}function aO($,Z){let Q={...$};for(let z of p){if(!z.canonical||!C2(Z,z.canonical)||C2(Z,z.path))continue;let X=Z0(Q,z.path);X2(Q,z.path,void 0);let H=Z0(Q,z.canonical);if(n8(X)&&r(H))X2(Q,z.canonical,X)}return Q}function tO($,Z){let Q={...$};for(let z of p){if(!z.canonical||!C2(Z,z.canonical)||C2(Z,z.path))continue;let X=Z0(Q,z.canonical);if(n8(X)||H2(X))X2(Q,z.path,X)}return Q}function eO($,Z,Q={}){let z=$.project,X=f(z)?z.type:void 0,H={...$};for(let U of p){if(U.category==="human"||U.category==="project")continue;let J=x2(X,U);if(J===null)return $;if(J){let G=typeof X==="string"&&I6[X]?.has(U.path)===!0;$M(H,Z,U,U.path.startsWith("stack.")?Q[U.path.slice(6)]:void 0,G)}else ZM(H,U)}return H}function $M($,Z,Q,z,X=!1){let H=j1(Q),U=(G)=>!r(Z0($,G))&&!H2(Z0($,G));for(let G of H){if(!H2(Z0($,G)))continue;if(X)X2($,G,H.some(U)?void 0:"");else if(!H2(Z0(Z,G)))X2($,G,C2(Z,G)?Z0(Z,G):"")}if(!n8(z))return;let J=H.filter((G)=>C2($,G));if(J.some((G)=>!r(Z0($,G))))return;for(let G of J.length>0?J:[Q.path])X2($,G,z)}function ZM($,Z){let Q=j1(Z).filter((X)=>C2($,X)),z=(X)=>!r(Z0($,X))&&!H2(Z0($,X));if(Q.some(z))return;for(let X of Q.length>0?Q:[Z.path])if(r(Z0($,X)))X2($,X,L6)}function QM($){let Z=$.project;if(Z===null||Z===void 0||f(Z)||Array.isArray(Z))return $;return{...$,project:{name:String(Z)}}}function zM($){let Z=$.project?.type??"library",Q=b2[Z]||b2.library;for(let z of p){if(Q.includes(z.category)||I6[Z]?.has(z.path))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 c3($,Z,"")}function XM($){let Z=g0.get($);return Z!==void 0&&Z.category!=="human"}function n8($){if(typeof $==="number"||typeof $==="boolean")return!0;return typeof $==="string"&&$.trim()!==""&&!r($)&&!H2($)}function HM($,Z){return XM($)&&n8(Z)}function c3($,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($5(U)){if(HM(J,H))z[X]=H;continue}if(r(U))z[X]=H;else if(f(H)&&f(U))z[X]=c3(U,H,J)}return z}function UM($){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 d3($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function JM($,Z={}){let Q=C1($);if(Z.repoUrl&&Q.project&&!W0($)?.name&&Q.project.name===$.split("/").pop())Q.project.name=d3(Z.repoUrl);return Q}import{existsSync as i3,lstatSync as GM}from"fs";import{join as VM,basename as YM}from"path";import{createHash as WM}from"crypto";var B0=($)=>typeof $==="object"&&$!==null&&!Array.isArray($),R0=($)=>typeof $==="number"&&Number.isFinite($),F0=($)=>typeof $==="string",BM=/^v?\d+\.\d+\.\d+$/,qM=new Set(["birth","doubled","peak","current"]);function a3($){return B0($)&&F0($.version)&&BM.test($.version)&&R0($.score)}var KM=($)=>R0($.birthDNA)?$.birthDNA:R0($.birthWeight)?$.birthWeight:null,DM=($)=>B0($)&&R0($.birthDNA)&&F0($.born),n3=($)=>B0($)&&F0($.born)&&R0($.birthDNA)&&R0($.lastScore)&&F0($.endedAt),LM=($)=>Array.isArray($)&&$.length>0&&$.every(a3),IM=($)=>B0($)&&R0($.score)&&F0($.version),OM=($)=>B0($)&&Array.isArray($.milestones)&&$.milestones.every(B0);function r3($){return B0($)&&DM($.birthCertificate)&&LM($.versions)&&IM($.current)&&OM($.growth)}function w1($){try{return GM($),!0}catch{return!1}}var S1=($)=>`${JSON.stringify($,null,2)}
|
|
266
|
-
`,MM=new Set(["version","score","lastSync"]),_M=new Set(["type","score","date","version","label","emoji"]),s3=($,Z)=>Object.keys($).every((Q)=>Z.has(Q)),E1={birth:{label:"Birth",emoji:"\uD83D\uDC23"},doubled:{label:"Doubled",emoji:"2️⃣"},peak:{label:"Peak",emoji:"\uD83C\uDFD4️"},current:{label:"Current",emoji:"\uD83D\uDCCD"}},t3=($)=>$.growth.milestones.filter((Z)=>Z.type==="peak"||Z.type==="current"),e3=($)=>s3($.current,MM)&&t3($).every((Z)=>s3(Z,_M)),PM=($)=>t3($).every((Z)=>Z.label===E1[Z.type].label&&Z.emoji===E1[Z.type].emoji);function FM($){return e3($)&&PM($)}var RM=".faf-dna is not in faf's shape: faf reads it and leaves it as it is.",NM=".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.",TM=".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.",AM=".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.",CM=".faf-dna has no birth certificate faf can read: faf leaves it as it is.";function jM($){if(!Array.isArray($))return[];return $.filter((Z)=>B0(Z)&&F0(Z.type)&&qM.has(Z.type)&&R0(Z.score))}var j2=($,Z="")=>F0($)?$:Z;function wM($,Z){if(!Array.isArray($))return[];return $.filter(a3).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 SM($,Z,Q,z){return{version:j2($.version,Z?.version??"v1.0.0"),score:R0($.score)?$.score:Z?.score??Q,lastSync:j2($.lastSync,z)}}function o3($){if(!B0($)||!B0($.birthCertificate))return null;let Z=$.birthCertificate,Q=KM(Z);if(Q===null)return null;let z=j2(Z.born),X=wM($.versions,Q),H=SM(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:jM(Array.isArray(U.milestones)?U.milestones:$.milestones)},lastModified:j2($.lastModified,z),format:"faf-dna-v1",...Array.isArray($.priorLineage)&&$.priorLineage.some(n3)?{priorLineage:$.priorLineage.filter(n3)}:{}}}class $z{projectPath;dnaPath;dna=null;own=!1;text;reason=null;sawNoFile=!1;constructor($){this.projectPath=$,this.dnaPath=VM($,".faf-dna")}exists(){let $=i3(this.dnaPath);if(!$&&!w1(this.dnaPath))this.sawNoFile=!0;return $}endingLineage(){let Z=this.dna??(()=>{let z=this.read();return z===null?null:o3(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(!w1(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(!i3(this.dnaPath)){if(!w1(this.dnaPath))this.sawNoFile=!0;return null}let $=this.read();if($===null)return null;let{text:Z,raw:Q}=$;if(r3(Q)&&S1(Q)===Z&&FM(Q))this.own=!0,this.reason=null,this.dna=Q;else this.own=!1,this.dna=o3(Q),this.reason=!this.dna?CM:!r3(Q)?RM:S1(Q)!==Z?NM:e3(Q)?AM:TM;return this.text=Z,this.dna}read(){let $;try{$=Q0(u(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 $=S1(this.dna),Z=this.text??(this.sawNoFile?null:I0(u(this.projectPath,".faf-dna")));e(this.dnaPath,$,{root:this.projectPath,expect:Z}),this.text=$,this.sawNoFile=!1}generateProjectDNA(){return WM("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=YM(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,...E1[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 V_}from"path";import{existsSync as z_,statSync as _A}from"fs";import{join as Yz}from"path";import{dirname as Uz,resolve as Jz}from"path";var Qz=100;var EM="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",bM=[/^<(script|pre|style|textarea)(?=\s|>|$)/i,/^<!--/,/^<\?/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp(`^</?(?:${EM})(?=\\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")],yM=[/<\/(?:script|pre|style|textarea)>/i,/-->/,/\?>/,/>/,/\]\]>/],xM=["","-->","?>",">","]]>"],gM=/[#`~*+_=<>0-9-]/,vM=/(\d{1,9})([.)])/y,kM=/#{1,6}(?:[ \t]+|$)/y,hM=/`{3,}(?!.*`)|~{3,}/y,uM=/(?:`{3,}|~{3,})(?=[ \t]*$)/y,fM=/(?:=+|-+)[ \t]*$/y,mM=/[^ \t\f\v\r\n]/;function Y6($,Z,Q){return $.lastIndex=Q,$.exec(Z)}var pM=($)=>$==="quote"||$==="list"||$==="item";function lM($){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 cM($,Z){if($==="document"||$==="quote"||$==="item")return Z!=="item";return $==="list"&&Z==="item"}var Zz=($)=>$==="paragraph"||$==="code"||$==="html";function dM($){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(dM),$.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}>`:xM[$.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"&&Zz(Z.kind);while(!Q&&!this.deep){this.findNextNonspace();let z=this.nextNonspace;if(!this.indented&&!gM.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(!Zz($.kind)&&this.offset<this.ln.length&&!this.blank)this.addChild({kind:"paragraph"})}addHtmlLine($){if($.type>5)return;let Z=yM[$.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(uM,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??=lM(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(kM,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(hM,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=bM[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(fM,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&&!mM.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(vM,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(!cM(this.tip.kind,$.kind))this.stack.pop();if(this.tip.hasChild=!0,this.stack.push($),pM($.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 -->",zz="\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$/,""),Gz=($)=>q$($).replace(/^\uFEFF/,"").trimEnd();function*b1($){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 iM($,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 y1($,Z,Q){let[z,X]=[new N0(!0),new N0(!1)].map((H)=>({reader:H,start:-1,found:null}));for(let H of b1($)){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)iM(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 Xz=($)=>(Z)=>Z===$;function w2($,Z=b0,Q=y0){return y1($,Xz(Z),Xz(Q))}function Hz($,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 nM=16;function rM($){let Z=new N0(!0);return $.map((Q)=>{let z=Z.overflowAt(q$(Q),nM),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 sM($,Z,Q){let X=rM(B6($).map((U)=>{let J=Gz(U);return J===Z||J===Q?` ${U}`:U})).join(""),H=Hz(X,Q);while(H.length>0&&H[0]!==null){let U=`${X}
|
|
266
|
+
`,MM=new Set(["version","score","lastSync"]),_M=new Set(["type","score","date","version","label","emoji"]),s3=($,Z)=>Object.keys($).every((Q)=>Z.has(Q)),E1={birth:{label:"Birth",emoji:"\uD83D\uDC23"},doubled:{label:"Doubled",emoji:"2️⃣"},peak:{label:"Peak",emoji:"\uD83C\uDFD4️"},current:{label:"Current",emoji:"\uD83D\uDCCD"}},t3=($)=>$.growth.milestones.filter((Z)=>Z.type==="peak"||Z.type==="current"),e3=($)=>s3($.current,MM)&&t3($).every((Z)=>s3(Z,_M)),PM=($)=>t3($).every((Z)=>Z.label===E1[Z.type].label&&Z.emoji===E1[Z.type].emoji);function FM($){return e3($)&&PM($)}var RM=".faf-dna is not in faf's shape: faf reads it and leaves it as it is.",NM=".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.",TM=".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.",AM=".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.",CM=".faf-dna has no birth certificate faf can read: faf leaves it as it is.";function jM($){if(!Array.isArray($))return[];return $.filter((Z)=>B0(Z)&&F0(Z.type)&&qM.has(Z.type)&&R0(Z.score))}var j2=($,Z="")=>F0($)?$:Z;function wM($,Z){if(!Array.isArray($))return[];return $.filter(a3).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 SM($,Z,Q,z){return{version:j2($.version,Z?.version??"v1.0.0"),score:R0($.score)?$.score:Z?.score??Q,lastSync:j2($.lastSync,z)}}function o3($){if(!B0($)||!B0($.birthCertificate))return null;let Z=$.birthCertificate,Q=KM(Z);if(Q===null)return null;let z=j2(Z.born),X=wM($.versions,Q),H=SM(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:jM(Array.isArray(U.milestones)?U.milestones:$.milestones)},lastModified:j2($.lastModified,z),format:"faf-dna-v1",...Array.isArray($.priorLineage)&&$.priorLineage.some(n3)?{priorLineage:$.priorLineage.filter(n3)}:{}}}class $z{projectPath;dnaPath;dna=null;own=!1;text;reason=null;sawNoFile=!1;constructor($){this.projectPath=$,this.dnaPath=VM($,".faf-dna")}exists(){let $=i3(this.dnaPath);if(!$&&!w1(this.dnaPath))this.sawNoFile=!0;return $}endingLineage(){let Z=this.dna??(()=>{let z=this.read();return z===null?null:o3(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(!w1(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(!i3(this.dnaPath)){if(!w1(this.dnaPath))this.sawNoFile=!0;return null}let $=this.read();if($===null)return null;let{text:Z,raw:Q}=$;if(r3(Q)&&S1(Q)===Z&&FM(Q))this.own=!0,this.reason=null,this.dna=Q;else this.own=!1,this.dna=o3(Q),this.reason=!this.dna?CM:!r3(Q)?RM:S1(Q)!==Z?NM:e3(Q)?AM:TM;return this.text=Z,this.dna}read(){let $;try{$=Q0(u(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 $=S1(this.dna),Z=this.text??(this.sawNoFile?null:I0(u(this.projectPath,".faf-dna")));e(this.dnaPath,$,{root:this.projectPath,expect:Z}),this.text=$,this.sawNoFile=!1}generateProjectDNA(){return WM("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=YM(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,...E1[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 V_}from"path";import{existsSync as z_,statSync as PA}from"fs";import{join as Yz}from"path";import{dirname as Uz,resolve as Jz}from"path";var Qz=100;var EM="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",bM=[/^<(script|pre|style|textarea)(?=\s|>|$)/i,/^<!--/,/^<\?/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp(`^</?(?:${EM})(?=\\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")],yM=[/<\/(?:script|pre|style|textarea)>/i,/-->/,/\?>/,/>/,/\]\]>/],xM=["","-->","?>",">","]]>"],gM=/[#`~*+_=<>0-9-]/,vM=/(\d{1,9})([.)])/y,kM=/#{1,6}(?:[ \t]+|$)/y,hM=/`{3,}(?!.*`)|~{3,}/y,uM=/(?:`{3,}|~{3,})(?=[ \t]*$)/y,fM=/(?:=+|-+)[ \t]*$/y,mM=/[^ \t\f\v\r\n]/;function Y6($,Z,Q){return $.lastIndex=Q,$.exec(Z)}var pM=($)=>$==="quote"||$==="list"||$==="item";function lM($){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 cM($,Z){if($==="document"||$==="quote"||$==="item")return Z!=="item";return $==="list"&&Z==="item"}var Zz=($)=>$==="paragraph"||$==="code"||$==="html";function dM($){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(dM),$.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}>`:xM[$.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"&&Zz(Z.kind);while(!Q&&!this.deep){this.findNextNonspace();let z=this.nextNonspace;if(!this.indented&&!gM.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(!Zz($.kind)&&this.offset<this.ln.length&&!this.blank)this.addChild({kind:"paragraph"})}addHtmlLine($){if($.type>5)return;let Z=yM[$.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(uM,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??=lM(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(kM,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(hM,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=bM[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(fM,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&&!mM.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(vM,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(!cM(this.tip.kind,$.kind))this.stack.pop();if(this.tip.hasChild=!0,this.stack.push($),pM($.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 -->",zz="\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$/,""),Gz=($)=>q$($).replace(/^\uFEFF/,"").trimEnd();function*b1($){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 iM($,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 y1($,Z,Q){let[z,X]=[new N0(!0),new N0(!1)].map((H)=>({reader:H,start:-1,found:null}));for(let H of b1($)){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)iM(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 Xz=($)=>(Z)=>Z===$;function w2($,Z=b0,Q=y0){return y1($,Xz(Z),Xz(Q))}function Hz($,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 nM=16;function rM($){let Z=new N0(!0);return $.map((Q)=>{let z=Z.overflowAt(q$(Q),nM),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 sM($,Z,Q){let X=rM(B6($).map((U)=>{let J=Gz(U);return J===Z||J===Q?` ${U}`:U})).join(""),H=Hz(X,Q);while(H.length>0&&H[0]!==null){let U=`${X}
|
|
267
267
|
${H[0]}`,J=Hz(U,Q);if(J.length>=H.length)break;X=U,H=J}return X}function oM($,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
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(oM(Z,z,X));if(J===null)throw new E("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 x1($,Z=b0,Q=y0){return`${Z}
|
|
@@ -280,5 +280,5 @@ ${G}`}function J_($){let Z=[],Q=$.project?.name??"Project",z=$.project?.main_lan
|
|
|
280
280
|
`)}function P_($,Z){$$($,".github"),T0(M_($,".github",t.copilot),Lz(Z),b0,y0,{root:$})}import{existsSync as F_,lstatSync as Pz,readFileSync as a8,realpathSync as k1,statSync as R_}from"fs";import{homedir as N_}from"os";import{basename as T_,dirname as h1,join as A0,resolve as E2}from"path";var Iz=200,Oz=200,Mz=12,A_="# Project Context (from project.faf)",C_="*This section is managed by tri-sync.";function j_($){let Z=0;for(let Q=0;Q<$.length;Q++)Z=(Z<<5)-Z+$.charCodeAt(Q)|0;return Z}function Fz($){let Z=$.replace(/[^a-zA-Z0-9]/g,"-");if(Z.length<=Iz)return Z;return`${Z.slice(0,Iz)}-${Math.abs(j_($)).toString(36)}`}function Rz($){try{let Z=Pz($);if(Z.isSymbolicLink()){let Q=R_($);return Q.isDirectory()||Q.isFile()}return Z.isDirectory()||Z.isFile()}catch{return!1}}function _z($){try{return Pz($).isFile()}catch{return!1}}function w_($){let Z=$;for(;;){if(Rz(A0(Z,".git")))return Z;let Q=h1(Z);if(Q===Z)return null;Z=Q}}function S_($){let Z;try{Z=a8(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(!_z(z))return $;let X=E2(Q,a8(z,"utf-8").trim());if(E2(h1(Q))!==A0(X,"worktrees"))return $;let H=A0(Q,"gitdir");if(!_z(H))return $;let U=a8(H,"utf-8").trim();if(k1(E2(Q,U))!==A0(k1($),".git"))return $;if(T_(X)!==".git")return Rz(A0(X,".git"))?$:X;return h1(X)}catch{return $}}function Nz($){let Z=E2($);try{Z=k1.native(Z)}catch{}let Q=w_(Z);return(Q?S_(Q):Z).normalize("NFC")}function e8($,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(N_(),".claude");return A0(E2(Q),"projects",Fz(Nz($)),"memory").normalize("NFC")}function E_($,Z={}){return A0(e8($,Z),t.memory)}var b_=new Set(["target_user","core_problem","mission_purpose"]),y_=["who","what","why","where","when","how"];function Tz($){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}`),...o8("Stack",Object.entries($.stack??{}).filter(([U,J])=>!b_.has(U)&&i(J)).map(([U,J])=>`- **${z0(`stack.${U}`)}:** ${J}`)),...o8("Context",y_.filter((U)=>i(z[U])).map((U)=>`- **${z0(`human_context.${U}`)}:** ${z[U]}`)),...o8("Commands",Object.entries($.commands??{}).filter(([,U])=>i(U)).slice(0,Mz).map(([U,J])=>`- ${U}: \`${U2(J)}\``)),...o8("Key files",X.filter(i).slice(0,Mz).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
281
|
`)}function o8($,Z){return Z.length>0?["",`### ${$}`,...Z]:[]}function Az($){return y1($,(Z)=>Z.trimEnd()===A_,(Z)=>Z.startsWith(C_))}function t8($){if($==="")return 0;let Z=$.match(/\r\n|\r|\n/g)?.length??0;return/(\r\n|\r|\n)$/.test($)?Z:Z+1}function x_($,Z,Q){if($===null)return{text:r8(null,Z,void 0,void 0,Q),action:"created",head:"",tail:""};let z=w2($),X=z??Az($);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:r8($,Z,void 0,void 0,Q),action:"added",head:H,tail:$.slice(H.length)}}function u1($){return $>Oz?[`MEMORY.md is ${$} lines. Claude Code loads the first ${Oz}; lines after that are kept in the file but not loaded.`]:[]}function g_($,Z={}){let Q=e8($,Z),z=A0(Q,t.memory),X={path:z,exists:!1,lines:0,hasBlock:!1,blockLines:0,hasLegacySection:!1,otherLines:0,warnings:[]};if(!F_(Q))return X;let H=q6(u(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=t8(H);return{path:z,exists:!0,lines:G,hasBlock:U!==null,blockLines:U?t8(H.slice(U.start,U.end)):0,hasLegacySection:!U&&Az(H)!==null,otherLines:J.split(/\r\n|\r|\n/).filter((V)=>V.replace(/^\uFEFF/,"").trim()!=="").length,warnings:u1(G)}}function v_($,Z,Q={}){let z=e8($,Q);$$(z);let X=u(z,t.memory),H=q6(X),U=x_(H,x1(Tz(Z)),X);if(U.text===H){let B=t8(H);return{path:X,action:"unchanged",written:!1,preserved:!0,lines:B,warnings:u1(B)}}let J=e(X,U.text,{root:z,expect:H}),G=a8(J,"utf-8"),V=G===U.text&&G.startsWith(U.head)&&G.endsWith(U.tail),Y=t8(G),W=U.action==="added"?s8(t.memory,H):null;return{path:J,action:U.action,written:!0,preserved:V,lines:Y,warnings:[...W?[W]:[],...u1(Y)]}}function k_($,Z){let Q=[],z=(G)=>I($,G),X=(G)=>w($,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 h_($,Z){let Q={...Z},z=null,X=w($,"package.json");if(X!==null)try{z=JSON.parse(X)}catch{z=null}let H=i8($,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=d8($);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=k_($,z);if(J.length)Q.conventions=J}return Q}export{JD as writeServerCard,bK as writeProjectHtml,L_ as writeGeminiMd,iq as writeFaf,O_ as writeCursorrules,P_ as writeCopilotInstructions,v_ as writeClaudeMemory,U_ as writeClaudeMd,B_ as writeAgentsMd,nz as validateFaf,F2 as utcNow,OD as upsertCatalog,mq as updateFafFile,rO as updateExistingFaf,u8 as turboCatSlots,P3 as turboCatScan,bz as slotsByCategory,s9 as serializeFaf,Z3 as seedSixWsFromGoal,iz as scoreText,J5 as scoreFafYaml,e as safeWriteFile,Xq as safeUnlink,q9 as safeReplaceOwned,sD as runLoop,u as resolveInside,E_ as resolveClaudeMemoryPath,e8 as resolveClaudeMemoryDir,d3 as repoNameFromUrl,dZ as renderProjectHtml,qz as renderGeminiMd,Kz as renderCursorrules,Lz as renderCopilotInstructions,Tz as renderClaudeMemory,J_ as renderClaudeMd,Bz as renderAgentsMd,R3 as relentlessContextDetailed,f8 as relentlessContext,w8 as registryTitle,Z1 as registryName,M2 as registryMeta,Q0 as readUtf8,qD as readFafa,t9 as readFafRaw,fq as readFaf,H_ as readClaudeMd,V1 as questionForSlot,$L as publicQuestions,CQ as projectServerJson,A8 as projectServerCard,SQ as projectPack,ND as projectCards,wQ as projectArd,jQ as projectAiCatalog,N8 as projectA2ACard,GD as patchServerJson,G_ as parseClaudeMd,UM as normalizeGitUrl,b8 as normalizeAnswer,aZ as mcpName,$$ as makeDirInside,X3 as loopVerdict,Z_ as legacyStampNoteAt,s8 as legacyStampNote,U5 as kernel,r as isPlaceholder,oq as isNonProjectRoot,Q3 as isHumanSlot,gz as isExplicitNone,E8 as isEmptyValue,lD as interviewForMissing,T0 as injectFafBlock,ZL as gradeAnswers,O$ as getTier,hz as getNextTier,VD as generateServerCard,yK as generateProjectHtml,DD as generateA2ACard,nQ as fromClaudeDir,KD as findFafaFile,e9 as findFafFile,w2 as findFafBlock,l0 as fillEmpties,FQ as fafaYaml,z$ as fafaDomain,x0 as fafMetaTag,S0 as fafContextBlock,n1 as enrichScore,h_ as enrichFromRepo,eD as deriveQuestionSet,QK as computeDrift,Nz as claudeProjectRoot,Fz as claudeProjectId,g_ as claudeMemoryStatus,z3 as classifyGaps,U$ as canonicalPriority,nD as buildTableOf8,Z6 as buildServerCard,QL as buildReceipt,$D as buildPack,Q1 as buildA2ACard,JM as authorFafFromRepo,C1 as assembleFreshFaf,PQ as answersToFafa,G3 as answersMatch,v0 as TIERS,E as SafePathError,eQ as STACK_INTERVIEW,g0 as SLOT_BY_PATH,p as SLOTS,L6 as SLOTIGNORED,G1 as SIX_WS_INTERVIEW,LQ as SERVER_JSON_SCHEMA,R8 as SERVER_CARD_SCHEMA,iZ as REGISTRY_PUBLISHER_KEY,z2 as PRIORITY_RANK,z1 as PRIORITY_ORDER,D6 as PLACEHOLDERS,S8 as KNOWLEDGE_TYPES,tQ as INTERVIEW_VERSION,pD as INTERVIEW_PATHS,$3 as INTERVIEW_BY_PATH,G$ as INTERVIEW,Y0 as FafmSoul,$z as FafDNAManager,b0 as FAF_START,L$ as FAF_HEX,y0 as FAF_END,l1 as EXPLICIT_NONE,xz as ENTERPRISE_SLOTS,W1 as BENCH_VERSION,yz as BASE_SLOTS,J3 as ALIAS_GROUPS,Q$ as A2A_CONTEXT_URI};
|
|
282
282
|
|
|
283
|
-
//# debugId=
|
|
283
|
+
//# debugId=FF3ED6BC06C5451764756E2164756E21
|
|
284
284
|
//# sourceMappingURL=index.js.map
|