Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 09:01:17 +08:00
commit 7f0944bcfe
18 changed files with 8440 additions and 0 deletions

221
skills/skill/SKILL.md Normal file
View File

@@ -0,0 +1,221 @@
---
name: gh-cli
description: GitHub CLI for remote repository analysis, file fetching, codebase comparison, and discovering trending code/repos. Use when analyzing repos without cloning, comparing codebases, or searching for popular GitHub projects.
---
# GitHub CLI - Remote Analysis & Discovery
Remote repository operations, codebase comparison, and code discovery without cloning.
## When to Use
- Analyze repositories without cloning
- Compare codebases side-by-side
- Fetch specific files from any repo
- Find trending repositories and code patterns
- Search code across GitHub
## Quick Operations
### Fetch a file remotely
```bash
gh api repos/OWNER/REPO/contents/path/file.ts | jq -r '.content' | base64 -d
```
### Get directory listing
```bash
gh api repos/OWNER/REPO/contents/PATH
```
### Search code
```bash
gh search code "pattern" --language=typescript
```
### Find trending repos
```bash
gh search repos --language=rust --sort stars --order desc
```
## Compare Two Codebases
Systematic workflow for comparing repositories to identify similarities and differences.
**Example use**: "Compare solana-fm/explorer-kit and tenequm/solana-idls"
### Step 1: Fetch directory structures
```bash
gh api repos/OWNER-A/REPO-A/contents/PATH > repo1.json
gh api repos/OWNER-B/REPO-B/contents/PATH > repo2.json
```
If comparing a monorepo package, specify the path (e.g., `packages/explorerkit-idls`).
### Step 2: Compare file lists
```bash
jq -r '.[].name' repo1.json > repo1-files.txt
jq -r '.[].name' repo2.json > repo2-files.txt
diff repo1-files.txt repo2-files.txt
```
Shows files unique to each repo and common files.
### Step 3: Fetch key files for comparison
Compare package dependencies:
```bash
gh api repos/OWNER-A/REPO-A/contents/package.json | jq -r '.content' | base64 -d > repo1-pkg.json
gh api repos/OWNER-B/REPO-B/contents/package.json | jq -r '.content' | base64 -d > repo2-pkg.json
```
Compare main entry points:
```bash
gh api repos/OWNER-A/REPO-A/contents/src/index.ts | jq -r '.content' | base64 -d > repo1-index.ts
gh api repos/OWNER-B/REPO-B/contents/src/index.ts | jq -r '.content' | base64 -d > repo2-index.ts
```
### Step 4: Analyze differences
Compare the fetched files to identify:
**API Surface**
- What functions/classes are exported?
- Are the APIs similar or completely different?
**Dependencies**
- Shared dependencies (same approach)
- Different dependencies (different implementation)
**Unique Features**
- Features only in repo1
- Features only in repo2
For detailed comparison strategies, see [references/comparison.md](references/comparison.md).
## Discover Trending Content
### Find trending repositories
```bash
# Most starred repos
gh search repos --sort stars --order desc --limit 20
# Trending in specific language
gh search repos --language=rust --sort stars --order desc
# Recently popular (created in last month)
gh search repos "created:>2024-10-01" --sort stars --order desc
# Trending in specific topic
gh search repos "topic:machine-learning" --sort stars --order desc
```
### Discover popular code patterns
```bash
# Find popular implementations
gh search code "function useWallet" --language=typescript --sort indexed
# Find code in popular repos only
gh search code "implementation" "stars:>1000"
# Search specific organization
gh search code "authentication" --owner=anthropics
```
For complete discovery queries and patterns, see [references/discovery.md](references/discovery.md).
## Search Basics
### Code search
```bash
# Search across all repositories
gh search code "API endpoint" --language=python
# Search in specific organization
gh search code "auth" --owner=anthropics
# Exclude results with negative qualifiers
gh search issues -- "bug report -label:wontfix"
```
### Issue & PR search
```bash
# Find open bugs
gh search issues --label=bug --state=open
# Search assigned issues
gh search issues --assignee=@me --state=open
```
For advanced search syntax, see [references/search.md](references/search.md).
## Special Syntax
### Field name inconsistencies
**IMPORTANT:** GitHub CLI uses inconsistent field names across commands:
| Field | `gh repo view` | `gh search repos` |
|-------|----------------|-------------------|
| Stars | `stargazerCount` | `stargazersCount` |
| Forks | `forkCount` | `forksCount` |
**Examples:**
```bash
# ✅ Correct for gh repo view
gh repo view owner/repo --json stargazerCount,forkCount
# ✅ Correct for gh search repos
gh search repos "query" --json stargazersCount,forksCount
```
### Excluding search results
When using negative qualifiers (like `-label:bug`), use `--` to prevent the hyphen from being interpreted as a flag:
```bash
gh search issues -- "query -label:bug"
```
For more syntax gotchas, see [references/syntax.md](references/syntax.md).
## Advanced Workflows
For detailed documentation on specific workflows:
**Core Workflows:**
- [remote-analysis.md](references/remote-analysis.md) - Advanced file fetching patterns
- [comparison.md](references/comparison.md) - Complete codebase comparison guide
- [discovery.md](references/discovery.md) - All trending and discovery queries
- [search.md](references/search.md) - Advanced search syntax
- [syntax.md](references/syntax.md) - Special syntax and command quirks
**GitHub Operations:**
- [repositories.md](references/repositories.md) - Repository operations
- [pull_requests.md](references/pull_requests.md) - PR workflows
- [issues.md](references/issues.md) - Issue management
- [actions.md](references/actions.md) - GitHub Actions
- [releases.md](references/releases.md) - Release management
**Setup & Configuration:**
- [getting_started.md](references/getting_started.md) - Installation and auth
- [other.md](references/other.md) - Environment variables, aliases, config
- [extensions.md](references/extensions.md) - CLI extensions
## Resources
- Official docs: https://cli.github.com/manual/
- GitHub CLI: https://github.com/cli/cli
- Search syntax: https://docs.github.com/en/search-github

View File

