rlsbl v0.113.0 /rlsbl.targets
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

python
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

python
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 optional releasable key.
  • workspace_root: path to the monorepo root (str or Path).

Returns:

  • Path string to the releasable config directory, or None.

#_parse_target_entry

python
def _parse_target_entry(entry, base_dir)

Parse a target config entry (string or dict) into a TargetEntry.

#_auto_detect

python
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

python
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.json exists** (discovery case): fall through

to auto-detection from project file manifests.

  • **.rlsbl/config.json exists but merged config has no targets

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

python
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 targets list;
  • - None, when the targets key is absent (callers fall through to

member-level detection -- backward compat for releasables that haven't declared targets yet).

  • Raises ConfigError when targets is an explicitly empty list, or a present-but-non-list value (string, dict, ...) -- the same loud story as validate_config_schema. A non-list value is never silently treated as absent. This keeps the two releasable target-resolution paths (collect_releasable_targets used by release init, and validate_release_targets used by release run) behaving identically on the banned config, instead of one short-circuiting while the other silently falls through.

#collect_releasable_targets

python
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.

Search