# Common recipes shared across all API packages
# Import this file in API-specific justfiles with: import '../common.just'
# Build API runtime: download OpenAPI spec and copy runtime files
build-api-runtime api_name spec_url api_dir output_dir:
#!/usr/bin/env bash
set -e
echo "📦 Building {{api_name}} runtime..."
echo " Output directory: {{output_dir}}"
just download-openapi-spec "{{spec_url}}" "{{api_dir}}"
just copy-runtime "{{api_dir}}" "{{output_dir}}"
just copy-patched-fastmcp "{{output_dir}}"
echo "✅ {{api_name}} runtime preparation complete"
# Download, merge, and validate OpenAPI spec
download-openapi-spec spec_url output_dir:
#!/usr/bin/env bash
# Get scripts directory relative to common.just location
SCRIPTS_DIR="$(dirname "{{source_file()}}")/../../scripts"
echo "🔍 Downloading and merging OpenAPI spec..."
python "$SCRIPTS_DIR/download_openapi_refs.py" \
"{{spec_url}}" \
"{{output_dir}}" \
openapi-spec.json
# Copy runtime files using rsync with include/exclude patterns
copy-runtime source_dir output_dir:
#!/usr/bin/env bash
echo "📁 Copying runtime files to {{output_dir}}..."
rsync -a --include='*.'{py,json,toml} --exclude='*' "{{source_dir}}/" "{{output_dir}}/"
# Copy patched fastmcp package to output directory
copy-patched-fastmcp output_dir:
#!/usr/bin/env bash
# Get repository root (common.just is at packages/apis/common.just)
REPO_ROOT="$(cd "$(dirname "{{source_file()}}")/../.." && pwd)"
FASTMCP_PATCHED_DIR="$REPO_ROOT/packages/fastmcp-patched"
echo "📦 Copying patched fastmcp to {{output_dir}}..."
rsync -a --exclude='*.dist-info' --exclude='__pycache__' "$FASTMCP_PATCHED_DIR/fastmcp/" "{{output_dir}}/fastmcp/"