@@ -0,0 +1,506 @@
# Gh-Cli - Actions
**Pages:** 15
---
## gh workflow run
**URL:** https://cli.github.com/manual/gh_workflow_run
**Contents:**
- gh workflow run
- Options
- Options inherited from parent commands
- Examples
- See also
Create a workflow_dispatch event for a given workflow.
This command will trigger GitHub Actions to run a given workflow file. The given workflow file must support an on.workflow_dispatch trigger in order to be run in this way.
If the workflow file supports inputs, they can be specified in a few ways:
**Examples:**
Example 1 (unknown):
```unknown
gh workflow run [<workflow-id> | <workflow-name>] [flags]
```
Example 2 (bash):
```bash
# Have gh prompt you for what workflow you'd like to run and interactively collect inputs
$ gh workflow run
# Run the workflow file 'triage.yml' at the remote's default branch
$ gh workflow run triage.yml
# Run the workflow file 'triage.yml' at a specified ref
$ gh workflow run triage.yml --ref my-branch
# Run the workflow file 'triage.yml' with command line inputs
$ gh workflow run triage.yml -f name=scully -f greeting=hello
# Run the workflow file 'triage.yml' with JSON via standard input
$ echo '{"name":"scully", "greeting":"hello"}' | gh workflow run triage.yml --json
```
---
## gh run view
**URL:** https://cli.github.com/manual/gh_run_view
**Contents:**
- gh run view
- Options
- Options inherited from parent commands
- JSON Fields
- Examples
- See also
View a summary of a workflow run.
Due to platform limitations, gh may not always be able to associate jobs with their corresponding logs when using the primary method of fetching logs in zip format.
In such cases, gh will attempt to fetch logs for each job individually via the API. This fallback is slower and more resource-intensive. If more than 25 job logs are missing, the operation will fail with an error.
Additionally, due to similar platform constraints, some log lines may not be associated with a specific step within a job. In these cases, the step name will appear as UNKNOWN STEP in the log output.
attempt, conclusion, createdAt, databaseId, displayTitle, event, headBranch, headSha, jobs, name, number, startedAt, status, updatedAt, url, workflowDatabaseId, workflowName
**Examples:**
Example 1 (unknown):
```unknown
gh run view [<run-id>] [flags]
```
Example 2 (bash):
```bash
# Interactively select a run to view, optionally selecting a single job
$ gh run view
# View a specific run
$ gh run view 12345
# View a specific run with specific attempt number
$ gh run view 12345 --attempt 3
# View a specific job within a run
$ gh run view --job 456789
# View the full log for a specific job
$ gh run view --log --job 456789
# Exit non-zero if a run failed
$ gh run view 0451 --exit-status && echo "run pending or passed"
```
---
## gh workflow enable
**URL:** https://cli.github.com/manual/gh_workflow_enable
**Contents:**
- gh workflow enable
- Options inherited from parent commands
- See also
Enable a workflow, allowing it to be run and show up when listing workflows.
**Examples:**
Example 1 (unknown):
```unknown
gh workflow enable [<workflow-id> | <workflow-name>]
```
---
## gh workflow
**URL:** https://cli.github.com/manual/gh_workflow
**Contents:**
- gh workflow
- Available commands
- Options
- See also
List, view, and run workflows in GitHub Actions.
---
## gh run
**URL:** https://cli.github.com/manual/gh_run
**Contents:**
- gh run
- Available commands
- Options
- See also
List, view, and watch recent workflow runs from GitHub Actions.
---
## gh run rerun
**URL:** https://cli.github.com/manual/gh_run_rerun
**Contents:**
- gh run rerun
- Options
- Options inherited from parent commands
- See also
Rerun an entire run, only failed jobs, or a specific job from a run.
Note that due to historical reasons, the --job flag may not take what you expect. Specifically, when navigating to a job in the browser, the URL looks like this: https://github.com/<owner>/<repo>/actions/runs/<run-id>/jobs/<number>.
However, this <number> should not be used with the --job flag and will result in the API returning 404 NOT FOUND. Instead, you can get the correct job IDs using the following command:
You will need to use databaseId field for triggering job re-runs.
**Examples:**
Example 1 (unknown):
```unknown
gh run rerun [<run-id>] [flags]
```
Example 2 (unknown):
```unknown
gh run view <run-id> --json jobs --jq '.jobs[] | {name, databaseId}'
```
---
## gh run watch
**URL:** https://cli.github.com/manual/gh_run_watch
**Contents:**
- gh run watch
- Options
- Options inherited from parent commands
- Examples
- See also
Watch a run until it completes, showing its progress.
By default, all steps are displayed. The --compact option can be used to only show the relevant/failed steps.
This command does not support authenticating via fine grained PATs as it is not currently possible to create a PAT with the checks:read permission.
**Examples:**
Example 1 (unknown):
```unknown
gh run watch <run-id> [flags]
```
Example 2 (bash):
```bash
# Watch a run until it's done
$ gh run watch
# Watch a run in compact mode
$ gh run watch --compact
# Run some other command when the run is finished
$ gh run watch && notify-send 'run is done!'
```
---
## gh workflow list
**URL:** https://cli.github.com/manual/gh_workflow_list
**Contents:**
- gh workflow list
- Options
- Options inherited from parent commands
- ALIASES
- JSON Fields
- See also
List workflow files, hiding disabled workflows by default.
id, name, path, state
**Examples:**
Example 1 (unknown):
```unknown
gh workflow list [flags]
```
---
## gh run list
**URL:** https://cli.github.com/manual/gh_run_list
**Contents:**
- gh run list
- Options
- Options inherited from parent commands
- ALIASES
- JSON Fields
- See also
List recent workflow runs.
Note that providing the workflow_name to the -w flag will not fetch disabled workflows. Also pass the -a flag to fetch disabled workflow runs using the workflow_name and the -w flag.
Runs created by organization and enterprise ruleset workflows will not display a workflow name due to GitHub API limitations.
attempt, conclusion, createdAt, databaseId, displayTitle, event, headBranch, headSha, name, number, startedAt, status, updatedAt, url, workflowDatabaseId, workflowName
**Examples:**
Example 1 (unknown):
```unknown
gh run list [flags]
```
---
## gh run download
**URL:** https://cli.github.com/manual/gh_run_download
**Contents:**
- gh run download
- Options
- Options inherited from parent commands
- Examples
- See also
Download artifacts generated by a GitHub Actions workflow run.
The contents of each artifact will be extracted under separate directories based on the artifact name. If only a single artifact is specified, it will be extracted into the current directory.
By default, this command downloads the latest artifact created and uploaded through GitHub Actions. Because workflows can delete or overwrite artifacts, <run-id> must be used to select an artifact from a specific workflow run.
**Examples:**
Example 1 (unknown):
```unknown
gh run download [<run-id>] [flags]
```
Example 2 (bash):
```bash
# Download all artifacts generated by a workflow run
$ gh run download <run-id>
# Download a specific artifact within a run
$ gh run download <run-id> -n <name>
# Download specific artifacts across all runs in a repository
$ gh run download -n <name1> -n <name2>
# Select artifacts to download interactively
$ gh run download
```
---
## gh workflow disable
**URL:** https://cli.github.com/manual/gh_workflow_disable
**Contents:**
- gh workflow disable
- Options inherited from parent commands
- See also
Disable a workflow, preventing it from running or showing up when listing workflows.
**Examples:**
Example 1 (unknown):
```unknown
gh workflow disable [<workflow-id> | <workflow-name>]
```
---
## gh run cancel
**URL:** https://cli.github.com/manual/gh_run_cancel
**Contents:**
- gh run cancel
- Options
- Options inherited from parent commands
- See also
Cancel a workflow run
**Examples:**
Example 1 (unknown):
```unknown
gh run cancel [<run-id>] [flags]
```
---
## gh run delete
**URL:** https://cli.github.com/manual/gh_run_delete
**Contents:**
- gh run delete
- Options inherited from parent commands
- Examples
- See also
Delete a workflow run
**Examples:**
Example 1 (unknown):
```unknown
gh run delete [<run-id>]
```
Example 2 (bash):
```bash
# Interactively select a run to delete
$ gh run delete
# Delete a specific run
$ gh run delete 12345
```
---
## gh workflow view
**URL:** https://cli.github.com/manual/gh_workflow_view
**Contents:**
- gh workflow view
- Options
- Options inherited from parent commands
- Examples
- See also
View the summary of a workflow
**Examples:**
Example 1 (unknown):
```unknown
gh workflow view [<workflow-id> | <workflow-name> | <filename>] [flags]
```
Example 2 (bash):
```bash
# Interactively select a workflow to view
$ gh workflow view
# View a specific workflow
$ gh workflow view 0451
```
---
## gh attestation verify
**URL:** https://cli.github.com/manual/gh_attestation_verify
**Contents:**
- gh attestation verify
- Understanding Verification
- Loading Artifacts And Attestations
- Additional Policy Enforcement
- Options
- Examples
- See also
Verify the integrity and provenance of an artifact using its associated cryptographically signed attestations.
An attestation is a claim (i.e. a provenance statement) made by an actor (i.e. a GitHub Actions workflow) regarding a subject (i.e. an artifact).
In order to verify an attestation, you must provide an artifact and validate:
By default, this command enforces the https://slsa.dev/provenance/v1 predicate type. To verify other attestation predicate types use the --predicate-type flag.
The "actor identity" consists of:
This identity is then validated against the attestation's certificate's SourceRepository, SourceRepositoryOwner, and SubjectAlternativeName (SAN) fields, among others.
It is up to you to decide how precisely you want to enforce this identity.
At a minimum, this command requires either:
The more precisely you specify the identity, the more control you will have over the security guarantees offered by the verification process.
Ideally, the path of the signer workflow is also validated using the --signer-workflow or --cert-identity flags.
Please note: if your attestation was generated via a reusable workflow then that reusable workflow is the signer whose identity needs to be validated. In this situation, you must use either the --signer-workflow or the --signer-repo flag.
For more options, see the other available flags.
To specify the artifact, this command requires:
By default, this command will attempt to fetch relevant attestations via the GitHub API using the values provided to --owner or --repo.
To instead fetch attestations from your artifact's OCI registry, use the --bundle-from-oci flag.
For offline verification using attestations stored on disk (c.f. the download command) provide a path to the --bundle flag.
Given the --format=json flag, upon successful verification this command will output a JSON array containing one entry per verified attestation.
This output can then be used for additional policy enforcement, i.e. by being piped into a policy engine.
Each object in the array contains two properties:
Within the verificationResult object you will find:
IMPORTANT: please note that only the signature.certificate and the verifiedTimestamps properties contain values that cannot be manipulated by the workflow that originated the attestation.
When dealing with attestations created within GitHub Actions, the contents of signature.certificate are populated directly from the OpenID Connect token that GitHub has generated. The contents of the verifiedTimestamps array are populated from the signed timestamps originating from either a transparency log or a timestamp authority and likewise cannot be forged by users.
When designing policy enforcement using this output, special care must be taken when examining the contents of the statement.predicate property: should an attacker gain access to your workflow's execution context, they could then falsify the contents of the statement.predicate.
To mitigate this attack vector, consider using a "trusted builder": when generating an artifact, have the build and attestation signing occur within a reusable workflow whose execution cannot be influenced by input provided through the caller workflow.
See above re: --signer-workflow.
**Examples:**
Example 1 (unknown):
```unknown
gh attestation verify [<file-path> | oci://<image-uri>] [--owner | --repo] [flags]
```
Example 2 (bash):
```bash
# Verify an artifact linked with a repository
$ gh attestation verify example.bin --repo github/example
# Verify an artifact linked with an organization
$ gh attestation verify example.bin --owner github
# Verify an artifact and output the full verification result
$ gh attestation verify example.bin --owner github --format json
# Verify an OCI image using attestations stored on disk
$ gh attestation verify oci://<image-uri> --owner github --bundle sha256:foo.jsonl
# Verify an artifact signed with a reusable workflow
$ gh attestation verify example.bin --owner github --signer-repo actions/example
```
---

View File

@@ -0,0 +1,168 @@
# Compare Two Codebases
Systematic workflow for comparing repositories to identify similarities, differences, and unique features.
## When to Use
- "Are repo-a and repo-b providing the same functionality?"
- "What's different between these two implementations?"
- "Which repo has more features?"
- "Can I replace library X with library Y?"
## 4-Step Comparison Workflow
### Step 1: Fetch directory structures
```bash
gh api repos/OWNER-A/REPO-A/contents/PATH > repo1.json
gh api repos/OWNER-B/REPO-B/contents/PATH > repo2.json
```
If comparing a monorepo package, specify the path (e.g., `packages/explorerkit-idls`).
### Step 2: Compare file lists
```bash
jq -r '.[].name' repo1.json > repo1-files.txt
jq -r '.[].name' repo2.json > repo2-files.txt
diff repo1-files.txt repo2-files.txt
```
This shows:
- Files unique to repo1 (prefixed with `<`)
- Files unique to repo2 (prefixed with `>`)
- Common files (no prefix)
### Step 3: Fetch key files for comparison
Compare the most important files:
#### Package dependencies
```bash
gh api repos/OWNER-A/REPO-A/contents/package.json | jq -r '.content' | base64 -d > repo1-pkg.json
gh api repos/OWNER-B/REPO-B/contents/package.json | jq -r '.content' | base64 -d > repo2-pkg.json
```
Then compare dependencies:
```bash
jq '.dependencies' repo1-pkg.json
jq '.dependencies' repo2-pkg.json
```
#### Main entry points
```bash
gh api repos/OWNER-A/REPO-A/contents/src/index.ts | jq -r '.content' | base64 -d > repo1-index.ts
gh api repos/OWNER-B/REPO-B/contents/src/index.ts | jq -r '.content' | base64 -d > repo2-index.ts
```
### Step 4: Analyze differences
Compare the fetched files to identify:
**API Surface**
- What functions/classes are exported?
- Are the APIs similar or completely different?
- Which repo has more comprehensive exports?
**Dependencies**
- Shared dependencies (same approach)
- Different dependencies (different implementation)
- Dependency versions (maintenance status)
**Unique Features**
- Features only in repo1
- Features only in repo2
- Similar features with different implementations
## Example: Compare Solana IDL Libraries
```bash
# Repo 1: solana-fm/explorer-kit (monorepo package)
gh api repos/solana-fm/explorer-kit/contents/packages/explorerkit-idls > repo1.json
# Repo 2: tenequm/solana-idls (standalone)
gh api repos/tenequm/solana-idls/contents/ > repo2.json
# Compare file structures
jq -r '.[].name' repo1.json > repo1-files.txt
jq -r '.[].name' repo2.json > repo2-files.txt
diff repo1-files.txt repo2-files.txt
# Fetch package.json from both
gh api repos/solana-fm/explorer-kit/contents/packages/explorerkit-idls/package.json | jq -r '.content' | base64 -d > repo1-pkg.json
gh api repos/tenequm/solana-idls/contents/package.json | jq -r '.content' | base64 -d > repo2-pkg.json
# Compare dependencies
echo "=== Repo 1 Dependencies ==="
jq '.dependencies' repo1-pkg.json
echo "=== Repo 2 Dependencies ==="
jq '.dependencies' repo2-pkg.json
# Fetch main entry points
gh api repos/solana-fm/explorer-kit/contents/packages/explorerkit-idls/src/index.ts | jq -r '.content' | base64 -d > repo1-index.ts
gh api repos/tenequm/solana-idls/contents/src/index.ts | jq -r '.content' | base64 -d > repo2-index.ts
# Compare exports
echo "=== Repo 1 Exports ==="
grep -E "^export" repo1-index.ts
echo "=== Repo 2 Exports ==="
grep -E "^export" repo2-index.ts
```
## Analysis Framework
After fetching files, analyze systematically:
### 1. Purpose & Scope
- What problem does each repo solve?
- Same problem or different use cases?
### 2. API Design
- Are the APIs compatible?
- Which is more user-friendly?
- Breaking changes if switching?
### 3. Dependencies
- Shared ecosystem (similar approach)
- Different dependencies (different implementation)
- Heavy vs lightweight
### 4. Maintenance
- Last commit dates
- Release frequency
- Issue/PR activity
### 5. Features
- Core features both have
- Unique to repo1
- Unique to repo2
## Tips
**Compare READMEs first**
```bash
gh api repos/OWNER-A/REPO-A/contents/README.md | jq -r '.content' | base64 -d > repo1-readme.md
gh api repos/OWNER-B/REPO-B/contents/README.md | jq -r '.content' | base64 -d > repo2-readme.md
```
This gives you a high-level understanding before diving into code.
**Check for common file patterns**
- `package.json` - Dependencies and metadata
- `tsconfig.json` - TypeScript configuration
- `src/index.ts` - Main entry point
- `README.md` - Documentation and examples
- `CHANGELOG.md` - Version history
**Use git tree for overview**
```bash
gh api repos/OWNER/REPO/git/trees/main?recursive=1 | jq '.tree[] | select(.type == "blob") | .path' | grep -E "\.(ts|js|json)$"
```
Gets all TypeScript/JavaScript/JSON files quickly.

