On this page
Release target registry and detection: maps ecosystem ids (npm, pypi, go, deno, zig, swift, hex, docker, maven, plain) to their target classes.
#rlsbl.targets
#rlsbl.targets
Release target discovery and registry that maps ecosystem identifiers (npm, pypi, go, deno, zig, swift, hex, docker, maven, plain) to their corresponding target classes for version bumps and scaffolding.
#TargetEntry
A detected target with its directory path.
#resolve_releasable_config_dir_for_ctx
def resolve_releasable_config_dir_for_ctx(ctx)Resolve the releasable config directory from a check context.
When ctx has workspace_root and project attributes (i.e. is a WorkspaceCheckContext), returns the releasable config dir path. Otherwise returns None.
Uses duck typing to avoid importing check_context (which would create a circular dependency).
#resolve_releasable_config_dir
def resolve_releasable_config_dir(proj, workspace_root)Resolve the releasable config directory for a workspace project.
Checks the project's releasable field (works with both WorkspaceProject objects and plain dicts). Returns the path to the releasable's state directory if the project belongs to a named releasable, or None otherwise.
Args:
proj: a WorkspaceProject or dict with optionalreleasablekey.workspace_root: path to the monorepo root (str or Path).
Returns:
- Path string to the releasable config directory, or None.
#_parse_target_entry
def _parse_target_entry(entry, base_dir)Parse a target config entry (string or dict) into a TargetEntry.
#_auto_detect
def _auto_detect(dir_path)Auto-detect targets from project file presence.
Returns list of TargetEntry(name, path) tuples for targets whose manifest files exist in dir_path.
#detect_targets
def detect_targets(dir_path='.', releasable_config_dir=None)Detect which targets are applicable in the given directory.
Uses read_project_config() with optional releasable-level inheritance to get the merged config view. If the merged config has a "targets" list, uses that (opt-in config). Each entry can be a plain string (defaults to dir_path) or a dict with "name" and optional "path" (subdirectory relative to dir_path).
Two-tier rule when targets key is absent from the merged config:
- **No
.rlsbl/config.jsonexists** (discovery case): fall through
to auto-detection from project file manifests.
- **
.rlsbl/config.jsonexists but merged config has notargets
key**: auto-detect to populate hints, then raise ConfigError listing detected targets as suggestions.
Args:
dir_path: project directory to scan.releasable_config_dir: optional path to a releasable's state
directory for config inheritance (4-level precedence).
Returns list of TargetEntry(name, path) tuples.
#read_releasable_targets
def read_releasable_targets(rel_config_path)Read the targets list from a releasable config, enforcing the ban.
Returns:
- - the declared list, when the config has a non-empty
targetslist; - -
None, when thetargetskey is absent (callers fall through to
member-level detection -- backward compat for releasables that haven't declared targets yet).
- Raises
ConfigErrorwhentargetsis an explicitly empty list, or a present-but-non-list value (string, dict, ...) -- the same loud story asvalidate_config_schema. A non-list value is never silently treated as absent. This keeps the two releasable target-resolution paths (collect_releasable_targetsused by release init, andvalidate_release_targetsused by release run) behaving identically on the banned config, instead of one short-circuiting while the other silently falls through.
#collect_releasable_targets
def collect_releasable_targets(releasable_name, member_projects, workspace_root)Collect targets for a releasable, preferring the releasable config.
If the releasable's config.json has a non-empty targets key, returns those directly (the releasable is the source of truth for targets in explicit mode). An explicitly empty targets list is banned and raises ConfigError (see read_releasable_targets). When the key is absent, falls back to unioning member-level detected targets for backward compatibility with releasables that haven't set targets yet.
Returns a deduplicated list of target names.