From a7a8ca7f81231585f5308e6c1c8feda82606a1be Mon Sep 17 00:00:00 2001 From: Andreas Asprou Date: Tue, 30 Dec 2025 09:12:11 +0200 Subject: [PATCH 1/2] fix(desktop): copy gitignored .superset/ to worktrees When .superset/ is gitignored, it doesn't exist in new worktrees since git only includes tracked files. This caused setup scripts like './.superset/setup.sh' to fail with 'no such file or directory'. Now .superset/ is automatically copied from the main repo to worktrees if it exists in main but not in the worktree. --- .../trpc/routers/workspaces/utils/setup.ts | 33 +++++++++++++++++-- .../lib/trpc/routers/workspaces/workspaces.ts | 6 +++- apps/marketing/src/app/scripts/page.tsx | 3 +- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.ts b/apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.ts index 573a118a6e5..73a3d39fdc4 100644 --- a/apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.ts +++ b/apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.ts @@ -1,9 +1,38 @@ -import { existsSync, readFileSync } from "node:fs"; +import { cpSync, existsSync, readFileSync } from "node:fs"; import { join } from "node:path"; +import { CONFIG_FILE_NAME, PROJECT_SUPERSET_DIR_NAME } from "shared/constants"; import type { SetupConfig } from "shared/types"; +/** + * Copies the .superset directory from main repo to worktree if it exists in main but not in worktree. + * This handles the case where .superset is gitignored - worktrees won't have it since git only + * includes tracked files. By copying it, setup scripts like "./.superset/setup.sh" will work. + */ +export function copySupersetConfigToWorktree( + mainRepoPath: string, + worktreePath: string, +): void { + const mainSupersetDir = join(mainRepoPath, PROJECT_SUPERSET_DIR_NAME); + const worktreeSupersetDir = join(worktreePath, PROJECT_SUPERSET_DIR_NAME); + + // Only copy if it exists in main repo but not in worktree + if (existsSync(mainSupersetDir) && !existsSync(worktreeSupersetDir)) { + try { + cpSync(mainSupersetDir, worktreeSupersetDir, { recursive: true }); + } catch (error) { + console.error( + `Failed to copy ${PROJECT_SUPERSET_DIR_NAME} to worktree: ${error instanceof Error ? error.message : String(error)}`, + ); + } + } +} + export function loadSetupConfig(mainRepoPath: string): SetupConfig | null { - const configPath = join(mainRepoPath, ".superset", "config.json"); + const configPath = join( + mainRepoPath, + PROJECT_SUPERSET_DIR_NAME, + CONFIG_FILE_NAME, + ); if (!existsSync(configPath)) { return null; diff --git a/apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts b/apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts index 00b3ce23c77..670b8e41b11 100644 --- a/apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts +++ b/apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts @@ -33,7 +33,7 @@ import { worktreeExists, } from "./utils/git"; import { fetchGitHubPRStatus } from "./utils/github"; -import { loadSetupConfig } from "./utils/setup"; +import { copySupersetConfigToWorktree, loadSetupConfig } from "./utils/setup"; import { runTeardown } from "./utils/teardown"; import { getWorkspacePath } from "./utils/worktree"; @@ -124,6 +124,10 @@ export const createWorkspacesRouter = () => { startPoint, ); + // Copy .superset directory to worktree if it's gitignored (not present in worktree) + // This ensures setup scripts like "./.superset/setup.sh" work even when gitignored + copySupersetConfigToWorktree(project.mainRepoPath, worktreePath); + // Insert worktree const worktree = localDb .insert(worktrees) diff --git a/apps/marketing/src/app/scripts/page.tsx b/apps/marketing/src/app/scripts/page.tsx index e563ed56fa7..967ef4b1e8d 100644 --- a/apps/marketing/src/app/scripts/page.tsx +++ b/apps/marketing/src/app/scripts/page.tsx @@ -182,7 +182,8 @@ export default function ScriptsPage() { .gitignore {" "} - if you don't want to share configs + for personal configs - Superset will automatically copy it to + new worktrees
  • Or commit it to share workspace setup with your team
  • From 63775d25504596cfbbbbc9a88d6dbb2684da0d66 Mon Sep 17 00:00:00 2001 From: AviPeltz Date: Wed, 31 Dec 2025 09:21:17 -0800 Subject: [PATCH 2/2] docs(marketing): update scripts page to recommend committing .superset/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace advice to gitignore .superset/ with guidance to commit it. The gitignore advice caused the original issue - gitignored files don't exist in worktrees. Now we recommend committing the config and using environment variables for machine-specific values. The copySupersetConfigToWorktree fallback remains as a safety net. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- apps/marketing/src/app/scripts/page.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/apps/marketing/src/app/scripts/page.tsx b/apps/marketing/src/app/scripts/page.tsx index 967ef4b1e8d..0b1c8354fd4 100644 --- a/apps/marketing/src/app/scripts/page.tsx +++ b/apps/marketing/src/app/scripts/page.tsx @@ -174,18 +174,16 @@ export default function ScriptsPage() { to chain commands that depend on each other
  • - Add{" "} + Commit{" "} .superset/ {" "} - to your{" "} - - .gitignore - {" "} - for personal configs - Superset will automatically copy it to - new worktrees + to share workspace setup with your team +
  • +
  • + For machine-specific values, use environment variables in your + scripts instead of hardcoding paths
  • -
  • Or commit it to share workspace setup with your team