View File

@@ -0,0 +1,315 @@
# Discovering Trending Content
Complete guide to finding popular repositories, code patterns, and active projects on GitHub.
## Find Trending Repositories
### By popularity
```bash
# Most starred repositories (all time)
gh search repos --sort stars --order desc --limit 20
# Most forked repos
gh search repos --sort forks --order desc
# Most watched repos
gh search repos --sort help-wanted-issues --order desc
```
### By language
```bash
# Trending repos in specific language
gh search repos --language=rust --sort stars --order desc
gh search repos --language=typescript --sort stars --order desc
gh search repos --language=python --sort stars --order desc
```
### By recency
```bash
# Recently popular (created in last month, sorted by stars)
gh search repos "created:>2024-10-01" --sort stars --order desc
# Created this year
gh search repos "created:>2024-01-01" --sort stars --order desc
# Recently updated popular repos
gh search repos "stars:>100 pushed:>2024-10-01" --sort updated --order desc
```
### By topic
```bash
# Trending in specific topic
gh search repos "topic:machine-learning" --sort stars --order desc
gh search repos "topic:blockchain" --sort stars --order desc
gh search repos "topic:react" --sort stars --order desc
# Multiple topics (AND)
gh search repos "topic:blockchain topic:typescript" --sort stars --order desc
```
### By activity
```bash
# Most active repos (by recent updates)
gh search repos --sort updated --order desc
# Active repos (many recent commits)
gh search repos "pushed:>2024-10-01" --sort stars
# Repos with many open issues (active community)
gh search repos "good-first-issues:>5" --sort stars --order desc
```
## Advanced Discovery Queries
### Unique projects
```bash
# Repos with many stars but few forks (unique ideas)
gh search repos "stars:>1000 forks:<100"
# High star-to-fork ratio (original content)
gh search repos "stars:>500 forks:<50"
```
### By file presence
```bash
# Find repos by file presence (e.g., has Dockerfile)
gh search code "filename:Dockerfile" --sort indexed
# Has specific config files
gh search code "filename:vite.config.ts" --sort indexed
gh search code "filename:wxt.config.ts" --sort indexed
```
### By description keywords
```bash
# Combined filters: Popular Solana repos updated recently
gh search repos "solana in:name,description stars:>100" --sort updated --order desc
# Specific keywords in description
gh search repos "machine learning in:description stars:>1000"
```
### By size and license
```bash
# Small but popular repos (easy to learn from)
gh search repos "stars:>1000 size:<1000" --language=typescript
# Specific license
gh search repos "license:mit stars:>500" --language=rust
```
### By organization
```bash
# Popular repos from specific org
gh search repos "org:vercel stars:>100"
gh search repos "org:anthropics"
```
## Discover Popular Code Patterns
### Find implementations
```bash
# Find popular implementations
gh search code "function useWallet" --language=typescript --sort indexed
gh search code "async fn main" --language=rust
# Specific patterns
gh search code "createContext" --language=typescript --sort indexed
gh search code "impl Display for" --language=rust
```
### By popularity
```bash
# Most starred code in specific language
gh search code "authentication" --language=typescript --sort stars
# Find code in popular repos only
gh search code "implementation" "stars:>1000"
gh search code "middleware" "stars:>500" --language=typescript
```
### By organization
```bash
# Search specific organization's popular code
gh search code "authentication" --owner=anthropics
gh search code "config" --owner=vercel
```
### By recency
```bash
# Find recent code examples
gh search code "React hooks" "created:>2024-01-01"
gh search code "Solana program" "created:>2024-06-01" --language=rust
```
## Combining Filters
### Examples of powerful combinations
```bash
# Popular TypeScript repos updated this month
gh search repos "language:typescript stars:>500 pushed:>2024-10-01" --sort updated
# New promising projects (recent, growing fast)
gh search repos "created:>2024-06-01 stars:>100" --sort stars --order desc
# Active open-source with good first issues
gh search repos "good-first-issues:>3 stars:>100 pushed:>2024-10-01"
# Well-maintained projects (recent activity + documentation)
gh search repos "stars:>1000 pushed:>2024-10-01" --language=typescript | grep -i "readme"
```
## Qualifiers Reference
### Date qualifiers
- `created:>YYYY-MM-DD` - Created after date
- `created:<YYYY-MM-DD` - Created before date
- `pushed:>YYYY-MM-DD` - Updated after date
- `pushed:<YYYY-MM-DD` - Updated before date
### Numeric qualifiers
- `stars:>N` - More than N stars
- `stars:N..M` - Between N and M stars
- `forks:>N` - More than N forks
- `size:<N` - Smaller than N KB
### Boolean qualifiers
- `is:public` - Public repos
- `is:private` - Private repos (requires auth)
- `archived:false` - Not archived
- `archived:true` - Archived repos
### Location qualifiers
- `in:name` - Search in repo name
- `in:description` - Search in description
- `in:readme` - Search in README
- `in:name,description` - Search in both
## Tips for Discovery
### Start broad, then filter
```bash
# 1. Find all Solana repos
gh search repos "solana"
# 2. Filter by popularity
gh search repos "solana stars:>100"
# 3. Filter by recency
gh search repos "solana stars:>100 pushed:>2024-10-01"
# 4. Add language
gh search repos "solana stars:>100 pushed:>2024-10-01" --language=rust
```
### Use topics for precision
Topics are more precise than text search:
```bash
# Better: Use topic
gh search repos "topic:web3" --sort stars
# Less precise: Text search
gh search repos "web3" --sort stars
```
### Check activity indicators
High stars but old updates = abandoned:
```bash
# Good: Popular AND recently updated
gh search repos "stars:>1000 pushed:>2024-10-01"
# Risk: Popular but potentially stale
gh search repos "stars:>1000"
```
### Look for hidden gems
Sometimes the best code isn't the most popular:
```bash
# Well-maintained but not famous
gh search repos "stars:10..100 pushed:>2024-10-01" --language=rust
# Recent projects gaining traction
gh search repos "created:>2024-09-01 stars:>10" --sort stars
```
## Output formatting
### Get specific fields
```bash
# Just repo names
gh search repos "topic:react" --json name --jq '.[].name'
# Name and star count
gh search repos "topic:react" --limit 5 --json name,stargazersCount --jq '.[] | "\(.name): \(.stargazersCount) stars"'
# Full URLs
gh search repos "topic:rust" --json url --jq '.[].url'
```
### Limit results
```bash
# Top 10 only
gh search repos "language:typescript" --sort stars --limit 10
# Top 50
gh search repos "topic:machine-learning" --limit 50
```
## Common Discovery Workflows
### "Find similar repos to X"
```bash
# 1. Check topics of repo X
gh repo view OWNER/REPO --json repositoryTopics
# 2. Search by those topics
gh search repos "topic:web3 topic:solana" --sort stars --order desc
```
### "What's trending in [language] this month?"
```bash
gh search repos "language:rust created:>2024-10-01" --sort stars --order desc --limit 20
```
### "Find actively maintained [topic] projects"
```bash
gh search repos "topic:blockchain pushed:>2024-10-01 stars:>50" --sort updated --order desc
```
### "Discover new tools for [task]"
```bash
# Example: PDF processing tools
gh search repos "pdf in:name,description language:python stars:>50" --sort stars
```

View File

@@ -0,0 +1,99 @@
# Gh-Cli - Extensions
**Pages:** 4
---
## gh extension upgrade
**URL:** https://cli.github.com/manual/gh_extension_upgrade
**Contents:**
- gh extension upgrade
- Options
- See also
Upgrade installed extensions
**Examples:**
Example 1 (unknown):
```unknown
gh extension upgrade {<name> | --all} [flags]
```
---
## gh extension browse
**URL:** https://cli.github.com/manual/gh_extension_browse
**Contents:**
- gh extension browse
- Options
- See also
This command will take over your terminal and run a fully interactive interface for browsing, adding, and removing gh extensions. A terminal width greater than 100 columns is recommended.
To learn how to control this interface, press ? after running to see the help text.
Running this command with --single-column should make this command more intelligible for users who rely on assistive technology like screen readers or high zoom.
For a more traditional way to discover extensions, see:
along with gh ext install, gh ext remove, and gh repo view.
**Examples:**
Example 1 (unknown):
```unknown
gh extension browse [flags]
```
Example 2 (unknown):
```unknown
gh ext search
```
---
## gh extension list
**URL:** https://cli.github.com/manual/gh_extension_list
**Contents:**
- gh extension list
- ALIASES
- See also
List installed extension commands
gh extension ls, gh extensions ls, gh ext ls
**Examples:**
Example 1 (unknown):
```unknown
gh extension list
```
---
## gh extension remove
**URL:** https://cli.github.com/manual/gh_extension_remove
**Contents:**
- gh extension remove
- See also
Remove an installed extension
**Examples:**
Example 1 (unknown):
```unknown
gh extension remove <name>
```
---

