Separate app DB per Git worktree (#348)

This commit is contained in:
Gregory Schier
2026-01-05 15:35:25 -08:00
committed by GitHub
parent dc51de2af1
commit 1f8fa0f8c3
2 changed files with 17 additions and 2 deletions

View File

@@ -86,6 +86,9 @@ try {
// Continue with default ports
}
// Get worktree name from current directory
const worktreeName = path.basename(process.cwd());
// Create .env.local with unique ports
const envContent = `# Auto-generated by git post-checkout hook
# This file configures ports for this worktree to avoid conflicts
@@ -95,6 +98,9 @@ YAAK_DEV_PORT=${maxDevPort}
# MCP Server port (main worktree uses 64343)
YAAK_PLUGIN_MCP_SERVER_PORT=${maxMcpPort}
# Database path prefix for worktree isolation
YAAK_DB_PATH_PREFIX=worktrees/${worktreeName}
`;
fs.writeFileSync(envLocalPath, envContent, 'utf8');