-
-
Notifications
You must be signed in to change notification settings - Fork 463
fix: bootstrap .gsd state in manual worktree creation #3447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ | |
| import type { ExtensionAPI, ExtensionCommandContext } from "@gsd/pi-coding-agent"; | ||
| import { loadPrompt } from "./prompt-loader.js"; | ||
| import { autoCommitCurrentBranch, getMainBranch, resolveGitHeadPath, nudgeGitBranchCache } from "./worktree.js"; | ||
| import { runWorktreePostCreateHook } from "./auto-worktree.js"; | ||
| import { runWorktreePostCreateHook, syncGsdStateToWorktree } from "./auto-worktree.js"; | ||
| import { showConfirm } from "../shared/tui.js"; | ||
| import { gsdRoot, milestonesDir } from "./paths.js"; | ||
| import { | ||
|
|
@@ -329,6 +329,9 @@ async function handleCreate( | |
| ctx.ui.notify(hookError, "warning"); | ||
| } | ||
|
|
||
| // Sync .gsd/ state from main into the new worktree (#3427) | ||
| syncGsdStateToWorktree(mainBase, info.path); | ||
|
|
||
|
Comment on lines
+332
to
+334
|
||
| // Track original cwd before switching | ||
| if (!originalCwd) originalCwd = basePath; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syncGsdStateToWorktree() is a no-op when the destination worktree doesn’t already have a
.gsd/directory (if (!existsSync(mainGsd) || !existsSync(wtGsd)) return). For manual worktree creation,.gsd/is commonly untracked and therefore won’t exist in the freshly created worktree, which means this call may not actually bootstrap any state (the #3427 failure case). Consider creating/initializing the worktree-local.gsd/directory (or reusing the auto-worktree planning-artifact seeding logic) before calling sync so/worktree createproduces an immediately usable workspace.