|
| 1 | +## Step 1: Hello GitHub Copilot agent mode |
| 2 | + |
| 3 | +Welcome to your **"Build applications with GitHub Copilot agent mode"** exercise! :robot: |
| 4 | + |
| 5 | +In this exercise, you will be using GitHub Copilot agent mode to build an application that tracks your fitness goals and progress. 🏋️♂️🏃♀️💪 |
| 6 | + |
| 7 | +### What is GitHub Copilot agent mode? |
| 8 | + |
| 9 | +Copilot agent mode can create apps from scratch, perform refactorings across multiple files, write and run tests, and migrate legacy code to modern frameworks. It can automatically generate documentation, integrate new libraries, or help answer questions about a complex codebase. Copilot agent mode helps you be super-productive by having an AI collaborator that understands the workspace. It can orchestrate your inner development flow while keeping you in control. |
| 10 | + |
| 11 | +Copilot agent mode operates in a more autonomous and dynamic manner to achieve the desired outcome. To process a request, Copilot loops over the following steps and iterates multiple times as needed: |
| 12 | + |
| 13 | +Determines the relevant context and files to edit autonomously. |
| 14 | +Offers both code changes and terminal commands to complete the task. For example, Copilot might compile code, install packages, run tests, and more. |
| 15 | +Monitors the correctness of code edits and terminal command output and iterates to remediate issues. |
| 16 | + |
| 17 | +> 💡 **Tip:** You can learn more about GitHub Copilot agent mode in the [Use agent mode documentation](https://code.visualstudio.com/docs/copilot/copilot-edits#_use-agent-mode-preview). |
| 18 | +
|
| 19 | +### :keyboard: Activity: Getting to know your GitHub Copilot agent mode development environment |
| 20 | + |
| 21 | +1. Right-click the below button to open the **Create Codespace** page in a new tab. |
| 22 | + |
| 23 | + [](https://codespaces.new/{{full_repo_name}}?quickstart=1) |
| 24 | + |
| 25 | + - The free tier of Codespaces that comes with all GitHub accounts is fine, assuming you still have minutes available. |
| 26 | + - The default Codespace settings are fine. |
| 27 | + |
| 28 | +1. Confirm the **Repository** field is your copy of the exercise, not the original, then click the green **Create Codespace** button. |
| 29 | + |
| 30 | + - ✅ Your copy: `/{{{full_repo_name}}}` |
| 31 | + - ❌ Original: `/skills/build-applications-w-copilot-agent-mode` |
| 32 | + |
| 33 | +1. Wait a moment for Visual Studio Code to load. |
| 34 | + 1. You may need to switch to VS Code insiders edition in the codespace since agent mode was released on 4/4 as a phased rollout to users. |
| 35 | + <img width="323" alt="vscode-insiders-light" src="https://github.com/user-attachments/assets/8ff8868b-9120-4055-8449-175e85552ba2" /> |
| 36 | + |
| 37 | +1. Before we continue let's take a moment to familiarize ourselves with the project folder. |
| 38 | + |
| 39 | + - The left navigation bar is where you can access the file explorer, debugger, and search. |
| 40 | + - The lower panel (Ctrl+J) shows the debugger output, allows running terminal commands, and allows configuring the web service ports. |
| 41 | + - Our docs folder contains the another sample application repository that will give Copilot agent mode context to build your application. More on that in the next steps! |
| 42 | + |
| 43 | +1. At the top of VS Code, locate and click the Copilot icon to open a Copilot Chat panel. |
| 44 | + |
| 45 | + <img width="150" alt="image" src="https://github.com/user-attachments/assets/5e64db46-95cb-415d-badc-b6b8677f10c1" /> |
| 46 | + |
| 47 | +1. If this is your first, time using GitHub Copilot, you will have to accept the usage terms to continue. |
| 48 | + - Click the **Accept** button to continue. |
| 49 | + - If you are using Copilot Chat for the first time, you will also have to accept the usage terms to continue. |
| 50 | + - Click the **Accept** button to continue. |
| 51 | + |
| 52 | +### :keyboard: Activity: Use Copilot agent mode to create a branch and publish it. 🙋 |
| 53 | + |
| 54 | +Great work! Now that we are familiar with the app and we know it works, let's ask copilot for help starting a branch so we can do some customizing. |
| 55 | + |
| 56 | +1. If not already there, return to VS Code. |
| 57 | + |
| 58 | +1. Open the GitHub Copilot Chat window if not already open. |
| 59 | +2. Copy and paste the following prompt in the GitHub Copilot Chat and select the **Agent** instead of **Ask** or **Edit** from the drop down where you are inserting the prompt. |
| 60 | + |
| 61 | + <img src="https://github.com/user-attachments/assets/e172f5c0-bc2a-45a9-a301-9af8bfbd6a2e" width=30% height=30%> |
| 62 | + |
| 63 | + |
| 64 | +> 🪧 **Note:** |
| 65 | +- Do not change the model from GPT-4o this will be an optional activity at the end of the course. |
| 66 | +- Keep in mind that the Copilot agent mode is conversational so it may ask you questions and you can ask it questions too. |
| 67 | +- Wait a moment for the Copilot to respond and press the continue button to execute commands presented by Copilot agent mode. |
| 68 | + |
| 69 | +1. Let's ask Copilot agent mode to help us remember the command and create the branch `build-octofit-app` and publishing it |
| 70 | + |
| 71 | + >  |
| 72 | + > |
| 73 | + > ```prompt |
| 74 | + > Hey copilot, how can I create and publish a new Git branch called build-octofit-app? |
| 75 | + > ``` |
| 76 | +
|
| 77 | +
|
| 78 | + Copilot agent mode will respond and ask if you if you want to enable it to run the command. Respond with **Yes**</br> |
| 79 | +
|
| 80 | + <img src=https://github.com/user-attachments/assets/8dafaa5f-80db-41ea-a189-b5d603c11d63 width=40% height=40%> |
| 81 | +
|
| 82 | +
|
| 83 | +1. Now that we are happy with the command, press the `Continue` button to let Copilot agent mode run it for us. No need to copy and paste! |
| 84 | +
|
| 85 | +1. After a moment, look in the VS Code lower status bar, on the left, to see the active branch. It should now say `build-octofit-app`. If so, you are all done with this step! |
| 86 | +
|
| 87 | +1. Now that your branch is pushed to GitHub, Mona should already be busy checking your work. Give her a moment and keep watch in the comments. You will see her respond with progress info and the next lesson. |
| 88 | +
|
| 89 | +<details> |
| 90 | +<summary>Having trouble? 🤷</summary><br/> |
| 91 | +
|
| 92 | +If you don't get feedback, here are some things to check: |
| 93 | +
|
| 94 | +- Make sure your created the branch with the exact name `build-octofit-app`. No prefixes or suffixes. |
| 95 | +- Make sure the branch was indeed published to your repository. |
| 96 | +
|
| 97 | +</details> |
0 commit comments