AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Detect Repo Host

skill-sgaunet-claude-plugins-detect-repo-host · by sgaunet

Detect repository hosting service (GitHub/GitLab/Forgejo) from git remote and extract owner/repo/project_path. Internal utility skill used by commands that need platform-aware routing.

No reviews yet
0 installs
37 views
0.0% view→install

Install

$ agentstack add skill-sgaunet-claude-plugins-detect-repo-host

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-sgaunet-claude-plugins-detect-repo-host)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Detect Repo Host? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Detect Repository Host Skill

Detect the repository hosting service from git remote configuration and extract structured metadata for platform-aware command routing.

Overview

Many commands need to determine whether the current repository is hosted on GitHub, GitLab, or Forgejo to route CLI calls correctly. This skill centralizes that detection logic so commands can invoke it via the Skill tool instead of duplicating git remote -v parsing.

When to Use

  • Before calling GitHub, GitLab, or Forgejo CLI tools that require owner/repo or project_path
  • When a command needs to branch logic based on hosting platform
  • Any workflow requiring platform-aware routing

Workflow

Step 1: Read Git Remotes

git remote -v

Parse the output to find the origin remote (or the first available remote if origin is not set).

Step 2: Parse Remote URL

Support both SSH and HTTPS URL formats:

SSH formats (scp-style):

git@github.com:owner/repo.git
git@gitlab.com:group/subgroup/project.git
git@gitlab.self-hosted.example.com:group/project.git
git@git.sylvlab.fr:owner/repo.git

SSH formats (ssh:// scheme, may include a custom port):

ssh://git@github.com/owner/repo.git
ssh://git@git.sylvlab.fr:2222/sylvain/mountain-blog-test.git

HTTPS formats:

https://github.com/owner/repo.git
https://gitlab.com/group/subgroup/project.git
https://gitlab.self-hosted.example.com/group/project.git
https://git.sylvlab.fr/owner/repo.git

Parsing rules:

  1. Strip trailing .git suffix if present
  2. Extract hostname from URL:
  • scp-style ([user@]host:path): hostname is between @ (if present) and the first :.
  • ssh://[user@]host[:port]/path: strip the ssh:// scheme and any user@, then the hostname is up to the next / or :drop the : segment (e.g. :2222); it is not part of the path.
  • https://host/path: hostname is between :// and the next /.
  1. Extract path segments after the hostname (after the : for scp-style, after the host[:port] for ssh://, after the host for HTTPS). The port number is never an owner/path segment.

Step 3: Detect Platform

Map the extracted hostname against an explicit hostname table. Add new self-hosted instances here as needed:

| Hostname | Platform | |----------|----------| | github.com | GitHub | | gitlab.com | GitLab | | git.sylvlab.fr | Forgejo | | (any other host) | Assume GitLab (self-hosted GitLab instances are common); emit a warning that the host is unrecognized so the user can verify the routing or add the host to this table |

Step 4: Extract Metadata

For GitHub (github.com):

  • owner: First path segment (user or organization)
  • repo: Second path segment (repository name)
  • project_path: owner/repo

For GitLab (gitlab.com or self-hosted):

  • project_path: Full path after hostname (supports nested groups, e.g., group/subgroup/project)
  • owner: First path segment (top-level group)
  • repo: Last path segment (project name)

For Forgejo (git.sylvlab.fr):

  • project_path: Full path after hostname
  • owner: First path segment (user or organization)
  • repo: Last path segment (repository name)

Output

Return the following structured information:

| Field | Description | Example (GitHub) | Example (GitLab) | Example (Forgejo) | |-------|-------------|-------------------|-------------------|-------------------| | platform | Hosting service | github | gitlab | forgejo | | owner | User/org/group | sgaunet | myorg | sylvain | | repo | Repository name | claude-plugins | myproject | mountain-blog-test | | project_path | Full path | sgaunet/claude-plugins | myorg/team/myproject | sylvain/mountain-blog-test | | remote_url | Raw remote URL | git@github.com:sgaunet/claude-plugins.git | https://gitlab.com/myorg/team/myproject.git | git@git.sylvlab.fr:sylvain/mountain-blog-test.git |

Error Handling

| Condition | Action | |-----------|--------| | Not a git repository | Abort: "Not a git repository. Initialize with git init first." | | No remotes configured | Abort: "No git remotes found. Add a remote with git remote add origin ." | | No origin remote | Fall back to first available remote, warn user | | URL format unrecognized | Abort: "Could not parse remote URL: ``. Expected GitHub, GitLab, or Forgejo format." |

Examples

GitHub SSH

$ git remote -v
origin  git@github.com:sgaunet/claude-plugins.git (fetch)

→ platform: github
→ owner: sgaunet
→ repo: claude-plugins
→ project_path: sgaunet/claude-plugins
→ remote_url: git@github.com:sgaunet/claude-plugins.git

GitLab HTTPS with Subgroups

$ git remote -v
origin  https://gitlab.com/myorg/backend/api-service.git (fetch)

→ platform: gitlab
→ owner: myorg
→ repo: api-service
→ project_path: myorg/backend/api-service
→ remote_url: https://gitlab.com/myorg/backend/api-service.git

Self-Hosted GitLab

$ git remote -v
origin  git@gitlab.company.internal:devteam/infra.git (fetch)

→ platform: gitlab
→ owner: devteam
→ repo: infra
→ project_path: devteam/infra
→ remote_url: git@gitlab.company.internal:devteam/infra.git

Forgejo SSH (ssh:// scheme with custom port)

$ git remote -v
origin  ssh://git@git.sylvlab.fr:2222/sylvain/mountain-blog-test.git (fetch)

→ platform: forgejo
→ owner: sylvain          # the :2222 port is dropped, NOT treated as the owner
→ repo: mountain-blog-test
→ project_path: sylvain/mountain-blog-test
→ remote_url: ssh://git@git.sylvlab.fr:2222/sylvain/mountain-blog-test.git

Forgejo SSH (scp-style)

$ git remote -v
origin  git@git.sylvlab.fr:sylvain/mountain-blog-test.git (fetch)

→ platform: forgejo
→ owner: sylvain
→ repo: mountain-blog-test
→ project_path: sylvain/mountain-blog-test
→ remote_url: git@git.sylvlab.fr:sylvain/mountain-blog-test.git

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.