How Can Clio Help Me as a Developer? (Part 1)

Aug 14, 2024 by Stein Ove Helset
How Can Clio Help Me as a Developer? (Part 1)

I'm a web developer, and I know how to use the command line for a lot of different things. But how can I use Clio to get super powers in the command line?

I know how to deploy a project to a server on Digital Ocean, and I know how to use Git commands like commit, merge, pull, etc. But if I was set to deploy a project to AWS, GCP or work with Kubernetes, I would be lost right away. Obviously, I could just jump straight into the documentation or read a tutorial on how to do this.

But reading documentation can be daunting, so is there a way for me to skip this?

In the first part of this article series, I will try to use AI and Clio to interact with my GitHub repos, try to do some changes and see if there is anything to Git I don't know and how Clio can help me with that. I will also use Clio to interact with my servers on my Digital Ocean account. I will see what Clio is capable of here and similar.

In the second part, I will try to deploy a project to a live server on AWS. This is something I have never tried before, and I will not read any documentation or tutorial. I will just let Clio be my own private devops assistant and see what happens.

In the third part, I will kick it up even more and try to make Clio code for me and build a static blog. This blog will be deployed to AWS as well, but this time I will include Docker, Kubernetes and maybe even more.

What can Clio teach me when it comes to CI/CD and other types of more advanced concepts?

Using Clio for managing a Github repo

As I already stated, I do know how to use Git. But some of the commands are not 100% stuck in my head so I might need to Google them, or at least check out what exactly do. There's also probably some commands I don't know, simply because I never have needed to use them.

And I think this is something Clio really can help me with. Plus, I can do absolutely everything from the command line.

Letting AI get in control of your Git repoes sounds scary, right? Don't worry, Clio will ask before actually executing anything.

When you have Clio set up on your computer and everything is running, you can start typing natural language in your command line to interact with an existing Github repo or create a new one.

A good thing about starting simple is that I know how to do this manually, so it's easy for me to verify that the AI is doing it the way I want it to.

For example: I simply asked Clio to create a readme file, and then told her to make the folder a Github repo. When this was ready, she was smart enough to ask me if I wanted her to create the repo on Github as well. I answered yes, and that was it. The only thing I did was:

>>> can you add a readme file to this folder and set the title to be "Testproject". Sure, I will create a README file in the current folder with the title "Testproject". ... >>> can you create a Github repository in this folder? Sure, I can help you create a GitHub repository in this folder. First, I'll initialize a new Git repository in the current folder, then I'll create a new repository on GitHub and link it. ... Next, I'll create a new repository on GitHub. What would you like to name the repository on GitHub? >>> can you add files in this folder, commit it with the message "initial" and push it? Sure, I'll add all the files in the current directory, commit them with the message "initial", and push them to the newly created repository. Let's proceed with the following steps: 1. Add all files. 2. Commit with the message "initial". 3. Push to the remote repository.

I mean, can this be any easier?

And as a plus, Clio will even explain everything she does in detail and teach you new things.

Okay, so far, Clio hasn't done anything I do multiple times on a daily basis. But it's nice doing this in my natural language. Now it's time to see if we can learn something new and how Clio will handle some more advanced stuff.

Branching out

I tried giving a simple command for creating a new branch and adding a new file:

>>> can you create a new branch called dev and then add a new file called devchanged.txt Sure, I'll create a new branch called "dev", switch to it, add a new file named devchanged.txt , and commit the changes.

As you can see, she did exactly as I wanted. She even committed the changes, but not before she asked me first.

What is the purpose of branching out according to Clio?

>>> what is the purpose of branching out? Branching in Git is a powerful feature that allows you to diverge from the main line of development and continue to work without affecting that main line. Here are some key purposes and benefits of branching: 1. Isolation of Work: • Feature Development: You can create a branch to develop a new feature. This keeps the feature work isolated from the main codebase until it's ready to be merged. • Bug Fixes: Similarly, you can create a branch to fix a bug. This allows you to work on the fix without disturbing the main codebase. 2. Parallel Development: • Multiple developers can work on different features or bug fixes simultaneously without interfering with each other's work. 3. Code Review and Collaboration: • Branches can be used to create pull requests, which facilitate code reviews and discussions before merging changes into the main codebase. 4. Experimentation: • You can create a branch to experiment with new ideas or technologies. If the experiment fails, you can simply delete the branch without affecting the main codebase. 5. Release Management: • Branches can be used to manage different versions of the codebase, such as release branches, hotfix branches, and development branches. 6. Continuous Integration/Continuous Deployment (CI/CD): • Branches can be integrated with CI/CD pipelines to automatically test and deploy code changes, ensuring that only stable and tested code is merged into the main branch. 7. Rollback and Recovery: • If something goes wrong, you can easily revert to a previous state by switching to an earlier branch or commit. In summary, branching allows for better organization, collaboration, and management of code changes, making it easier to develop, test, and deploy software in a controlled and efficient manner.

I would say that this is a really great and consise explanation. Most people who's used Git for a while know this already, but what if you're a junior and want to find out yourself before start asking a senior?

There are a lot of other things that Clio can help with as well. For example: Cherry-picking, rebasing, stashing, submodules, etc. Everything you can do with the Github CLI is possible to do with Clio.

