Conversation
t3.json worktree setup used ln -sf and shell variable expansion, which fails under Windows PowerShell when creating worktrees. Replace it with a small Node script that installs deps, links or copies .env files, and warms the web dep cache.
Pin cwd for installs, only replace env files when the project root has a source, create parent dirs, and cover link/copy/skip paths so Windows setup does not wipe local .env files.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved 6091865 This PR replaces POSIX shell commands with a cross-platform Node.js script for developer worktree setup. The change only affects development tooling (not production runtime), includes comprehensive tests, and maintains equivalent functionality while adding Windows compatibility. You can customize Macroscope's approvability policy. Learn more. |
Review: rmSync before symlink/copy could delete a locally edited worktree .env if the replacement then failed. Stage to a temp path and only rename over the destination after the operation succeeds; restore from backup on swap failure.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1cb172a. Configure here.
Review: resolve alone missed worktree junctions/symlinks to the project root, and a directory source could symlink-succeed on POSIX. Use realpath for identity, skip non-files without touching the destination, and cover both cases in tests.
CDVolvik
left a comment
There was a problem hiding this comment.
Windows verification (PowerShell 5.1 + Node 22.14, Developer Mode on).
The old t3.json command is broken here exactly as described:
ln : The term 'ln' is not recognized as the name of a cmdlet, function,
script file, or operable program.
scripts/setup-worktree.test.ts: 6/6. The link path works on this box — symlinkSync(..., "file") succeeded and lstat reports a symlink (so the copy fallback is unexercised here). spawnSync("node", ["-e", "..."], { shell: true }) does pass the args through cmd.exe on this Node, so the vp i / node …/warm-dep-cache.ts spawn shape is fine.
I did not run the full setup (vp i + cache warm) in a real worktree. The unchecked items in the test plan are still the missing piece.
One small gap: the junction/same-path test returns if symlinkSync(..., "junction") throws, so CI on a box without that permission never sees skipped-same-path. The missing-source and not-a-file cases still pin the "don't delete the worktree .env" rule.
|
Superseded by #13589, which landed the same cross-OS worktree setup approach ( |
|
Superseded by #13589 |

Problem
Worktree setup from
t3.jsonis typed into a terminal viaProjectSetupScriptRunner. The command usedln -sf,&&, and `` expansion, which fails under Windows PowerShell/cmd — so new worktrees on Windows never get deps, env files, or a warm web cache.Fix
Replace the shell one-liner with
node scripts/setup-worktree.tsthat:vp iwith the worktree as cwd.envfiles into the worktree (copy if symlink is denied)Does not delete a worktree
.envwhen the project root has no source yet. Parent dirs are created as needed.Test plan
vp test run scripts/setup-worktree.test.ts(link / copy / skip-missing / same-path)lnerrors.envappears in the worktree (link or copy) when present on the project rootModel: Grok 4.5 · Harness: Grok Build
Note
Medium Risk
Touches worktree bootstrap and
.envlinking/copying with filesystem staging/rollback; a bug could leave worktrees without deps or with wrong env files, especially on Windows.Overview
Replaces the POSIX-only worktree setup command in
t3.json(vp i && ln -sf ...) withnode scripts/setup-worktree.ts, so setup works under PowerShell/cmd on Windows.The new script installs deps, links
.envandinfra/relay/.envfrom the project root into the worktree (falling back to copy when symlinks are denied), then warms the web dep cache. Linking uses staging + backup/rename so a failed mid-flight write does not wipe a local worktree.env, and missing sources are skipped instead of deleting the destination.Adds unit coverage for path resolution, link/copy, same-path/junction skips, missing sources, and non-file sources.
Reviewed by Cursor Bugbot for commit 6091865. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Replace inline shell worktree setup with a Node script in
scripts/setup-worktree.tsnode scripts/setup-worktree.ts, removing the dependency on a POSIX shell.projectRootandworktreefrom environment variables, installs dependencies viavp i, links or copies configured.envfiles, and warms the web dep cache.Macroscope summarized 6091865.