feat: Support OPENCLAW_HOME environment variable! (#194)

Author:    tobrainto <tobrainto@qq.com>
This commit is contained in:
tobrainto
2026-03-23 18:32:50 +08:00
committed by GitHub
parent e6406500f3
commit 7e66abe636
+9
View File
@@ -271,12 +271,21 @@ def _install_skill():
import importlib.resources import importlib.resources
# Determine skill install path # Determine skill install path
# Priority 1: OPENCLAW_HOME environment variable (if set)
# Priority 2: ~/.openclaw/skills (default)
# Priority 3: ~/.claude/skills (Claude Code)
# Priority 4: ~/.agents/skills (Generic agents)
skill_dirs = [ skill_dirs = [
os.path.expanduser("~/.openclaw/skills"), # OpenClaw os.path.expanduser("~/.openclaw/skills"), # OpenClaw
os.path.expanduser("~/.claude/skills"), # Claude Code (if exists) os.path.expanduser("~/.claude/skills"), # Claude Code (if exists)
os.path.expanduser("~/.agents/skills"), # Generic agents os.path.expanduser("~/.agents/skills"), # Generic agents
] ]
# Insert OPENCLAW_HOME path at the beginning if environment variable is set
openclaw_home = os.environ.get("OPENCLAW_HOME")
if openclaw_home:
skill_dirs.insert(0, os.path.join(openclaw_home, ".openclaw", "skills"))
installed = False installed = False
for skill_dir in skill_dirs: for skill_dir in skill_dirs:
if os.path.isdir(skill_dir): if os.path.isdir(skill_dir):