name: sourcegraph-setup description: "First-time setup for the Sourcegraph code explorer. Installs dependencies, symlinks scripts to PATH, and configures authentication. Run this once after installing the plugin."
Sourcegraph Explorer Setup
One-time setup to install the Sourcegraph code search tools.
Instructions
Run all steps in order. If a step fails, report it but continue with the remaining steps.
Step 1: Install Python dependency
pip3 install cryptography
Step 2: Ensure ~/.local/bin exists and is on PATH
mkdir -p ~/.local/bin
Check if ~/.local/bin is on the user's PATH:
echo "$PATH" | tr ':' '\n' | grep -q "$HOME/.local/bin" && echo "OK: ~/.local/bin is on PATH" || echo "NEEDS FIX: ~/.local/bin is not on PATH"
If it's not on PATH, add it. Detect their shell and append the appropriate line:
# For zsh (most macOS users):
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
# For bash:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
Then source the config so it takes effect in the current session:
export PATH="$HOME/.local/bin:$PATH"
Step 3: Find the plugin directory and symlink scripts
The scripts are in the bin/ directory of this plugin. Find it:
# Look for the plugin in common locations
PLUGIN_DIR=""
for dir in \
~/.vibe/marketplace/plugins/sourcegraph-explorer \
~/Projects/static \
; do
if [ -f "$dir/bin/sg-search" ]; then
PLUGIN_DIR="$dir"
break
fi
done
if [ -z "$PLUGIN_DIR" ]; then
echo "ERROR: Could not find sourcegraph-explorer plugin directory"
echo "If you installed it somewhere custom, run:"
echo " ln -sf /path/to/plugin/bin/sg-* ~/.local/bin/"
else
echo "Found plugin at: $PLUGIN_DIR"
ln -sf "$PLUGIN_DIR/bin/sg-search" ~/.local/bin/sg-search
ln -sf "$PLUGIN_DIR/bin/sg-read" ~/.local/bin/sg-read
ln -sf "$PLUGIN_DIR/bin/sg-cookie-refresh" ~/.local/bin/sg-cookie-refresh
echo "Symlinked scripts to ~/.local/bin/"
ls -la ~/.local/bin/sg-*
fi
Step 4: Refresh cookies
Make sure the user is logged into Sourcegraph (https://sourcegraph.prod.databricks-corp.com) in their browser (Arc, Chrome, or Safari), then run:
sg-cookie-refresh
On first run, macOS will prompt for Keychain access. The user should click "Allow" or "Always Allow".
If this reports EXPIRED, the user needs to log into Sourcegraph in their browser and retry.
Step 5: Verify
Run a quick test search:
sg-search "repo:databricks-eng/universe type:repo count:1"
If this returns a result, setup is complete. Tell the user:
Setup complete. You can now ask questions about the Databricks codebase and I'll search through it via Sourcegraph. Try asking something like "How does the cluster creation API work?" or "What limits exist on SQL warehouse sizing?"
If you get auth errors later, just run
sg-cookie-refreshto refresh your session.