char-slop/berry
multipurpose self-modifiable agentic harness
git clone https://git.t4t.associates/char-slop/berry
a4e772a
main
1import type { Context } from "@earendil-works/chord" ; 2import { getOrThrow } from "@earendil-works/pi-durable/env" ; 3import type { Environment } from "@berry/api" ; 4 5export async function userDirectory ( 6env :Environment , 7variable :string , 8fallback :string [], 9context :Context , 10) :Promise < string > { 11const value = Object . entries ( env . variables ). find (([ name ]) => 12env . platform === "win32" ?name . toUpperCase () === variable :name === variable 13)?.[ 1 ]; 14return getOrThrow ( 15await ( value 16 ?env . absolutePath ( value , context ) 17 :env . joinPath ([ env . home , ...fallback ], context )), 18); 19}