Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:A5c ai Babysitter release version resolver

From Leeroopedia
Knowledge Sources
Domains Release_Pipeline, Semantic_Versioning
Last Updated 2026-10-23 00:00 GMT

Overview

Concrete tool for resolving release versions and creating immutable release tags provided by the Babysitter release scripts.

Description

The release-version.cjs CLI and its library lib/release-version.cjs implement the single-authority version resolution for the Babysitter monorepo. The resolveReleaseVersion function takes a branch name, root package version, and short SHA, then computes the canonical release version and dist-tag. Prerelease branches (e.g. develop) produce commit-pinned prerelease versions; release branches (e.g. main) produce stable versions.

The ensureReleaseTag function creates an annotated git tag babysitter/<branch>/v<version> idempotently — it never pushes or moves an existing tag. The tag body carries provenance metadata (commit, source, run URL).

Usage

  • CI release flow: Run resolve to compute the release version, then pass it to subsequent pipeline steps.
  • Immutable tagging: Run ensure-tag after successful publication to create a permanent release marker.

Code Reference

Source Location

  • Repository: Babysitter
  • File (CLI): scripts/release-version.cjs:L122-205
  • File (library):** scripts/lib/release-version.cjs:L200-244 (resolve), L337-414 (ensure-tag)

Signature

// resolveReleaseVersion
function resolveReleaseVersion({ branch, rootVersion, shortSha }) {
  // Returns: { branch, releaseVersion, distTag, releaseTag, shortSha, commit? }
}

// ensureReleaseTag
function ensureReleaseTag({ version, branch, commit, source, runUrl }) {
  // Creates annotated git tag: babysitter/<branch>/v<version>
}

// parseReleaseTag
function parseReleaseTag(tag) {
  // Returns: { branch, releaseVersion, distTag, releaseTag }
}

// CLI
node scripts/release-version.cjs resolve --branch <b> --sha <short-sha> [--root-version <v>] [--github-output] [--write <file>] [--print <field>]
node scripts/release-version.cjs ensure-tag --version <v> --branch <b> [--commit <sha>] [--source <s>] [--run-url <u>]

Import

// CLI usage (no direct import needed)
// Library import:
const { resolveReleaseVersion, ensureReleaseTag, parseReleaseTag } = require("./scripts/lib/release-version.cjs");

I/O Contract

Inputs

Name Type Required Description
branch string Yes Git branch name
rootVersion string Yes Root package.json version (semver)
shortSha string Yes (prerelease) Short commit SHA (required for prerelease branches)
version string Yes (ensure-tag) Release version
commit string No (ensure-tag) Commit SHA

Outputs

Name Type Description
releaseVersion string Canonical semver version
distTag string npm dist-tag (latest, staging, develop)
releaseTag string Git tag name: babysitter/<branch>/v<version>

Usage Examples

Resolve Release Version

# Resolve for main branch (stable release)
node scripts/release-version.cjs resolve --branch main --sha abc12345 --github-output

# Resolve for develop branch (prerelease)
node scripts/release-version.cjs resolve --branch develop --sha abc12345 --write release-version.json

# Print a single field
node scripts/release-version.cjs resolve --branch main --sha abc12345 --print releaseVersion

Create Immutable Tag

# Create annotated release tag after successful publication
node scripts/release-version.cjs ensure-tag \
  --version 6.0.4 \
  --branch main \
  --commit abc12345def \
  --source publish-workflow \
  --run-url https://github.com/a5c-ai/babysitter/actions/runs/123

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment