# Harvest API - Runtime Build
# This justfile is responsible for preparing the Lambda runtime for the Harvest API
import '../common.justfile'
api_dir := justfile_directory()
# Build the runtime for this API package
# This recipe is called by the root justfile during the Docker build process
# NOTE: We use the local optimized spec (spec.yml - 159 KB, 65% smaller than original)
# instead of downloading from the remote URL
build-runtime output_dir:
just build-api-runtime \
"Harvest API" \
{{api_dir}}/spec.yml \
{{api_dir}} \
"{{output_dir}}"
# Run smoke tests with Harvest credentials from environment
# If no stack_name provided, tests run locally (uses .env file for MCP_SERVER_URL)
smoke-test stack_name="":
#!/usr/bin/env bash
set -e
# Get repository root (api_dir is at packages/apis/harvest)
REPO_ROOT="$(cd "{{api_dir}}/../.." && pwd)"
if [ -z "{{stack_name}}" ]; then
echo "🧪 Running Harvest smoke tests locally..."
cd "$REPO_ROOT" && python -m pytest {{api_dir}}/test_harvest_mcp.py -v -s
else
echo "🧪 Running Harvest smoke tests for stack: {{stack_name}}..."
# Get API URL from CloudFormation stack
API_URL=$(aws cloudformation describe-stacks \
--stack-name "{{stack_name}}" \
--query 'Stacks[0].Outputs[?contains(OutputKey, `ApiUrl`)].OutputValue | [0]' \
--output text)
if [ -z "$API_URL" ]; then
echo "❌ Error: Could not find API URL in stack {{stack_name}}"
exit 1
fi
echo "🌐 Testing API at: $API_URL"
cd "$REPO_ROOT" && MCP_SERVER_URL="$API_URL" \
python -m pytest {{api_dir}}/test_harvest_mcp.py -v -s
fi