View File

@@ -0,0 +1,39 @@
# Gh-Cli - Getting Started
**Pages:** 1
---
## gh auth setup-git
**URL:** https://cli.github.com/manual/gh_auth_setup-git
**Contents:**
- gh auth setup-git
- Options
- Examples
- See also
This command configures git to use GitHub CLI as a credential helper. For more information on git credential helpers please reference: https://git-scm.com/docs/gitcredentials.
By default, GitHub CLI will be set as the credential helper for all authenticated hosts. If there is no authenticated hosts the command fails with an error.
Alternatively, use the --hostname flag to specify a single host to be configured. If the host is not authenticated with, the command fails with an error.
**Examples:**
Example 1 (unknown):
```unknown
gh auth setup-git [flags]
```
Example 2 (bash):
```bash
# Configure git to use GitHub CLI as the credential helper for all authenticated hosts
$ gh auth setup-git
# Configure git to use GitHub CLI as the credential helper for enterprise.internal host
$ gh auth setup-git --hostname enterprise.internal
```
---

View File

@@ -0,0 +1,39 @@
# Gh-Cli Documentation Index
## Categories
### Actions
**File:** `actions.md`
**Pages:** 15
### Extensions
**File:** `extensions.md`
**Pages:** 4
### Getting Started
**File:** `getting_started.md`
**Pages:** 1
### Issues
**File:** `issues.md`
**Pages:** 15
### Other
**File:** `other.md`
**Pages:** 60
### Pull Requests
**File:** `pull_requests.md`
**Pages:** 31
### Releases
**File:** `releases.md`
**Pages:** 9
### Repositories
**File:** `repositories.md`
**Pages:** 72
### Search
**File:** `search.md`
**Pages:** 7

View File

