Skip to content

fix(gbrain-sync): append .gbrain-source to consumer repo's .gitignore after attach#1501

Open
NikhileshNanduri wants to merge 1 commit into
garrytan:mainfrom
NikhileshNanduri:fix/1384-gbrain-source-gitignore-consumer-repo
Open

fix(gbrain-sync): append .gbrain-source to consumer repo's .gitignore after attach#1501
NikhileshNanduri wants to merge 1 commit into
garrytan:mainfrom
NikhileshNanduri:fix/1384-gbrain-source-gitignore-consumer-repo

Conversation

@NikhileshNanduri
Copy link
Copy Markdown

Summary

Fixes #1384.

The v1.29.0.0 changelog explicitly promised:

.gbrain-source added to .gitignore so per-worktree pin doesn't leak across branches.

The original patch only added .gbrain-source to gstack's own .gitignore. Consumer repos were never updated, so the pin file shows up as an untracked file and can get committed accidentally, silently overwriting other Conductor sibling worktrees' per-worktree source IDs on next pull.

This patch adds the entry idempotently to the consumer repo's .gitignore immediately after a successful gbrain sources attach, inside runCodeImport. The write is wrapped in a non-fatal try/catch so read-only checkouts don't fail the whole stage.

What changed

  • bin/gstack-gbrain-sync.ts: after gbrain sources attach succeeds, append .gbrain-source to <root>/.gitignore if not already present.

Test plan

  • Run /sync-gbrain in a repo with no existing .gbrain-source line in .gitignore — line is appended after attach
  • Run /sync-gbrain again in the same repo — line is NOT duplicated (idempotent)
  • Run /sync-gbrain in a repo with no .gitignore — file is created with .gbrain-source
  • Existing tests pass: bun test (doc-inventory and Supabase failures are pre-existing on main)

🤖 Generated with Claude Code

… after attach

Closes garrytan#1384. The v1.29.0.0 changelog promised that .gbrain-source would
be added to the consuming repo's .gitignore; the original patch only added
it to gstack's own .gitignore. Conductor sibling worktrees sharing the same
repo+branch would overwrite each other's per-worktree pin on every pull.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/sync-gbrain doesn't add .gbrain-source to consumer repo's .gitignore (v1.29.0.0 changelog promised it)

1 participant