Vanna Environment Sync
Synchronizes .env and .env.local files across all vanna-connect project clones and worktrees in ~/code/vanna.
Quick Start
Run this skill to:
- •Find all vanna-connect projects and worktrees
- •Identify the most recent
.envand.env.localfiles - •Copy them to all other locations (projects and worktrees)
The skill syncs these files:
Source files (.env) - contain secrets and configuration:
- •
typescript/apps/cli/.env - •
typescript/apps/web/.env - •
typescript/apps/admin/.env - •
typescript/servers/api-service/.env - •
typescript/servers/automations-service/.env - •
typescript/servers/adt-service/.env - •
typescript/domains/adt/.env - •
typescript/domains/fhirdb/.env
Generated files (.env.local) - auto-generated by setup:
- •
typescript/servers/api-service/.env.local - •
typescript/servers/automations-service/.env.local - •
typescript/servers/adt-service/.env.local - •
typescript/apps/cli/.env.local - •
typescript/apps/admin/.env.local - •
typescript/apps/web/.env.local
Instructions
Follow this workflow:
Step 1: Find All Projects and Worktrees
# Find regular project directories
echo "Regular projects:"
for dir in ~/code/vanna/*/; do
if [ -d "${dir}typescript" ]; then
echo " $(basename "$dir")"
fi
done
echo ""
echo "Worktree projects:"
# Find worktree directories
for worktree_dir in ~/code/vanna/*/.worktrees/*/; do
if [ -d "${worktree_dir}typescript" ]; then
parent=$(basename "$(dirname "$(dirname "$worktree_dir")")")
worktree=$(basename "$worktree_dir")
echo " $parent/.worktrees/$worktree"
fi
done
This identifies:
- •All directories in
~/code/vanna/*/that contain atypescriptsubdirectory - •All worktree directories in
~/code/vanna/*/.worktrees/*/that contain atypescriptsubdirectory
Step 2: Find Most Recent Files
echo "Checking .env files (source of truth):"
find ~/code/vanna -name ".env" -path "*/typescript/*" -type f -exec ls -lt {} + 2>/dev/null | head -20
echo ""
echo "Checking .env.local files (generated):"
find ~/code/vanna -name ".env.local" -path "*/typescript/*" -type f -exec ls -lt {} + 2>/dev/null | head -20
Look for the files with the most recent modification timestamps. Prioritize .env files as the source of truth. The source project will be the one with the newest complete set of files.
Step 3: Copy Files to All Projects and Worktrees
Use this script template:
#!/bin/bash
# Source directory with the most recent env files
SOURCE_DIR="/Users/juan.caicedo/code/vanna/[SOURCE_PATH]/typescript"
# Target locations (excluding the source)
# Can be either:
# - Regular projects: "project-name"
# - Worktrees: "project-name/.worktrees/worktree-name"
TARGETS=(
# List all locations except the source
)
# .env files (source of truth - contain secrets and config)
ENV_FILES=(
"apps/cli/.env"
"apps/web/.env"
"apps/admin/.env"
"servers/api-service/.env"
"servers/automations-service/.env"
"servers/adt-service/.env"
"domains/adt/.env"
"domains/fhirdb/.env"
)
# .env.local files (generated files)
ENV_LOCAL_FILES=(
"servers/api-service/.env.local"
"servers/automations-service/.env.local"
"servers/adt-service/.env.local"
"apps/cli/.env.local"
"apps/admin/.env.local"
"apps/web/.env.local"
)
# Copy files to each location
for target in "${TARGETS[@]}"; do
echo "Copying to $target..."
# Copy .env files
for file in "${ENV_FILES[@]}"; do
SOURCE_FILE="$SOURCE_DIR/$file"
TARGET_FILE="/Users/juan.caicedo/code/vanna/$target/typescript/$file"
if [ -f "$SOURCE_FILE" ]; then
mkdir -p "$(dirname "$TARGET_FILE")"
cp "$SOURCE_FILE" "$TARGET_FILE"
echo " ✓ Copied $file"
fi
done
# Copy .env.local files
for file in "${ENV_LOCAL_FILES[@]}"; do
SOURCE_FILE="$SOURCE_DIR/$file"
TARGET_FILE="/Users/juan.caicedo/code/vanna/$target/typescript/$file"
if [ -f "$SOURCE_FILE" ]; then
mkdir -p "$(dirname "$TARGET_FILE")"
cp "$SOURCE_FILE" "$TARGET_FILE"
echo " ✓ Copied $file"
fi
done
echo ""
done
echo "Done! Verifying copied files..."
echo ""
echo ".env files:"
find ~/code/vanna -name ".env" -path "*/typescript/*" -type f -exec ls -lt {} + 2>/dev/null | head -10
echo ""
echo ".env.local files:"
find ~/code/vanna -name ".env.local" -path "*/typescript/*" -type f -exec ls -lt {} + 2>/dev/null | head -10
Step 4: Report Results
After copying, show:
- •Source location used (project or worktree)
- •Number of .env files copied (8 files)
- •Number of .env.local files copied (6 files)
- •List of target locations updated (projects and worktrees)
- •Verification of new timestamps
Examples
Example 1: Sync from most recent project
Input: User runs /vanna-env-sync
Process:
- •Find locations:
burrito-vanna-connect-2,taco-vanna-connect,vanna-connect,vanna-connect/.worktrees/feature-branch, etc. - •Identify most recent:
burrito-vanna-connect-2(Feb 13 10:30) - •Copy 8 .env files and 6 .env.local files to all other locations
Output:
✓ Synced environment files from burrito-vanna-connect-2 .env files (8): - apps/cli/.env (contains EMAIL, secrets, config) - apps/web/.env - apps/admin/.env - servers/api-service/.env - servers/automations-service/.env - servers/adt-service/.env - domains/adt/.env - domains/fhirdb/.env .env.local files (6): - servers/api-service/.env.local - servers/automations-service/.env.local - servers/adt-service/.env.local - apps/cli/.env.local - apps/admin/.env.local - apps/web/.env.local To locations: - taco-vanna-connect - vanna-connect - vanna-connect-2 - vanna-connect/.worktrees/FT-257 - vanna-connect-exploration - vanna-connect-FT-654 - taco-backup All files updated to Feb 13 10:45
Example 2: No files found
If no env files exist, inform the user:
No .env or .env.local files found in any vanna-connect projects. Run the setup.sh script to generate them first.
Guidelines
- •Always identify the most recent files by timestamp (across both regular projects and worktrees)
- •Exclude the source location from the copy targets
- •Create target directories if they don't exist
- •Preserve file permissions when copying
- •Show verification of timestamps after copying
- •Handle missing files gracefully with clear messages
- •Use absolute paths to avoid directory confusion
- •Treat worktrees and regular projects equally when finding the most recent files
Common Scenarios
After running localSetup: The skill detects which location (project or worktree) has the newest setup and propagates it to all others.
After manual edits: If you manually update .env.local in one location, run this to sync across all locations.
Before switching projects or worktrees: Ensure all locations have consistent environment configuration before changing your working directory.
Working with git worktrees: When using git worktrees for parallel development, this ensures all worktrees have the same environment configuration as the main project.
Notes
About .env files:
- •
.envfiles are the source of truth - •They contain secrets (from 1Password), email, and configuration
- •Created by
setup.shusingop injectfrom.env.examplefiles - •Manual edits to
.envare persistent
About .env.local files:
- •
.env.localfiles are auto-generated from.envfiles - •Created by
pnpm run cli data-management local-setupand similar commands - •Manual edits will be lost on next setup run
- •For persistent changes, edit
.envinstead of.env.local
Sync strategy:
- •The skill syncs both
.envand.env.localfiles - •It prioritizes locations with the most recent
.envfiles - •Since
.env.localcan be regenerated from.env, having.envfiles is critical