#!/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 ``conform`` tool.
#
# This is the only file that knows about the repository layout.
# The conform tool itself is fully portable — all repo-specific paths
# are supplied via the conform.toml config file.
#
# Usage:
# py/bin/conform check-model Run all model conformance tests
# py/bin/conform check-model anthropic Run specific plugin(s)
# py/bin/conform check-model --use-cli Legacy genkit CLI fallback
# py/bin/conform check-plugin Check plugins have conformance files
# py/bin/conform list List plugins, runtimes, and readiness
# py/bin/conform --help Show help
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PY_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
CONFORM_CONFIG="${PY_DIR}/tests/conform/conform.toml"
# --config must come after the subcommand (it's a per-subcommand flag).
# Insert it right after the first positional argument (the subcommand).
args=()
subcommand_seen=false
for arg in "$@"; do
args+=("$arg")
if [[ "$subcommand_seen" == false && "$arg" != -* ]]; then
args+=("--config" "${CONFORM_CONFIG}")
subcommand_seen=true
fi
done
# If no subcommand was given, just pass --help.
if [[ "$subcommand_seen" == false ]]; then
args+=("--help")
fi
exec uv run --directory "${PY_DIR}" --active conform "${args[@]}"