Files
wehub-resource-sync dfb0b33892
Workflow Lint / actionlint (push) Waiting to run
Build CI Image / build (push) Waiting to run
Skill Docs Freshness / check-freshness (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 11:59:46 +08:00

15 lines
572 B
Bash
Executable File

#!/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