[Sync] llm stuff
This commit is contained in:
@@ -1,4 +1,25 @@
|
||||
function opencodes --description 'contained opencode'
|
||||
function opencodes --description 'contained opencode (bwrap); extra args are passed to opencode'
|
||||
set -l cfg ~/.config/opencode
|
||||
# ~/.config/opencode is stowed as per-file symlinks into ~/.dots. Bind each link's real parent
|
||||
# dir read-only too, or the sandbox sees dangling links and opencode starts with NO config.
|
||||
set -l dirs
|
||||
for f in $cfg/* $cfg/*/*
|
||||
test -L $f; or continue
|
||||
set -l d (path resolve $f | path dirname)
|
||||
string match -q "$cfg*" $d; and continue
|
||||
contains -- $d $dirs; or set -a dirs $d
|
||||
end
|
||||
set -l binds
|
||||
for d in $dirs
|
||||
set -a binds --ro-bind $d $d
|
||||
end
|
||||
# --clearenv drops everything; pass through only what the TUI and its tools need.
|
||||
set -l env --setenv PATH /usr/local/bin:/usr/bin:/bin
|
||||
for v in HOME TERM COLORTERM LANG LC_ALL EDITOR OPENCODE_CONFIG DUSKADIY_API_KEY
|
||||
set -l val $$v
|
||||
test -n "$val"; and set -a env --setenv $v $val
|
||||
end
|
||||
mkdir -p ~/.cache/opencode ~/.local/state/opencode ~/.local/share/opencode
|
||||
bwrap \
|
||||
--unshare-all \
|
||||
--new-session \
|
||||
@@ -12,10 +33,13 @@ function opencodes --description 'contained opencode'
|
||||
--ro-bind /lib64 /lib64 \
|
||||
--ro-bind /bin /bin \
|
||||
--ro-bind /etc /etc \
|
||||
--ro-bind ~/.config/opencode ~/.config/opencode \
|
||||
--tmpfs /tmp/node-compile-cache \
|
||||
--ro-bind $cfg $cfg \
|
||||
$binds \
|
||||
--tmpfs /tmp \
|
||||
--bind ~/.cache/opencode ~/.cache/opencode \
|
||||
--bind ~/.local/state/opencode ~/.local/state/opencode \
|
||||
--bind ~/.local/share/opencode ~/.local/share/opencode \
|
||||
--bind "$(pwd)" "$(pwd)" \
|
||||
opencode
|
||||
--bind $PWD $PWD \
|
||||
$env \
|
||||
opencode $argv
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user