rlsbl v0.113.0 /rlsbl.commands.monorepo.releasable_rename
On this page

Rename a releasable group across workspace.toml, state directories, and publish gate prefixes, with optional alias tag creation.

#rlsbl.commands.monorepo.releasable_rename

#rlsbl.commands.monorepo.releasable_rename

Rename a releasable group: rlsbl monorepo rename-releasable <old> <new>.

Renaming a releasable is a coordinated, idempotent operation:

  1. Rewrite workspace.toml in place -- the [[releasables]] table's

name field and every member project's releasable field -- preserving comments and key order.

  1. Move the releasable's state directory

(.rlsbl-monorepo/releasables/<old> -> <new>).

  1. Delete the moved changes/.validated cache (the tag glob changes, so the

validation cache is stale).

  1. Re-run monorepo sync to regenerate the publish gate prefixes and CI

router.

  1. Commit all of the above as a single commit.

Then, last, when the releasable's tag_format contains {name} (so the tag prefix actually changes), a boundary alias tag for the current version is created at the commit the old current-version tag points to and pushed. This is the single sanctioned remote action. Historical releases stay under the old prefix and are no longer managed by rlsbl release edit/deprecate/yank.

The flow is idempotent: a crash between the local commit and the tag push is healed by re-running the command, which detects the already-renamed state and finishes the tag step.

#validate_releasable_name

python
def validate_releasable_name(name)

Validate a releasable name against the [a-z][a-z0-9-]* charset.

Raises WorkspaceError when the name is not a string, is empty, or contains characters outside the allowed set (lowercase letters, digits, hyphens, starting with a letter).

#_is_clean_tree

python
def _is_clean_tree(root)

Return True when the git working tree at root is clean.

#_tag_exists_local

python
def _tag_exists_local(root, tag)

Return True when tag exists as a local git tag.

#_tag_exists_remote

python
def _tag_exists_remote(root, remote, tag)

Return True when tag exists on remote.

#_resolve_tag_commit

python
def _resolve_tag_commit(root, tag)

Resolve tag to the commit SHA it points to, or None if absent.

#_saferm_file

python
def _saferm_file(path)

Delete a stale cache file via saferm (audit trail; -f skips if missing).

#_apply_workspace_rename

python
def _apply_workspace_rename(root, old, new)

Rewrite workspace.toml in place: releasable name + member fields.

Locates the [[releasables]] table whose name equals old and rewrites only its name field, then rewrites every [[projects]] table whose releasable equals old to new. All other content -- comments, key order, unrelated tables -- is preserved byte-for-byte.

Returns True when the file was changed, False when it was already renamed (idempotent no-op).

#_apply_local_rename

python
def _apply_local_rename(root, old, new)

Perform the local mutations (steps 1-5) and commit them as one commit.

Structured as a standalone callable so tests can invoke it (simulating a crash right after the commit, before the tag push) and then run the full command to verify the tag step is healed on re-run.

#_push_timeout_for

python
def _push_timeout_for(root, name)

Resolve the push timeout from the renamed releasable's config.

The workspace root has no per-package .rlsbl/config.json in a monorepo, so this reads the releasable-level config and lets the standard push_timeout key (or its default) apply.

#_finish_alias_tag

python
def _finish_alias_tag(root, old_tag, new_tag, remote, *, push_timeout)

Create the boundary alias tag and push it, idempotently.

Returns a status dict describing what was (or would have been) done.

#_unmanaged_history_note

python
def _unmanaged_history_note(old_prefix, new_prefix)

Return the note printed after a prefix-changing rename.

#_check_no_inflight

python
def _check_no_inflight(root, releasables)

Hard-error when a release is in flight (workspace or member state).

#_announce_rename

python
def _announce_rename(old, new, alias_tag)

Print what the rename is about to do, before any mutation.

An announcement, not a gate. monorepo rename-releasable is not consequential: the local half is an ordinary commit, and the only thing that leaves the repo is one ADDITIVE alias tag that can be deleted. The flow is idempotent, so a re-run heals a partial rename.

#rename_releasable

python
def rename_releasable(workspace_root, old_name, new_name, *, dry_run=False, remote='origin')

Rename releasable old_name to new_name in a monorepo workspace.

See the module docstring for the full ordered flow. Returns a result dict describing what was done (or, in dry-run, what would be done).

Raises WorkspaceError on any preflight failure.

Search