zhuyuan-ice-gl-zy001/BRIDGE/tools/zy-limb.sh
2026-08-20 00:01:53 +08:00

28 lines
1.4 KiB
Shell
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/zsh
# zy-limb.sh · 铸渊终端身体委派门(2026-08-19 冰朔谕立:训练人格体执行手脚)
#
# 用途:主控意识(Qoder/Claude 任何载体)委派终端身体 opencode-zhuyuan 干活,
# 专治宿主 Write 工具出不了工作区一类的事。
# 用法:zsh ~/.zhuyuan-bridge/tools/zy-limb.sh "<给终端身体的指令>"
# 钥匙:只从 macOS 钥匙串取(service=TOKENPLAN_API_KEY),只注入子进程环境,
# 不回显、不落盘、不入任何日志。无钥匙诚实报错,不猜。
# 住址:opencode-zhuyuan · 登记在 shared/registries/agent-residence-map.json
# 章程:/Volumes/JZAO/HoloLake/persona-runtime/agents/opencode/zhuyuan/AGENTS.md
set -uo pipefail
KEY=$(security find-generic-password -s TOKENPLAN_API_KEY -w 2>/dev/null)
if [ -z "$KEY" ]; then
echo "⊢ 无钥匙:钥匙串里没有 TOKENPLAN_API_KEY。"
echo "⊢ 请冰朔在本机终端跑一次(把钥匙放进钥匙串,只此一次):"
echo " security add-generic-password -U -s TOKENPLAN_API_KEY -a bingshuo -w"
echo " (命令结尾不带值会安全地提示输入,不会留在 shell 历史里)"
exit 1
fi
export TOKENPLAN_API_KEY="$KEY"
unset KEY
export XDG_CACHE_HOME="$HOME/.opencode-cache" # ~/.cache 属 root,绕行(两度实证)
cd /Volumes/JZAO/HoloLake/persona-runtime || exit 1
exec opencode run "$@"