~cytrogen/gstack

ref: cdd6f7865d0edf741f658a256115cbf77dace61b gstack/browse/bin/remote-slug -rwxr-xr-x 572 bytes
cdd6f786 — Garry Tan feat: community wave — 7 fixes, relink, sidebar Write, discoverability (v0.13.5.0) (#641) 11 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env bash
# Output the remote slug (owner-repo) for the current git repo.
# Used by SKILL.md files to derive project-specific paths in ~/.gstack/projects/.
set -e
URL=$(git remote get-url origin 2>/dev/null || true)
if [ -n "$URL" ]; then
  # Strip trailing .git if present, then extract owner/repo
  URL="${URL%.git}"
  # Handle both SSH (git@host:owner/repo) and HTTPS (https://host/owner/repo)
  OWNER_REPO=$(echo "$URL" | sed -E 's#.*[:/]([^/]+)/([^/]+)$#\1-\2#')
  echo "$OWNER_REPO"
else
  basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
fi