Problem
In auto-worktree mode (steady-state sync on protected branch), Pull-SDLC.ai.ps1 prints
Scaffolded consumer-owned files from templates:
+ .github/instructions/project.instructions.md
+ README.md
Open each file and fill in the sections, then commit them to your repo.
but those files are NOT present in the consumer's project tree. They were scaffolded into .worktrees/sdlc-sync/ (the inner Invoke-PullSDLC call's RepoRoot) and committed to chore/sdlc-sync. The intent is that the PR merge brings them back into main, but:
- If PR creation fails (e.g. force-push race against a previously-merged scratch branch,
Head sha can't be blank GraphQL error), the files are stranded in the worktree branch and never appear in the consumer's working tree.
- Even when the PR succeeds, the files are not visible until the user merges the PR and pulls
main -- which contradicts the printed message Open each file and fill in the sections, then commit them to your repo (implying they exist right now).
This is misleading at best and a silent data-loss vector at worst.
Proposal
Move the scaffold step out of the inner (worktree) Invoke-PullSDLC and run it in the parent consumer tree from the outer call, AFTER Invoke-AutoWorktreeSync returns. Consumer-owned scaffolded files are already in \ -- they're never part of the upstream-replay diff -- so creating them outside the PR commit is correct.
Concretely:
- Add
-NoScaffold switch to Invoke-PullSDLC; Invoke-AutoWorktreeSync passes it to the inner call so the worktree no longer scaffolds.
- In
Invoke-PullSDLC, after Invoke-AutoWorktreeSync returns rc=0, run Invoke-TemplateScaffold against the parent \ so the consumer immediately sees the new files in their project tree.
- The
Open each file ... message follows the actual file creation, in the same shell.
Tests to add
- In auto-worktree mode, scaffolded files appear in the parent
\, not in the worktree.
- Scaffold runs even when
Invoke-AutoWorktreeSync returns 0 with a failed PR step.
- Direct (commit-on-main / bootstrap) mode continues to scaffold in-place exactly as before.
Note
.gitattributes is being removed from the scaffold map in a separate change -- it will be owned by Initialize-GitDefaults.ps1 instead. This issue concerns the remaining scaffolded files: CLAUDE.project.md, .github/instructions/project.instructions.md, README.md, tasks/README.md.
Problem
In auto-worktree mode (steady-state sync on protected branch), Pull-SDLC.ai.ps1 prints
but those files are NOT present in the consumer's project tree. They were scaffolded into
.worktrees/sdlc-sync/(the innerInvoke-PullSDLCcall'sRepoRoot) and committed tochore/sdlc-sync. The intent is that the PR merge brings them back intomain, but:Head sha can't be blankGraphQL error), the files are stranded in the worktree branch and never appear in the consumer's working tree.main-- which contradicts the printed messageOpen each file and fill in the sections, then commit them to your repo(implying they exist right now).This is misleading at best and a silent data-loss vector at worst.
Proposal
Move the scaffold step out of the inner (worktree)
Invoke-PullSDLCand run it in the parent consumer tree from the outer call, AFTERInvoke-AutoWorktreeSyncreturns. Consumer-owned scaffolded files are already in\-- they're never part of the upstream-replay diff -- so creating them outside the PR commit is correct.Concretely:
-NoScaffoldswitch toInvoke-PullSDLC;Invoke-AutoWorktreeSyncpasses it to the inner call so the worktree no longer scaffolds.Invoke-PullSDLC, afterInvoke-AutoWorktreeSyncreturns rc=0, runInvoke-TemplateScaffoldagainst the parent\so the consumer immediately sees the new files in their project tree.Open each file ...message follows the actual file creation, in the same shell.Tests to add
\, not in the worktree.Invoke-AutoWorktreeSyncreturns 0 with a failed PR step.Note
.gitattributesis being removed from the scaffold map in a separate change -- it will be owned byInitialize-GitDefaults.ps1instead. This issue concerns the remaining scaffolded files:CLAUDE.project.md,.github/instructions/project.instructions.md,README.md,tasks/README.md.