From a482c39a611ceddd6818e74052ce849e5372a1a2 Mon Sep 17 00:00:00 2001 From: Terry Carson YM Date: Wed, 13 May 2026 12:27:37 +0800 Subject: [PATCH 1/2] fix: add .gbrain-source to .gitignore and create utility to ensure it in consumer repos Fixes #1384 Problem: When gbrain sources attach creates .gbrain-source in a consumer repo, the file is not added to .gitignore, causing it to be accidentally committed. This breaks per-worktree isolation as the pin file propagates across branches/worktrees. Solution: 1. Add .gbrain-source to gstack's own .gitignore 2. Create bin/gstack-gbrain-ensure-gitignore utility script that can be called after gbrain sources attach to ensure .gbrain-source is in consumer repo's .gitignore The utility script is idempotent and handles edge cases like missing .gitignore files and files without trailing newlines. Integration note: This utility should be called after any code path that runs 'gbrain sources attach' in a consumer repository. The exact integration point depends on where gstack invokes gbrain sources attach for consumer repos (not found in current v1.25.1.0 codebase, may be in future versions or external tooling). Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitignore | 1 + bin/gstack-gbrain-ensure-gitignore | 39 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 bin/gstack-gbrain-ensure-gitignore diff --git a/.gitignore b/.gitignore index 9e413bc56b..ce2208d15e 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ supabase/.temp/ # Throughput analysis — local-only, regenerate via scripts/garry-output-comparison.ts docs/throughput-*.json +.gbrain-source diff --git a/bin/gstack-gbrain-ensure-gitignore b/bin/gstack-gbrain-ensure-gitignore new file mode 100644 index 0000000000..c84d3ca3a5 --- /dev/null +++ b/bin/gstack-gbrain-ensure-gitignore @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# gstack-gbrain-ensure-gitignore — append .gbrain-source to .gitignore if missing +# +# Usage: +# gstack-gbrain-ensure-gitignore [path-to-repo] +# +# Ensures .gbrain-source is in the repo's .gitignore. Idempotent. +# Called after gbrain sources attach to prevent per-worktree pin from +# leaking across branches (per v1.29.0.0 changelog promise). +# +# Exit codes: +# 0 — success (entry added or already present) +# 1 — .gitignore unwritable or other IO error + +set -euo pipefail + +REPO_ROOT="${1:-.}" +GITIGNORE_PATH="$REPO_ROOT/.gitignore" +ENTRY=".gbrain-source" + +# Read existing .gitignore content (empty string if file doesn't exist) +existing="" +if [ -f "$GITIGNORE_PATH" ]; then + existing=$(cat "$GITIGNORE_PATH") +fi + +# Check if entry already exists (exact match on its own line) +if echo "$existing" | grep -qxF "$ENTRY"; then + exit 0 # Already present, nothing to do +fi + +# Append entry with proper newline handling +if [ -n "$existing" ] && [ "${existing: -1}" != $'\n' ]; then + # Existing content doesn't end with newline, add one first + echo "" >> "$GITIGNORE_PATH" +fi + +echo "$ENTRY" >> "$GITIGNORE_PATH" +exit 0 From 19684d95fadb5c776828b7b3009a57ae206beae6 Mon Sep 17 00:00:00 2001 From: Terry Carson YM Date: Wed, 13 May 2026 12:52:28 +0800 Subject: [PATCH 2/2] chore: bump VERSION to 1.33.3.0 Co-Authored-By: Claude Opus 4.6 (1M context) --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 0df2c524d3..06277cf607 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.33.2.0 +1.33.3.0