Copilot CLI Tutorial #11 - Delegating Tasks to the Cloud
Skills:
AI Pair Programming90%
Key Takeaways
Delegates tasks to the cloud using Copilot CLI and AI-assisted development workflow
Full Transcript
All right, then gang. In this final lesson of the series, we're going to be taking a look at how we can delegate coding tasks to the cloud, whereby Copilot can work remotely on that task on a new branch, and even open up a PR for whatever new feature or fix it's working on. Now, you might think that at first that sounds a little bit pointless. I mean, why not just have it work locally as we have been doing instead throughout the series? But, there are a couple of reasons I like delegating to cloud agents, and those are that one, if I'm working locally on a feature and I come across a unrelated bug, I can delegate a new task to the cloud to fix that bug while I carry on working locally with whatever feature I'm fleshing out. And two, I can also have multiple different tasks all running simultaneously on the cloud while I'm still working locally. So, it just speeds up the whole development process a lot when you've got a lot of different small independent tasks to complete. So, then, how do we delegate tasks? Well, it's pretty simple. We just need to use the delegate command followed by a prompt to describe the task that we want the cloud agent to work on. So, for example, I could say something like, "Can you make some reusable UI components for this app and base their designs on the current site design? Do not use the components anywhere yet." Then, I can just hit enter. So, when we do that, it's going to ask us for confirmation whether we want to send this session to GitHub. And when we do that, it's going to push changes to a new branch, which is called copilot/julemmings. Automatically comes up with this branch. It's just random. And then, it's going to be based on our current branch that we're currently on, which is still footer component. And then, it's going to create a PR in the repo. So, I'm going to press yes to allow this. So, then, at some point whilst Copilot works remotely on the task, it's going to open a PR for the new feature while it's still working on it. And it's also going to leave a link down here to the active cloud session, which we can view. Also, because this session has now been sent to the cloud so that Copilot can work remotely, we can't use the session here locally anymore while it does so. So, we'd have to start a new session or switch to a previous one to continue working locally. For now though, let's click on this link to view the session as it's going on. So then, on this page you're going to see the current Copilot session and all the work that Copilot is doing remotely. And also, at the bottom of the session we can chat with Copilot while it works to gear it in a different location if we don't like what we're seeing here. And then, Copilot will respond to those instructions. Anyway, when we delegated this task to the cloud, Copilot also opened a pull request for the new feature, which we can see by going to pull requests and then it's this one right here. So, you can see already a description of what's going on and what work's going to be added to this PR and Copilot's automatically going to update this PR as it works until eventually it finishes and then we can review the code. Also, we can head back to the session by clicking this button right here, which takes us back to the page we were just on. All right. So, I'm going to stop recording here just for a moment until it's complete. Then, I'll start recording again when it's done. All right. So, now that's all done, we can scroll through this whole session to see all the work that it has completed and the different components it's made. And we can also head to the PR now and review the code there and we can merge it if we wanted it to. First though, I want to show you how we can bring this session back down to the project locally including the branch and all the code changes as well so we can view those changes in VS Code. So, all we need to do is head right to the top of the session and we'll see an open in VS Code button. Now, if we click on the little arrow next to this, we're going to get a Copilot CLI command that we can copy and then we just need to paste that into the terminal in VS Code. And when we do that, it's going to bring down this session and also ask us if we want to bring down the branch too with all the code changes. So then, let's paste this in and when we do that, you can see that all we're actually doing is using the Copilot command to start a session, then the resume flag to resume a particular one, and then we're just adding on the ID of that cloud session at the end. So, if we hit enter now, then just after a couple of moments, we're going to get a choice. We can either just pull down the session and not the code, and then any follow-up prompts that we issue to Copilot, they're going to work on in the cloud then, or we can pull down the branch with all of the code changes and continue locally with the session instead. So, you can key through these options and select whichever one you want. I want to bring down all the code locally, so I'll select that local option. And when we do that, it's just going to take a couple of seconds, but then it drops us into the session locally. Also, if you look down here, you can see we've been switched to the branch it was working on remotely. And if we take a look at the files, we should see some new UI components as well. Awesome. So, again, you could review all of this code locally now if you wanted to, or even preview the changes in a browser by spinning up the dev server. You can even make changes to the branch and push those back up. And then, when you're happy, you can head back to the PR in GitHub and merge the branch into main. So then, that's about it for delegating tasks to the cloud. And like I said before, I find this really useful when I spot a bug or I need Copilot to work on some independent components or even flesh out a feature which doesn't clash with the work I'm doing locally. And that, my friends, is the end of the series as well. Hopefully, you've enjoyed it and you've enjoyed using the Copilot CLI, too. I actually really like using it now, almost as much as Cloud Code, and I feel like there's a few advantages it has over Cloud Code in some areas, too, like it's more seamless interaction with GitHub and to some extent VS Code as well. And I actually really like the UI of Copilot as well. Anyway, I'm not here to say which one's better than the other. You can choose which one you prefer. I'm going to stick to using both. Also, my friends, if you enjoyed this series and you want me to make a much more in-depth masterclass course about using Copilot CLI, using different techniques and workflows I've used to flush out full applications, definitely let me know in the comments down below the video, and I'll see what I can do. So, then, my friends, I really, really hope you enjoyed this series, and you learned something along the way. If you did, please, please, please don't forget to share, subscribe, and like. That really means a lot. And if you want to access all of my YouTube courses without adverts, also get access to premium courses and early access courses, as well, you can do at netninja.dev. You can sign up for Net Ninja Pro, which is just $9 a month, and also half price for the first month with this promo code right here. And for that, like I said, you get access to every course without adverts, without YouTube adverts. You also get access to exclusive courses not found anywhere else. You get access to my premium courses on Udemy, and also early access to all of my YouTube courses, as well. So, the link to this page to sign up is going to be down below. Again, I really hope you enjoyed this series, and I'm going to see you in the very next one. >> [music] [music]
Original Description
In this Copilot CLI tutorial, I'll show you how to adopt an AI-assisted development workflow using commands, skills, MCP servers, plan mode and custom agents.
🍿👇 Get early access to the whole course on NetNinja.dev
https://netninja.dev/p/copilot-cli-tutorial
🔥👇 Get access to ALL Masterclasses & premium courses with a Net Ninja Pro membership:
https://netninja.dev/p/net-ninja-pro/#prosignup
🔗👇 Get the Starter Project on GitHub:
https://github.com/iamshaunjp/WordSprint
🔗👇 Copilot CLI Docs:
https://docs.github.com/en/copilot/how-tos/copilot-cli
🔗👇 Model Comparison:
https://docs.github.com/en/copilot/reference/ai-models/model-comparison#recommended-models-by-task
🔗👇 Astro Crash Course:
https://www.youtube.com/watch?v=CF3drb6H3Yw&list=PL4cUxeGkcC9hXL99yOeCcUrdUee8u36s3
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
More on: AI Pair Programming
View skill →
🎓
Tutor Explanation
DeepCamp AI