char-slop/berry
multipurpose self-modifiable agentic harness
git clone https://git.t4t.associates/char-slop/berry
c51dc10
main
1// Build libghostty-vt as wasm for the terminal extension, from a pinned ghostty, into 2// extensions/terminal/ghostty-vt.wasm. Run it as `deno task ghostty`; it needs git and zig 0.16 on PATH. 3 4import { join } from "node:path" ; 5 6const GHOSTTY = "7ec9e26a29399b30ef78f06985fc75045b3cecb6" ; 7 8const home = Deno . env . get ( "HOME" ) ?? "." ; 9const source = join ( Deno . env . get ( "XDG_CACHE_HOME" ) ?? join ( home , ".cache" ), "berry" , "ghostty" ); 10const target = new URL ( "./ghostty-vt.wasm" , import . meta. url ); 11 12async function run ( cwd :string , program :string , ...args :string []) { 13console . error ( `$ ${ program } ${ args . join ( " " )} ` ); 14const { success} = await new Deno . Command ( program , { 15 args, 16 cwd, 17stdout :"inherit" , 18stderr :"inherit" , 19}) 20. output (); 21if ( ! success ) throw new Error ( ` ${ program } failed` ); 22} 23 24await Deno . mkdir ( source , { recursive :true }); 25await run ( source , "git" , "init" , "--quiet" ); 26await run ( 27source , 28"git" , 29"fetch" , 30"--quiet" , 31"--depth" , 32"1" , 33"https://github.com/ghostty-org/ghostty" , 34GHOSTTY , 35); 36await run ( source , "git" , "checkout" , "--quiet" , "--force" , "FETCH_HEAD" ); 37await run ( 38source , 39"zig" , 40"build" , 41"-Demit-lib-vt" , 42"-Dtarget=wasm32-freestanding" , 43"-Doptimize=ReleaseSmall" , 44); 45await Deno . copyFile ( join ( source , "zig-out" , "bin" , "ghostty-vt.wasm" ), target ); 46console . error ( `built ${ target . pathname } ` );