[PR #341] [MERGED] Support running multiple Yaak instances via git worktrees #263

Closed
opened 2026-03-22 21:11:44 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mountain-loop/yaak/pull/341
Author: @gschier
Created: 1/3/2026
Status: Merged
Merged: 1/3/2026
Merged by: @gschier

Base: mainHead: feature/worktree-port-configuration


📝 Commits (10+)

  • f5c9860 Git hook for getting work trees to work without port conflicts
  • b36bdb8 Fix duplicate package script entry
  • 54c0257 Also copy editor config folders in work tree setup hook
  • 5b01299 Dynamic port working for tauri?
  • 2b72b12 Fix editor config folder copying in post-checkout hook
  • 93a69a0 Add worktree management skill for Claude
  • 098bb1a Fix Vite env loading to support .env.local files
  • 103e9ee Fix env loading path and prefix
  • 3de3b0f Use dotenv-cli to load .env.local in app-dev script
  • ed79088 Update Zed Develop task to use npm run app-dev

📊 Changes

9 files changed (+425 additions, -47 deletions)

View changed files

.claude/skills/worktree.md (+35 -0)
.husky/post-checkout (+1 -0)
📝 package-lock.json (+140 -0)
📝 package.json (+5 -1)
📝 plugins-external/mcp-server/src/index.ts (+1 -1)
scripts/git-hooks/post-checkout.mjs (+153 -0)
scripts/run-dev.mjs (+49 -0)
📝 src-tauri/src/lib.rs (+36 -31)
📝 src-web/vite.config.ts (+5 -14)

📄 Description

Summary

Adds automatic port configuration and setup for git worktrees, allowing multiple Yaak instances to run simultaneously without conflicts.

Changes

  • Git post-checkout hook: Automatically configures unique ports for each worktree in .env.local
    • First worktree: ports 1421/64344
    • Second worktree: ports 1422/64345, etc.
    • Main worktree continues using default ports 1420/64343
  • Editor config copying: Automatically copies gitignored editor folders (.zed, .idea, etc.) from main worktree
  • Vite configuration: Updated to load environment variables from .env.local using loadEnv()
  • Tauri configuration: Dynamic devUrl override via environment variable in app-dev script
  • MCP server: Configurable port via YAAK_PLUGIN_MCP_SERVER_PORT
  • Husky integration: Cross-platform git hook management
  • Claude skill: Added worktree management skill to standardize worktree paths to ../yaak-worktrees/<NAME>

How to use

# Create a new worktree
git worktree add ../yaak-worktrees/feature-name

# The hook automatically:
# - Creates .env.local with unique ports
# - Copies editor config folders
# - Runs npm install && npm run bootstrap

# Run the app in the worktree
npm run app-dev  # Uses port from .env.local

# Delete worktree when done
git worktree remove ../yaak-worktrees/feature-name

Testing

  • Created multiple test worktrees successfully
  • Verified unique port assignment
  • Confirmed editor config folders are copied
  • Tested running multiple instances simultaneously

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mountain-loop/yaak/pull/341 **Author:** [@gschier](https://github.com/gschier) **Created:** 1/3/2026 **Status:** ✅ Merged **Merged:** 1/3/2026 **Merged by:** [@gschier](https://github.com/gschier) **Base:** `main` ← **Head:** `feature/worktree-port-configuration` --- ### 📝 Commits (10+) - [`f5c9860`](https://github.com/mountain-loop/yaak/commit/f5c9860a724bdb65d2544b0b5c44427d521646de) Git hook for getting work trees to work without port conflicts - [`b36bdb8`](https://github.com/mountain-loop/yaak/commit/b36bdb8bbbb2a1cbbdbc9456725a82a40940d7c2) Fix duplicate package script entry - [`54c0257`](https://github.com/mountain-loop/yaak/commit/54c0257ffd9ba3fcbcdb4ab9906298e8b1b189de) Also copy editor config folders in work tree setup hook - [`5b01299`](https://github.com/mountain-loop/yaak/commit/5b012999a6f1bad2fa0da5fc2dfddb44406932bf) Dynamic port working for tauri? - [`2b72b12`](https://github.com/mountain-loop/yaak/commit/2b72b123c75f672b2bce207505f6d91be62e4b41) Fix editor config folder copying in post-checkout hook - [`93a69a0`](https://github.com/mountain-loop/yaak/commit/93a69a08c61daac4ce477a92cd71995c4b86ccb6) Add worktree management skill for Claude - [`098bb1a`](https://github.com/mountain-loop/yaak/commit/098bb1a029eaad0ffe5823e463d7bab7779f7a66) Fix Vite env loading to support .env.local files - [`103e9ee`](https://github.com/mountain-loop/yaak/commit/103e9ee30c27f5db319899620d3c9c06073d6818) Fix env loading path and prefix - [`3de3b0f`](https://github.com/mountain-loop/yaak/commit/3de3b0fb22768b4c914accbf5d8060b300f4b1bf) Use dotenv-cli to load .env.local in app-dev script - [`ed79088`](https://github.com/mountain-loop/yaak/commit/ed7908821e70eb521d5addac5deaf2d126bddf67) Update Zed Develop task to use npm run app-dev ### 📊 Changes **9 files changed** (+425 additions, -47 deletions) <details> <summary>View changed files</summary> ➕ `.claude/skills/worktree.md` (+35 -0) ➕ `.husky/post-checkout` (+1 -0) 📝 `package-lock.json` (+140 -0) 📝 `package.json` (+5 -1) 📝 `plugins-external/mcp-server/src/index.ts` (+1 -1) ➕ `scripts/git-hooks/post-checkout.mjs` (+153 -0) ➕ `scripts/run-dev.mjs` (+49 -0) 📝 `src-tauri/src/lib.rs` (+36 -31) 📝 `src-web/vite.config.ts` (+5 -14) </details> ### 📄 Description ## Summary Adds automatic port configuration and setup for git worktrees, allowing multiple Yaak instances to run simultaneously without conflicts. ## Changes - **Git post-checkout hook**: Automatically configures unique ports for each worktree in `.env.local` - First worktree: ports 1421/64344 - Second worktree: ports 1422/64345, etc. - Main worktree continues using default ports 1420/64343 - **Editor config copying**: Automatically copies gitignored editor folders (.zed, .idea, etc.) from main worktree - **Vite configuration**: Updated to load environment variables from `.env.local` using `loadEnv()` - **Tauri configuration**: Dynamic devUrl override via environment variable in `app-dev` script - **MCP server**: Configurable port via `YAAK_PLUGIN_MCP_SERVER_PORT` - **Husky integration**: Cross-platform git hook management - **Claude skill**: Added worktree management skill to standardize worktree paths to `../yaak-worktrees/<NAME>` ## How to use ```bash # Create a new worktree git worktree add ../yaak-worktrees/feature-name # The hook automatically: # - Creates .env.local with unique ports # - Copies editor config folders # - Runs npm install && npm run bootstrap # Run the app in the worktree npm run app-dev # Uses port from .env.local # Delete worktree when done git worktree remove ../yaak-worktrees/feature-name ``` ## Testing - Created multiple test worktrees successfully - Verified unique port assignment - Confirmed editor config folders are copied - Tested running multiple instances simultaneously --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-22 21:11:44 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/yaak#263