On this page
Workspace data layer for monorepo support handling discovery, loading, saving, and resolution of workspaces from workspace.toml config.
#rlsbl.workspace
#rlsbl.workspace
Workspace data layer for monorepo support handling discovery, loading, saving, and resolution of workspaces from workspace.toml config.
#WorkspaceProject
Typed wrapper over a workspace.toml project dict.
Provides typed property access for known fields while preserving the underlying dict for round-trip serialization. Unknown fields are kept intact. Dict-like [], get(), and in access is supported for backward compatibility with code that treats projects as dicts.
#name
def name(self) -> str#path
def path(self) -> str#watch
def watch(self) -> list[str]#library
def library(self) -> bool#dev_node
def dev_node(self) -> bool#depends_on
def depends_on(self) -> list[str]#get
def get(self, key, default=None)Dict-like access for backward compatibility.
#to_dict
def to_dict(self) -> dictReturn the underlying dict for serialization.
#find_workspace_root
def find_workspace_root(start_path='.')Walk up from start_path looking for a .rlsbl-monorepo/workspace.toml.
Returns the directory containing .rlsbl-monorepo/, or None if not found.
#load_workspace
def load_workspace(root)Read and validate workspace.toml, returning a list of WorkspaceProject.
Each project has at least 'path' (str) and 'name' (str, defaults to basename of path). The returned WorkspaceProject instances support dict-like access for backward compatibility.
Raises FileNotFoundError if workspace.toml doesn't exist. Raises ValueError on invalid structure.
#save_workspace
def save_workspace(root, projects)Write workspace.toml atomically using tomlkit for clean TOML output.
Preserves top-level sections, comments, and formatting from the existing file by reading it with tomlkit first and modifying the [[projects]] array in-place. Falls back to creating a new document when the file does not yet exist.
Creates .rlsbl-monorepo/ directory if it doesn't exist.
#resolve_project
def resolve_project(root, cwd='.')Determine which project cwd is inside, returning a WorkspaceProject or None.
If multiple projects match (nested paths), returns the most specific one.