← Files SavvyARCHIVED FILE

skills/savvy/scripts/contracts/folder_target.py

944 Bytes · Oct 4, 2026 · 12:27 UTC

↓ Download file

"""Folder-target conventions shared across the toolchain.

Kept in `contracts` (no live-API dependency) so both the API client (`savant_api`) and the pure
stage-gate validators can agree on how a folder target is expressed without the validators having
to import the API package.
"""
from __future__ import annotations

# Reserved `--folder-id` / `folder.id` values meaning "the Home folder" (the namespace root,
# as the user sees it in the app) rather than a real folder id. `home` is the canonical
# spelling; `root` is kept as a legacy alias. The import API represents the Home folder as a
# missing folderId. Real folder ids are generated tokens, so these literal aliases never
# collide with one.
ROOT_FOLDER_ALIASES = {"home", "root"}


def is_root_folder_target(value: str | None) -> bool:
    """True when a folder-target value means the Home folder (namespace root)."""
    return (value or "").strip().lower() in ROOT_FOLDER_ALIASES

SHA-256: ba078faa8e0d1a90d41de69c95a46281d7760cbbcc94d0862f3ad6433c27482f