Run draft-thread project scripts from resolved project/worktree cwd#1178
Open
juliusmarminge wants to merge 3 commits intomainfrom
Open
Run draft-thread project scripts from resolved project/worktree cwd#1178juliusmarminge wants to merge 3 commits intomainfrom
juliusmarminge wants to merge 3 commits intomainfrom
Conversation
|
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 Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
- use shared `projectScriptCwd` to choose worktree path or project root - allow script execution from local draft threads with correct terminal env/cwd - add ChatView and helper tests covering local and worktree draft cases
- Treat detached `xterm-helper-textarea` nodes as unfocused in `isTerminalFocused` - Add unit tests for connected vs detached terminal focus behavior - Harden ChatView shortcut test flow by waiting for keybindings/config and retrying route transition
b06a638 to
1caf2db
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
projectScriptCwdhelper.ChatView.mockServiceWorker.js(MSW package version bump) and include updated Vitest attachment artifact.Testing
apps/web/src/projectScripts.test.ts: verifiesprojectScriptCwdprefersworktreePathand falls back to projectcwd.apps/web/src/components/ChatView.browser.tsx: verifiesterminalOpenfor local draft thread usescwd: /repo/projectand env includesT3CODE_PROJECT_ROOT.apps/web/src/components/ChatView.browser.tsx: verifies worktree draft thread usescwd: /repo/worktrees/feature-draftand env includes bothT3CODE_PROJECT_ROOTandT3CODE_WORKTREE_PATH.apps/web/src/components/ChatView.browser.tsx: verifies script command dispatch (terminalWrite) sends the expected command (bun run lint\r).bun fmt,bun lint,bun typecheck.Note
Medium Risk
Changes how/when project scripts and terminal actions resolve their working directory and enables running scripts from local draft threads, which could alter where commands execute. Adds test coverage that should catch regressions, but behavior impacts developer workflow and command execution paths.
Overview
Project script execution now resolves cwd consistently across project vs worktree threads.
ChatViewswitches from ad-hocworktreePath ?? project.cwdlogic to a sharedprojectScriptCwdhelper, and uses that value for git queries and the header “Open in…” target.Draft-thread behavior changes: the guard that previously blocked
runProjectScripton non-server threads is removed, allowing scripts to run from local draft threads as well.Regression coverage added: new unit tests cover
projectScriptCwdandisTerminalFocused(now ignores detached DOM nodes), plus browser-levelChatViewtests assertingterminalOpen/terminalWritecwd/env for local vs worktree draft threads and more robust shortcut assertions. Also updates.gitignoreto ignore.tanstack.Written by Cursor Bugbot for commit 1caf2db. This will update automatically on new commits. Configure here.
Note
Run draft-thread project scripts from the resolved project or worktree cwd
runProjectScriptthat blocked execution for non-server (local draft) threads, so project scripts now run from draft threads.projectScriptCwdin projectScripts.ts to resolve the working directory: usesworktreePathwhen present, otherwise falls back to the projectcwd.isTerminalFocusedin terminalFocus.ts to returnfalsefor xterm helper textareas that are detached from the DOM.cwdand env vars (T3CODE_PROJECT_ROOT,T3CODE_WORKTREE_PATH) in terminal open/write payloads.runProjectScriptno longer skips execution for local draft threads; scripts will now open a terminal using the resolved project or worktree path.Macroscope summarized 1caf2db.