GitHub Copilot CLI 初心者向け:一般的なスラッシュコマンドの概要
本文の状態
日本語全文を表示中
詳細モードで約6分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
GitHub Blog
GitHub は、GitHub Copilot CLI の初心者向けシリーズで、スラッシュコマンドの意味や重要性、効率的な使用方法を解説し、モデル切り替えやトークン使用量の確認などのタスクを紹介した。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
GitHub Copilot CLI入門シリーズへようこそ!このシリーズ(動画形式とブログ形式の両方で利用可能)では、GitHub Copilot CLIの使用を開始するために必要なすべてをご案内します。これまでのシリーズでは、始め方とインタラクティブモードとノンインタラクティブモードの使い分けについて解説しました。今回のエディションでは、スラッシュコマンドとは何か、なぜ重要なのか、そしてターミナルから直接モデルの切り替えやトークン使用量の確認、過去のセッションの再開といったタスクを効率的に実行するためにスラッシュコマンドをどう活用するかを学びます。
それでは始めましょう!
GitHub Copilot CLIにおけるスラッシュコマンドの理解
Copilot CLIで作業する際、最初に習得すべき最も強力な概念の一つがスラッシュコマンドです。スラッシュコマンドは、コマンドラインから直接アクセスできる組み込みコントロールです。Copilot CLI内での制御パネルとして機能し、スラッシュコマンドを使うことで以下が可能になります:
- Copilotの動作を誘導する
- 変更内容を検査する
- コンテキストを管理する
- セッションやプロジェクト間を効率的に移動する
- パーミッションを整理整頓する
スラッシュコマンドは、Copilot CLIと対話するためのコマンドセンターと考えることができます。利用可能なすべてのオプションを確認するには、コマンドラインで / と入力するだけで、現在サポートされているすべてのスラッシュコマンドのスクロール可能なリストが表示されます。
いくつかの人気のあるコマンドを見てみましょう。
適切なモデルの選択
異なるモデルは、それぞれ異なる種類の作業に最適化されています。モデルを切り替えたい場合は、コマンドラインに /model と入力してください。これにより、利用可能なモデルの一覧が表示され、以下のような主要な詳細情報も併せて確認できます:
機能: 一部はリファクタリングなどの軽量で迅速なタスクに優れており、他のモデルは機能計画などより深い推論を効率的に処理します。
可用性: リストは、お客様のプランや組織の設定によって異なる場合があります。
コスト: 各モデルの右側に表示される数値はコスト乗数を示しており、プランに基づいてパフォーマンスと利用状況の適切なバランスを選ぶ際の参考になります。
適切なモデルを選択することは、速度と結果の両方に大きな影響を与えます。
コンテキストとトークン使用量の管理
Copilot CLI はコンテキストウィンドウ内で動作し、セッション中に「記憶」できる情報の量を決定します。現在の使用状況を確認したい場合は、/context と入力してください。これにより、残りのトークン数、システムの使用状況、利用可能なバッファが表示されます。
スペースが不足していると感じた場合は、コマンドラインに /compact と入力してスペースを解放できます。これにより、現在の会話が要約され、新しいセッションを開始することなく作業を継続できるようになります。Copilot CLI は制限に近づくと自動的にこの処理を行いますが、新しいタスクに移行したい場合や、セッション中にコンテキストを整理したい場合は手動で実行することも可能です。
環境を完全にリセットして最初から始めたい場合は、/clear を使用してセッション全体をクリアできます。
セッション間での作業
以前のセッションを再開したい場合は、/resume と入力してください。これにより、ローカルおよびリモートの両方のセッションを含む、過去のセッション一覧が表示されます。過去のセッションを選択すると、そのセッションの履歴が表示され、中断した場所からすぐに作業を続けることができます。
変更内容の確認
Copilot を使用してプロジェクトに変更を加える際、何が変わったかを追跡することが重要です。変更内容を確認したい場合は、/diff を実行して最近の更新を表示してください。これにより、セッション中に行われた修正が明確に把握できるため、先に進む前に変更を検証することができます。
プロジェクトとディレクトリの移動
リポジトリやディレクトリ間を作業する場合でも、Copilot から退出する必要はありません。/cwd と入力することで、作業ディレクトリを別々のリポジトリに変更できます。これにより、Copilot の作業範囲をプロジェクトの特定の部分に限定でき、複数のコードベース間でマルチタスクを行う際の効率性を維持するのに役立ちます。
ツール権限の管理
過去には、ファイル編集などのアクションを実行する権限を Copilot CLI に付与したことがあるかもしれません。より慎重に対応したいリポジトリに切り替え、その権限をリセットしたい場合は、/reset-allowed-tools を実行することで対応できます。
これらを活用して
これらのスラッシュコマンドを使用することで、Copilot CLI に対する制御力がさらに向上します。これらのコマンドに慣れれば慣れるほど、ワークフローはより意図的なものになります。
モデルの切り替え、コンテキストの管理、プロジェクト間の移動などを行う際、CLI でスラッシュコマンドを使用すれば、必要なツールが揃い、コントロールを維持できます。まだ試していない方は、ぜひターミナルを開いて「/」と入力し、探索してみてください。さらに多くのスラッシュコマンドが見つかるはずです。
Happy coding!
GitHub Copilot CLI を試してみたい方は、ドキュメントを読んで今日から始めましょう。
さらに詳しく調べるためのリソース:
GitHub Copilot CLI for Beginners video series
GitHub Copilot CLI for Beginners: Getting started with GitHub Copilot CLI
GitHub Copilot CLI for Beginners: Interactive v. non-interactive mode
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: Overview of common slash commands appeared first on The GitHub Blog.
原文を表示
Welcome back to GitHub Copilot CLI for Beginners! In this series (available in video and blog format), we’ll give you everything you need to get started using GitHub Copilot CLI. So far in this series, we’ve covered how to get started and when to use interactive and non-interactive modes. In this edition, we’ll learn what slash commands are, why they matter, and how to use slash commands to control GitHub Copilot efficiently. You can complete tasks like switching models, checking token usage, and resuming past sessions right from your terminal.
Let’s dive in!
Understanding slash commands in GitHub Copilot CLI
When working in Copilot CLI, one of the most powerful concepts to learn early on is slash commands. Slash commands are built-in controls that you can access directly from the command line. Acting as your control surface within Copilot CLI, slash commands allow you to:
Guide Copilot’s behavior
Inspect changes
Manage context
Move efficiently across sessions and projects
Keep permissions tidy
Slash commands can be thought of as your command center for interacting with Copilot CLI. To look at all of the options available, just type / in the command line for a scrollable list of all currently supported slash commands.
Let’s take a look at some of the most popular ones.
Choosing the right model
Different models are optimized for different kinds of work. If you want to switch models, type /model into the command line. This will display a list of available models, along with key details like:
Capabilities: Some are better for quick, lightweight tasks like refactoring, while others more efficiently handle deeper reasoning such as feature planning.
Availability: The list may vary depending on your plan or organization’s settings.
Cost: Numbers shown on the right of each model indicate cost multiplier, helping you choose the right balance between performance and usage in relation to your plan.
Choosing the right model can significantly impact both speed and results.
Managing context and token usage
Copilot CLI operates within a context window, which determines how much information it can “remember” during a session. If you want to check your current usage, type /context to learn how many tokens you have left, along with system usage and available buffer.
If you find that you’re running low on space, you can free up space by typing /compact in the command line. This summarizes your current conversation so you can continue without having to start a new session. Copilot CLI will do this automatically when you approach the limit, but you can also do this manually if you want to transition to a new task or clean up context mid-session.
If you’d rather start fresh and completely reset your environment, you can use /clear to clear the session entirely.
Working across sessions
If you want to resume a previous session, you can type /resume. This will bring up a list of previous sessions you’ve had, including both local and remote sessions. Entering a previous session will show you your session history, and you can pick up right where you left off.
Inspecting changes
As you work with Copilot to make changes to your project, it’s important to keep track of what’s changed. If you want to see what the changes are, run /diff to see recent updates. This gives you a clear view of what modifications were made during your session, so you can validate changes before moving forward.
Navigating projects and directories
If you want to work across repositories or directories, you don’t have to exit Copilot. You can type /cwd to change your working directory to another repository. This allows you to scope Copilot’s work to a specific part of your project and helps you stay efficient while multitasking across codebases.
Managing tool permissions
In the past, you might have granted Copilot CLI permission to perform actions like editing files. Say you’re switching to a repository you want to be more careful in and want to reset those permissions: you can do so by running /reset-allowed-tools.
Take this with you
Using these slash commands gives you even better control over Copilot CLI—and the more familiar you become with them, the more deliberate your workflow becomes.
Whether you’re switching models, managing context, or navigating across projects, using slash commands in CLI gives you the tools you need to stay in control. And if you haven’t already: open up your terminal, type /, and explore! There are many more slash commands to discover.
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 for Beginners: Getting started with GitHub Copilot CLI
GitHub Copilot CLI for Beginners: Interactive v. non-interactive mode
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: Overview of common slash commands appeared first on The GitHub Blog.
News to Guide
ニュースの次に確認する
発表内容を、現在の料金や仕様と照らし合わせられる関連ガイドです。
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み