On this page
Pre-push-check command that enforces JSONL commit coverage and warns on manual release-branch pushes, using git_util for monorepo-aware file filtering.
#rlsbl.commands.pre_push_check
#rlsbl.commands.pre_push_check
Pre-push-check command that verifies CHANGELOG.md contains an entry for the current version before allowing a git push to proceed.
#_get_release_branches
def _get_release_branches()Return the configured release-branch list.
Reads release_branches from .rlsbl/config.json if present; falls back to ["main", "master"] when the key is absent.
Raises :class:ValueError if the key is present but malformed (empty list or non-list value). An empty list would silently disable the manual-release-push warning, which is almost never what the user wants; require explicit removal of the key instead.
#_warn_if_manual_release_push
def _warn_if_manual_release_push(stdin_lines)Print a warning when a manual push targets a release branch.
Fires only when RLSBL_RELEASE_PUSH is NOT set (i.e. the push didn't originate from rlsbl release run/rlsbl release undo). Inspects the pushed refs and warns on any branch matching the configured release-branch list. Never blocks -- the warning is purely advisory.
#_detect_version
def _detect_version(dir_path='.')Detect version using registry adapters.
Returns (version_string, registry_name) or (None, None) if undetectable.
#_check_gitignore_guard
def _check_gitignore_guard(dir_path)Check that rlsbl-managed files are not gitignored.
Returns an error string listing gitignored paths, or None if all clear.
#_check_jsonl_changelog
def _check_jsonl_changelog(dir_path, refs, pushed_commits=None)Check JSONL changelog coverage for commits being pushed.
Verifies that every commit in the push range exists in at least one unreleased.jsonl entry's commits list.
When pushed_commits is provided, uses that set directly instead of calling _get_pushed_commits(refs). This allows callers (e.g. monorepo check) to pass a pre-filtered set of commits.
Returns None on success, or an error message string on failure.
#_get_pushed_commits
def _get_pushed_commits(refs)Get the set of commit SHAs being pushed.
Returns a set of full 40-char SHAs, or None on error.
#_read_stdin_lines
def _read_stdin_lines()Read raw pre-push hook stdin lines.
Returns a list of non-empty lines, or None if stdin is not readable or empty.
#_has_version_tag_push
def _has_version_tag_push(stdin_lines)Check whether any stdin line is pushing a version tag.
Version tags match refs/tags/v* (single-project) or refs/tags/@v (monorepo scoped tags like [email protected]).
Returns True if at least one line pushes a version tag.
#_parse_stdin_refs
def _parse_stdin_refs(stdin_lines=None)Parse pre-push hook stdin to extract (local_sha, remote_sha) pairs.
Each line is:
When stdin_lines is provided (a list of raw lines), parses those directly instead of reading stdin. When omitted, reads stdin via _read_stdin_lines().
Returns a list of (local_sha, remote_sha) tuples, or None if the input is empty or unreadable.
#_get_changed_files
def _get_changed_files(refs)Get the list of files changed across all pushed refs.
Returns a set of file paths relative to the repo root.
#_affected_projects
def _affected_projects(changed_files, projects)Determine which projects are affected by the changed files.
Returns a list of project dicts that have at least one changed file.
#_run_monorepo_check
def _run_monorepo_check(workspace_root, projects, changed_files, refs=None)Check changelogs for all affected monorepo projects.
Filters pushed commits per project so that a commit touching only one project does not require changelog coverage in other projects.
Returns exit code 0 on success, 1 if any project fails.
#run_cmd
def run_cmd(registry, args, flags)Check that CHANGELOG.md has an entry for the current project version.
In monorepo mode (when a workspace root is detected), parses the pushed ref range from stdin to determine which projects are affected, then checks each affected project's changelog independently.
In single-project mode, checks the current directory's changelog.
Exits 1 if any changelog entry is missing; exits 0 silently on success.