Stashing

Let's try to add a new file and then stash it. I have used this command some times before, so I know what it does. But I tend to forget the syntax. Let's try asking with plain English.

>>> can you create a new file called hello.txt? The file hello.txt has been created with the content "Hello, world!". >>> i want to stash the changes, can you walk me through this? Sure, stashing changes in Git allows you to save your current work temporarily without committing it. This is useful if you need to switch branches or perform other tasks without losing your current changes. Here are the steps to stash your changes: 1. Check the Current Status: • It's always a good idea to check the current status of your working directory. git status 2. Stash the Changes: • Use the git stash command to save your changes. git stash 3. List Stashes: • You can list all stashes to see the saved changes. git stash list 4. Apply Stash: • When you're ready to reapply the stashed changes, use the git stash apply command. git stash apply 5. Drop Stash: • If you no longer need the stashed changes, you can drop them. git stash drop 6. Pop Stash: • Alternatively, you can use git stash pop to apply and drop the stash in one command. git stash pop >>> great, go a head and stash them

When this is done, we're back on the dev branch and the "hello.txt" file is stashed. You even get explanations on different types of stashing, what they do, etc. But now I want it back again. Let's say that I don't even know what the opposite of stash is.

>>> can you help me get the hello.txt file back? Sure, to get the hello.txt file back, we can apply the stashed changes. This will restore the file to your working directory. ... Running git stash apply ... The stashed changes have been successfully applied, and the file hello.txt is now back in your working directory and staged for commit.

Not only did it work seemlessly, but I got an explanation and which command Clio used to do this.

Using Clio for interacting with Digital Ocean

Next step now is to interact with Digital Ocean using Clio. I want to check the status of my Droplets, and I want to try to create a new droplet. Plus, I want to see if there is anything more Clio can help with.

Creating a new droplet

I think this should be pretty straight forward, let's just ask Clio if she can do this for me and see what happens.

>>> can you create a new droplet for me in the "Code With Stein" project? Sure, I can help you create a new droplet in the "Code With Stein" project on DigitalOcean. Before proceeding, I'll need some details: 1. The name of the droplet. 2. The region where you want to create the droplet (e.g., nyc3 , sfo2 ). 3. The size of the droplet (e.g., s-1vcpu-1gb ). 4. The image you want to use for the droplet (e.g., ubuntu-20-04-x64 ). 5. Any SSH keys you want to add to the droplet. Please provide these details so I can proceed. >>> 1) clio-test 2) sfo2 3) s-1vcpu-1gb 4) ubuntu-20-04-x64 5) ssh-ed25519 AABBAC3NzaCafAAAIACv01823adfjlahBMswywD7La9y213aZfEYF00BafwSkEJD [email protected] Great! I'll proceed with creating the droplet using the provided parameters. The droplet clio-test has been successfully created. Here are the details: • ID: 438019956 • Name: clio-test • Region: sfo2 • Size: s-1vcpu-1gb • Image: Ubuntu 20.04 (LTS) x64 • Memory: 1024 MB • VCPUs: 1 • Disk: 25 GB • Status: new The droplet is currently being set up. You can check its status and obtain the public IP address once it's fully provisioned. Is there anything else you would like to do?

Awesome. The droplet was created and everything seems to be fine. I have 5-6 droplets on my account, and over the years, I've probably created between 20-30 servers. So even though this isn't really necessary for me, it's cool how easy this can be.

Checking the status of my droplets

Next, I want to see if I can see the status of the droplets in my account.

>>> can you check the status of all my droplets in the code with stein project? Sure! I'll list all the droplets in your account to check their status. I'll run the following command: doctl compute droplet list Let's proceed. ID 438019956 Name clio-test Status Active

And there we have that as well. We now know that the server is up and running.

What else can Clio do with Digital Ocean?

For the last part of this article, I just want to check what else she can help me with:

>>> What else can you help me with on Digital Ocean? 1. Create Droplets: Create new droplets with specific configurations. 2. Delete Droplets: Delete existing droplets. 3. Resize Droplets: Change the size of your droplets to scale up or down. 4. Rebuild Droplets: Rebuild a droplet using a different image. 5. Power Actions: Power on, power off, or reboot your droplets. 6. Snapshots: Create and manage snapshots of your droplets. 7. Backups: Enable or disable backups for your droplets. 8. Monitoring: Enable or disable monitoring for your droplets. 9. Tags: Add or remove tags from your droplets. 10. Floating IPs: Assign or unassign floating IPs to your droplets. 11. Private Networking: Enable or disable private networking for your droplets. 12. Firewalls: Manage firewall rules for your droplets. 13. SSH Keys: Add or remove SSH keys for your droplets. 14. User Data: Provide user data scripts to run on droplet creation.

As you can see, there is a lot of cool things you can do here without ever having to log in to your account in the browser. Play around with this and see if you're able to do anything cool.

In the next part of this article series, I will try to deploy a simple website to a server on AWS. This is something I have never done before, so it will be cool to see Clio really help me with this. In the meantime, if you prefer to follow along in video format, save the video below for reference.

Stein Helset is a developer who creates tutorial videos to teach coding, with a focus on Django, Python, Vue, Htmx and much much more!