gh-cli
- 作者仓库星标 16
- 许可证 MIT
- 作者仓库 wave
GitHub CLI (gh)
Work seamlessly with GitHub from the command line. For the complete command reference see references/full-reference.md.
Authentication
# Interactive login
gh auth login
# Login with token
gh auth login --with-token < token.txt
# Check status
gh auth status
# Switch accounts
gh auth switch --hostname github.com --user username
# Setup git credential helper
gh auth setup-git
# Print active token
gh auth token
Pull Requests
# Create PR (interactive)
gh pr create
# Create with title, body, base, draft, reviewer
gh pr create --title "Feature: X" --body "Details..." --base main --draft --reviewer alice
# List open PRs
gh pr list
# List with filters
gh pr list --author @me --labels bug --state all --limit 50
# View a PR
gh pr view 123
gh pr view 123 --comments --web
# Merge a PR
gh pr merge 123 --squash --delete-branch
# Check CI status
gh pr checks 123
gh pr checks 123 --watch
Issues
# Create issue (interactive)
gh issue create
# Create with title and labels
gh issue create --title "Bug: X" --body "Steps..." --labels bug,high-priority --assignee @me
# List open issues
gh issue list
# List with filters
gh issue list --assignee @me --labels bug --state all --search "is:open label:bug"
# View an issue
gh issue view 123
gh issue view 123 --comments --web
# Close / reopen
gh issue close 123 --comment "Fixed in PR #456"
gh issue reopen 123
Common Flags
| Flag | Description |
|---|---|
--repo OWNER/REPO |
Target a specific repository |
--json FIELDS |
Output JSON for given fields |
--jq EXPRESSION |
Filter JSON output with jq |
--web |
Open result in browser |
--paginate |
Follow pagination for large result sets |
--limit N |
Cap result count |
API Requests
# REST GET
gh api /user --jq '.login'
# REST POST with fields
gh api --method POST /repos/owner/repo/issues \
--field title="Issue title" --field body="Body"
# Paginate all results
gh api /user/repos --paginate
# GraphQL query
gh api graphql -f query='{ viewer { login } }'
JSON Output Examples
# List PR numbers and titles
gh pr list --json number,title --jq '.[] | "\(.number): \(.title)"'
# Get issue labels
gh issue view 123 --json labels --jq '.labels[].name'
# Filter open PRs by author
gh pr list --json number,title,author \
--jq '.[] | select(.author.login == "alice")'
Complete Reference
For all commands including repos, releases, Actions, projects, gists, codespaces, search, secrets, extensions, and more, see:
- 流狐分类
- 通用
- 作者声明 Agent
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 94 / 100 · 启发式扫描,不代表运行安全
- 作者 / 版本 / 许可
- @re-cinq · MIT
- 流狐 Token 估算
- 低消耗
- 流狐接入估算
- 即装即用
- 是否需要外部 API Key
- 未发现要求
- 检测到的系统要求
- 未声明
- 底层运行要求
- 未声明
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 检测到的网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
# JSON Output Examples
# List PR numbers and titles
gh pr list --json number,title --jq '.[] | "\(.number): \(.title)"'
# Get issue labels
gh issue view 123 --json labels --jq '.labels[].name'
# Filter open PRs by author
gh pr list --json number,title,author \
--jq '.[] | select(.author.login == "alice")' Authentication
Authentication
Pull Requests
Pull Requests
Issues
Issues
Common Flags
Flag · Description --repo OWNER/REPO · Target a specific repository --json FIELDS · Output JSON for given fields
API Requests
API Requests
JSON Output Examples
JSON Output Examples
# GitHub CLI (gh)
Work seamlessly with GitHub from the command line. For the complete command reference see [`references/full-reference.md`](references/full-reference.md).
## Authentication
```bash
# Interactive login
gh auth login
# Login with token
gh auth login --with-token < token.txt
# Check status
gh auth status
# Switch accounts
gh auth switch --hostname github.com --user username
# Setup git credential helper
gh auth setup-git
# Print active token
gh auth token
```
## Pull Requests
```bash
# Create PR (interactive)
gh pr create
# Create with title, body, base, draft, reviewer
gh pr create --title "Feature: X" --body "Details..." --base main --draft --reviewer alice
# List open PRs
gh pr list
# List with filters
gh pr list --author @me --labels bug --state all --limit 50
# View a PR
gh pr view 123
gh pr view 123 --comments --web
# Merge a PR
gh pr merge 123 --squash --delete-branch
# Check CI status
gh pr checks 123
gh pr checks 123 --watch
```
## Issues
```bash
# Create issue (interactive)
gh issue create
# Create with title and labels
gh issue create --title "Bug: X" --body "Steps..." --labels bug,high-priority --assignee @me
# List open issues
gh issue list
# List with filters
gh issue list --assignee @me --labels bug --state all --search "is:open label:bug"
# View an issue
gh issue view 123
gh issue view 123 --comments --web
# Close / reopen
gh issue close 123 --comment "Fixed in PR #456"
gh issue reopen 123
```
## Common Flags
| Flag | Description |
|---|---|
| `--repo OWNER/REPO` | Target a specific repository |
| `--json FIELDS` | Output JSON for given fields |
| `--jq EXPRESSION` | Filter JSON output with jq |
| `--web` | Open result in browser |
| `--paginate` | Follow pagination for large result sets |
… 证据边界与执行链路
作者原文负责流程事实;流狐只索引当前章节、要点、文件与命令。
章节 -> Authentication → Pull Requests → Issues → Common Flags → API Requests → JSON Output Examples
要点 -> [references/full-reference.md](references/full-reference.md) · Work seamlessly with GitHub from the command line.
文件/命令 -> references/full-reference.md · --repo OWNER/REPO · --json FIELDS · --jq EXPRESSION · --web · --paginate · --limit N
内容 SHA-256 -> 73a0b950b18b
原文结构
适用与边界
原文中的明确线索
references/full-reference.md、--repo OWNER/REPO、--json FIELDS、--jq EXPRESSION、--web、--paginate、--limit N