Repository navigation
Replies: 2 comments 1 reply
|
@juliusmarminge Hi, real human here. This is to allow T3 action scripts to open the browser preview on a different port for each worktree. I had Opus 5.5 & Sol 6.1 implement and review the work, as per @t3dotgg's preferences. Would be very grateful if you could take a quick look and approve if you're happy. |
1 reply
|
+1. I run several worktrees at once, each with its own dev server on a different port. A fixed Preview URL always opens the wrong one. The |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem
A project action's Preview URL is a fixed string. That works for one checkout, but not when several worktrees of the same project run their dev servers at once: each server needs its own port, and the Preview URL can only name one. Agents in each thread have the same gap, since nothing tells them which port their worktree's server is on.
My current annoying workaround is a small landing page on a fixed port that every worktree registers its dev server with, plus a Preview URL pointing at that page. It works, but it's hideous.
Proposal
Add a "Reserve a port" option to actions. Like "Open preview automatically", it's available once the action has a Preview URL.
T3CODE_PREVIEW_PORT, alongside the existingT3CODE_PROJECT_ROOTandT3CODE_WORKTREE_PATH. It needs its own terminal because a shell's environment is fixed when the shell starts. Running the action again reuses that terminal.${T3CODE_PREVIEW_PORT}, which T3 replaces before opening the preview. Nothing else in the URL is expanded.Actions without the option behave exactly as they do today. The preview still opens only after the command reaches the terminal, and a launch that fails never opens it.
Related
#20055 proposes opening whatever server an action's terminal starts, which suits servers you can't configure. A reserved port covers what detection can't. The port is known before the server starts, so agents and config can use it. It usually stays the same between runs, so the preview keeps its cookies and logins. And an action that starts both a frontend and an API doesn't leave T3 guessing which one to open. The two fit together.
I'm building this now and plan to open a PR that links back here. If this isn't a direction you'd accept, or you'd want a different scope, I'd rather hear it before the PR than after.
All reactions