INNER CODE UNIT · Python

_checked_path

faridrashidi/cnsplots · src/cnsplots/_cli.py:67

def _checked_path(root: Path, name: str) -> Path:
    path = root
    for part in name.split("/"):
        if path.exists() and not path.is_dir():
            raise NotADirectoryError(f"not a skill directory: {path}")
        path = path / part
        if path.is_symlink():
            raise ValueError(f"refusing to follow skill symlink: {path}")
    return path


def _destinations(agent: str, base_dir: Path) -> tuple[tuple[str, Path], ...]:
    names = tuple(_AGENT_SKILL_DIRS) if agent == "all" else (agent,)
    root = base_dir.resolve()
    destinations = []
    for name in names:
        if name not in _AGENT_SKILL_DIRS:
            raise ValueError(f"unsupported agent: {name}")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…