worktree-operations
Provides guidance for managing git worktrees in the Orient monorepo, including setup, dependency installation, and troubleshooting.
Install this skill
Security score
The worktree-operations skill was audited on Feb 25, 2026 and we found 168 security issues across 4 threat categories, including 1 high-severity. Review the findings below before installing.
Categories Tested
Security Issues
Template literal with variable interpolation in command context
| 1992 | return fetchAPI(`/apps/${appName}/edit`, {...}); |
Template literal with variable interpolation in command context
| 1995 | return apiRequest(`/apps/${appName}/edit`, {...}); |
Template literal with variable interpolation in command context
| 2787 | ``` |
Template literal with variable interpolation in command context
| 2793 | ```yaml |
Template literal with variable interpolation in command context
| 2826 | ```yaml |
Template literal with variable interpolation in command context
| 2838 | ```bash |
Template literal with variable interpolation in command context
| 2910 | ```bash |
Template literal with variable interpolation in command context
| 2939 | ```bash |
Template literal with variable interpolation in command context
| 2972 | ```bash |
Template literal with variable interpolation in command context
| 3091 | ```bash |
Template literal with variable interpolation in command context
| 3103 | ```bash |
Template literal with variable interpolation in command context
| 3114 | ```bash |
Template literal with variable interpolation in command context
| 3130 | | `SQLITE_DB_PATH` | `.dev-data/instance-0/orient.db` | `.dev-data/instance-9/orient.db` | `.dev-data/instance-${ID}/...` | |
Template literal with variable interpolation in command context
| 3159 | ```bash |
Template literal with variable interpolation in command context
| 3282 | ```bash |
Template literal with variable interpolation in command context
| 3299 | ```bash |
Template literal with variable interpolation in command context
| 3409 | ```bash |
Curl to non-GitHub URL
| 128 | curl -s http://localhost:4099/global/health || echo "OpenCode not running" |
Curl to non-GitHub URL
| 2339 | TOKEN=$(curl -X POST http://localhost:4098/api/auth/login \ |
Curl to non-GitHub URL
| 2642 | curl http://localhost:13098/api/prompts |
Curl to non-GitHub URL
| 3610 | # Check API endpoints with curl |
Access to hidden dotfiles in home directory
| 375 | - Content-addressable store at `~/.pnpm-store` |
Access to hidden dotfiles in home directory
| 739 | export TURBO_CACHE_DIR=~/.turbo-cache |
Access to hidden dotfiles in home directory
| 742 | "build": "TURBO_CACHE_DIR=~/.turbo-cache turbo run build" |
Access to hidden dotfiles in home directory
| 764 | rm -rf ~/.turbo-cache |
Access to .env file
| 140 | # cp $ROOT_WORKTREE_PATH/.env .env |
Access to .env file
| 155 | # Your .env already points to the shared dev database |
Access to .env file
| 172 | 2. Updates your `.env` with the new SQLITE_DB_PATH |
Access to .env file
| 1817 | .env.local |
Access to .env file
| 1818 | .env.*.local |
Access to .env file
| 2035 | repoPath: process.env.REPO_PATH || process.cwd(), |
Access to .env file
| 2036 | worktreeBase: process.env.APP_WORKTREES_PATH, |
Access to .env file
| 2040 | process.env.OPENCODE_SERVER_URL || 'http://localhost:4099', |
Access to .env file
| 2041 | process.env.OPENCODE_DEFAULT_MODEL |
Access to .env file
| 2049 | portalBaseUrl: process.env.OPENCODE_PORTAL_URL || 'http://localhost:4099', |
Access to .env file
| 2112 | config: process.env.MY_CONFIG, |
Access to .env file
| 2240 | openCodeUrl: process.env.OPENCODE_SERVER_URL, |
Access to .env file
| 2241 | repoPath: process.env.REPO_PATH, |
Access to .env file
| 2317 | const db = createMiniappEditDatabase(process.env.SQLITE_DB_PATH!); |
Access to .env file
| 2360 | 7. **✅ Provide fallback defaults** - Use `process.env.VAR || 'default'` |
Access to .env file
| 2720 | Environment files (`.env`, `.env.local`) should be copied from main worktree: |
Access to .env file
| 2723 | cp $ROOT_WORKTREE_PATH/.env .env |
Access to .env file
| 2724 | cp $ROOT_WORKTREE_PATH/.env.local .env.local 2>/dev/null || true |
Access to .env file
| 2856 | **Critical Setup**: When copying `.env` from the main repo to a worktree, you MUST update instance-specific values or services will use the wrong database and storage. |
Access to .env file
| 2862 | **Root Cause**: `.env` contains hard-coded values for instance 0: |
Access to .env file
| 2914 | # 2. Update SQLITE_DB_PATH in .env |
Access to .env file
| 2915 | sed -i '' "s|^SQLITE_DB_PATH=.*|SQLITE_DB_PATH=.dev-data/instance-${AI_INSTANCE_ID}/orient.db|" .env |
Access to .env file
| 2922 | grep SQLITE_DB_PATH .env |
Access to .env file
| 2943 | # Check if S3_ENDPOINT exists in .env |
Access to .env file
| 2944 | if grep -q "^S3_ENDPOINT=" .env; then |
Access to .env file
| 2946 | sed -i '' "s|^S3_ENDPOINT=.*|S3_ENDPOINT=http://localhost:${MINIO_API_PORT}|" .env |
Access to .env file
| 2949 | echo "S3_ENDPOINT=http://localhost:${MINIO_API_PORT}" >> .env |
Access to .env file
| 2953 | if ! grep -q "^AI_INSTANCE_ID=" .env; then |
Access to .env file
| 2954 | echo "AI_INSTANCE_ID=${AI_INSTANCE_ID}" >> .env |
Access to .env file
| 2958 | grep -E "(S3_ENDPOINT|AI_INSTANCE_ID)" .env |
Access to .env file
| 2968 | #### Complete Worktree .env Setup Script |
Access to .env file
| 2975 | # Run after copying .env from main repo |
Access to .env file
| 2979 | echo "=== Configuring .env for Worktree Instance ===" |
Access to .env file
| 2993 | sed -i '' "s|^SQLITE_DB_PATH=.*|SQLITE_DB_PATH=.dev-data/instance-${AI_INSTANCE_ID}/orient.db|" .env |
Access to .env file
| 2998 | if grep -q "^S3_ENDPOINT=" .env; then |
Access to .env file
| 2999 | sed -i '' "s|^S3_ENDPOINT=.*|S3_ENDPOINT=http://localhost:${MINIO_API_PORT}|" .env |
Access to .env file
| 3001 | echo "S3_ENDPOINT=http://localhost:${MINIO_API_PORT}" >> .env |
Access to .env file
| 3006 | if ! grep -q "^AI_INSTANCE_ID=" .env; then |
Access to .env file
| 3007 | echo "" >> .env |
Access to .env file
| 3008 | echo "# Instance-specific configuration (auto-generated)" >> .env |
Access to .env file
| 3009 | echo "AI_INSTANCE_ID=${AI_INSTANCE_ID}" >> .env |
Access to .env file
| 3017 | echo " grep -E '(SQLITE_DB_PATH|S3_ENDPOINT|AI_INSTANCE_ID)' .env" |
Access to .env file
| 3023 | # After copying .env from main repo |
Access to .env file
| 3024 | cp $ROOT_WORKTREE_PATH/.env .env |
Access to .env file
| 3036 | After fixing `.env`, migrate secrets from `.env` to the database: |
Access to .env file
| 3039 | # Set master encryption key (from main repo's .env) |
Access to .env file
| 3057 | 1. Reads secrets from `.env` (e.g., `SLACK_BOT_TOKEN=xoxb-...`) |
Access to .env file
| 3060 | 4. Services load secrets from database instead of `.env` |
Access to .env file
| 3062 | **Important**: The migration script uses `SQLITE_DB_PATH` from `.env`, which is why fixing it first is critical! |
Access to .env file
| 3066 | After configuring `.env`, verify instance isolation: |
Access to .env file
| 3074 | DB_PATH=$(grep SQLITE_DB_PATH .env | cut -d'=' -f2) |
Access to .env file
| 3078 | MINIO_PORT=$(grep S3_ENDPOINT .env | grep -oE ':[0-9]+' | tr -d ':') |
Access to .env file
| 3098 | sed -i '' "s|^SQLITE_DB_PATH=.*|SQLITE_DB_PATH=.dev-data/instance-${AI_INSTANCE_ID}/orient.db|" .env |
Access to .env file
| 3109 | sed -i '' "s|instance-[0-9]|instance-${AI_INSTANCE_ID}|g" .env |
Access to .env file
| 3120 | echo "S3_ENDPOINT=http://localhost:${MINIO_API_PORT}" >> .env |
Access to .env file
| 3138 | - `SLACK_BOT_TOKEN` - Stored in database, not `.env` |
Access to .env file
| 3139 | - `OPENAI_API_KEY` - Stored in database, not `.env` |
Access to .env file
| 3144 | **CRITICAL**: When running multiple instances, you MUST verify that your `.env` file is properly configured for your instance. A common issue is copying `.env` from the main repo without updating inst |
Access to .env file
| 3148 | Run this one-liner to check if your `.env` matches your instance: |
Access to .env file
| 3152 | grep SQLITE_DB_PATH .env | grep -q "instance-$AI_INSTANCE_ID" && echo "✅ SQLITE_DB_PATH OK" || echo "❌ SQLITE_DB_PATH WRONG (expected instance-$AI_INSTANCE_ID)" |
Access to .env file
| 3189 | CURRENT_DB_PATH=$(grep "^SQLITE_DB_PATH=" .env 2>/dev/null | cut -d'=' -f2-) |
Access to .env file
| 3191 | echo " ❌ SQLITE_DB_PATH not found in .env" |
Access to .env file
| 3206 | S3_ENDPOINT=$(grep "^S3_ENDPOINT=" .env 2>/dev/null | cut -d'=' -f2-) |
Access to .env file
| 3221 | # Check AI_INSTANCE_ID in .env |
Access to .env file
| 3223 | echo "🔍 Checking AI_INSTANCE_ID in .env..." |
Access to .env file
| 3224 | ENV_INSTANCE_ID=$(grep "^AI_INSTANCE_ID=" .env 2>/dev/null | cut -d'=' -f2-) |
Access to .env file
| 3226 | echo " ⚠️ AI_INSTANCE_ID not set in .env (relies on auto-detection)" |
Access to .env file
| 3228 | echo " ❌ AI_INSTANCE_ID in .env ($ENV_INSTANCE_ID) differs from detected ($AI_INSTANCE_ID)" |
Access to .env file
| 3271 | echo " sed -i '' 's|instance-[0-9]|instance-$AI_INSTANCE_ID|g' .env" |
Access to .env file
| 3274 | echo " echo 'S3_ENDPOINT=http://localhost:$MINIO_API_PORT' >> .env" |
Access to .env file
| 3289 | # Fix SQLITE_DB_PATH in .env |
Access to .env file
| 3290 | sed -i '' "s|^SQLITE_DB_PATH=.*|SQLITE_DB_PATH=.dev-data/instance-${AI_INSTANCE_ID}/orient.db|" .env |
Access to .env file
| 3294 | grep SQLITE_DB_PATH .env |
Access to .env file
| 3304 | if grep -q "^S3_ENDPOINT=" .env; then |
Access to .env file
| 3306 | sed -i '' "s|^S3_ENDPOINT=.*|S3_ENDPOINT=http://localhost:${MINIO_API_PORT}|" .env |
Access to .env file
| 3309 | echo "S3_ENDPOINT=http://localhost:${MINIO_API_PORT}" >> .env |
Access to .env file
| 3313 | if ! grep -q "^AI_INSTANCE_ID=" .env; then |
Access to .env file
| 3314 | echo "AI_INSTANCE_ID=${AI_INSTANCE_ID}" >> .env |
Access to .env file
| 3317 | echo "Updated .env:" |
Access to .env file
| 3318 | grep -E "(S3_ENDPOINT|AI_INSTANCE_ID)" .env |
Access to .env file
| 3331 | grep SQLITE_DB_PATH .env |
Access to .env file
| 3389 | grep SQLITE_DB_PATH .env # Should show instance-1 |
Access to .env file
| 3391 | grep SQLITE_DB_PATH .env # Should show instance-6 |
Access to .env file
| 3399 | grep S3_ENDPOINT .env |
Access to .env file
| 3410 | # Copy .env from main and fix instance-specific values |
Access to .env file
| 3411 | cp /path/to/main/repo/.env .env |
Access to .env file
| 3420 | cat >> .env << EOF |
Access to .env file
| 3428 | sed -i '' "s|^SQLITE_DB_PATH=.*|SQLITE_DB_PATH=.dev-data/instance-${AI_INSTANCE_ID}/orient.db|" .env |
Access to .env file
| 3716 | - Environment files (`.env`) - Keep staging's version |
Access to .env file
| 3876 | cp $MAIN_REPO/.env .env |
Access to .env file
| 3877 | cp $MAIN_REPO/.env.local .env.local 2>/dev/null || true |
Access to .env file
| 3878 | cp $MAIN_REPO/.env.staging .env.staging 2>/dev/null || true |
Access to .env file
| 3891 | cp $ROOT_WORKTREE_PATH/.env .env |
Access to .env file
| 3897 | # Link to main repo's .env (changes affect all worktrees!) |
Access to .env file
| 3898 | ln -s $ROOT_WORKTREE_PATH/.env .env |
Access to .env file
| 4032 | # Conflict in .env or config files |
Access to .env file
| 4035 | git checkout --theirs .env |
Access to .env file
| 4036 | git checkout --theirs .env.local |
Access to .env file
| 4037 | git add .env .env.local |
Access to .env file
| 4196 | #### Pattern 3: Environment File Conflicts (.env, .env.local) |
Access to .env file
| 4202 | git checkout --ours .env |
Access to .env file
| 4203 | git checkout --ours .env.local 2>/dev/null || true |
Access to .env file
| 4204 | git add .env .env.local |
Access to .env file
| 4208 | cp .env .env.backup |
Access to .env file
| 4211 | git checkout --theirs .env |
Access to .env file
| 4214 | diff .env.backup .env # See what changed |
Access to .env file
| 4215 | # Add any new variables you need to .env.backup |
Access to .env file
| 4216 | mv .env.backup .env |
Access to .env file
| 4217 | git add .env |
Access to .env file
| 4305 | # Handle .env (keep ours) |
Access to .env file
| 4306 | if git diff --name-only --diff-filter=U | grep -q ".env"; then |
Access to .env file
| 4307 | git checkout --ours .env |
Access to .env file
| 4315 | git add pnpm-lock.yaml .env 2>/dev/null || true |
Access to .env file
| 4382 | 3. **✅ Keep your .env file (use `git checkout --ours .env`)** |
External URL reference
| 128 | curl -s http://localhost:4099/global/health || echo "OpenCode not running" |
External URL reference
| 1719 | target: 'http://localhost:4098', |
External URL reference
| 2040 | process.env.OPENCODE_SERVER_URL || 'http://localhost:4099', |
External URL reference
| 2049 | portalBaseUrl: process.env.OPENCODE_PORTAL_URL || 'http://localhost:4099', |
External URL reference
| 2152 | OPENCODE_SERVER_URL=http://localhost:4099 # OpenCode API endpoint |
External URL reference
| 2153 | OPENCODE_PORTAL_URL=http://localhost:4099 # OpenCode web portal |
External URL reference
| 2169 | OPENCODE_SERVER_URL=http://localhost:4099 # API endpoint |
External URL reference
| 2339 | TOKEN=$(curl -X POST http://localhost:4098/api/auth/login \ |
External URL reference
| 2346 | http://localhost:4098/api/apps/sessions/active |
External URL reference
| 2642 | curl http://localhost:13098/api/prompts |
External URL reference
| 2740 | Main repo (Instance 0): http://localhost:80 (ports: 80, 4098, 9000) |
External URL reference
| 2741 | Worktree 1 (Instance 1): http://localhost:1080 (ports: 1080, 5098, 10000) |
External URL reference
| 2742 | Worktree 2 (Instance 2): http://localhost:2080 (ports: 2080, 6098, 11000) |
External URL reference
| 2750 | echo "Dashboard: http://localhost:$NGINX_PORT" |
External URL reference
| 2866 | S3_ENDPOINT=http://localhost:9000 |
External URL reference
| 2946 | sed -i '' "s|^S3_ENDPOINT=.*|S3_ENDPOINT=http://localhost:${MINIO_API_PORT}|" .env |
External URL reference
| 2949 | echo "S3_ENDPOINT=http://localhost:${MINIO_API_PORT}" >> .env |
External URL reference
| 2964 | S3_ENDPOINT=http://localhost:18000 |
External URL reference
| 2999 | sed -i '' "s|^S3_ENDPOINT=.*|S3_ENDPOINT=http://localhost:${MINIO_API_PORT}|" .env |
External URL reference
| 3001 | echo "S3_ENDPOINT=http://localhost:${MINIO_API_PORT}" >> .env |
External URL reference
| 3003 | echo " ✅ S3_ENDPOINT: http://localhost:${MINIO_API_PORT}" |
External URL reference
| 3120 | echo "S3_ENDPOINT=http://localhost:${MINIO_API_PORT}" >> .env |
External URL reference
| 3131 | | `S3_ENDPOINT` | `http://localhost:9000` | `http://localhost:18000` | 9000 + (ID × 1000) | |
External URL reference
| 3209 | echo " Expected: http://localhost:$MINIO_API_PORT" |
External URL reference
| 3274 | echo " echo 'S3_ENDPOINT=http://localhost:$MINIO_API_PORT' >> .env" |
External URL reference
| 3306 | sed -i '' "s|^S3_ENDPOINT=.*|S3_ENDPOINT=http://localhost:${MINIO_API_PORT}|" .env |
External URL reference
| 3309 | echo "S3_ENDPOINT=http://localhost:${MINIO_API_PORT}" >> .env |
External URL reference
| 3424 | S3_ENDPOINT=http://localhost:$MINIO_API_PORT |
External URL reference
| 3611 | curl -H "Authorization: Bearer $TOKEN" http://localhost:4098/api/my-feature/test |
Install this skill with one command
/learn @orient-bot/worktree-operations