GitHub Copilot CLI 初心者向け:GitHub Copilot CLI の始め方
GitHub Copilot CLIは、ターミナル内でAIコーディングアシスタントを利用できるコマンドラインツールで、npm経由でインストールし、GitHub認証後にプロジェクトの概要取得やコード生成などのタスクを実行できる。
キーポイント
GitHub Copilot CLIの概要
コマンドラインインターフェースにCopilotのAI機能を統合し、リポジトリのコンテキストを活用しながらターミナル内でコード生成やタスク実行を可能にするツール。
インストール方法
npmを使用したクロスプラットフォームインストール(npm install -g @github/copilot)や、WinGetやHomebrewなどのパッケージマネージャー経由でのインストールが可能。
初期設定手順
インストール後、ターミナルでCopilotを起動し、GitHub認証(/login)を行い、フォルダへのアクセス権限を付与することで使用開始できる。
主なユースケース
プロジェクトの概要取得、コード生成、テスト実行などのタスクをAIエージェントに委任でき、ワークフローを中断せずに作業を進められる。
エージェント機能の特徴
自律的にコード構築やテスト実行を行い、自己修正やエラー修正も可能で、ユーザーは他の作業に集中しながら結果をレビューできる。
影響分析・編集コメントを表示
影響分析
この記事は、GitHub Copilotの機能をCLI環境に拡張することで、開発者の作業効率を向上させる新たなツールの紹介であり、AI支援開発がより統合的なワークフローに進化していることを示している。既存のCopilotユーザーにとっては利便性が高まるが、技術的な革新性は限定的と言える。
編集コメント
GitHub公式ブログからの製品紹介記事であり、実用的な導入ガイドとして価値があるが、技術的な深掘りや業界全体への影響分析は限定的。既存Copilotユーザー向けの機能拡張という位置付け。
タイトル: GitHub Copilot CLI for Beginners: Getting started with GitHub Copilot CLI
GitHub Copilot CLI for Beginnersへようこそ!このシリーズ(動画形式およびGitHubブログで公開)では、AIコーディングアシスタントをターミナルで直接使用する方法と、プロのようにコマンドラインを操作するコツをご紹介します。
このブログでは、GitHub Copilot CLIの概要、仕組み、そして使い始める手順を順を追って説明します。npmを使ったインストール方法、GitHubアカウントでの認証、フォルダー権限の付与、そしてターミナルから直接コードを生成する最初のプロンプトの実行方法を学びましょう。
さあ、始めましょう!
GitHub Copilot CLIとは?
GitHub Copilot CLIは、Copilotのエージェント型AIの機能をコマンドラインインターフェース(CLI)に直接導入するものです。これにより、(リポジトリの完全なコンテキストを持った)他のターミナルやコンソールベースのツールと同様に使用できるようになります。
エージェントの特筆すべき点は、コードのビルドやテストの実行といったタスクを自律的に行える能力にあり、これにより反復的な開発が可能になります。さらに、人間が指示を出さなくても、自己修正してエラーを修正することさえできます。
つまり、タスクをCopilotに任せ、他のToDoリストの項目に集中し、その後で結果を確認してターミナルから追加の変更を要求できるのです。ワークフローを中断したり、ツールを切り替えたりする必要は一切ありません。(CLI内からCopilot Cloudエージェントにタスクを委任することもできます。詳細は後述します。)
Copilot CLIのインストール
当然ながら、Copilot CLIを使い始める最初のステップはインストールです。すでにNode.jsがインストールされている場合の主要なクロスプラットフォーム手法は、npmを使用して以下のコマンドを実行することです:
npm install -g @github/copilot
WinGetやHomebrewなどのパッケージマネージャーを使用している場合は、それらのツールを通じてCopilot CLIをインストールすることもできます。(正確な方法については、各ツールのドキュメントを参照してください。)
GitHub Copilot CLIの使い始め
製品をインストールしたら、コマンドラインで「copilot」と入力して起動できます。使用可能なスイッチ(オプション)は多数ありますが、それらはシリーズの後半で取り上げます。
初めてターミナルで使用する場合は、GitHubの認証情報でログインする必要があります。
/login
これにより、以下のことが行われます:
- クライアントがあなたのCopilotアカウントに紐付けられます。
- 読み取り専用のGitHub MCPサーバーに接続され、GitHub上のリソースへのアクセスが許可されます。(MCPについてもシリーズ後半で説明しますのでご安心ください!)
Copilotを使用する際には、ファイルの探索や変更を可能にするために、フォルダーへのアクセス権を付与する必要があります。これは現在のセッションのみに適用することも、今後のセッションにも適用する設定として保存することもできます。これにより、将来同じプロジェクトに対して繰り返し承認を行うことなく、Copilotを再起動できるようになります。
以上の設定が完了したら、Copilotに話しかけ、質問をし、コードやその他のタスクを要求し始めることができます。
ユースケース:Copilot CLIでできること
以下は、GitHub Copilot CLIでできることのほんの一例です。(さらに多くのユースケースは「GitHub Copilot CLI 101」ブログで紹介されています!)
- プロジェクトの概要を尋ねる:Copilotがプロジェクトを探索し、重要なファイルを開き、その内容を報告します。
Give me an overview of this project- 新しいエンドポイントなどのコードを要求する:Copilotはプロジェクトを調査し、既存のドキュメントや例を参照して、見つけたプラクティスに従おうとします。なお、ファイル作成の許可を求めてきます。
Let’s add a new endpoint to return all categories- タスクをCopilot Cloudエージェントに委任する:明確に定義されたタスクについては、CLIから直接Copilot Cloudエージェントに委任できます。Copilotは現在のセッションのコンテキストを保持し、新しいブランチを作成し、ドラフトプルリクエストを開き、要求された変更をバックグラウンドで行った上で、レビューを依頼します。
/delegate Let’s deal with issue #14 to add the rest of the CRUD endpoints to games
もちろん、Copilot CLIで何ができるかを探る最良の方法の一つは、Copilot自体に尋ねることです。Copilotは自身のドキュメントを参照し、効果的な対話方法や探求の仕方についてガイダンスを提供できます。
シリーズの次のレッスンでは、2つの異なるモードについて説明します。GitHub Copilotにプロジェクトをローカルで実行させるインタラクティブモードと、シェルのコンテキストを離れずに簡単な要約を得るための -p フラグを使った非インタラクティブモードです。
まとめ
エージェント型AIをターミナルに直接導入することは、作業の流れを中断することなく、学び、実験し、物事を成し遂げる全く新しい方法を開きます。今後の「GitHub Copilot CLI for Beginners」シリーズの動画にご期待ください。以下のトピックを取り上げる予定です:
- インタラクティブモード vs 非インタラクティブモード
- Copilot CLIのスラッシュコマンド
- Copilot CLIでのMCPサーバーの利用
- その他
Happy coding!
GitHub Copilot CLIを試してみませんか? ドキュメントを読んで、今日から始めましょう。
さらに探求するためのリソース:
- GitHub Copilot CLI for Beginnersビデオシリーズ
- GitHub Copilot CLI 101: コマンドラインからGitHub Copilotを使う方法
- GitHub Copilot CLIのベストプラクティス
この投稿「GitHub Copilot CLI for Beginners: Getting started with GitHub Copilot CLI」は、The GitHub Blogに最初に掲載されました。
原文を表示
Welcome to GitHub Copilot CLI for Beginners! In this series (available in video format and on the GitHub blog), we’ll explore how to use your AI coding assistant directly in your terminal, along with tips and tricks on how to navigate the command line like a pro!
In this blog, we’ll walk through what GitHub Copilot CLI is, how it works, and how to get started. You’ll learn how to install it using npm, authenticate with your GitHub account, grant folder permissions, and run your first prompts to generate code directly from the terminal.
Let’s get started!
What is GitHub Copilot CLI?
The GitHub Copilot CLI brings Copilot’s agentic AI capabilities right into the command-line interface (CLI), becoming like any terminal or console based tool you use (with the full context of your repos)!
What makes agents so special is their ability to perform tasks like building code and running tests autonomously, so you can build iteratively. They can even self-correct and fix errors without needing a human to prompt them.
This means you can assign tasks to Copilot, focus on other to-do list items, and then review the results and request additional changes from the terminal—all without having to interrupt your workflow or switch tools. (You can even delegate tasks to Copilot Cloud agent from inside the CLI, more on this later.)
Installing Copilot CLI
Not surprisingly, the first step to using Copilot CLI is installation. The core cross-platform way—if you already have node—to do this is via npm, using:
npm install -g @github/copilot
If you’re using a package manager like WinGet or Homebrew, you can install Copilot CLI through those tools as well. (You’ll want to consult those tools’ documentation for the exact specifics on how to do this.)
Getting started with GitHub Copilot CLI
Once you install the product, you can launch it by typing “Copilot” in your command line. There are numerous switches you can use, which we’ll cover later in the series.
If it’s your first time in the terminal, you’ll need to log in with your GitHub credentials.
/login
This will:
Tie the client to your Copilot account.
Connect the readonly GitHub MCP server, which grants access to resources on GitHub. (Don’t worry, we’ll cover MCP later in the series as well!)
When using Copilot, you need to grant access to the folder for Copilot to be able to explore and potentially modify files. You can do this for only this session or save this setting to apply to later sessions, too. This will allow you to launch Copilot again in the future, without having to keep approving it for the same project.
Once you’ve done that, you can start talking to Copilot, asking it questions, and request code or other tasks.
Use cases: What you can do with Copilot CLI
Here are just a few GitHub Copilot CLI use cases. (There are many more covered in the GitHub Copilot CLI 101 blog!)
Ask for an overview of the project: Copilot will explore, open important files, and report back with its findings.
Give me an overview of this project
Ask for code, such as a new endpoint: Copilot will look at the project, find existing documentation and examples, and try to follow the practices it sees. Again, it will ask for permission to create the file.
Let’s add a new endpoint to return all categories
Delegate tasks to Copilot cloud agent: For well-defined tasks, you can delegate to Copilot cloud agent right from the CLI. Copilot will preserve the context from your current session, create a new branch, open a draft pull request, and make the requested changes in the background before requesting your review.
/delegate Let’s deal with issue #14 to add the rest of the CRUD endpoints to games
Of course, one of the best ways to explore what you can do with Copilot CLI is to simply ask Copilot. It can look through its own documentation and provide guidance on the best ways to interact with it and explore.
Tune in for the next lesson in the series which covers using two different modes: interactive mode to have GitHub Copilot run your project locally or non-interactive mode with the -p flag for quick summaries without leaving your shell context.
Take this with you
Bringing agentic AI right to your terminal opens a whole new way to learn, experiment, and get things done without ever breaking your flow. Keep an eye out for more videos in the GitHub Copilot CLI for Beginners series, where we’ll learn about:
Interactive vs non-interactive modes
Copilot CLI slash commands
Using MCP servers with Copilot CLI
And more!
Happy coding!
Looking to try GitHub Copilot CLI? Read the Docs and get started today.
More resources to explore:
GitHub Copilot CLI for Beginners video series
GitHub Copilot CLI 101: How to use GitHub Copilot from the command line
Best practices for GitHub Copilot CLI
The post GitHub Copilot CLI for Beginners: Getting started with GitHub Copilot CLI appeared first on The GitHub Blog.
関連記事
マイクロソフトがAzure Copilot Migration Agentを発表、クラウド移行計画を加速
マイクロソフトは、Azureポータルに組み込まれたAIアシスタント「Azure Copilot Migration Agent」を発表した。このエージェントは、移行計画の自動化、エージェントレスなVMwareの検出、ランディングゾーンの作成を行う。ただし、移行の実行はできず、レプリケーションと切り替えは手動タスクのままである。
マイクロソフト、Copilot Coworkを拡大展開し、AIモデル同士の相互チェック機能を導入
マイクロソフトがCopilot Coworkを拡大展開し、AIアシスタントがワークフロー全体を自律的に処理できるようにした。また、複数のAIモデルが互いの作業をチェックする新機能も導入した。
マイクロソフト、Copilot Researcherに新たなAI機能を導入
マイクロソフトはCopilot Researcherに新たなAI機能を追加し、企業ワークフローの正確性と信頼性を向上させた。