The lock file for ``skill_dir``, kept out of the skill directory. Inside it, a project-scope install would leave the file in the user's repository, and uninstall would have to delete a file another process may still hold - letting that process and a new one both own the lock.
(skill_dir: Path)
| 48 | |
| 49 | |
| 50 | def _skill_lock_path(skill_dir: Path) -> Path: |
| 51 | """The lock file for ``skill_dir``, kept out of the skill directory. |
| 52 | |
| 53 | Inside it, a project-scope install would leave the file in the user's |
| 54 | repository, and uninstall would have to delete a file another process may |
| 55 | still hold - letting that process and a new one both own the lock. |
| 56 | """ |
| 57 | try: |
| 58 | real = skill_dir.resolve() |
| 59 | except (OSError, RuntimeError): # symlink loop |
| 60 | real = skill_dir.absolute() |
| 61 | digest = hashlib.sha256(os.path.normcase(str(real)).encode("utf-8")).hexdigest()[:16] |
| 62 | return Path.home() / ".cache" / "graphify" / "skill-locks" / f"{digest}.lock" |
| 63 | |
| 64 | |
| 65 | # Lock files this thread holds: the CLI's refresh takes the lock and then calls |