faf-cli 8.11.0 → 8.11.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 CHANGED
@@ -34,7 +34,7 @@ detected from your real stack, scored, and versioned with your code. No drift. N
34
34
  [![DOI: Context paper](https://img.shields.io/badge/DOI-Context%20paper-FF6B35)](https://doi.org/10.5281/zenodo.18251362)
35
35
  [![DOI: Memory paper](https://img.shields.io/badge/DOI-Memory%20paper-FF6B35)](https://doi.org/10.5281/zenodo.20348942)
36
36
  [![project.faf → faf](https://img.shields.io/badge/project.faf-inside-008B8B)](https://github.com/Wolfe-Jam/faf)
37
- [![TAF](./badge.svg)](https://github.com/Wolfe-Jam/faf-taf-git)
37
+ [![TAF](./badge.svg)](https://github.com/Wolfe-Jam/taf-git)
38
38
  [![CI](https://github.com/Wolfe-Jam/faf-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/Wolfe-Jam/faf-cli/actions/workflows/ci.yml)
39
39
 
40
40
  FAF defines. AGENTS.md instructs. AI codes.
@@ -139,10 +139,12 @@ faf memory show
139
139
 
140
140
  **The six W's now reach every agent: AGENTS.md points to project.faf, and CLAUDE.md, GEMINI.md, .cursorrules, Copilot and llms.txt carry them, one rule, one line each.**
141
141
 
142
+ **8.11.1:** `faf taf setup` writes taf-git 3.0.0 (faf-taf-git was renamed). A workflow written by 8.11.0 stops starting after the rename: run `faf taf setup` again.
143
+
142
144
  - **AGENTS.md points to the facts.** A `## Project facts` section names `project.faf`, by its real path from AGENTS.md (a legacy `.faf`, a file one folder up, `--output`). The only pointer before was an HTML comment, which agents skip. AGENTS.md still doesn't copy the six W's.
143
145
  - **The six W's in every context file.** GEMINI.md and .cursorrules gain a Context section, as CLAUDE.md and the Copilot instructions have. `llms.txt` and Claude Code's MEMORY.md block (Pro) show the same values.
144
146
  - **One rule, the score's.** A slot the score counts as empty (empty, `slotignored`, TBD, N/A) is left out; numbers show as written in project.faf, dates and lists as text; each fact is one line. CLAUDE.md no longer shows `slotignored` or placeholders.
145
- - **`faf taf setup` writes two jobs** (faf-taf-git 2.7.0): the tests run with a read-only token, only the receipt job can write, and a red run on the default branch is recorded as a `FAILED` receipt.
147
+ - **`faf taf setup` writes two jobs** (taf-git 3.0.0 since 8.11.1): the tests run with a read-only token, only the receipt job can write, and a red run on the default branch is recorded as a `FAILED` receipt.
146
148
  - **Why:** [the evidence](https://github.com/Wolfe-Jam/context7-faf-receipt#round-4-what-agentsmd-carries-opencode-and-codex). On tasks whose deciding fact was only in the six W's, Codex and OpenCode found the team's decision 4/22 times with the old AGENTS.md, 12/21 with the pointer, 19/20 with the six W's in the file.
147
149
 
148
150
  Earlier editions: [CHANGELOG.md](./CHANGELOG.md) · [Releases](https://github.com/Wolfe-Jam/faf-cli/releases)
package/dist/cli.js CHANGED
@@ -162,7 +162,7 @@ ${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.pus
162
162
  `)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
163
163
  `,Z)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,Z.value){let z="end"in Z.value?Z.value.end:void 0;if((Array.isArray(z)?z[z.length-1]:void 0)?.type==="comment")z?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else{if(this.atIndentedComment(Z.start,$.indent)){let Q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(Q)){S5(Q,Z.start),Q.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let z=!this.onKeyLine&&this.indent===$.indent,Q=z&&(Z.sep||Z.explicitKey)&&this.type!=="seq-item-ind",X=[];if(Q&&Z.sep&&!Z.value){let J=[];for(let Y=0;Y<Z.sep.length;++Y){let U=Z.sep[Y];switch(U.type){case"newline":J.push(Y);break;case"space":break;case"comment":if(U.indent>$.indent)J.length=0;break;default:J.length=0}}if(J.length>=2)X=Z.sep.splice(J[1])}switch(this.type){case"anchor":case"tag":if(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X}),this.onKeyLine=!0;else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"explicit-key-ind":if(!Z.sep&&!Z.explicitKey)Z.start.push(this.sourceToken),Z.explicitKey=!0;else if(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(Z.explicitKey)if(!Z.sep)if(H6(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let J=E1(Z.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]})}else if(Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(H6(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(fY(Z.key)&&!H6(Z.sep,"newline")){let J=E1(Z.start),Y=Z.key,U=Z.sep;U.push(this.sourceToken),delete Z.key,delete Z.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:Y,sep:U}]})}else if(X.length>0)Z.sep=Z.sep.concat(X,this.sourceToken);else Z.sep.push(this.sourceToken);else if(!Z.sep)Object.assign(Z,{key:null,sep:[this.sourceToken]});else if(Z.value||Q)$.items.push({start:X,key:null,sep:[this.sourceToken]});else if(H6(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else Z.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let J=this.flowScalar(this.type);if(Q||Z.value)$.items.push({start:X,key:J,sep:[]}),this.onKeyLine=!0;else if(Z.sep)this.stack.push(J);else Object.assign(Z,{key:J,sep:[]}),this.onKeyLine=!0;return}default:{let J=this.startBlockValue($);if(J){if(J.type==="block-seq"){if(!Z.explicitKey&&Z.sep&&!H6(Z.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(z)$.items.push({start:X});this.stack.push(J);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(Z.value){let z="end"in Z.value?Z.value.end:void 0;if((Array.isArray(z)?z[z.length-1]:void 0)?.type==="comment")z?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(Z.start,$.indent)){let Q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(Q)){S5(Q,Z.start),Q.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return;case"anchor":case"tag":if(Z.value||this.indent<=$.indent)break;Z.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(Z.value||H6(Z.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return}if(this.indent>$.indent){let z=this.startBlockValue($);if(z){this.stack.push(z);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let Z=$.items[$.items.length-1];if(this.type==="flow-error-end"){let z;do yield*this.pop(),z=this.peek(1);while(z?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!Z||Z.sep)$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return;case"map-value-ind":if(!Z||Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Object.assign(Z,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!Z||Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let Q=this.flowScalar(this.type);if(!Z||Z.value)$.items.push({start:[],key:Q,sep:[]});else if(Z.sep)this.stack.push(Q);else Object.assign(Z,{key:Q,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let z=this.startBlockValue($);if(z)this.stack.push(z);else yield*this.pop(),yield*this.step()}else{let z=this.peek(2);if(z.type==="block-map"&&(this.type==="map-value-ind"&&z.indent===$.indent||this.type==="newline"&&!z.items[z.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&z.type!=="flow-collection"){let Q=j5(z),X=E1(Q);hY($);let J=$.end.splice(1,$.end.length);J.push(this.sourceToken);let Y={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:X,key:$,sep:J}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=Y}else yield*this.lineEnd($)}}flowScalar($){if(this.onNewLine){let Z=this.source.indexOf(`
164
164
  `)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
165
- `,Z)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Z=j5($),z=E1(Z);return z.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Z=j5($),z=E1(Z);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Z){if(this.type!=="comment")return!1;if(this.indent<=Z)return!1;return $.every((z)=>z.type==="newline"||z.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}rA.Parser=uY});var dY=F((QC)=>{var mY=j9(),oA=d$(),a$=i$(),aA=h7(),tA=t(),eA=h9(),cY=f9();function pY($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new eA.LineCounter||null,prettyErrors:Z}}function $C($,Z={}){let{lineCounter:z,prettyErrors:Q}=pY(Z),X=new cY.Parser(z?.addNewLine),J=new mY.Composer(Z),Y=Array.from(J.compose(X.parse($)));if(Q&&z)for(let U of Y)U.errors.forEach(a$.prettifyError($,z)),U.warnings.forEach(a$.prettifyError($,z));if(Y.length>0)return Y;return Object.assign([],{empty:!0},J.streamInfo())}function lY($,Z={}){let{lineCounter:z,prettyErrors:Q}=pY(Z),X=new cY.Parser(z?.addNewLine),J=new mY.Composer(Z),Y=null;for(let U of J.compose(X.parse($),!0,$.length))if(!Y)Y=U;else if(Y.options.logLevel!=="silent"){Y.errors.push(new a$.YAMLParseError(U.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&z)Y.errors.forEach(a$.prettifyError($,z)),Y.warnings.forEach(a$.prettifyError($,z));return Y}function ZC($,Z,z){let Q=void 0;if(typeof Z==="function")Q=Z;else if(z===void 0&&Z&&typeof Z==="object")z=Z;let X=lY($,z);if(!X)return null;if(X.warnings.forEach((J)=>aA.warn(X.options.logLevel,J)),X.errors.length>0)if(X.options.logLevel!=="silent")throw X.errors[0];else X.errors=[];return X.toJS(Object.assign({reviver:Q},z))}function zC($,Z,z){let Q=null;if(typeof Z==="function"||Array.isArray(Z))Q=Z;else if(z===void 0&&Z)z=Z;if(typeof z==="string")z=z.length;if(typeof z==="number"){let X=Math.round(z);z=X<1?void 0:X>8?{indent:8}:{indent:X}}if($===void 0){let{keepUndefined:X}=z??Z??{};if(!X)return}if(tA.isDocument($)&&!Q)return $.toString(z);return new oA.Document($,Q,z).toString(z)}QC.parse=ZC;QC.parseAllDocuments=$C;QC.parseDocument=lY;QC.stringify=zC});var lU={};NX(lU,{plainOnStderr:()=>K3,orange:()=>_0,italic:()=>ZP,fafCyanDeep:()=>r5,fafCyan:()=>A,dim:()=>M,colorOn:()=>q3,bold:()=>C,FAF_HEX:()=>V4});function q3($=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)}function K3($){return q3(process.stderr)?$:$.replace($P,"")}var $P,n5=($,Z)=>q3()?`\x1B[${$}m${Z}\x1B[0m`:Z,H3=($)=>(Z)=>n5($,Z),C,M,ZP,V4,A=($)=>n5("38;2;0;212;212",$),r5=($)=>n5("38;2;14;140;140",$),_0=($)=>n5("38;5;208",$);var i=h(()=>{$P=new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`,"g");C=H3("1"),M=H3("2"),ZP=H3("3"),V4={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var gz=F((cn,gy)=>{gy.exports={name:"faf-cli",version:"8.11.0",description:"Persistent AI context + memory — .faf and .fafm, IANA-registered. AI suggests your goal and six W's, you confirm, and every agent file faf writes carries them. Anthropic-merged.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",types:"./dist/index.d.ts",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"},"./pack":{types:"./dist/interop/pack.d.ts",default:"./dist/pack.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",clean:"rm -rf dist",build:"bun run clean && bun build src/cli.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/index.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/interop/pack.ts --outdir dist --target=browser --minify --sourcemap=linked && tsc -p tsconfig.build.json && node scripts/strip-sources-content.mjs",compile:"bun build src/cli.ts --compile --bytecode --minify --outfile faf","compile:all":"bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-arm64 --outfile faf-darwin-arm64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-x64 --outfile faf-darwin-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-linux-x64 --outfile faf-linux-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-windows-x64 --outfile faf-windows-x64.exe",test:"bun test --timeout=120000","test:watch":"bun test --watch --timeout=120000",lint:"eslint 'src/**/*.ts'",format:"prettier --write 'src/**/*.ts'","check:no-hardcode":"! grep -rEln '/(Users|home/runner|private/var)/' dist/ || (echo '❌ Hardcoded build-machine path leaked into dist — see grep output above. Externalize the offending dep in the build script.'; exit 1)","check:engines":"node scripts/check-engines.mjs",prepublishOnly:"bun run check:engines && bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational","agents-md","context-engineering","codex","windsurf","fafm","ai-memory","agents"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.3","faf-scoring-kernel":"^3.0.0",open:"^11.0.0",yaml:"^2.9.0"},devDependencies:{"@anthropic-ai/sdk":"^0.91.1","@faf/specification":"github:Wolfe-Jam/faf","@types/bun":"^1.3.14","@types/node":"^22.20.1","@typescript-eslint/eslint-plugin":"^8.66.0","@typescript-eslint/parser":"^8.66.0",ajv:"^8.20.0",eslint:"^9.39.5",prettier:"^3.9.6",typescript:"^5.9.3","typescript-eslint":"^8.66.0"},overrides:{"brace-expansion":"^1.1.18","fast-uri":"^3.1.9",picomatch:"^4.0.5","@typescript-eslint/typescript-estree":{minimatch:"^11.0.1"}},engines:{node:">=22.0.0"},publishConfig:{access:"public"}}});function R($,Z,z,Q,X){if(Q==="m")throw TypeError("Private method is not writable");if(Q==="a"&&!X)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!X:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return Q==="a"?X.call($,z):X?X.value=z:Z.set($,z),z}function O($,Z,z,Q){if(z==="a"&&!Q)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!Q:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return z==="m"?Q:z==="a"?Q.call($):Q?Q.value:Z.get($)}var $6=()=>{};var iz=function(){let{crypto:$}=globalThis;if($?.randomUUID)return iz=$.randomUUID.bind($),$.randomUUID();let Z=new Uint8Array(1),z=$?()=>$.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(Q)=>(+Q^z()&15>>+Q/4).toString(16))};function Z6($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var r4=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var b,L0,x0,R6,z$,Q$,X$,J$,Y$,U$,W$,G$,V$;var i0=h(()=>{b=class b extends Error{};L0=class L0 extends b{constructor($,Z,z,Q,X){super(`${L0.makeMessage($,Z,z)}`);this.status=$,this.headers=Q,this.requestID=Q?.get("request-id"),this.error=Z,this.type=X??null}static makeMessage($,Z,z){let Q=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):z;if($&&Q)return`${$} ${Q}`;if($)return`${$} status code (no body)`;if(Q)return Q;return"(no status code or body)"}static generate($,Z,z,Q){if(!$||!Q)return new R6({message:z,cause:r4(Z)});let X=Z,J=X?.error?.type;if($===400)return new Q$($,X,z,Q,J);if($===401)return new X$($,X,z,Q,J);if($===403)return new J$($,X,z,Q,J);if($===404)return new Y$($,X,z,Q,J);if($===409)return new U$($,X,z,Q,J);if($===422)return new W$($,X,z,Q,J);if($===429)return new G$($,X,z,Q,J);if($>=500)return new V$($,X,z,Q,J);return new L0($,X,z,Q,J)}};x0=class x0 extends L0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};R6=class R6 extends L0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};z$=class z$ extends R6{constructor({message:$}={}){super({message:$??"Request timed out."})}};Q$=class Q$ extends L0{};X$=class X$ extends L0{};J$=class J$ extends L0{};Y$=class Y$ extends L0{};U$=class U$ extends L0{};W$=class W$ extends L0{};G$=class G$ extends L0{};V$=class V$ extends L0{}});function dZ($){if(typeof $!=="object")return{};return $??{}}function sz($){if(!$)return!0;for(let Z in $)return!1;return!0}function _K($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var Ak,CK=($)=>{return Ak.test($)},nz=($)=>(nz=Array.isArray,nz($)),rz,PK=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new b(`${$} must be an integer`);if(Z<0)throw new b(`${$} must be a positive integer`);return Z},iZ=($)=>{try{return JSON.parse($)}catch(Z){return}};var q1=h(()=>{i0();Ak=/^[a-z][a-z0-9+.-]*:/i,rz=nz});var FK=($)=>new Promise((Z)=>setTimeout(Z,$));var j6="0.91.1";function Ck(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}function Pk(){if(typeof navigator>"u"||!navigator)return null;let $=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:Z,pattern:z}of $){let Q=z.exec(navigator.userAgent);if(Q){let X=Q[1]||0,J=Q[2]||0,Y=Q[3]||0;return{browser:Z,version:`${X}.${J}.${Y}`}}}return null}var EK=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},_k=()=>{let $=Ck();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":j6,"X-Stainless-OS":jK(Deno.build.os),"X-Stainless-Arch":RK(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":j6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if($==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":j6,"X-Stainless-OS":jK(globalThis.process.platform??"unknown"),"X-Stainless-Arch":RK(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=Pk();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":j6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Z.browser}`,"X-Stainless-Runtime-Version":Z.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":j6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},RK=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},jK=($)=>{if($=$.toLowerCase(),$.includes("ios"))return"iOS";if($==="android")return"Android";if($==="darwin")return"MacOS";if($==="win32")return"Windows";if($==="freebsd")return"FreeBSD";if($==="openbsd")return"OpenBSD";if($==="linux")return"Linux";if($)return`Other:${$}`;return"Unknown"},SK,wK=()=>{return SK??(SK=_k())};var oz=()=>{};function xK(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function az(...$){let Z=globalThis.ReadableStream;if(typeof Z>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new Z(...$)}function nZ($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return az({start(){},async pull(z){let{done:Q,value:X}=await Z.next();if(Q)z.close();else z.enqueue(X)},async cancel(){await Z.return?.()}})}function s4($){if($[Symbol.asyncIterator])return $;let Z=$.getReader();return{async next(){try{let z=await Z.read();if(z?.done)Z.releaseLock();return z}catch(z){throw Z.releaseLock(),z}},async return(){let z=Z.cancel();return Z.releaseLock(),await z,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function yK($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),z=Z.cancel();Z.releaseLock(),await z}var bK=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function kK($){return Object.entries($).filter(([Z,z])=>typeof z<"u").map(([Z,z])=>{if(typeof z==="string"||typeof z==="number"||typeof z==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent(z)}`;if(z===null)return`${encodeURIComponent(Z)}=`;throw new b(`Cannot stringify type ${typeof z}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}var vK=h(()=>{i0()});function fK($){let Z=0;for(let X of $)Z+=X.length;let z=new Uint8Array(Z),Q=0;for(let X of $)z.set(X,Q),Q+=X.length;return z}function o4($){let Z;return(gK??(Z=new globalThis.TextEncoder,gK=Z.encode.bind(Z)))($)}function tz($){let Z;return(hK??(Z=new globalThis.TextDecoder,hK=Z.decode.bind(Z)))($)}var gK,hK;class S6{constructor(){$2.set(this,void 0),Z2.set(this,void 0),R(this,$2,new Uint8Array,"f"),R(this,Z2,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?o4($):$;R(this,$2,fK([O(this,$2,"f"),Z]),"f");let z=[],Q;while((Q=jk(O(this,$2,"f"),O(this,Z2,"f")))!=null){if(Q.carriage&&O(this,Z2,"f")==null){R(this,Z2,Q.index,"f");continue}if(O(this,Z2,"f")!=null&&(Q.index!==O(this,Z2,"f")+1||Q.carriage)){z.push(tz(O(this,$2,"f").subarray(0,O(this,Z2,"f")-1))),R(this,$2,O(this,$2,"f").subarray(O(this,Z2,"f")),"f"),R(this,Z2,null,"f");continue}let X=O(this,Z2,"f")!==null?Q.preceding-1:Q.preceding,J=tz(O(this,$2,"f").subarray(0,X));z.push(J),R(this,$2,O(this,$2,"f").subarray(Q.index),"f"),R(this,Z2,null,"f")}return z}flush(){if(!O(this,$2,"f").length)return[];return this.decode(`
165
+ `,Z)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Z=j5($),z=E1(Z);return z.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Z=j5($),z=E1(Z);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Z){if(this.type!=="comment")return!1;if(this.indent<=Z)return!1;return $.every((z)=>z.type==="newline"||z.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}rA.Parser=uY});var dY=F((QC)=>{var mY=j9(),oA=d$(),a$=i$(),aA=h7(),tA=t(),eA=h9(),cY=f9();function pY($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new eA.LineCounter||null,prettyErrors:Z}}function $C($,Z={}){let{lineCounter:z,prettyErrors:Q}=pY(Z),X=new cY.Parser(z?.addNewLine),J=new mY.Composer(Z),Y=Array.from(J.compose(X.parse($)));if(Q&&z)for(let U of Y)U.errors.forEach(a$.prettifyError($,z)),U.warnings.forEach(a$.prettifyError($,z));if(Y.length>0)return Y;return Object.assign([],{empty:!0},J.streamInfo())}function lY($,Z={}){let{lineCounter:z,prettyErrors:Q}=pY(Z),X=new cY.Parser(z?.addNewLine),J=new mY.Composer(Z),Y=null;for(let U of J.compose(X.parse($),!0,$.length))if(!Y)Y=U;else if(Y.options.logLevel!=="silent"){Y.errors.push(new a$.YAMLParseError(U.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&z)Y.errors.forEach(a$.prettifyError($,z)),Y.warnings.forEach(a$.prettifyError($,z));return Y}function ZC($,Z,z){let Q=void 0;if(typeof Z==="function")Q=Z;else if(z===void 0&&Z&&typeof Z==="object")z=Z;let X=lY($,z);if(!X)return null;if(X.warnings.forEach((J)=>aA.warn(X.options.logLevel,J)),X.errors.length>0)if(X.options.logLevel!=="silent")throw X.errors[0];else X.errors=[];return X.toJS(Object.assign({reviver:Q},z))}function zC($,Z,z){let Q=null;if(typeof Z==="function"||Array.isArray(Z))Q=Z;else if(z===void 0&&Z)z=Z;if(typeof z==="string")z=z.length;if(typeof z==="number"){let X=Math.round(z);z=X<1?void 0:X>8?{indent:8}:{indent:X}}if($===void 0){let{keepUndefined:X}=z??Z??{};if(!X)return}if(tA.isDocument($)&&!Q)return $.toString(z);return new oA.Document($,Q,z).toString(z)}QC.parse=ZC;QC.parseAllDocuments=$C;QC.parseDocument=lY;QC.stringify=zC});var lU={};NX(lU,{plainOnStderr:()=>K3,orange:()=>_0,italic:()=>ZP,fafCyanDeep:()=>r5,fafCyan:()=>A,dim:()=>M,colorOn:()=>q3,bold:()=>C,FAF_HEX:()=>V4});function q3($=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)}function K3($){return q3(process.stderr)?$:$.replace($P,"")}var $P,n5=($,Z)=>q3()?`\x1B[${$}m${Z}\x1B[0m`:Z,H3=($)=>(Z)=>n5($,Z),C,M,ZP,V4,A=($)=>n5("38;2;0;212;212",$),r5=($)=>n5("38;2;14;140;140",$),_0=($)=>n5("38;5;208",$);var i=h(()=>{$P=new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`,"g");C=H3("1"),M=H3("2"),ZP=H3("3"),V4={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var gz=F((cn,gy)=>{gy.exports={name:"faf-cli",version:"8.11.1",description:"Persistent AI context + memory — .faf and .fafm, IANA-registered. AI suggests your goal and six W's, you confirm, and every agent file faf writes carries them. Anthropic-merged.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",types:"./dist/index.d.ts",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"},"./pack":{types:"./dist/interop/pack.d.ts",default:"./dist/pack.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",clean:"rm -rf dist",build:"bun run clean && bun build src/cli.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/index.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/interop/pack.ts --outdir dist --target=browser --minify --sourcemap=linked && tsc -p tsconfig.build.json && node scripts/strip-sources-content.mjs",compile:"bun build src/cli.ts --compile --bytecode --minify --outfile faf","compile:all":"bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-arm64 --outfile faf-darwin-arm64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-x64 --outfile faf-darwin-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-linux-x64 --outfile faf-linux-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-windows-x64 --outfile faf-windows-x64.exe",test:"bun test --timeout=120000","test:watch":"bun test --watch --timeout=120000",lint:"eslint 'src/**/*.ts'",format:"prettier --write 'src/**/*.ts'","check:no-hardcode":"! grep -rEln '/(Users|home/runner|private/var)/' dist/ || (echo '❌ Hardcoded build-machine path leaked into dist — see grep output above. Externalize the offending dep in the build script.'; exit 1)","check:engines":"node scripts/check-engines.mjs",prepublishOnly:"bun run check:engines && bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational","agents-md","context-engineering","codex","windsurf","fafm","ai-memory","agents"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.3","faf-scoring-kernel":"^3.0.0",open:"^11.0.0",yaml:"^2.9.0"},devDependencies:{"@anthropic-ai/sdk":"^0.91.1","@faf/specification":"github:Wolfe-Jam/faf","@types/bun":"^1.3.14","@types/node":"^22.20.1","@typescript-eslint/eslint-plugin":"^8.66.0","@typescript-eslint/parser":"^8.66.0",ajv:"^8.20.0",eslint:"^9.39.5",prettier:"^3.9.6",typescript:"^5.9.3","typescript-eslint":"^8.66.0"},overrides:{"brace-expansion":"^1.1.18","fast-uri":"^3.1.9",picomatch:"^4.0.5","@typescript-eslint/typescript-estree":{minimatch:"^11.0.1"}},engines:{node:">=22.0.0"},publishConfig:{access:"public"}}});function R($,Z,z,Q,X){if(Q==="m")throw TypeError("Private method is not writable");if(Q==="a"&&!X)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!X:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return Q==="a"?X.call($,z):X?X.value=z:Z.set($,z),z}function O($,Z,z,Q){if(z==="a"&&!Q)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!Q:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return z==="m"?Q:z==="a"?Q.call($):Q?Q.value:Z.get($)}var $6=()=>{};var iz=function(){let{crypto:$}=globalThis;if($?.randomUUID)return iz=$.randomUUID.bind($),$.randomUUID();let Z=new Uint8Array(1),z=$?()=>$.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(Q)=>(+Q^z()&15>>+Q/4).toString(16))};function Z6($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var r4=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var b,L0,x0,R6,z$,Q$,X$,J$,Y$,U$,W$,G$,V$;var i0=h(()=>{b=class b extends Error{};L0=class L0 extends b{constructor($,Z,z,Q,X){super(`${L0.makeMessage($,Z,z)}`);this.status=$,this.headers=Q,this.requestID=Q?.get("request-id"),this.error=Z,this.type=X??null}static makeMessage($,Z,z){let Q=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):z;if($&&Q)return`${$} ${Q}`;if($)return`${$} status code (no body)`;if(Q)return Q;return"(no status code or body)"}static generate($,Z,z,Q){if(!$||!Q)return new R6({message:z,cause:r4(Z)});let X=Z,J=X?.error?.type;if($===400)return new Q$($,X,z,Q,J);if($===401)return new X$($,X,z,Q,J);if($===403)return new J$($,X,z,Q,J);if($===404)return new Y$($,X,z,Q,J);if($===409)return new U$($,X,z,Q,J);if($===422)return new W$($,X,z,Q,J);if($===429)return new G$($,X,z,Q,J);if($>=500)return new V$($,X,z,Q,J);return new L0($,X,z,Q,J)}};x0=class x0 extends L0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};R6=class R6 extends L0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};z$=class z$ extends R6{constructor({message:$}={}){super({message:$??"Request timed out."})}};Q$=class Q$ extends L0{};X$=class X$ extends L0{};J$=class J$ extends L0{};Y$=class Y$ extends L0{};U$=class U$ extends L0{};W$=class W$ extends L0{};G$=class G$ extends L0{};V$=class V$ extends L0{}});function dZ($){if(typeof $!=="object")return{};return $??{}}function sz($){if(!$)return!0;for(let Z in $)return!1;return!0}function _K($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var Ak,CK=($)=>{return Ak.test($)},nz=($)=>(nz=Array.isArray,nz($)),rz,PK=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new b(`${$} must be an integer`);if(Z<0)throw new b(`${$} must be a positive integer`);return Z},iZ=($)=>{try{return JSON.parse($)}catch(Z){return}};var q1=h(()=>{i0();Ak=/^[a-z][a-z0-9+.-]*:/i,rz=nz});var FK=($)=>new Promise((Z)=>setTimeout(Z,$));var j6="0.91.1";function Ck(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}function Pk(){if(typeof navigator>"u"||!navigator)return null;let $=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:Z,pattern:z}of $){let Q=z.exec(navigator.userAgent);if(Q){let X=Q[1]||0,J=Q[2]||0,Y=Q[3]||0;return{browser:Z,version:`${X}.${J}.${Y}`}}}return null}var EK=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},_k=()=>{let $=Ck();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":j6,"X-Stainless-OS":jK(Deno.build.os),"X-Stainless-Arch":RK(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":j6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if($==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":j6,"X-Stainless-OS":jK(globalThis.process.platform??"unknown"),"X-Stainless-Arch":RK(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=Pk();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":j6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Z.browser}`,"X-Stainless-Runtime-Version":Z.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":j6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},RK=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},jK=($)=>{if($=$.toLowerCase(),$.includes("ios"))return"iOS";if($==="android")return"Android";if($==="darwin")return"MacOS";if($==="win32")return"Windows";if($==="freebsd")return"FreeBSD";if($==="openbsd")return"OpenBSD";if($==="linux")return"Linux";if($)return`Other:${$}`;return"Unknown"},SK,wK=()=>{return SK??(SK=_k())};var oz=()=>{};function xK(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function az(...$){let Z=globalThis.ReadableStream;if(typeof Z>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new Z(...$)}function nZ($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return az({start(){},async pull(z){let{done:Q,value:X}=await Z.next();if(Q)z.close();else z.enqueue(X)},async cancel(){await Z.return?.()}})}function s4($){if($[Symbol.asyncIterator])return $;let Z=$.getReader();return{async next(){try{let z=await Z.read();if(z?.done)Z.releaseLock();return z}catch(z){throw Z.releaseLock(),z}},async return(){let z=Z.cancel();return Z.releaseLock(),await z,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function yK($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),z=Z.cancel();Z.releaseLock(),await z}var bK=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function kK($){return Object.entries($).filter(([Z,z])=>typeof z<"u").map(([Z,z])=>{if(typeof z==="string"||typeof z==="number"||typeof z==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent(z)}`;if(z===null)return`${encodeURIComponent(Z)}=`;throw new b(`Cannot stringify type ${typeof z}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}var vK=h(()=>{i0()});function fK($){let Z=0;for(let X of $)Z+=X.length;let z=new Uint8Array(Z),Q=0;for(let X of $)z.set(X,Q),Q+=X.length;return z}function o4($){let Z;return(gK??(Z=new globalThis.TextEncoder,gK=Z.encode.bind(Z)))($)}function tz($){let Z;return(hK??(Z=new globalThis.TextDecoder,hK=Z.decode.bind(Z)))($)}var gK,hK;class S6{constructor(){$2.set(this,void 0),Z2.set(this,void 0),R(this,$2,new Uint8Array,"f"),R(this,Z2,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?o4($):$;R(this,$2,fK([O(this,$2,"f"),Z]),"f");let z=[],Q;while((Q=jk(O(this,$2,"f"),O(this,Z2,"f")))!=null){if(Q.carriage&&O(this,Z2,"f")==null){R(this,Z2,Q.index,"f");continue}if(O(this,Z2,"f")!=null&&(Q.index!==O(this,Z2,"f")+1||Q.carriage)){z.push(tz(O(this,$2,"f").subarray(0,O(this,Z2,"f")-1))),R(this,$2,O(this,$2,"f").subarray(O(this,Z2,"f")),"f"),R(this,Z2,null,"f");continue}let X=O(this,Z2,"f")!==null?Q.preceding-1:Q.preceding,J=tz(O(this,$2,"f").subarray(0,X));z.push(J),R(this,$2,O(this,$2,"f").subarray(Q.index),"f"),R(this,Z2,null,"f")}return z}flush(){if(!O(this,$2,"f").length)return[];return this.decode(`
166
166
  `)}}function jk($,Z){for(let X=Z??0;X<$.length;X++){if($[X]===10)return{preceding:X,index:X+1,carriage:!1};if($[X]===13)return{preceding:X,index:X+1,carriage:!0}}return null}function uK($){for(let Q=0;Q<$.length-1;Q++){if($[Q]===10&&$[Q+1]===10)return Q+2;if($[Q]===13&&$[Q+1]===13)return Q+2;if($[Q]===13&&$[Q+1]===10&&Q+3<$.length&&$[Q+2]===13&&$[Q+3]===10)return Q+4}return-1}var $2,Z2;var ez=h(()=>{$6();$2=new WeakMap,Z2=new WeakMap;S6.NEWLINE_CHARS=new Set([`
167
167
  `,"\r"]);S6.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function a4(){}function rZ($,Z,z){if(!Z||sZ[$]>sZ[z])return a4;else return Z[$].bind(Z)}function R0($){let Z=$.logger,z=$.logLevel??"off";if(!Z)return Sk;let Q=mK.get(Z);if(Q&&Q[0]===z)return Q[1];let X={error:rZ("error",Z,z),warn:rZ("warn",Z,z),info:rZ("info",Z,z),debug:rZ("debug",Z,z)};return mK.set(Z,[z,X]),X}var sZ,$Q=($,Z,z)=>{if(!$)return;if(_K(sZ,$))return $;R0(z).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(sZ))}`);return},Sk,mK,z6=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([Z,z])=>[Z,Z.toLowerCase()==="x-api-key"||Z.toLowerCase()==="authorization"||Z.toLowerCase()==="cookie"||Z.toLowerCase()==="set-cookie"?"***":z]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var oZ=h(()=>{q1();sZ={off:0,error:200,warn:300,info:400,debug:500};Sk={error:a4,warn:a4,info:a4,debug:a4},mK=new WeakMap});async function*Ek($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new b("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new b("Attempted to iterate over a response with no body")}let z=new cK,Q=new S6,X=s4($.body);for await(let J of wk(X))for(let Y of Q.decode(J)){let U=z.decode(Y);if(U)yield U}for(let J of Q.flush()){let Y=z.decode(J);if(Y)yield Y}}async function*wk($){let Z=new Uint8Array;for await(let z of $){if(z==null)continue;let Q=z instanceof ArrayBuffer?new Uint8Array(z):typeof z==="string"?o4(z):z,X=new Uint8Array(Z.length+Q.length);X.set(Z),X.set(Q,Z.length),Z=X;let J;while((J=uK(Z))!==-1)yield Z.slice(0,J),Z=Z.slice(J)}if(Z.length>0)yield Z}class cK{constructor(){this.event=null,this.data=[],this.chunks=[]}decode($){if($.endsWith("\r"))$=$.substring(0,$.length-1);if(!$){if(!this.event&&!this.data.length)return null;let X={event:this.event,data:this.data.join(`
168
168
  `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],X}if(this.chunks.push($),$.startsWith(":"))return null;let[Z,z,Q]=xk($,":");if(Q.startsWith(" "))Q=Q.substring(1);if(Z==="event")this.event=Q;else if(Z==="data")this.data.push(Q);return null}}function xk($,Z){let z=$.indexOf(Z);if(z!==-1)return[$.substring(0,z),Z,$.substring(z+Z.length)];return[$,"",""]}var t4,z2;var ZQ=h(()=>{$6();i0();ez();q1();oZ();i0();z2=class z2{constructor($,Z,z){this.iterator=$,t4.set(this,void 0),this.controller=Z,R(this,t4,z,"f")}static fromSSEResponse($,Z,z){let Q=!1,X=z?R0(z):console;async function*J(){if(Q)throw new b("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let U of Ek($,Z)){if(U.event==="completion")try{yield JSON.parse(U.data)}catch(W){throw X.error("Could not parse message into JSON:",U.data),X.error("From chunk:",U.raw),W}if(U.event==="message_start"||U.event==="message_delta"||U.event==="message_stop"||U.event==="content_block_start"||U.event==="content_block_delta"||U.event==="content_block_stop"||U.event==="message"||U.event==="user.message"||U.event==="user.interrupt"||U.event==="user.tool_confirmation"||U.event==="user.custom_tool_result"||U.event==="agent.message"||U.event==="agent.thinking"||U.event==="agent.tool_use"||U.event==="agent.tool_result"||U.event==="agent.mcp_tool_use"||U.event==="agent.mcp_tool_result"||U.event==="agent.custom_tool_use"||U.event==="agent.thread_context_compacted"||U.event==="session.status_running"||U.event==="session.status_idle"||U.event==="session.status_rescheduled"||U.event==="session.status_terminated"||U.event==="session.error"||U.event==="session.deleted"||U.event==="span.model_request_start"||U.event==="span.model_request_end")try{yield JSON.parse(U.data)}catch(W){throw X.error("Could not parse message into JSON:",U.data),X.error("From chunk:",U.raw),W}if(U.event==="ping")continue;if(U.event==="error"){let W=iZ(U.data)??U.data,G=W?.error?.type;throw new L0(void 0,W,void 0,$.headers,G)}}Y=!0}catch(U){if(Z6(U))return;throw U}finally{if(!Y)Z.abort()}}return new z2(J,Z,z)}static fromReadableStream($,Z,z){let Q=!1;async function*X(){let Y=new S6,U=s4($);for await(let W of U)for(let G of Y.decode(W))yield G;for(let W of Y.flush())yield W}async function*J(){if(Q)throw new b("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let U of X()){if(Y)continue;if(U)yield JSON.parse(U)}Y=!0}catch(U){if(Z6(U))return;throw U}finally{if(!Y)Z.abort()}}return new z2(J,Z,z)}[(t4=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],Z=[],z=this.iterator(),Q=(X)=>{return{next:()=>{if(X.length===0){let J=z.next();$.push(J),Z.push(J)}return X.shift()}}};return[new z2(()=>Q($),this.controller,O(this,t4,"f")),new z2(()=>Q(Z),this.controller,O(this,t4,"f"))]}toReadableStream(){let $=this,Z;return az({async start(){Z=$[Symbol.asyncIterator]()},async pull(z){try{let{value:Q,done:X}=await Z.next();if(X)return z.close();let J=o4(JSON.stringify(Q)+`
@@ -499,7 +499,7 @@ human_context:
499
499
  ${M(' Demo complete. Run "faf init" in your project to get started.')}`)}i();function oq($,Z={}){if(!$)console.error("Usage: faf search <keyword>"),process.exit(2);let z=$.toLowerCase(),Q=!Z.slots&&!Z.formats,X=0;if(Q||Z.slots){let J=X0.filter((Y)=>Y.path.toLowerCase().includes(z)||Y.description.toLowerCase().includes(z)||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${A("slots")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
500
500
  `);for(let Y of J)console.log(` ${C(`#${Y.index}`)} ${Y.path} ${M("—")} ${Y.description} ${M(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(Q||Z.formats){let J=c4.filter((Y)=>Y.name.toLowerCase().includes(z)||Y.extensions.some((U)=>U.toLowerCase().includes(z))||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${A("formats")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
501
501
  `);for(let Y of J)console.log(` ${C(Y.name)} ${M(Y.extensions.join(", "))} ${M(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(X===0)console.log(M(` No results for "${$}"`))}import{spawnSync as Kb}from"child_process";import{existsSync as Hb,readdirSync as cz,readFileSync as QK}from"fs";import{dirname as Bb,join as n4,resolve as Mb}from"path";i();import{spawnSync as aq}from"child_process";import{readFileSync as ty,statSync as ey}from"fs";import{join as $b}from"path";i();var cZ=($)=>typeof $==="number"&&Number.isFinite($)?$:null,l4=($)=>typeof $==="string"&&$!==""?$:null,hz=($)=>Array.isArray($)?$.filter((Z)=>typeof Z==="string"):[];function Zb($){if(typeof $!=="object"||$===null)return;let Z=$;return{names:hz(Z.names),truncated:Z.truncated===!0,hash:l4(Z.hash),newly_skipped:hz(Z.newly_skipped),no_longer_skipped:hz(Z.no_longer_skipped)}}function zb($){if(typeof $!=="object"||$===null)return null;let Z=$,z=Z.timestamp instanceof Date?Z.timestamp.toISOString():l4(Z.timestamp);if(!z)return null;let Q=typeof Z.tests==="object"&&Z.tests!==null?Z.tests:{};return{timestamp:z,result:l4(Z.result)??"UNKNOWN",passed:cZ(Q.passed),failed:cZ(Q.failed),skipped:cZ(Q.skipped),total:cZ(Q.total),trigger:l4(Z.trigger),skipped_tests:Zb(Z.skipped_tests)}}var Qb=/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/,tq=($)=>Date.parse(Qb.test($)?`${$.replace(" ","T")}Z`:$);function Xb($){let Z=S0($),Q=(Array.isArray(Z?.test_history)?Z.test_history:[]).map(zb).filter((J)=>J!==null),X=(J)=>tq(J.timestamp);return Q.sort((J,Y)=>(Number.isNaN(X(Y))?-1/0:X(Y))-(Number.isNaN(X(J))?-1/0:X(J))||Y.timestamp.localeCompare(J.timestamp)),{project:l4(Z?.project),receipts:Q}}function Jb($,Z){let z=Z?[Z]:["origin/taf-receipts","taf-receipts"];for(let X of z){let J=aq("git",["show","--end-of-options",`${X}:.taf`],{cwd:$,encoding:"utf-8",maxBuffer:67108864,env:{...process.env,GIT_NO_LAZY_FETCH:"1"}});if(J.status===0&&typeof J.stdout==="string")return{text:J.stdout,source:X}}let Q=$b($,".taf");if(!Z&&ey(Q,{throwIfNoEntry:!1})?.isFile())return{text:ty(Q,"utf-8"),source:".taf"};return null}function Yb($,Z){for(let z of Z?[Z]:["origin/taf-receipts","taf-receipts"]){let Q=aq("git",["ls-tree","--name-only","--end-of-options",z,"--",".taf"],{cwd:$,encoding:"utf-8",env:{...process.env,GIT_NO_LAZY_FETCH:"1"}});if(Q.status===0&&Q.stdout.trim()===".taf")return z}return null}var Ub=($)=>{let Z=tq($);if(/^\d{4}-\d{2}-\d{2}$/.test($)||Number.isNaN(Z))return $;return new Date(Z).toISOString().replace("T"," ").slice(0,16)},Wb=($)=>{if($.passed===null||$.total===null)return"—";let Z=$.skipped_tests?.newly_skipped.length??0,z=[$.failed?`${$.failed} failed`:"",$.skipped?`${$.skipped} skipped`:"",Z?`+${Z} newly skipped`:""].filter(Boolean).join(", ");return`${$.passed}/${$.total}${z?` ${z}`:""}`};function Gb($){let Z=$===void 0?10:Number($);if(!Number.isInteger(Z)||Z<1)console.error(`${C("×")} --limit takes a whole number, 1 or more.`),process.exit(1);return Z}function Vb($,Z){if(Z?.startsWith("-"))console.error(`${C("×")} --ref takes a git ref, not an option: ${Z}`),process.exit(1);let z=Jb($,Z);if(!z){let Q=Yb($,Z);if(Q)console.error(`${C("×")} ${Q} is here, its .taf is not (a partial clone). Get it once: git show ${Q}:.taf > /dev/null`),process.exit(1);let X=Z?`${Z}:.taf`:"origin/taf-receipts, taf-receipts or ./.taf";console.error(`${C("×")} No receipts found (looked in ${X}). Fetch them: git fetch origin taf-receipts`),process.exit(1)}try{return{source:z.source,...Xb(z.text)}}catch(Q){console.error(`${C("×")} ${z.source}: the .taf is not YAML faf can read (${Q.message.split(`
502
- `)[0]})`),process.exit(1)}}function qb($,Z,z,Q){let X=Z?` — ${Z}`:"";if(console.log(`${A("TAF receipts")}${X} ${M(`· ${z} on ${$} · times in UTC`)}`),Q.length===0){console.log(M(" no receipts yet"));return}for(let Y of Q)console.log(` ${Ub(Y.timestamp)} ${Y.result.padEnd(8)} ${Wb(Y)}`);let J=new Map;for(let Y of Q)J.set(Y.result,(J.get(Y.result)??0)+1);if(console.log(M(` last ${Q.length}: ${[...J].map(([Y,U])=>`${U} ${Y}`).join(" · ")}`)),$.startsWith("origin/"))console.log(M(" as of your last fetch (git fetch origin taf-receipts)"))}function eq($={}){let Z=Gb($.limit),{source:z,project:Q,receipts:X}=Vb(process.cwd(),$.ref),J=X.slice(0,Z);if($.json){console.log(JSON.stringify({source:z,project:Q,total:X.length,receipts:J},null,2));return}qb(z,Q,X.length,J)}function Lb($){try{let Z=JSON.parse(new TextDecoder().decode($));return typeof Z==="object"&&Z!==null&&!Array.isArray(Z)&&typeof Z.taf_version==="string"}catch{return!1}}var Db="v2.7.0",Ob=`Wolfe-Jam/faf-taf-git/.github/workflows/receipt.yml@${Db}`,XK="taf-test-output";function JK($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;let z=$??"";if($===""||!Object.hasOwn($K,z))console.error(`${C("×")} Unknown: faf taf ${z}. Use ${C("faf taf setup")} or ${C("faf taf receipts")}.`),process.exit(1);Ib(z,Z),$K[z](Z)}var Nb={setup:["write"],receipts:["limit","json","ref"],"":["output","force"]},$K={setup:($)=>Zk($),receipts:($)=>eq($),"":($)=>zk($)};function Ib($,Z){let z=Object.keys(Z).filter((X)=>Z[X]!==void 0&&!Nb[$].includes(X));if(z.length===0)return;let Q=z.map((X)=>`--${X}`).join(", ");console.error(M(`note: ${Q} ${z.length===1?"does":"do"} nothing with faf taf${$?` ${$}`:""} (ignored)`))}function Tb($){if(I($,"bun.lockb")||I($,"bun.lock"))return"bun";if(I($,"pnpm-lock.yaml"))return"pnpm";if(I($,"yarn.lock"))return"yarn";return"npm"}function Ab($){try{let Z=JSON.parse(QK(n4($,"package.json"),"utf-8"));return Z&&typeof Z==="object"&&!Array.isArray(Z)?Z:{}}catch{return{}}}var fz=($,Z)=>new RegExp(`(^|[\\s;&|(])${Z}(?![\\w-])`).test($),Cb=/^\s*(?:npm run|pnpm(?: run)?|yarn(?: run)?|bun run)\s+([\w:.-]+)\s*$/;function YK($){let Z=$.test;for(let z=0;z<3&&typeof Z==="string";z++){let Q=Cb.exec(Z)?.[1];if(!Q)break;if(Z=$[Q],typeof Z!=="string")return null}return typeof Z==="string"?Z:void 0}function ZK($,Z){let z=$.scripts&&typeof $.scripts==="object"?$.scripts:{},Q=YK(z);if(Q===null){let X={...$.devDependencies,...$.dependencies};return"jest"in X||"vitest"in X}if(Q===void 0)return!1;return fz(Q,"jest")||fz(Q,"vitest")||Z==="bun"&&fz(Q,"bun test")}function _b($){let Z=$.packageManager,z=$.devEngines?.packageManager;return typeof Z==="string"&&Z.startsWith("pnpm@")||z?.name==="pnpm"&&typeof z.version==="string"&&z.version!==""?" - uses: pnpm/action-setup@v6":` - uses: pnpm/action-setup@v6
502
+ `)[0]})`),process.exit(1)}}function qb($,Z,z,Q){let X=Z?` — ${Z}`:"";if(console.log(`${A("TAF receipts")}${X} ${M(`· ${z} on ${$} · times in UTC`)}`),Q.length===0){console.log(M(" no receipts yet"));return}for(let Y of Q)console.log(` ${Ub(Y.timestamp)} ${Y.result.padEnd(8)} ${Wb(Y)}`);let J=new Map;for(let Y of Q)J.set(Y.result,(J.get(Y.result)??0)+1);if(console.log(M(` last ${Q.length}: ${[...J].map(([Y,U])=>`${U} ${Y}`).join(" · ")}`)),$.startsWith("origin/"))console.log(M(" as of your last fetch (git fetch origin taf-receipts)"))}function eq($={}){let Z=Gb($.limit),{source:z,project:Q,receipts:X}=Vb(process.cwd(),$.ref),J=X.slice(0,Z);if($.json){console.log(JSON.stringify({source:z,project:Q,total:X.length,receipts:J},null,2));return}qb(z,Q,X.length,J)}function Lb($){try{let Z=JSON.parse(new TextDecoder().decode($));return typeof Z==="object"&&Z!==null&&!Array.isArray(Z)&&typeof Z.taf_version==="string"}catch{return!1}}var Db="v3.0.0",Ob=`Wolfe-Jam/taf-git/.github/workflows/receipt.yml@${Db}`,XK="taf-test-output";function JK($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;let z=$??"";if($===""||!Object.hasOwn($K,z))console.error(`${C("×")} Unknown: faf taf ${z}. Use ${C("faf taf setup")} or ${C("faf taf receipts")}.`),process.exit(1);Ib(z,Z),$K[z](Z)}var Nb={setup:["write"],receipts:["limit","json","ref"],"":["output","force"]},$K={setup:($)=>Zk($),receipts:($)=>eq($),"":($)=>zk($)};function Ib($,Z){let z=Object.keys(Z).filter((X)=>Z[X]!==void 0&&!Nb[$].includes(X));if(z.length===0)return;let Q=z.map((X)=>`--${X}`).join(", ");console.error(M(`note: ${Q} ${z.length===1?"does":"do"} nothing with faf taf${$?` ${$}`:""} (ignored)`))}function Tb($){if(I($,"bun.lockb")||I($,"bun.lock"))return"bun";if(I($,"pnpm-lock.yaml"))return"pnpm";if(I($,"yarn.lock"))return"yarn";return"npm"}function Ab($){try{let Z=JSON.parse(QK(n4($,"package.json"),"utf-8"));return Z&&typeof Z==="object"&&!Array.isArray(Z)?Z:{}}catch{return{}}}var fz=($,Z)=>new RegExp(`(^|[\\s;&|(])${Z}(?![\\w-])`).test($),Cb=/^\s*(?:npm run|pnpm(?: run)?|yarn(?: run)?|bun run)\s+([\w:.-]+)\s*$/;function YK($){let Z=$.test;for(let z=0;z<3&&typeof Z==="string";z++){let Q=Cb.exec(Z)?.[1];if(!Q)break;if(Z=$[Q],typeof Z!=="string")return null}return typeof Z==="string"?Z:void 0}function ZK($,Z){let z=$.scripts&&typeof $.scripts==="object"?$.scripts:{},Q=YK(z);if(Q===null){let X={...$.devDependencies,...$.dependencies};return"jest"in X||"vitest"in X}if(Q===void 0)return!1;return fz(Q,"jest")||fz(Q,"vitest")||Z==="bun"&&fz(Q,"bun test")}function _b($){let Z=$.packageManager,z=$.devEngines?.packageManager;return typeof Z==="string"&&Z.startsWith("pnpm@")||z?.name==="pnpm"&&typeof z.version==="string"&&z.version!==""?" - uses: pnpm/action-setup@v6":` - uses: pnpm/action-setup@v6
503
503
  with:
504
504
  version: 10`}var UK={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: actions/setup-node@v7
505
505
  with:
@@ -559,9 +559,9 @@ ${Z.map((X)=>` ${X}`).join(`
559
559
  `,db=/^\s*node\s+--test(?![\w-])[^;&|]*$/,ib=/^\s*mocha(?![\w-])[^;&|]*$/,nb=/--(?:test-)?reporter\b/;function rb($,Z){let z=$.scripts&&typeof $.scripts==="object"?$.scripts:{},Q=YK(z);if(typeof Q!=="string"||nb.test(Q))return null;let X=UK[Z].test;if(db.test(Q))return`NODE_OPTIONS="--test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=report.xml" ${X}`;if(typeof z.test==="string"&&ib.test(z.test))return`${X}${Z==="npm"?" --":""} --reporter xunit --reporter-option output=report.xml`;return null}function sb($){let Z=Tb($),z=Ab($),Q=UK[Z],X=Z==="pnpm"?`${_b(z)}
560
560
  ${Q.setup}`:Q.setup,J=ZK(z,Z)?null:rb(z,Z);if(J)return{body:`${X}
561
561
  - run: ${Q.install}
562
- # Your test command, with a JUnit report added (faf-taf-git reads it).
562
+ # Your test command, with a JUnit report added (taf-git reads it).
563
563
  ${J.includes("xunit")?` # mocha writes only the report: failure details are in report.xml.
564
- `:""}${i4(J)}`,report:"report.xml"};let Y=ZK(z,Z)?i4(`${Q.test} 2>&1 | tee test-output.txt`):` # TODO: faf-taf-git reads Jest, Vitest and Bun output, or JUnit XML
564
+ `:""}${i4(J)}`,report:"report.xml"};let Y=ZK(z,Z)?i4(`${Q.test} 2>&1 | tee test-output.txt`):` # TODO: taf-git reads Jest, Vitest and Bun output, or JUnit XML
565
565
  # (node --test: --test-reporter=junit; mocha: --reporter xunit).
566
566
  # Run your tests so they write one of those, and point test-output-file at it.
567
567
  ${i4(`echo "TODO: your test command" 2>&1 | tee test-output.txt # e.g. ${Q.test} 2>&1 | tee test-output.txt`)}`;return{body:`${X}
@@ -569,7 +569,7 @@ ${i4(`echo "TODO: your test command" 2>&1 | tee test-output.txt # e.g. ${Q.tes
569
569
  ${Y}`,report:"test-output.txt"}}function ob($){let Z=(J)=>{let Y=Kb("git",J,{cwd:$,encoding:"utf-8"});return Y.status===0?Y.stdout.trim():""},z=Z(["symbolic-ref","--short","refs/remotes/origin/HEAD"]).replace(/^origin\//,"");if(z)return{name:z};for(let J of["main","master"])if(Z(["rev-parse","--verify","--quiet",`refs/remotes/origin/${J}`]))return{name:J};let Q=Z(["for-each-ref","--format=%(refname:lstrip=3)","refs/remotes/origin/"]).split(`
570
570
  `).filter((J)=>J&&J!=="HEAD");if(Q.length===1)return{name:Q[0]};let X=Z(["branch","--show-current"]);if(X)return{name:X,guess:"origin/HEAD is not set, so this is the current branch"};return{name:"main",guess:"no branch found"}}var ab=($)=>/^[\w./-]+$/.test($)?$:`'${$.replace(/[*?+[\]!]/g,"\\$&")}'`;function tb($,Z){let z=`github.ref == 'refs/heads/${Z}' && github.event_name != 'pull_request'`,Q=`name: TAF Receipts
571
571
  # Prints a Test Receipt (.taf) for every run on ${Z}: proof over time.
572
- # Written by \`faf taf setup\`. Docs: https://github.com/Wolfe-Jam/faf-taf-git
572
+ # Written by \`faf taf setup\`. Docs: https://github.com/Wolfe-Jam/taf-git
573
573
  on:
574
574
  push:
575
575
  branches: [${ab(Z)}]
@@ -671,5 +671,5 @@ ${C("faf bench — agent-native protocol")} ${M(`qset ${J.qsetHash} · ${J.ques
671
671
  `),console.log(M(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json · --force")),console.log(M(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}i();var{version:OX}=gz(),Eg=console.error.bind(console);console.error=(...$)=>Eg(...$.map((Z)=>typeof Z==="string"?K3(Z):Z));var m=new gX;m.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(OX,"-v, --version");m.command("init").description("Create .faf from your project").addOption(new S7("--yolo").hideHelp()).addOption(new S7("--quick").hideHelp()).option("--new","Replace project.faf with a fresh one; .faf-dna is kept as it is").option("--force","Same as --new: replace project.faf; .faf-dna is kept (a birth certificate is written once)").option("--output <path>","Output path").action(($)=>p3($));m.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").option("--json","Output the lineage as JSON").option("--verify","Check the birth certificate against the commit that first added .faf-dna (exit 0 same, 1 changed, 2 cannot check)").action(($)=>HG($));m.command("auto").description("Fill the tech slots from the repo, then score").action(()=>OZ());m.command("loop").description("Drive to 100% — source what we can, then ask only the human").option("-r, --rounds <n>","max auto rounds before stopping","5").action(($)=>DG($));m.command("go").description("Confirm the goal and six W's, suggested in gray, then fill the rest").option("--resume","Resume previous session").action(($)=>TK($));m.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>a5($,Z));m.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key; grade saves .faf-bench.json)").option("--json","Output as JSON").option("--cold","Grade as the without-context run").option("--faf","Grade as the with-context run").option("--tokens <n>","Tokens used in the run (reported by the agent)").option("--model <name>","Model that answered (reported)").option("--file <path>","Path to project.faf (default: discovered)").option("--submit","Submit the full-pair receipt to the public bench ledger (mcpaas.live; --endpoint to change)").option("--endpoint <url>","Override the submit endpoint").action(($,Z,z)=>xH($,Z,z));m.command("show").description("Render project.faf → project.html and open it").option("--force","Replace a project.html faf cannot prove it rendered (edited since, or not faf's)").action(($)=>Qq($));m.command("sync").description(".faf → CLAUDE.md — one way; writes faf's block only; Pro also updates Claude Code's MEMORY.md").option("--watch","Watch for changes").action(($)=>hG($));m.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").option("--force","Replace an output file that is not a .fafb faf compiled").action(($,Z)=>pG($,Z));m.command("decompile <file>").description("Decompile .fafb to JSON (prints; --output writes a file)").option("--output <path>","Output path").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a faf decompile)").action(($,Z)=>$V($,Z));m.command("git <url>").description("Instant scored context from any GitHub repo (any branch/tag with --ref) — shallow-clones to a temp dir, writes ./project.faf (--stdout to print)").option("--ref <ref>","Clone at a specific branch or tag (versioned context)").option("--output <path>","Write to a custom path (default: ./project.faf)").option("--force","Overwrite an existing project.faf").option("--stdout","Print the .faf to stdout instead of writing a file").action(($,Z)=>Wq($,Z));m.command("diff [range]").description("Semantic context diff between two .faf versions (slot deltas + score). git ranges: <ref>, A..B, A...B").option("--json","Emit the delta as structured JSON").option("--install-driver","Wire faf diff into native git — `git diff` renders .faf score+slot deltas").option("--uninstall-driver","Remove the native-git diff driver").action(($,Z)=>Iq($,Z));m.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>Mq($??[]));m.command("log").description("Score timeline across git history — the .faf score at every commit that touched it").option("-n, --limit <n>","Max commits to show (default 20)").option("--all","Show every commit, no cap").option("--reverse","Oldest-first instead of newest-first").option("--json","Emit the timeline as structured JSON").action(($)=>Tq($));m.command("hooks").description("Pre-commit context guard — scores staged .faf vs HEAD, warns (or --strict blocks) on regression").option("--install","Install the pre-commit hook").option("--uninstall","Remove the faf hook block (preserves other hooks)").option("--strict","With --install: block the commit on a score regression (default: warn only)").action(($)=>kq($));m.command("hooks-run",{hidden:!0}).description("Internal: the pre-commit context guard the git hook invokes").option("--strict","Exit non-zero on a score regression").action(($)=>{bq($);let Z=()=>process.exit(0);setTimeout(Z,2000).unref(),process.stdout.write("",()=>process.stderr.write("",Z))});m.command("export").description("Write agent files from .faf — bare: AGENTS.md, .cursorrules, GEMINI.md, Copilot instructions, project.html").option("--agents","Author AGENTS.md").option("--cursor","Author .cursorrules").option("--gemini","Author GEMINI.md").option("--copilot","Author .github/copilot-instructions.md (GitHub Copilot)").option("--grok","Wire grok-faf-mcp into .grok/config.toml (opt-in; never on --all)").option("--llms","Author llms.txt (llmstxt.org view of authored 6Ws — opt-in)").option("--conductor","Author conductor config").option("--html","Author project.html (visual render of project.faf)").option("--card","Author MCP Server Card (./server-card) with the FAF context-block").option("--all","Author all formats").option("--output <path>","Write exported files to this directory instead of the current one").option("--force","Replace a project.html or Server Card faf cannot prove it wrote (edited since, or not faf's)").action(($)=>V1($));m.command("server-card").description("Emit the registry server.json identity (name + title + _meta) from project.faf — the cross-language server-card emitter; patches an existing file").option("--in <path>","Existing server.json to patch (default: ./server.json)").option("--out <path>","Output path (default: same as --in)").option("--faf <path>","project.faf path (default: auto-discover)").option("--set-version <version>","Set the version field (default: preserve existing). NOTE: not --version, which is the global CLI-version flag").option("--generated <iso>","Override the _meta generated stamp (default: preserve existing)").option("--check","Print to stdout, do not write (diff/verify — the idempotency-test hook)").option("--force","With --out: replace a file faf cannot prove it wrote (edited since, or no faf identity)").action(($)=>pV($));m.command("cards").description("Write the cards your files allow. BETTER: an agent.fafa → A2A card, MCP Server Card, registry, AI Catalog, ARD (as its endpoints allow). BEST: + project.faf → the same cards with FAF context. An agent.fafa with no mcp endpoint gets no MCP Server Card or registry server.json; nor does a project.faf alone whose type is not mcp, unless asked for with --target (--check prints, writes nothing)").option("--target <list>","Comma list: a2a,mcp,registry,catalog,ard (default: whatever inputs allow)").option("--faf <path>","project.faf path (default: auto-discover)").option("--fafa <path>","agent.fafa path (default: auto-discover)").option("--dir <path>","Working directory (default: cwd)").option("--a2a-url <url>","Public URL of the A2A card (catalog row)").option("--door-url <url>","A2A door when .fafa has no a2a endpoint").option("--faf-pointer <url>","Absolute .faf pointer for served cards (default: ./project.faf)").option("--check","Print projected cards to stdout, do not write").option("--force","Replace a card file faf cannot prove it wrote (edited since, or not faf's)").action(($)=>hZ($));var sH=($,Z=[])=>[...Z,$],wg=m.command("card").description("One card at a time");wg.command("init").description("Write an agent.fafa from seven answers: name, short name, domain, what it does, version, where it runs, what it can do").option("--name <name>",'Name people see, e.g. "Weather Agent"').option("--short-name <handle>","Short name, lowercase (default: from --name)").option("--domain <domain>","Domain it is published under, e.g. example.com").option("--description <text>","What it does, one sentence").option("--set-version <version>","Its version. NOTE: not --version, which is the global CLI-version flag").option("--url <url>","Where it runs: a live endpoint people call over http(s). For something people install (a CLI, a library, a stdio MCP server), use --package").option("--protocol <protocol>","Protocol at --url: a2a or mcp (default: a2a)").option("--package <name>","Where it runs: a package people install. A bare name is npm; or npm:<name>, pypi:<name>, crates:<name>").option("--kind <kind>","What --package is: mcp (an MCP server, the default), cli or library. Only mcp gets MCP cards").option("--homepage <url>","Its homepage, an http(s) URL (default: https://<domain>)").option("--skill <skill>",'What it can do, "Name: description" (repeatable)',sH).option("--example <question>","A question people ask it; search finds it by these (repeatable, 2-5)",sH).option("--dir <path>","Working directory (default: cwd)").option("--out <path>","Output path (default: ./agent.fafa)").option("--force","Replace an existing agent.fafa").action(($)=>zq($));m.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--verbose","Show slot breakdown").action(($,Z)=>Kz($,Z));m.command("info").description("Show version and system info").option("--version","Show version").action(($)=>vq($));m.command("formats").description("Show supported formats").action(()=>gq());m.command("clear").description("Delete faf's cached clones (faf-git-* temp dirs)").action(()=>hq());m.command("convert").description("Print .faf as YAML or JSON (writes nothing)").option("--json","Output as JSON").action(($)=>fq($));m.command("context").description("Author context output").action(()=>uq());m.command("refresh").description("Re-ground on the live .faf — re-score, measure drift vs the DNA baseline, keep .fafb current").option("--json","Output as JSON").action(($)=>yH($));m.command("drift").description("Check context drift").option("--json","Emit the drift report as structured JSON").action(($)=>lq($));m.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>dq($,Z));m.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>iq($));m.command("pro [subcommand]").description("Pro features & licensing (activate opens faf.one/pro)").action(($)=>nq($));m.command("share").description("Print a faf.one share link for .faf (built locally — nothing is sent)").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>rq($));m.command("demo").description("Demo walkthrough").action(()=>sq());m.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>oq($,Z));m.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` prints the CI receipt workflow (--write creates it); `faf taf receipts` shows them; bare snapshot deprecated → faf score --json").option("--limit <n>","taf receipts: how many to show (default 10)").option("--json","taf receipts: output as JSON").option("--ref <ref>","taf receipts: git ref to read .taf from (default origin/taf-receipts)").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a TAF snapshot)").action(($,Z)=>JK($,Z));m.command("ai [subcommand]").description("Ask Claude for suggestions about project.faf (analyze) — sends it to the Anthropic API, writes nothing").action(($)=>AH($));m.command("conductor [subcommand] [path]").description("Conductor config — import <path> merges into .faf; export prints it").action(($,Z)=>_H($,Z));m.command("wjttc").description("Audit test suite for WJTTC tier coverage (vendor-neutral)").option("--path <path>","Test directory (default: tests)").option("--strict","Exit non-zero if any tests are untiered").option("--json","Output as JSON for CI consumption").action(($)=>FH($));m.command("memory [subcommand] [arg]").description(".fafm soul ops — convert Claude memory, etch, recall, ls, show (etch and convert write soul.fafm)").option("-f, --file <path>","Soul file (default: ./soul.fafm)").option("-o, --output <path>","Output path (convert)").option("--namepoint <handle>","Namepoint for new/converted soul").option("--id <id>","Fact id (etch)").option("--type <type>","Fact type filter / etch type").option("--tag <tags>","Comma-separated tags (recall)").option("--priority <level>","Min priority floor (recall) or etch priority").option("--limit <n>","Max recall hits").option("--json","JSON output").option("--force","Overwrite an existing soul.fafm (convert)").action(($,Z,z)=>rH($,Z,z));m.command("status",{hidden:!0}).action(()=>a5(void 0,{status:!0}));m.command("agents",{hidden:!0}).action(()=>V1({agents:!0}));m.command("cursor",{hidden:!0}).action(()=>V1({cursor:!0}));m.command("gemini",{hidden:!0}).action(()=>V1({gemini:!0}));m.command("grok",{hidden:!0}).action(()=>V1({grok:!0}));m.command("llms",{hidden:!0}).action(()=>V1({llms:!0}));m.command("validate [file]",{hidden:!0}).action(($)=>Kz($));m.command("yolo",{hidden:!0}).action(()=>p3());if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:z,colorOn:Q}=await Promise.resolve().then(() => (i(),lU)),X=process.cwd().replace(process.env.HOME??"","~");if(!Q())console.log(`${z($("faf"))} ${Z(`v${OX}`)} ${Z("Nelly Never Forgets")}`);else{console.log(""),console.log(`\x1B[48;2;29;29;29m ${"\x1B[38;2;150;150;150m"}▄${"\x1B[48;2;150;150;150m"}███████${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▄${"\x1B[0m"}`),console.log(`\x1B[48;2;29;29;29m \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}█${"\x1B[38;2;29;29;29m"}█${"\x1B[38;2;150;150;150m"}███████${"\x1B[0m"} ${z($("faf"))} ${Z(`v${OX}`)}`);let V="\x1B[38;2;39;174;96m";console.log(`\x1B[48;2;29;29;29m${"\x1B[38;2;150;150;150m"}▀${"\x1B[48;2;150;150;150m"}${"\x1B[38;2;29;29;29m"}▀${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[0m ${Z("Nelly Never Forgets")}`),console.log(`${V}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`)}console.log(`${Z(` ${X}`)}`),console.log("");try{await a5(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${z("faf --help")} ${Z("for commands")}`)})();else m.addHelpText("after",["","Git-native (The GIT Version):"," faf diff [range] semantic context diff + score delta (A..B, A...B)"," faf diff --install-driver make native `git diff` render .faf deltas"," faf log score timeline across history (Proof-Over-Time)"," faf hooks --install pre-commit guard against context regression"," faf git <url> [--ref] instant scored context from any repo, any branch/tag","",' "FAF is to Context what Git is to Versions."',"","What touches what:"," read-only score check dna context drift log convert search share, diff (no --install-driver)"," sends data ai analyze (Anthropic API) · bench --submit (mcpaas.live)"," every command https://docs.faf.one/side-effects",""].join(`
672
672
  `)),m.parseAsync(process.argv).catch(($)=>{if(!i1($))throw $;console.error(n1($,xg())),process.exit(1)});function xg(){let $=process.argv[2];return m.commands.find((z)=>z.name()===$||z.aliases().includes($))?.options.some((z)=>z.long==="--force")??!1}
673
673
 
674
- //# debugId=83955078416BC2B864756E2164756E21
674
+ //# debugId=ABF7EC6D6BDBB65A64756E2164756E21
675
675
  //# sourceMappingURL=cli.js.map