Skip to content

feat(server): run the setup script in every repo of a multi-repo worktree - #328

Merged
LoganRupe merged 1 commit into
multi-repo-workspacesfrom
feature/multi-repo/setup-script-per-repo
Sep 30, 2026
Merged

LoganRupe merged 1 commit into
multi-repo-workspacesfrom
feature/multi-repo/setup-script-per-repo

Conversation

@LoganRupe

@LoganRupe LoganRupe commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

What Changed

A multi-repo isolated run now starts the project's setup script in every repo's worktree, not just the first one.

  • Each repo runs in its own terminal. The first repo keeps setup-<id> and the others get setup-<id>-<repo>.
  • The worktree setup card still has one Setup stage. Output lines are prefixed [repo], and failures name the repo (web: exit 1). A script not marked async holds the agent until every repo finishes. Cancel closes every setup terminal.
  • Scripts get T3CODE_REPO_ROOT, which points at the repo's original checkout. A multi-repo project's T3CODE_PROJECT_ROOT is the folder holding the .code-workspace file, so before this a script couldn't find the repo to copy .env* from.

Single-repo runs are unchanged.

Why

Cousin repos came up with no .env and no dependencies, so the agent spent its first minutes on setup in every repo after the first. Tools like spawnpoint solve this outside T3. This change makes the setup script we already have cover every repo instead.

Every repo runs the same script. A script that needs to differ per repo can branch on files or on T3CODE_REPO_ROOT.

UI Changes

compare.mp4

Before: the card only shows setting up api, and there's one setup terminal. After: [api] and [web] both run, each in its own terminal.

Copilot AI balanced review requested due to automatic review settings September 30, 2026 05:00
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Terminal ID truncation can collide and stop earlier repository setup processes.

Review effort: Balanced
Findings: 1 High severity · 1 Low severity

Open (2)
What changed in this PR

Runs setup scripts across every repository in multi-repo worktrees.

Changes:

  • Launches and tracks per-repository setup terminals.
  • Adds repository-labelled output, failures, and cancellation.
  • Exposes T3CODE_REPO_ROOT and adds multi-repo coverage.
File Description
apps/​server/​src/​ws.ts Coordinates multi-repo setup execution and tracking.
apps/​server/​src/​server.test.ts Tests multi-repo setup behavior.
apps/​server/​src/​project/​ProjectSetupScriptRunner.ts Adds repository environment and terminal suffix support.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +356 to +360
const terminalId =
input.preferredTerminalId ??
(input.terminalIdSuffix
? `setup-${script.id}-${input.terminalIdSuffix}`.slice(0, 128)
: `setup-${script.id}`);
const env = projectScriptRuntimeEnv({
project: { cwd: project.workspaceRoot },
worktreePath: input.worktreePath,
...(input.repoRoot ? { extraEnv: { T3CODE_REPO_ROOT: input.repoRoot } } : {}),
@LoganRupe
LoganRupe merged commit 9fffb69 into multi-repo-workspaces Sep 30, 2026
8 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants