SuperAPI AI 工具集

speckit-git-remote

编程与开发

查看项目

更新于 10-16 03:11

技能介绍

用途:检测当前 Git 仓库的远程 URL,为 GitHub 相关集成(如创建 issue)提供仓库信息。

主要能力:解析远程 URL 并输出仓库所有者(owner)、仓库名(repo),以及远程是否指向 GitHub 仓库。支持 HTTPS 格式 https://github.com/<owner>/<repo>.git 与 SSH 格式 git@github.com:<owner>/<repo>.git。

使用方式:先检查 Git 是否可用,运行 git rev-parse --is-inside-work-tree 2>/dev/null;若不可用则输出警告“[specify] Warning: Git repository not detected; cannot determine remote URL”并返回空。随后运行 git config --get remote.origin.url 获取远程地址并进行解析。

限制与注意事项:只有当远程 URL 实际指向 github.com 时才报告为 GitHub 仓库,不能仅凭 URL 格式假设。若 Git 未安装、当前目录不是 Git 仓库或未配置远程,则返回空结果且不报错,以便其他工作流继续运行。