remote-slug
18 lines · browse/bin/remote-slug at 3f79d81
1#!/usr/bin/env bash
2# Output the remote slug for the current git repo.
3# Used by SKILL.md files to derive project-specific paths in ~/.gstack/projects/.
4# The slug rule (owner-repo for 2-segment remotes, "<last-two>-<16 hex>" for
5# 3+-segment nested-group remotes, #3003) is shared with bin/gstack-slug through
6# bin/gstack-remote-identity.sh.
7set -e
8. "$(dirname "$0")/../../bin/gstack-remote-identity.sh" 2>/dev/null || { echo "$0: bin/gstack-remote-identity.sh is missing. fix: reinstall with ./setup or /gstack-upgrade" >&2; exit 1; }
9URL=$(git remote get-url origin 2>/dev/null || true)
10_gri_slug=""
11if [ -n "$URL" ]; then
12 gstack_remote_slug "$URL"
13fi
14if [ -n "$_gri_slug" ]; then
15 echo "$_gri_slug"
16else
17 basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
18fi