13 lines
559 B
Python
13 lines
559 B
Python
import pathlib
|
|
|
|
|
|
def project_key(checkout_root: str, home: pathlib.Path) -> str:
|
|
"""The checkout's path relative to ~/code, or to / outside it: what names a project's loop-claude session, its entry in the models file and its archive folder."""
|
|
return checkout_root.removeprefix(f"{home / 'code'}/").lstrip("/")
|
|
|
|
|
|
def checkout_of(key: str, home: pathlib.Path) -> str:
|
|
"""The checkout a project key names: under ~/code where that folder exists, else under /."""
|
|
under_code = home / "code" / key
|
|
return str(under_code) if under_code.is_dir() else f"/{key}"
|