rlsbl.targets.protocol
Release target protocol -- the formal interface all targets must implement.
Classes
ReleaseTarget
Protocol defining a release target.
Targets handle version management, scaffolding templates, and optionally build/publish steps for a specific ecosystem (npm, pypi, go, codehome, docs, etc.)
name
def name(self) -> str
Unique identifier for this target (e.g. 'npm', 'pypi', 'codehome').
scope
def scope(self) -> Literal['root', 'subdir']
Whether this target operates on the whole repo or a subdirectory.
detect
def detect(self, dir_path: str) -> bool
Check if this target is present/applicable in the given directory.
read_version
def read_version(self, dir_path: str) -> str
Read the current version from the target's manifest file.
write_version
def write_version(self, dir_path: str, version: str) -> None
Write a new version to the target's manifest file (atomic).
version_file
def version_file(self) -> str | None
Filename that holds the version (e.g. 'package.json'), or None if inherited.
tag_format
def tag_format(self, name: str | None, version: str) -> str
Format the git tag for a release.
name is the scoped component name (for subdir targets), version is the new version. Root targets typically ignore name and return f'v{version}'. Subdir targets return f'{name}@v{version}'.
template_dir
def template_dir(self) -> str | None
Absolute path to target-specific template directory, or None.
shared_template_dir
def shared_template_dir(self) -> str | None
Absolute path to shared template directory, or None.
template_vars
def template_vars(self, dir_path: str) -> dict[str, str]
Extract template placeholder values from the project.
template_mappings
def template_mappings(self) -> list[dict[str, str]]
Target-specific template-to-output-path mappings.
shared_template_mappings
def shared_template_mappings(self) -> list[dict[str, str]]
Shared template-to-output-path mappings.
check_project_exists
def check_project_exists(self, dir_path: str) -> bool
Check if the target's project file exists (alias for detect).
get_project_init_hint
def get_project_init_hint(self) -> str
Human-readable hint for initializing a project for this target.
build
def build(self, dir_path: str, version: str) -> None
Pre-publish build step (e.g. generate docs). No-op by default.
publish
def publish(self, dir_path: str, version: str) -> None
Post-push publish/deploy step. No-op by default.