INNER CODE UNIT · Python
install_skill
faridrashidi/cnsplots · src/cnsplots/_cli.py:209
def install_skill(
agent: str,
*,
force: bool,
base_dir: Path,
) -> tuple[tuple[str, Path], ...]:
"""Install and track packaged files, requiring force to update existing skills.
Forced updates overwrite current managed files, including local edits. Only
unchanged obsolete files are removed. Legacy installs are overlaid without
deleting untracked files; new conflicts in managed installs are refused.
All targets are validated and staged before replacing any installation.
"""
destinations = _destinations(agent, base_dir)
conflicts = tuple(path for _, path in destinations if path.exists())
if conflicts and not force:
paths = ", ".join(str(path) for path in conflicts)
raise FileExistsError(