#!/usr/bin/env bash
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Wrapper script for the ``releasekit`` tool.
#
# This is the only file that knows about the repository layout.
# The releasekit tool itself is fully portable — all repo-specific
# settings are supplied via the releasekit.toml config file discovered
# automatically from the workspace root.
#
# Usage:
# py/bin/releasekit discover List all workspace packages
# py/bin/releasekit check Run workspace health checks
# py/bin/releasekit check --fix Auto-fix what can be fixed
# py/bin/releasekit plan Preview the execution plan
# py/bin/releasekit publish --dry-run Dry-run publish
# py/bin/releasekit graph Show the dependency graph
# py/bin/releasekit version Show computed version bumps
# py/bin/releasekit explain <CODE> Explain an error code
# py/bin/releasekit --help Show help
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PY_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
RELEASEKIT_DIR="${PY_DIR}/tools/releasekit"
# releasekit discovers the workspace root by walking up from CWD
# looking for pyproject.toml with [tool.uv.workspace], so we must
# run from within the workspace tree.
cd "${PY_DIR}"
exec uv run --directory "${RELEASEKIT_DIR}" releasekit "$@"