@@ -0,0 +1,477 @@
# Gh-Cli - Issues
**Pages:** 15
---
## gh issue lock
**URL:** https://cli.github.com/manual/gh_issue_lock
**Contents:**
- gh issue lock
- Options
- Options inherited from parent commands
- See also
Lock issue conversation
**Examples:**
Example 1 (unknown):
```unknown
gh issue lock {<number> | <url>} [flags]
```
---
## gh issue delete
**URL:** https://cli.github.com/manual/gh_issue_delete
**Contents:**
- gh issue delete
- Options
- Options inherited from parent commands
- See also
**Examples:**
Example 1 (unknown):
```unknown
gh issue delete {<number> | <url>} [flags]
```
---
## gh label
**URL:** https://cli.github.com/manual/gh_label
**Contents:**
- gh label
- Available commands
- Options
- See also
Work with GitHub labels.
---
## gh issue develop
**URL:** https://cli.github.com/manual/gh_issue_develop
**Contents:**
- gh issue develop
- Options
- Options inherited from parent commands
- Examples
- See also
Manage linked branches for an issue.
When using the --base flag, the new development branch will be created from the specified remote branch. The new branch will be configured as the base branch for pull requests created using gh pr create.
**Examples:**
Example 1 (unknown):
```unknown
gh issue develop {<number> | <url>} [flags]
```
Example 2 (bash):
```bash
# List branches for issue 123
$ gh issue develop --list 123
# List branches for issue 123 in repo cli/cli
$ gh issue develop --list --repo cli/cli 123
# Create a branch for issue 123 based on the my-feature branch
$ gh issue develop 123 --base my-feature
# Create a branch for issue 123 and checkout it out
$ gh issue develop 123 --checkout
# Create a branch in repo monalisa/cli for issue 123 in repo cli/cli
$ gh issue develop 123 --repo cli/cli --branch-repo monalisa/cli
```
---
## gh label edit
**URL:** https://cli.github.com/manual/gh_label_edit
**Contents:**
- gh label edit
- Options
- Options inherited from parent commands
- Examples
- See also
Update a label on GitHub.
A label can be renamed using the --name flag.
The label color needs to be 6 character hex value.
**Examples:**
Example 1 (unknown):
```unknown
gh label edit <name> [flags]
```
Example 2 (bash):
```bash
# Update the color of the bug label
$ gh label edit bug --color FF0000
# Rename and edit the description of the bug label
$ gh label edit bug --name big-bug --description "Bigger than normal bug"
```
---
## gh auth status
**URL:** https://cli.github.com/manual/gh_auth_status
**Contents:**
- gh auth status
- Options
- JSON Fields
- Examples
- See also
Display active account and authentication state on each known GitHub host.
For each host, the authentication state of each known account is tested and any issues are included in the output. Each host section will indicate the active account, which will be used when targeting that host.
If an account on any host (or only the one given via --hostname) has authentication issues, the command will exit with 1 and output to stderr. Note that when using the --json option, the command will always exit with zero regardless of any authentication issues, unless there is a fatal error.
To change the active account for a host, see gh auth switch.
**Examples:**
Example 1 (unknown):
```unknown
gh auth status [flags]
```
Example 2 (bash):
```bash
# Display authentication status for all accounts on all hosts
$ gh auth status
# Display authentication status for the active account on a specific host
$ gh auth status --active --hostname github.example.com
# Display tokens in plain text
$ gh auth status --show-token
# Format authentication status as JSON
$ gh auth status --json hosts
# Include plain text token in JSON output
$ gh auth status --json hosts --show-token
# Format hosts as a flat JSON array
$ gh auth status --json hosts --jq '.hosts | add'
```
---
## gh issue unlock
**URL:** https://cli.github.com/manual/gh_issue_unlock
**Contents:**
- gh issue unlock
- Options inherited from parent commands
- See also
Unlock issue conversation
**Examples:**
Example 1 (unknown):
```unknown
gh issue unlock {<number> | <url>}
```
---
## gh alias set
**URL:** https://cli.github.com/manual/gh_alias_set
**Contents:**
- gh alias set
- Options
- Examples
- See also
Define a word that will expand to a full gh command when invoked.
The expansion may specify additional arguments and flags. If the expansion includes positional placeholders such as $1, extra arguments that follow the alias will be inserted appropriately. Otherwise, extra arguments will be appended to the expanded command.
Use - as expansion argument to read the expansion string from standard input. This is useful to avoid quoting issues when defining expansions.
If the expansion starts with ! or if --shell was given, the expansion is a shell expression that will be evaluated through the sh interpreter when the alias is invoked. This allows for chaining multiple commands via piping and redirection.
**Examples:**
Example 1 (unknown):
```unknown
gh alias set <alias> <expansion> [flags]
```
Example 2 (bash):
```bash
# Note: Command Prompt on Windows requires using double quotes for arguments
$ gh alias set pv 'pr view'
$ gh pv -w 123 #=> gh pr view -w 123
$ gh alias set bugs 'issue list --label=bugs'
$ gh bugs
$ gh alias set homework 'issue list --assignee @me'
$ gh homework
$ gh alias set 'issue mine' 'issue list --mention @me'
$ gh issue mine
$ gh alias set epicsBy 'issue list --author="$1" --label="epic"'
$ gh epicsBy vilmibm #=> gh issue list --author="vilmibm" --label="epic"
$ gh alias set --shell igrep 'gh issue list --label="$1" | grep "$2"'
$ gh igrep epic foo #=> gh issue list --label="epic" | grep "foo"
```
---
## gh project item-edit
**URL:** https://cli.github.com/manual/gh_project_item-edit
**Contents:**
- gh project item-edit
- Options
- Examples
- See also
Edit either a draft issue or a project item. Both usages require the ID of the item to edit.
For non-draft issues, the ID of the project is also required, and only a single field value can be updated per invocation.
Remove project item field value using --clear flag.
**Examples:**
Example 1 (unknown):
```unknown
gh project item-edit [flags]
```
Example 2 (bash):
```bash
# Edit an item's text field value
$ gh project item-edit --id <item-id> --field-id <field-id> --project-id <project-id> --text "new text"
# Clear an item's field value
$ gh project item-edit --id <item-id> --field-id <field-id> --project-id <project-id> --clear
```
---
## gh issue status
**URL:** https://cli.github.com/manual/gh_issue_status
**Contents:**
- gh issue status
- Options
- Options inherited from parent commands
- JSON Fields
- See also
- In use
Show status of relevant issues
assignees, author, body, closed, closedAt, closedByPullRequestsReferences, comments, createdAt, id, isPinned, labels, milestone, number, projectCards, projectItems, reactionGroups, state, stateReason, title, updatedAt, url
**Examples:**
Example 1 (unknown):
```unknown
gh issue status [flags]
```
Example 2 (unknown):
```unknown
# Viewing issues relevant to you
~/Projects/my-project$ gh issue status
Issues assigned to you
#8509 [Fork] Improve how Desktop handles forks (epic:fork, meta)
Issues mentioning you
#8938 [Fork] Add create fork flow entry point at commit warning (epic:fork)
#8509 [Fork] Improve how Desktop handles forks (epic:fork, meta)
Issues opened by you
#8936 [Fork] Hide PR number badges on branches that have an upstream PR (epic:fork)
#6386 Improve no editor detected state on conflicts modal (enhancement)
~/Projects/my-project$
```
---
## gh issue
**URL:** https://cli.github.com/manual/gh_issue
**Contents:**
- gh issue
- General commands
- Targeted commands
- Options
- Examples
- See also
Work with GitHub issues.
**Examples:**
Example 1 (bash):
```bash
$ gh issue list
$ gh issue create --label bug
$ gh issue view 123 --web
```
---
## gh issue view
**URL:** https://cli.github.com/manual/gh_issue_view
**Contents:**
- gh issue view
- Options
- Options inherited from parent commands
- JSON Fields
- See also
- In use
- In terminal
- In the browser
Display the title, body, and other information about an issue.
With --web flag, open the issue in a web browser instead.
assignees, author, body, closed, closedAt, closedByPullRequestsReferences, comments, createdAt, id, isPinned, labels, milestone, number, projectCards, projectItems, reactionGroups, state, stateReason, title, updatedAt, url
By default, we will display items in the terminal.
Quickly open an item in the browser using --web or -w
**Examples:**
Example 1 (unknown):
```unknown
gh issue view {<number> | <url>} [flags]
```
Example 2 (unknown):
```unknown
# Viewing an issue in terminal
~/Projects/my-project$ gh issue view 21
Issue title
opened by user. 0 comments. (label)
Issue body
View this issue on GitHub: https://github.com/owner/repo/issues/21
~/Projects/my-project$
```
Example 3 (unknown):
```unknown
# Viewing an issue in the browser
~/Projects/my-project$ gh issue view 21 --web
Opening https://github.com/owner/repo/issues/21 in your browser.
~/Projects/my-project$
```
---
## gh issue reopen
**URL:** https://cli.github.com/manual/gh_issue_reopen
**Contents:**
- gh issue reopen
- Options
- Options inherited from parent commands
- See also
**Examples:**
Example 1 (unknown):
```unknown
gh issue reopen {<number> | <url>} [flags]
```
---
## gh issue comment
**URL:** https://cli.github.com/manual/gh_issue_comment
**Contents:**
- gh issue comment
- Options
- Options inherited from parent commands
- Examples
- See also
Add a comment to a GitHub issue.
Without the body text supplied through flags, the command will interactively prompt for the comment text.
**Examples:**
Example 1 (unknown):
```unknown
gh issue comment {<number> | <url>} [flags]
```
Example 2 (bash):
```bash
$ gh issue comment 12 --body "Hi from GitHub CLI"
```
---
## gh issue close
**URL:** https://cli.github.com/manual/gh_issue_close
**Contents:**
- gh issue close
- Options
- Options inherited from parent commands
- See also
**Examples:**
Example 1 (unknown):
```unknown
gh issue close {<number> | <url>} [flags]
```
---

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,823 @@
# Gh-Cli - Pull Requests
**Pages:** 31
---
## gh project view
**URL:** https://cli.github.com/manual/gh_project_view
**Contents:**
- gh project view
- Options
- Examples
- See also
**Examples:**
Example 1 (unknown):
```unknown
gh project view [<number>] [flags]
```
Example 2 (bash):
```bash
# View the current user's project "1"
$ gh project view 1
# Open user monalisa's project "1" in the browser
$ gh project view 1 --owner monalisa --web
```
---
## gh pr merge
**URL:** https://cli.github.com/manual/gh_pr_merge
**Contents:**
- gh pr merge
- Options
- Options inherited from parent commands
- See also
Merge a pull request on GitHub.
Without an argument, the pull request that belongs to the current branch is selected.
When targeting a branch that requires a merge queue, no merge strategy is required. If required checks have not yet passed, auto-merge will be enabled. If required checks have passed, the pull request will be added to the merge queue. To bypass a merge queue and merge directly, pass the --admin flag.
**Examples:**
Example 1 (unknown):
```unknown
gh pr merge [<number> | <url> | <branch>] [flags]
```
---
## gh project copy
**URL:** https://cli.github.com/manual/gh_project_copy
**Contents:**
- gh project copy
- Options
- Examples
- See also
**Examples:**
Example 1 (unknown):
```unknown
gh project copy [<number>] [flags]
```
Example 2 (bash):
```bash
# Copy project "1" owned by monalisa to github
$ gh project copy 1 --source-owner monalisa --target-owner github --title "a new project"
```
---
## gh project item-add
**URL:** https://cli.github.com/manual/gh_project_item-add
**Contents:**
- gh project item-add
- Options
- Examples
- See also
Add a pull request or an issue to a project
**Examples:**
Example 1 (unknown):
```unknown
gh project item-add [<number>] [flags]
```
Example 2 (bash):
```bash
# Add an item to monalisa's project "1"
$ gh project item-add 1 --owner monalisa --url https://github.com/monalisa/myproject/issues/23
```
---
## gh preview prompter
**URL:** https://cli.github.com/manual/gh_preview_prompter
**Contents:**
- gh preview prompter
- See also
Execute a test program to preview the prompter. Without an argument, all prompts will be run.
Available prompt types:
**Examples:**
Example 1 (unknown):
```unknown
gh preview prompter [prompt type]
```
---
## gh pr update-branch
**URL:** https://cli.github.com/manual/gh_pr_update-branch
**Contents:**
- gh pr update-branch
- Options
- Options inherited from parent commands
- Examples
- See also
Update a pull request branch with latest changes of the base branch.
Without an argument, the pull request that belongs to the current branch is selected.
The default behavior is to update with a merge commit (i.e., merging the base branch into the PR's branch). To reconcile the changes with rebasing on top of the base branch, the --rebase option should be provided.
**Examples:**
Example 1 (unknown):
```unknown
gh pr update-branch [<number> | <url> | <branch>] [flags]
```
Example 2 (bash):
```bash
$ gh pr update-branch 23
$ gh pr update-branch 23 --rebase
$ gh pr update-branch 23 --repo owner/repo
```
---
## gh agent-task list
**URL:** https://cli.github.com/manual/gh_agent-task_list
**Contents:**
- gh agent-task list
- Options
- See also
List agent tasks (preview)
**Examples:**
Example 1 (unknown):
```unknown
gh agent-task list [flags]
```
---
## gh pr edit
**URL:** https://cli.github.com/manual/gh_pr_edit
**Contents:**
- gh pr edit
- Options
- Options inherited from parent commands
- Examples
- See also
Without an argument, the pull request that belongs to the current branch is selected.
Editing a pull request's projects requires authorization with the project scope. To authorize, run gh auth refresh -s project.
The --add-assignee and --remove-assignee flags both support the following special values:
The --add-reviewer and --remove-reviewer flags do not support these special values.
**Examples:**
Example 1 (unknown):
```unknown
gh pr edit [<number> | <url> | <branch>] [flags]
```
Example 2 (bash):
```bash
$ gh pr edit 23 --title "I found a bug" --body "Nothing works"
$ gh pr edit 23 --add-label "bug,help wanted" --remove-label "core"
$ gh pr edit 23 --add-reviewer monalisa,hubot --remove-reviewer myorg/team-name
$ gh pr edit 23 --add-assignee "@me" --remove-assignee monalisa,hubot
$ gh pr edit 23 --add-assignee "@copilot"
$ gh pr edit 23 --add-project "Roadmap" --remove-project v1,v2
$ gh pr edit 23 --milestone "Version 1"
$ gh pr edit 23 --remove-milestone
```
---
## gh project mark-template
**URL:** https://cli.github.com/manual/gh_project_mark-template
**Contents:**
- gh project mark-template
- Options
- Examples
- See also
Mark a project as a template
**Examples:**
Example 1 (unknown):
```unknown
gh project mark-template [<number>] [flags]
```
Example 2 (bash):
```bash
# Mark the github org's project "1" as a template
$ gh project mark-template 1 --owner "github"
# Unmark the github org's project "1" as a template
$ gh project mark-template 1 --owner "github" --undo
```
---
## gh pr review
**URL:** https://cli.github.com/manual/gh_pr_review
**Contents:**
- gh pr review
- Options
- Options inherited from parent commands
- Examples
- See also
Add a review to a pull request.
Without an argument, the pull request that belongs to the current branch is reviewed.
**Examples:**
Example 1 (unknown):
```unknown
gh pr review [<number> | <url> | <branch>] [flags]
```
Example 2 (bash):
```bash
# Approve the pull request of the current branch
$ gh pr review --approve
# Leave a review comment for the current branch
$ gh pr review --comment -b "interesting"
# Add a review for a specific pull request
$ gh pr review 123
# Request changes on a specific pull request
$ gh pr review 123 -r -b "needs more ASCII art"
```
---
## gh preview
**URL:** https://cli.github.com/manual/gh_preview
**Contents:**
- gh preview
- Available commands
- See also
Preview commands are for testing, demonstrative, and development purposes only. They should be considered unstable and can change at any time.
---
## gh pr close
**URL:** https://cli.github.com/manual/gh_pr_close
**Contents:**
- gh pr close
- Options
- Options inherited from parent commands
- See also
**Examples:**
Example 1 (unknown):
```unknown
gh pr close {<number> | <url> | <branch>} [flags]
```
---
## gh project delete
**URL:** https://cli.github.com/manual/gh_project_delete
**Contents:**
- gh project delete
- Options
- Examples
- See also
**Examples:**
Example 1 (unknown):
```unknown
gh project delete [<number>] [flags]
```
Example 2 (bash):
```bash
# Delete the current user's project "1"
$ gh project delete 1 --owner "@me"
```
---
## gh pr lock
**URL:** https://cli.github.com/manual/gh_pr_lock
**Contents:**
- gh pr lock
- Options
- Options inherited from parent commands
- See also
Lock pull request conversation
**Examples:**
Example 1 (unknown):
```unknown
gh pr lock {<number> | <url>} [flags]
```
---
## gh agent-task
**URL:** https://cli.github.com/manual/gh_agent-task
**Contents:**
- gh agent-task
- Available commands
- ALIASES
- Examples
- See also
Working with agent tasks in the GitHub CLI is in preview and subject to change without notice.
gh agent, gh agents, gh agent-tasks
**Examples:**
Example 1 (unknown):
```unknown
gh agent-task <command>
```
Example 2 (bash):
```bash
# List your most recent agent tasks
$ gh agent-task list
# Create a new agent task on the current repository
$ gh agent-task create "Improve the performance of the data processing pipeline"
# View details about agent tasks associated with a pull request
$ gh agent-task view 123
# View details about a specific agent task
$ gh agent-task view 12345abc-12345-12345-12345-12345abc
```
---
## gh pr comment
**URL:** https://cli.github.com/manual/gh_pr_comment
**Contents:**
- gh pr comment
- Options
- Options inherited from parent commands
- Examples
- See also
Add a comment to a GitHub pull request.
Without the body text supplied through flags, the command will interactively prompt for the comment text.
**Examples:**
Example 1 (unknown):
```unknown
gh pr comment [<number> | <url> | <branch>] [flags]
```
Example 2 (bash):
```bash
$ gh pr comment 13 --body "Hi from GitHub CLI"
```
---
## gh project item-archive
**URL:** https://cli.github.com/manual/gh_project_item-archive
**Contents:**
- gh project item-archive
- Options
- Examples
- See also
Archive an item in a project
**Examples:**
Example 1 (unknown):
```unknown
gh project item-archive [<number>] [flags]
```
Example 2 (bash):
```bash
# Archive an item in the current user's project "1"
$ gh project item-archive 1 --owner "@me" --id <item-ID>
```
---
## gh project item-delete
**URL:** https://cli.github.com/manual/gh_project_item-delete
**Contents:**
- gh project item-delete
- Options
- Examples
- See also
Delete an item from a project by ID
**Examples:**
Example 1 (unknown):
```unknown
gh project item-delete [<number>] [flags]
```
Example 2 (bash):
```bash
# Delete an item in the current user's project "1"
$ gh project item-delete 1 --owner "@me" --id <item-id>
```
---
## gh project close
**URL:** https://cli.github.com/manual/gh_project_close
**Contents:**
- gh project close
- Options
- Examples
- See also
**Examples:**
Example 1 (unknown):
```unknown
gh project close [<number>] [flags]
```
Example 2 (bash):
```bash
# Close project "1" owned by monalisa
$ gh project close 1 --owner monalisa
# Reopen closed project "1" owned by github
$ gh project close 1 --owner github --undo
```
---
## gh project field-list
**URL:** https://cli.github.com/manual/gh_project_field-list
**Contents:**
- gh project field-list
- Options
- Examples
- See also
List the fields in a project
**Examples:**
Example 1 (unknown):
```unknown
gh project field-list [<number>] [flags]
```
Example 2 (bash):
```bash
# List fields in the current user's project "1"
$ gh project field-list 1 --owner "@me"
```
---
## gh project edit
**URL:** https://cli.github.com/manual/gh_project_edit
**Contents:**
- gh project edit
- Options
- Examples
- See also
**Examples:**
Example 1 (unknown):
```unknown
gh project edit [<number>] [flags]
```
Example 2 (bash):
```bash
# Edit the title of monalisa's project "1"
$ gh project edit 1 --owner monalisa --title "New title"
```
---
## gh project item-list
**URL:** https://cli.github.com/manual/gh_project_item-list
**Contents:**
- gh project item-list
- Options
- Examples
- See also
List the items in a project
**Examples:**
Example 1 (unknown):
```unknown
gh project item-list [<number>] [flags]
```
Example 2 (bash):
```bash
# List the items in the current users's project "1"
$ gh project item-list 1 --owner "@me"
```
---
## gh pr diff
**URL:** https://cli.github.com/manual/gh_pr_diff
**Contents:**
- gh pr diff
- Options
- Options inherited from parent commands
- See also
View changes in a pull request.
Without an argument, the pull request that belongs to the current branch is selected.
With --web flag, open the pull request diff in a web browser instead.
**Examples:**
Example 1 (unknown):
```unknown
gh pr diff [<number> | <url> | <branch>] [flags]
```
---
## gh project list
**URL:** https://cli.github.com/manual/gh_project_list
**Contents:**
- gh project list
- Options
- ALIASES
- Examples
- See also
List the projects for an owner
**Examples:**
Example 1 (unknown):
```unknown
gh project list [flags]
```
Example 2 (bash):
```bash
# List the current user's projects
$ gh project list
# List the projects for org github including closed projects
$ gh project list --owner github --closed
```
---
## gh project
**URL:** https://cli.github.com/manual/gh_project
**Contents:**
- gh project
- Available commands
- Examples
- See also
Work with GitHub Projects.
The minimum required scope for the token is: project. You can verify your token scope by running gh auth status and add the project scope by running gh auth refresh -s project.
**Examples:**
Example 1 (bash):
```bash
$ gh project create --owner monalisa --title "Roadmap"
$ gh project view 1 --owner cli --web
$ gh project field-list 1 --owner cli
$ gh project item-list 1 --owner cli
```
---
## gh pr unlock
**URL:** https://cli.github.com/manual/gh_pr_unlock
**Contents:**
- gh pr unlock
- Options inherited from parent commands
- See also
Unlock pull request conversation
**Examples:**
Example 1 (unknown):
```unknown
gh pr unlock {<number> | <url>}
```
---
## gh pr reopen
**URL:** https://cli.github.com/manual/gh_pr_reopen
**Contents:**
- gh pr reopen
- Options
- Options inherited from parent commands
- See also
Reopen a pull request
**Examples:**
Example 1 (unknown):
```unknown
gh pr reopen {<number> | <url> | <branch>} [flags]
```
---
## gh project field-delete
**URL:** https://cli.github.com/manual/gh_project_field-delete
**Contents:**
- gh project field-delete
- Options
- See also
Delete a field in a project
**Examples:**
Example 1 (unknown):
```unknown
gh project field-delete [flags]
```
---
## gh pr
**URL:** https://cli.github.com/manual/gh_pr
**Contents:**
- gh pr
- General commands
- Targeted commands
- Options
- Examples
- See also
Work with GitHub pull requests.
**Examples:**
Example 1 (bash):
```bash
$ gh pr checkout 353
$ gh pr create --fill
$ gh pr view --web
```
---
## gh pr checks
**URL:** https://cli.github.com/manual/gh_pr_checks
**Contents:**
- gh pr checks
- Options
- Options inherited from parent commands
- JSON Fields
- See also
Show CI status for a single pull request.
Without an argument, the pull request that belongs to the current branch is selected.
When the --json flag is used, it includes a bucket field, which categorizes the state field into pass, fail, pending, skipping, or cancel.
Additional exit codes: 8: Checks pending
bucket, completedAt, description, event, link, name, startedAt, state, workflow
**Examples:**
Example 1 (unknown):
```unknown
gh pr checks [<number> | <url> | <branch>] [flags]
```
---
## gh pr ready
**URL:** https://cli.github.com/manual/gh_pr_ready
**Contents:**
- gh pr ready
- Options
- Options inherited from parent commands
- See also
Mark a pull request as ready for review.
Without an argument, the pull request that belongs to the current branch is marked as ready.
If supported by your plan, convert to draft with --undo
**Examples:**
Example 1 (unknown):
```unknown
gh pr ready [<number> | <url> | <branch>] [flags]
```
---

View File

@@ -0,0 +1,254 @@
# Gh-Cli - Releases
**Pages:** 9
---
## gh release delete
**URL:** https://cli.github.com/manual/gh_release_delete
**Contents:**
- gh release delete
- Options
- Options inherited from parent commands
- See also
**Examples:**
Example 1 (unknown):
```unknown
gh release delete <tag> [flags]
```
---
## gh release upload
**URL:** https://cli.github.com/manual/gh_release_upload
**Contents:**
- gh release upload
- Options
- Options inherited from parent commands
- See also
Upload asset files to a GitHub Release.
To define a display label for an asset, append text starting with # after the file name.
**Examples:**
Example 1 (unknown):
```unknown
gh release upload <tag> <files>... [flags]
```
---
## gh release delete-asset
**URL:** https://cli.github.com/manual/gh_release_delete-asset
**Contents:**
- gh release delete-asset
- Options
- Options inherited from parent commands
- See also
Delete an asset from a release
**Examples:**
Example 1 (unknown):
```unknown
gh release delete-asset <tag> <asset-name> [flags]
```
---
## gh release view
**URL:** https://cli.github.com/manual/gh_release_view
**Contents:**
- gh release view
- Options
- Options inherited from parent commands
- JSON Fields
- See also
View information about a GitHub Release.
Without an explicit tag name argument, the latest release in the project is shown.
apiUrl, assets, author, body, createdAt, databaseId, id, isDraft, isImmutable, isPrerelease, name, publishedAt, tagName, tarballUrl, targetCommitish, uploadUrl, url, zipballUrl
**Examples:**
Example 1 (unknown):
```unknown
gh release view [<tag>] [flags]
```
---
## gh release verify-asset
**URL:** https://cli.github.com/manual/gh_release_verify-asset
**Contents:**
- gh release verify-asset
- Options
- Options inherited from parent commands
- Examples
- See also
Verify that a given asset file originated from a specific GitHub Release using cryptographically signed attestations.
An attestation is a claim made by GitHub regarding a release and its assets.
**Examples:**
Example 1 (unknown):
```unknown
gh release verify-asset [<tag>] <file-path> [flags]
```
Example 2 (unknown):
```unknown
This command checks that the asset you provide matches a valid attestation for the specified release (or the latest release, if no tag is given). It ensures the asset's integrity by validating that the asset's digest matches the subject in the attestation and that the attestation is associated with the release.
```
Example 3 (bash):
```bash
# Verify an asset from the latest release
$ gh release verify-asset ./dist/my-asset.zip
# Verify an asset from a specific release tag
$ gh release verify-asset v1.2.3 ./dist/my-asset.zip
# Verify an asset from a specific release tag and output the attestation in JSON format
$ gh release verify-asset v1.2.3 ./dist/my-asset.zip --format json
```
---
## gh release download
**URL:** https://cli.github.com/manual/gh_release_download
**Contents:**
- gh release download
- Options
- Options inherited from parent commands
- Examples
- See also
Download assets from a GitHub release.
Without an explicit tag name argument, assets are downloaded from the latest release in the project. In this case, --pattern or --archive is required.
**Examples:**
Example 1 (unknown):
```unknown
gh release download [<tag>] [flags]
```
Example 2 (bash):
```bash
# Download all assets from a specific release
$ gh release download v1.2.3
# Download only Debian packages for the latest release
$ gh release download --pattern '*.deb'
# Specify multiple file patterns
$ gh release download -p '*.deb' -p '*.rpm'
# Download the archive of the source code for a release
$ gh release download v1.2.3 --archive=zip
```
---
## gh release edit
**URL:** https://cli.github.com/manual/gh_release_edit
**Contents:**
- gh release edit
- Options
- Options inherited from parent commands
- Examples
- See also
**Examples:**
Example 1 (unknown):
```unknown
gh release edit <tag>
```
Example 2 (bash):
```bash
# Publish a release that was previously a draft
$ gh release edit v1.0 --draft=false
# Update the release notes from the content of a file
$ gh release edit v1.0 --notes-file /path/to/release_notes.md
```
---
## gh release verify
**URL:** https://cli.github.com/manual/gh_release_verify
**Contents:**
- gh release verify
- Options
- Options inherited from parent commands
- Examples
- See also
Verify that a GitHub Release is accompanied by a valid cryptographically signed attestation.
An attestation is a claim made by GitHub regarding a release and its assets.
This command checks that the specified release (or the latest release, if no tag is given) has a valid attestation. It fetches the attestation for the release and prints metadata about all assets referenced in the attestation, including their digests.
**Examples:**
Example 1 (unknown):
```unknown
gh release verify [<tag>] [flags]
```
Example 2 (bash):
```bash
# Verify the latest release
gh release verify
# Verify a specific release by tag
gh release verify v1.2.3
# Verify a specific release by tag and output the attestation in JSON format
gh release verify v1.2.3 --format json
```
---
## gh release
**URL:** https://cli.github.com/manual/gh_release
**Contents:**
- gh release
- General commands
- Targeted commands
- Options
- See also
---

View File

@@ -0,0 +1,92 @@
# Remote Repository Analysis
Fetch files and analyze repositories without cloning them locally.
## Fetch Files Without Cloning
### Get directory listing
```bash
gh api repos/OWNER/REPO/contents/PATH
```
Returns JSON array with file/directory metadata.
### Fetch file content
```bash
gh api repos/OWNER/REPO/contents/path/file.ts | jq -r '.content' | base64 -d
```
The API returns base64-encoded content, so decode it with `base64 -d`.
### Get entire file tree recursively
```bash
gh api repos/OWNER/REPO/git/trees/main?recursive=1
```
Returns complete tree structure in one request.
## Useful Remote Analysis Patterns
### Check if file exists
```bash
gh api repos/OWNER/REPO/contents/path/file.ts 2>/dev/null && echo "exists" || echo "not found"
```
### Get latest commit for specific file
```bash
gh api repos/OWNER/REPO/commits?path=src/index.ts | jq -r '.[0].sha'
```
### Compare file across branches
```bash
gh api repos/OWNER/REPO/contents/file.ts?ref=main | jq -r '.content' | base64 -d > main.ts
gh api repos/OWNER/REPO/contents/file.ts?ref=dev | jq -r '.content' | base64 -d > dev.ts
diff main.ts dev.ts
```
### Get file from specific commit
```bash
gh api repos/OWNER/REPO/contents/file.ts?ref=abc123 | jq -r '.content' | base64 -d
```
Use any commit SHA, branch name, or tag as the `ref` parameter.
## Working with Large Repositories
For large repos, use the Git Trees API instead of Contents API:
```bash
# Get full tree
gh api repos/OWNER/REPO/git/trees/main?recursive=1 | jq '.tree[] | select(.type == "blob") | .path'
```
This is more efficient for listing many files.
## Common Use Cases
### Inspect configuration files
```bash
gh api repos/vercel/next.js/contents/package.json | jq -r '.content' | base64 -d | jq '.dependencies'
```
### Check documentation
```bash
gh api repos/anthropics/anthropic-sdk-python/contents/README.md | jq -r '.content' | base64 -d
```
### Analyze project structure
```bash
gh api repos/OWNER/REPO/git/trees/main?recursive=1 | jq -r '.tree[] | select(.type == "tree") | .path'
```
Shows all directories in the repository.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,372 @@
# Gh-Cli - Search
**Pages:** 7
---
## gh search prs
**URL:** https://cli.github.com/manual/gh_search_prs
**Contents:**
- gh search prs
- Options
- JSON Fields
- Examples
- See also
Search for pull requests on GitHub.
The command supports constructing queries using the GitHub search syntax, using the parameter and qualifier flags, or a combination of the two.
GitHub search syntax is documented at: https://docs.github.com/search-github/searching-on-github/searching-issues-and-pull-requests
On supported GitHub hosts, advanced issue search syntax can be used in the --search query. For more information about advanced issue search, see: https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/filtering-and-searching-issues-and-pull-requests#building-advanced-filters-for-issues
For more information on handling search queries containing a hyphen, run gh search --help.
assignees, author, authorAssociation, body, closedAt, commentsCount, createdAt, id, isDraft, isLocked, isPullRequest, labels, number, repository, state, title, updatedAt, url
**Examples:**
Example 1 (unknown):
```unknown
gh search prs [<query>] [flags]
```
Example 2 (bash):
```bash
# Search pull requests matching set of keywords "fix" and "bug"
$ gh search prs fix bug
# Search draft pull requests in cli repository
$ gh search prs --repo=cli/cli --draft
# Search open pull requests requesting your review
$ gh search prs --review-requested=@me --state=open
# Search merged pull requests assigned to yourself
$ gh search prs --assignee=@me --merged
# Search pull requests with numerous reactions
$ gh search prs --reactions=">100"
# Search pull requests without label "bug"
$ gh search prs -- -label:bug
# Search pull requests only from un-archived repositories (default is all repositories)
$ gh search prs --owner github --archived=false
```
---
## gh search issues
**URL:** https://cli.github.com/manual/gh_search_issues
**Contents:**
- gh search issues
- Options
- JSON Fields
- Examples
- See also
Search for issues on GitHub.
The command supports constructing queries using the GitHub search syntax, using the parameter and qualifier flags, or a combination of the two.
GitHub search syntax is documented at: https://docs.github.com/search-github/searching-on-github/searching-issues-and-pull-requests
On supported GitHub hosts, advanced issue search syntax can be used in the --search query. For more information about advanced issue search, see: https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/filtering-and-searching-issues-and-pull-requests#building-advanced-filters-for-issues
For more information on handling search queries containing a hyphen, run gh search --help.
assignees, author, authorAssociation, body, closedAt, commentsCount, createdAt, id, isLocked, isPullRequest, labels, number, repository, state, title, updatedAt, url
**Examples:**
Example 1 (unknown):
```unknown
gh search issues [<query>] [flags]
```
Example 2 (bash):
```bash
# Search issues matching set of keywords "readme" and "typo"
$ gh search issues readme typo
# Search issues matching phrase "broken feature"
$ gh search issues "broken feature"
# Search issues and pull requests in cli organization
$ gh search issues --include-prs --owner=cli
# Search open issues assigned to yourself
$ gh search issues --assignee=@me --state=open
# Search issues with numerous comments
$ gh search issues --comments=">100"
# Search issues without label "bug"
$ gh search issues -- -label:bug
# Search issues only from un-archived repositories (default is all repositories)
$ gh search issues --owner github --archived=false
```
---
## gh search code
**URL:** https://cli.github.com/manual/gh_search_code
**Contents:**
- gh search code
- Options
- JSON Fields
- Examples
- See also
Search within code in GitHub repositories.
The search syntax is documented at: https://docs.github.com/search-github/searching-on-github/searching-code
Note that these search results are powered by what is now a legacy GitHub code search engine. The results might not match what is seen on github.com, and new features like regex search are not yet available via the GitHub API.
For more information on handling search queries containing a hyphen, run gh search --help.
path, repository, sha, textMatches, url
**Examples:**
Example 1 (unknown):
```unknown
gh search code <query> [flags]
```
Example 2 (bash):
```bash
# Search code matching "react" and "lifecycle"
$ gh search code react lifecycle
# Search code matching "error handling"
$ gh search code "error handling"
# Search code matching "deque" in Python files
$ gh search code deque --language=python
# Search code matching "cli" in repositories owned by microsoft organization
$ gh search code cli --owner=microsoft
# Search code matching "panic" in the GitHub CLI repository
$ gh search code panic --repo cli/cli
# Search code matching keyword "lint" in package.json files
$ gh search code lint --filename package.json
```
---
## gh search commits
**URL:** https://cli.github.com/manual/gh_search_commits
**Contents:**
- gh search commits
- Options
- JSON Fields
- Examples
- See also
Search for commits on GitHub.
The command supports constructing queries using the GitHub search syntax, using the parameter and qualifier flags, or a combination of the two.
GitHub search syntax is documented at: https://docs.github.com/search-github/searching-on-github/searching-commits
For more information on handling search queries containing a hyphen, run gh search --help.
author, commit, committer, id, parents, repository, sha, url
**Examples:**
Example 1 (unknown):
```unknown
gh search commits [<query>] [flags]
```
Example 2 (bash):
```bash
# Search commits matching set of keywords "readme" and "typo"
$ gh search commits readme typo
# Search commits matching phrase "bug fix"
$ gh search commits "bug fix"
# Search commits committed by user "monalisa"
$ gh search commits --committer=monalisa
# Search commits authored by users with name "Jane Doe"
$ gh search commits --author-name="Jane Doe"
# Search commits matching hash "8dd03144ffdc6c0d486d6b705f9c7fba871ee7c3"
$ gh search commits --hash=8dd03144ffdc6c0d486d6b705f9c7fba871ee7c3
# Search commits authored before February 1st, 2022
$ gh search commits --author-date="<2022-02-01"
```
---
## gh extension search
**URL:** https://cli.github.com/manual/gh_extension_search
**Contents:**
- gh extension search
- Options
- JSON Fields
- Examples
- See also
Search for gh extensions.
With no arguments, this command prints out the first 30 extensions available to install sorted by number of stars. More extensions can be fetched by specifying a higher limit with the --limit flag.
When connected to a terminal, this command prints out three columns. The first has a ✓ if the extension is already installed locally. The second is the full name of the extension repository in OWNER/REPO format. The third is the extension's description.
When not connected to a terminal, the ✓ character is rendered as the word "installed" but otherwise the order and content of the columns are the same.
This command behaves similarly to gh search repos but does not support as many search qualifiers. For a finer grained search of extensions, try using:
and adding qualifiers as needed. See gh help search repos to learn more about repository search.
For listing just the extensions that are already installed locally, see:
createdAt, defaultBranch, description, forksCount, fullName, hasDownloads, hasIssues, hasPages, hasProjects, hasWiki, homepage, id, isArchived, isDisabled, isFork, isPrivate, language, license, name, openIssuesCount, owner, pushedAt, size, stargazersCount, updatedAt, url, visibility, watchersCount
**Examples:**
Example 1 (unknown):
```unknown
gh extension search [<query>] [flags]
```
Example 2 (unknown):
```unknown
gh search repos --topic "gh-extension"
```
Example 3 (unknown):
```unknown
gh ext list
```
Example 4 (bash):
```bash
# List the first 30 extensions sorted by star count, descending
$ gh ext search
# List more extensions
$ gh ext search --limit 300
# List extensions matching the term "branch"
$ gh ext search branch
# List extensions owned by organization "github"
$ gh ext search --owner github
# List extensions, sorting by recently updated, ascending
$ gh ext search --sort updated --order asc
# List extensions, filtering by license
$ gh ext search --license MIT
# Open search results in the browser
$ gh ext search -w
```
---
## gh search repos
**URL:** https://cli.github.com/manual/gh_search_repos
**Contents:**
- gh search repos
- Options
- JSON Fields
- Examples
- See also
Search for repositories on GitHub.
The command supports constructing queries using the GitHub search syntax, using the parameter and qualifier flags, or a combination of the two.
GitHub search syntax is documented at: https://docs.github.com/search-github/searching-on-github/searching-for-repositories
For more information on handling search queries containing a hyphen, run gh search --help.
createdAt, defaultBranch, description, forksCount, fullName, hasDownloads, hasIssues, hasPages, hasProjects, hasWiki, homepage, id, isArchived, isDisabled, isFork, isPrivate, language, license, name, openIssuesCount, owner, pushedAt, size, stargazersCount, updatedAt, url, visibility, watchersCount
**Examples:**
Example 1 (unknown):
```unknown
gh search repos [<query>] [flags]
```
Example 2 (bash):
```bash
# Search repositories matching set of keywords "cli" and "shell"
$ gh search repos cli shell
# Search repositories matching phrase "vim plugin"
$ gh search repos "vim plugin"
# Search repositories public repos in the microsoft organization
$ gh search repos --owner=microsoft --visibility=public
# Search repositories with a set of topics
$ gh search repos --topic=unix,terminal
# Search repositories by coding language and number of good first issues
$ gh search repos --language=go --good-first-issues=">=10"
# Search repositories without topic "linux"
$ gh search repos -- -topic:linux
# Search repositories excluding archived repositories
$ gh search repos --archived=false
```
---
## gh search
**URL:** https://cli.github.com/manual/gh_search
**Contents:**
- gh search
- Available commands
- See also
Search across all of GitHub.
Excluding search results that match a qualifier
In a browser, the GitHub search syntax supports excluding results that match a search qualifier by prefixing the qualifier with a hyphen. For example, to search for issues that do not have the label "bug", you would use -label:bug as a search qualifier.
gh supports this syntax in gh search as well, but it requires extra command line arguments to avoid the hyphen being interpreted as a command line flag because it begins with a hyphen.
On Unix-like systems, you can use the -- argument to indicate that the arguments that follow are not a flag, but rather a query string. For example:
$ gh search issues -- "my-search-query -label:bug"
On PowerShell, you must use both the --% argument and the -- argument to produce the same effect. For example:
$ gh --% search issues -- "my search query -label:bug"
See the following for more information:
---

View File

@@ -0,0 +1,432 @@
# Special Syntax & Command Quirks
GitHub CLI has several syntax inconsistencies and special cases to be aware of.
## Field Name Inconsistencies
**CRITICAL:** Different commands use different field names for the same data.
### Stars field
| Command | Field Name |
|---------|-----------|
| `gh repo view` | `stargazerCount` |
| `gh search repos` | `stargazersCount` |
**Examples:**
```bash
# ✅ Correct for gh repo view
gh repo view anthropics/anthropic-sdk-python --json stargazerCount
# ✅ Correct for gh search repos
gh search repos "anthropics" --json stargazersCount
# ❌ Wrong - will error
gh repo view anthropics/anthropic-sdk-python --json stargazersCount
gh search repos "anthropics" --json stargazerCount
```
### Forks field
| Command | Field Name |
|---------|-----------|
| `gh repo view` | `forkCount` |
| `gh search repos` | `forksCount` |
**Examples:**
```bash
# ✅ Correct
gh repo view owner/repo --json forkCount
gh search repos "query" --json forksCount
# ❌ Wrong
gh repo view owner/repo --json forksCount
gh search repos "query" --json forkCount
```
### Quick reference table
| Data | `gh repo view` | `gh search repos` |
|------|----------------|-------------------|
| Stars | `stargazerCount` | `stargazersCount` |
| Forks | `forkCount` | `forksCount` |
| Topics | `repositoryTopics` | `repositoryTopics` |
| Description | `description` | `description` |
| URL | `url` | `url` |
## Negative Qualifiers
When using negative search qualifiers (prefixed with `-`), you need special syntax to prevent the shell from interpreting the hyphen as a flag.
### Unix/Linux/Mac
Use `--` to mark the end of flags:
```bash
# ✅ Correct
gh search issues -- "bug report -label:wontfix"
gh search repos -- "typescript -topic:deprecated"
gh search code -- "TODO -filename:test"
# ❌ Wrong - shell interprets -label as a flag
gh search issues "bug report -label:wontfix"
```
### PowerShell
Use `--%` (stop parsing) operator:
```bash
# ✅ Correct
gh --% search issues -- "bug report -label:wontfix"
gh --% search repos -- "rust -archived:true"
# ❌ Wrong
gh search issues "bug report -label:wontfix"
```
### Common negative qualifiers
```bash
# Exclude labels
gh search issues -- "bug -label:wontfix -label:duplicate"
# Exclude topics
gh search repos -- "web framework -topic:deprecated"
# Exclude archived repos
gh search repos -- "stars:>100 -archived:true"
# Exclude specific languages
gh search code -- "config -language:json"
# Exclude filenames
gh search code -- "authentication -filename:test -filename:spec"
```
## Date Format Quirks
### ISO 8601 format required
```bash
# ✅ Correct
gh search repos "created:>2024-10-01"
gh search repos "pushed:<2024-12-31"
# ❌ Wrong
gh search repos "created:>10/01/2024" # US format doesn't work
gh search repos "created:>2024/10/01" # Slashes don't work
```
### Date ranges
```bash
# Between dates
gh search repos "created:2024-01-01..2024-06-30"
# Relative dates work in some contexts
gh search repos "pushed:>2024-10-01" # After October 1st
# Time is optional (defaults to start of day)
gh search repos "created:>2024-10-01T12:00:00Z" # With time
gh search repos "created:>2024-10-01" # Without time (00:00:00)
```
## Search Syntax Gotchas
### Spaces in queries
Wrap multi-word queries in quotes:
```bash
# ✅ Correct
gh search code "error handling" --language=python
gh search repos "machine learning" --sort stars
# ❌ Wrong - treats each word as separate argument
gh search code error handling --language=python
```
### Boolean operators
GitHub search doesn't support traditional AND/OR/NOT:
```bash
# ✅ Use qualifiers instead
gh search repos "topic:react topic:typescript" # Implicit AND
gh search issues -- "bug -label:wontfix" # Implicit NOT
# ❌ Wrong - literal text search
gh search repos "react AND typescript"
gh search repos "bug NOT wontfix"
```
### Wildcards
Limited wildcard support:
```bash
# ✅ Wildcards work in some contexts
gh search code "function*" --language=typescript
gh search repos "react-*" in:name
# ❌ Wildcards don't work everywhere
gh search repos "created:>2024-*" # Doesn't work with dates
```
## JSON Output Quirks
### jq is required for field extraction
```bash
# ✅ Correct - use jq to extract fields
gh api repos/owner/repo/contents/file.ts | jq -r '.content'
# ❌ Wrong - raw output is base64 + JSON
gh api repos/owner/repo/contents/file.ts
```
### Array handling
```bash
# ✅ Correct - iterate array
gh search repos "topic:rust" --json name --jq '.[].name'
# ❌ Wrong - returns raw JSON array
gh search repos "topic:rust" --json name
```
### Null handling
```bash
# ✅ Correct - handle nulls
gh api repos/owner/repo/contents/path | jq -r '.content // empty'
# ❌ Wrong - errors on null
gh api repos/owner/repo/contents/path | jq -r '.content'
```
## API Endpoint Quirks
### Base64 encoding
File contents from the API are base64-encoded:
```bash
# ✅ Correct - decode with base64 -d
gh api repos/owner/repo/contents/file.ts | jq -r '.content' | base64 -d
# ❌ Wrong - outputs base64 gibberish
gh api repos/owner/repo/contents/file.ts | jq -r '.content'
```
### Recursive tree flag
For recursive directory listings, use query parameter:
```bash
# ✅ Correct
gh api repos/owner/repo/git/trees/main?recursive=1
# ❌ Wrong - returns only top level
gh api repos/owner/repo/git/trees/main
```
### Ref parameter
Specify branch/tag/commit with `ref`:
```bash
# ✅ Correct
gh api repos/owner/repo/contents/file.ts?ref=dev
gh api repos/owner/repo/contents/file.ts?ref=v1.0.0
gh api repos/owner/repo/contents/file.ts?ref=abc123
# ❌ Wrong - uses default branch
gh api repos/owner/repo/contents/file.ts
```
## Pagination
### Default limits
Different commands have different default limits:
```bash
# gh search commands default to 30 results
gh search repos "topic:rust" # Returns max 30
# Specify limit explicitly
gh search repos "topic:rust" --limit 100 # Max 100
# API commands may paginate automatically
gh api repos/owner/repo/issues # May return all or paginate
```
### Manual pagination
```bash
# Use --paginate for API calls
gh api --paginate repos/owner/repo/issues
# Search commands have hard limit of 1000 total results
gh search repos "topic:python" --limit 1000
```
## Permission Errors
### Authentication required
Some operations require authentication:
```bash
# Works without auth
gh search repos "topic:rust"
gh api repos/owner/repo/contents/README.md
# Requires auth
gh repo view owner/private-repo
gh search repos "is:private"
# Set token
export GH_TOKEN="your_token"
# or
gh auth login
```
### Rate limiting
```bash
# Check rate limit status
gh api rate_limit
# Authenticated requests have higher limits
# Unauthenticated: 60 requests/hour
# Authenticated: 5000 requests/hour
```
## Quoting Rules
### Shell quoting
```bash
# ✅ Double quotes for variables
gh api repos/$OWNER/$REPO/contents/file.ts
# ✅ Single quotes for literal strings
gh search code 'function*'
# ✅ Escape special chars in double quotes
gh search repos "name with \"quotes\""
```
### JSON quoting in --json
```bash
# ✅ Comma-separated field list
gh repo view owner/repo --json name,description,stargazerCount
# ❌ Wrong - no quotes around field names
gh repo view owner/repo --json "name","description"
# ❌ Wrong - spaces
gh repo view owner/repo --json name, description
```
## Command-Specific Quirks
### gh search vs gh api
Different approaches for different use cases:
```bash
# Use gh search for discovery
gh search repos "topic:rust" --sort stars
# Use gh api for precise data
gh api repos/owner/repo --jq '.stargazers_count'
```
### gh repo view vs gh api
Field names differ:
```bash
# gh repo view uses camelCase
gh repo view owner/repo --json stargazerCount
# gh api uses snake_case
gh api repos/owner/repo --jq '.stargazers_count'
```
## Common Errors
### "No field named X"
You used the wrong field name for the command:
```bash
# Error: "No field named stargazersCount"
gh repo view owner/repo --json stargazersCount
# Fix: use stargazerCount for gh repo view
gh repo view owner/repo --json stargazerCount
```
### "Not Found (404)"
File doesn't exist or wrong ref:
```bash
# Check file exists in branch
gh api repos/owner/repo/contents/path/file.ts?ref=main
# Try different ref
gh api repos/owner/repo/contents/path/file.ts?ref=dev
```
### "Bad credentials"
Authentication issue:
```bash
# Check auth status
gh auth status
# Re-authenticate
gh auth login
```
## Tips
### Always test field names
Before using in scripts, test the field name:
```bash
# Check available fields
gh repo view owner/repo --json | jq keys
# Check search result fields
gh search repos "query" --json | jq '.[0] | keys'
```
### Use --help
Every command has detailed help:
```bash
gh search repos --help
gh api --help
gh repo view --help
```
### Check the manual
For edge cases, check official docs:
- CLI manual: https://cli.github.com/manual/
- Search syntax: https://docs.github.com/en/search-github
- API reference: https://docs.github.com/en/rest