How to use the /share command in GitHub Copilot CLI | Demo

By GitHub

Share:

Key Concepts

  • GitHub Copilot CLI: Command-line interface for interacting with GitHub Copilot.
  • Large Language Models (LLMs): Specifically, Claude Opus and Claude Sonnet are mentioned as available models.
  • Local Agent: Copilot operating locally, utilizing local tools and accessing the filesystem.
  • Handy: Open-source dictation tool used for voice input.
  • ASI Architecture Diagram: A text-based diagram generated by Copilot to visualize codebase structure.
  • Gist: A feature on GitHub for sharing code snippets or sessions.
  • Slash Commands: Commands within the Copilot CLI interface, initiated with a forward slash (e.g., /share).
  • Mermaid: A JavaScript based diagramming and charting tool.

Exploring a Codebase with GitHub Copilot CLI

The demonstration focuses on using GitHub Copilot CLI within a Windows Subsystem for Linux (WSL) environment, and also directly within PowerShell on Windows, to explore and document a codebase for a podcast dashboard. Scott utilizes voice input via the Handy dictation tool to interact with Copilot. The initial goal is to gain a high-level understanding of the codebase’s architecture.

Generating an ASI Architecture Diagram

Copilot was prompted to create an ASI (ASCII) architecture diagram of the administrative codebase. The process began with a broad request: “Can you make me an ASI art um architecture diagram? I don't really understand this codebase and I want to get a sense of what's going on here.” Copilot, acting as a local agent, accessed the codebase’s directories to analyze its structure.

The initial diagram highlighted the middleware, specifically TypeScript middleware. Recognizing the potential for excessive detail with the Claude Opus model, Scott refined the request, stating, “I want to understand the routing specifically because that can be confusing to early and career engineers that are just exploring a new codebase.” This demonstrates the importance of providing more context for improved results. The refined prompt resulted in an expanded diagram focusing on the app router within a Next.js framework, detailing layout nesting and request flow – accurately reflecting the podcast dashboard’s architecture. Scott notes the diagram could be saved as an architecture.md file or further processed using tools like Mermaid to create more formal charts.

Utilizing Voice Input and Iterative Refinement

Scott emphasizes the benefit of using voice input through Handy, stating, “I don't type much. I do like to to talk to it. It's easier on my hands.” This highlights a practical advantage of the workflow. The process also showcases iterative refinement – starting with a general request and then narrowing the focus based on the initial output. He notes that “More context means better results.”

Sharing the Copilot Session as a Gist

After generating the architecture diagram, Scott used the /share command within the Copilot CLI to share the entire session as a secret gist on GitHub. This shared session includes the logged-in user information, the configured MCP servers, the complete reasoning process, the back-and-forth interaction, and the final ASI architecture diagram. The gist can be made public, revealing all the details of the interaction.

Installation and Resources

GitHub Copilot CLI can be installed using winget install github.copilot on Windows, brew on macOS and Linux, or within WSL. Further information is available at copilot.github.com. Handy, the open-source dictation tool, is available at handy.computer and is hosted on GitHub.

Notable Quote

“More context means better results.” – Scott, emphasizing the importance of detailed prompts for effective interaction with Copilot.

Technical Terms

  • WSL (Windows Subsystem for Linux): A compatibility layer for running Linux binary executables natively on Windows.
  • Next.js: A React framework for building web applications.
  • Middleware: Software that acts as an intermediary between different applications or components.
  • MCP Servers: Likely refers to Microsoft Copilot Proxy servers, facilitating communication with the Copilot service.

Synthesis

The demonstration effectively illustrates the power of GitHub Copilot CLI as a tool for codebase exploration and documentation. By combining voice input, iterative prompting, and the ability to leverage local tools, developers can quickly gain a high-level understanding of complex codebases. The /share command provides a valuable mechanism for sharing the entire interaction, fostering collaboration and knowledge transfer. The key takeaway is that Copilot is not just a code completion tool, but a powerful agent capable of assisting with architectural understanding and documentation.

Chat with this Video

AI-Powered

Hi! I can answer questions about this video "How to use the /share command in GitHub Copilot CLI | Demo". What would you like to know?

Chat is based on the transcript of this video and may not be 100% accurate.

Related Videos

Ready to summarize another video?

Summarize YouTube Video