GitHub CLI でリモートリポジトリの内容を直接閲覧可能に
GitHub が GitHub CLI に「gh repo read-file」と「gh repo read-dir」の2 つの新コマンドを追加し、ユーザーがリポジトリをクローンせずにターミナルからファイルやディレクトリ内容を直接閲覧・確認できるようになった。
ターミナルからクローンせずにリポジトリの内容を探索するには、2 つの新しいコマンド gh repo read-file と gh repo read-dir を使用します。
できること
gh repo read-file を使用して、リモートリポジトリから個別のファイルを読み取ることができます。
gh repo read-dir を使用して、リモートリポジトリ内のディレクトリのコンテンツを閲覧できます。
これらのコマンドは、アクセス権限を持つパブリックおよびプライベートリポジトリ全体で動作し、あらゆるリポジトリからのコード、ドキュメント、設定ファイルをより迅速に検査できるようになります。
ユースケース
gh repo read-file と gh repo read-dir を使用すると、以下が可能になります:
ターミナルから離れることなく、README ファイルやドキュメントをすばやく検査する。
複数のリポジトリにわたる設定ファイルを確認する。
リポジトリの内容を読み取るスクリプトと自動化を構築する。
AI エージェントやワークフローへのリポジトリ探索の統合。
利用状況
github CLI v2.95.0 以降にインストールまたはアップグレードした後、gh repo read-file と gh repo read-dir は、GitHub Enterprise Server (GHES) ユーザーを含むすべての GitHub ユーザーで利用可能になります。また、gh スキルをインストールまたは更新することで、AI エージェントが新しい GitHub CLI の機能をどのように活用するかを教えることもできます。
cli/cli リポジトリで詳細を確認したり、フィードバックを提供してください。
この投稿「Read remote repository content with GitHub CLI」は、The GitHub Blog で最初に公開されました。
原文を表示
Explore repository content from your terminal without cloning by using two new commands: gh repo read-file and gh repo read-dir.
What you can do
Use gh repo read-file to read an individual file from a remote repository
Use gh repo read-dir to browse a directory’s contents from a remote repository
These commands work across public and private repositories you have access to, making it faster to inspect code, documentation, and configuration files from any repository.
Use cases
With gh repo read-file and gh repo read-dir, you can:
Quickly inspect README files or documentation without leaving your terminal.
Check configuration files across multiple repositories.
Build scripts and automation that read repository content.
Integrate repository exploration into AI agents and workflows.
Availability
gh repo read-file and gh repo read-dir are available to all GitHub users, including those on GitHub Enterprise Server (GHES), after installing or upgrading to GitHub CLI v2.95.0 or later. You can also teach your agents how to leverage new GitHub CLI features by installing or updating the gh skill.
Learn more or give us feedback on the cli/cli repository.
The post Read remote repository content with GitHub CLI appeared first on The GitHub Blog.
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み