d45d4fec8a
test / run tests/run_tests.py (pull_request) Successful in 14s
The copy logic was Docker-specific (docker exec mkdir / rm -rf, docker cp); it had no reason to live in a top-level skills module. Pull the body into DockerBottleBackend.provision_skills. skills.py keeps the host-side discovery + validation (host_skill_dir, host_skill_exists, require_host_skill, skills_validate_all). The orphaned CONTAINER_HOME / CONTAINER_SKILLS_DIR constants and the now-unused subprocess + info imports are removed.
35 lines
910 B
Python
35 lines
910 B
Python
"""Skill discovery and host-side validation. The copy step itself
|
|
lives on the backend (e.g. DockerBottleBackend.provision_skills)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
from .log import die
|
|
|
|
|
|
def host_skill_dir(name: str) -> str:
|
|
home = os.environ.get("HOME")
|
|
if not home:
|
|
die("HOME not set")
|
|
return f"{home}/.claude/skills/{name}"
|
|
|
|
|
|
def host_skill_exists(name: str) -> bool:
|
|
return os.path.isdir(host_skill_dir(name))
|
|
|
|
|
|
def require_host_skill(name: str) -> None:
|
|
if not host_skill_exists(name):
|
|
die(
|
|
f"skill '{name}' not found on host at {host_skill_dir(name)}. "
|
|
f"Create it under ~/.claude/skills/, then re-run."
|
|
)
|
|
|
|
|
|
def skills_validate_all(names: list[str]) -> None:
|
|
"""Use BEFORE the y/N so the user does not get asked about a plan
|
|
that's already known to fail."""
|
|
for n in names:
|
|
require_host_skill(n)
|