mirror of
https://github.com/garrytan/gstack.git
synced 2026-06-24 18:50:03 +02:00
chore: merge origin/main (v1.37.0.0 split-engine gbrain) + bump to v1.38.0.0
Main shipped v1.37.0.0 (split-engine gbrain) while this PR was in review. Merge resolved cleanly on bin/gstack-artifacts-init (allowlist patterns from both branches coexist). CHANGELOG entry retained for our changes, version header bumped from 1.36.0.0 to 1.38.0.0. Migration script renamed: gstack-upgrade/migrations/v1.36.0.0.sh -> v1.38.0.0.sh, with internal references and the test file updated to match. VERSION + package.json: 1.38.0.0. Regenerated SKILL.md across 12 hosts and refreshed golden fixtures. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Executable
+92
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env bash
|
||||
# Migration: v1.37.0.0 — split-engine gbrain (remote MCP brain + optional
|
||||
# local PGLite for code search per worktree).
|
||||
#
|
||||
# Per plan D5: prints a ONE-TIME discoverability notice for existing
|
||||
# Path 4 users who don't yet have a local engine. They learn that
|
||||
# symbol-aware code search (gbrain code-def / code-refs / code-callers)
|
||||
# is now available via /setup-gbrain Step 4.5 if they want it.
|
||||
#
|
||||
# When to print the notice (state match — all conditions must hold):
|
||||
# - ~/.claude.json declares mcpServers.gbrain.{type|transport} = http|sse|url
|
||||
# OR mcpServers.gbrain.url is set (remote-http MCP active)
|
||||
# - ~/.gbrain/config.json is absent (no local engine yet)
|
||||
# - User has not previously opted out via:
|
||||
# ~/.claude/skills/gstack/bin/gstack-config set local_code_index_offered true
|
||||
#
|
||||
# When silent: anything else (Path 1/2/3 users, anyone already on PGLite,
|
||||
# anyone who opted out, anyone without remote-http MCP).
|
||||
#
|
||||
# Idempotency: writes a touchfile at ~/.gstack/.migrations/v1.37.0.0.done
|
||||
# on completion. Re-running this script is silent if the touchfile exists,
|
||||
# OR if local_code_index_offered=true.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ -z "${HOME:-}" ]; then
|
||||
echo " [v1.37.0.0] HOME is unset — skipping migration." >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
GSTACK_HOME="${GSTACK_HOME:-$HOME/.gstack}"
|
||||
MIGRATIONS_DIR="$GSTACK_HOME/.migrations"
|
||||
DONE_TOUCH="$MIGRATIONS_DIR/v1.37.0.0.done"
|
||||
CONFIG_BIN="$HOME/.claude/skills/gstack/bin/gstack-config"
|
||||
CLAUDE_JSON="$HOME/.claude.json"
|
||||
GBRAIN_CONFIG="$HOME/.gbrain/config.json"
|
||||
|
||||
mkdir -p "$MIGRATIONS_DIR"
|
||||
|
||||
# Idempotency: already-ran skips silently.
|
||||
if [ -f "$DONE_TOUCH" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# User opt-out skips silently AND records done.
|
||||
if [ -x "$CONFIG_BIN" ]; then
|
||||
if [ "$("$CONFIG_BIN" get local_code_index_offered 2>/dev/null)" = "true" ]; then
|
||||
touch "$DONE_TOUCH"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# State match: remote-http MCP active?
|
||||
is_remote_http_mcp() {
|
||||
[ -f "$CLAUDE_JSON" ] || return 1
|
||||
command -v jq >/dev/null 2>&1 || return 1
|
||||
local mtype murl
|
||||
mtype=$(jq -r '.mcpServers.gbrain.type // .mcpServers.gbrain.transport // empty' "$CLAUDE_JSON" 2>/dev/null)
|
||||
murl=$(jq -r '.mcpServers.gbrain.url // empty' "$CLAUDE_JSON" 2>/dev/null)
|
||||
case "$mtype" in
|
||||
url|http|sse) return 0 ;;
|
||||
esac
|
||||
[ -n "$murl" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
# State match: local engine absent?
|
||||
is_local_engine_missing() {
|
||||
[ ! -f "$GBRAIN_CONFIG" ]
|
||||
}
|
||||
|
||||
if is_remote_http_mcp && is_local_engine_missing; then
|
||||
cat <<'NOTICE'
|
||||
|
||||
┌──────────────────────────────────────────────────────────────────┐
|
||||
│ gstack v1.37.0.0 — split-engine gbrain │
|
||||
│ │
|
||||
│ Symbol-aware code search is now available on this machine. │
|
||||
│ Your remote brain at gbrain MCP keeps working as today; you can │
|
||||
│ add a tiny local PGLite (~30s, no accounts) for `gbrain │
|
||||
│ code-def` / `code-refs` / `code-callers` queries per worktree. │
|
||||
│ │
|
||||
│ Run /setup-gbrain to opt in at Step 4.5. Or skip this notice │
|
||||
│ permanently: │
|
||||
│ gstack-config set local_code_index_offered true │
|
||||
└──────────────────────────────────────────────────────────────────┘
|
||||
|
||||
NOTICE
|
||||
fi
|
||||
|
||||
# Always touch done so we don't print again, regardless of state-match outcome.
|
||||
touch "$DONE_TOUCH"
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Migration: v1.36.0.0 — add root-level design + test-plan patterns to
|
||||
# Migration: v1.38.0.0 — add root-level design + test-plan patterns to
|
||||
# .brain-allowlist, .brain-privacy-map.json, and .gitattributes (#1452).
|
||||
#
|
||||
# Why a migration: gstack-artifacts-init regenerates these files but also
|
||||
@@ -21,7 +21,7 @@ PRIVACY="${GSTACK_HOME}/.brain-privacy-map.json"
|
||||
GITATTRS="${GSTACK_HOME}/.gitattributes"
|
||||
|
||||
MIGRATION_DIR="${GSTACK_HOME}/.migrations"
|
||||
DONE="${MIGRATION_DIR}/v1.36.0.0.done"
|
||||
DONE="${MIGRATION_DIR}/v1.38.0.0.done"
|
||||
|
||||
mkdir -p "${MIGRATION_DIR}" 2>/dev/null || true
|
||||
if [ -f "${DONE}" ]; then
|
||||
@@ -67,12 +67,12 @@ if [ -f "${PRIVACY}" ]; then
|
||||
added_any=1
|
||||
else
|
||||
rm -f "${PRIVACY}.tmp"
|
||||
echo " [v1.36.0.0] WARN: jq failed to patch ${PRIVACY}; skipping pattern ${PATTERN}." >&2
|
||||
echo " [v1.38.0.0] WARN: jq failed to patch ${PRIVACY}; skipping pattern ${PATTERN}." >&2
|
||||
fi
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo " [v1.36.0.0] WARN: jq not found; skipping privacy-map repair. Install jq and re-run gstack-upgrade, or run gstack-artifacts-init manually." >&2
|
||||
echo " [v1.38.0.0] WARN: jq not found; skipping privacy-map repair. Install jq and re-run gstack-upgrade, or run gstack-artifacts-init manually." >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -92,7 +92,7 @@ fi
|
||||
touch "${DONE}"
|
||||
|
||||
if [ "${added_any}" = "1" ]; then
|
||||
echo " [v1.36.0.0] allowlist/privacy-map/gitattributes patched for root-level design + test-plan artifacts (idempotent)" >&2
|
||||
echo " [v1.38.0.0] allowlist/privacy-map/gitattributes patched for root-level design + test-plan artifacts (idempotent)" >&2
|
||||
fi
|
||||
|
||||
# NEVER `git commit + push` from this migration. The user controls when the
|
||||
Reference in New Issue
Block a user