Glitchi: The fancier CLI tool for Glitch

Hello Glitch!

I’m happy to announce that I’ll be developing a new Glitch CLI glitchi that will give you a completely new experience with Glitch!

I will be communicating to you through this thread, we can all stay in touch here!

Why another CLI for Glitch?

This CLI application will solve some features that have been missing for a very long time. I’m not sure about you, but I love CI/CD. I also like Heroku and how they’ve got a CLI application that allows you to push your local changes and automatically have them deployed to their services.

Do not fear no more! With glitchi you will have all the features you need for continous deployment with glitch!

Work In Progress

I only started the project today (March 31st), so as expected I haven’t come really far. Anyhow, I have a board setup so you can follow my progress along the way. I will also post a link to my git repo once I establish some ground code.

Features

Glitchi is a feature rich CLI application for Glitch. It will include all the features in your wildest dreams!

Login Feature

I wanted the logins to be as good as possible, so I took it upon myself to create the best terminal login interface you’ve ever seen! This login command have been thoroughly planned to the roots, I’m not messing around with this one!

Login (for CI/CD)

First, let’s cover the most basic one, which is manual for continuous integration. It is a very simple command that goes as follows:

$ glitchi login --no-tty persistentToken gitAccessToken

What the above code did was manually logging in by entering persistenToken and gitAccessToken manually, this would ideally be setup in a CI/CD environment, for instance:

$ glitchi login --no-tty ${GLITCH_PERSISTENT_TOKEN} ${GLITCH_GIT_ACCESS_TOKEN}

Login (with email and code)

This is another basic one! This is Glitch’s own way of logging on users, by sending the user a mail with a code that the user has to enter in their browser to login. This is also a very easy thing to do:

$ glitchi login --mail
? Email address: example@example.com
? Code received from email: some-few-words
Hello, example! Have a wonderful day!

I’ve actually got a little sneakpeak from the development of the login module where I showcase the login with Glitch. Note that this is not the final look.

Login (with github)

Okay, this is where we are getting fancy! The login module has a powerful weapon, it’s called headless-chrome. Behind the scenes Glitchi will be able to log you onto github to then use github to log onto Glitch!!

$ glitchi login --github
? GitHub Username: octocat
? GitHub Password: *******
Hello, octocat!

Wait, you must think I’m stupid, I’ve forgotten about 2FA!?! Hahah no! Gotcha… If the login module detects the crave for a 2FA code, it will simply ask you for it :open_mouth: How cool!

$ glitchi login --github
? GitHub Username: octocat
? GitHub Password: *******
? 2FA: 123 456
Hello, octocat!

Login (etc)

So this fanciness goes on for the listed:

Help: glitchi login (or: l)
    -f, --facebook
    -h, --github
    -g, --google
    -m, --mail

Now there is also a manual entry one with an interactive interface:

$ glitchi login -t
? Glitch Persistent Token: ****************
? Glitch Git Access Token: ****************

Token Encryption

You’re right, the fanciness is still not over for the login category!! We are cool you know! You see, if you’re afraid that your tokens might get stolen, or you loose your portable laptop or something. We got you covered! Glitchi let’s you encrypt your tokens so only you can access glitch in your terminal!

No matter what login method you decide you use, you can add the --encrypt flag into the command:

$ glitchi login --mail --encrypt
? Email address: example@example.com
? Code received from email: some-few-words
? Encryption Password: ************

Now that is about it for the login command!

Work from Home!

Sorry, for this pun on beforehand! I just had to :slight_smile:

One of the main features with Glitchi is that you can work locally from your own computer and send your local changes to glitch! I am a true follower of the Work from Home corona-rule, but, I’d also like to work locally as well! I want to be able to use my own IDE, or perhaps I want to use vim, regardless! Glitchi, as always, got you covered!

$ glitchi project fetch <project-name> [destination]

The command above downloads the given project to its destination, not only that! It actually saves you a few key-strokes by also changing the directory into the destination for you. Wowzers!

Once inside the directory in your terminal, you can simply write:

$ glitchi push

Normally this would not be possible with git without having to configure git via the Glitch terminal, but hey! Fanciness is still here. Glitchi takes care of all configuration for you! Not only does it configure everything up, but when you push new changes to glitch, glitchi also has the courtesy to refresh your project automatically for you.

Creating and managing projects!

Glitchi, as always, is fancy! It allows you to create, remix, modify and delete projects from your very terminal! Although, I’ll get more into this later when some more code has been written.

More information about developing from your local machine will come later.

Terminal

Do you want to know something that really annoys me? I’m sorry Glitch for the insult, but I really hate that you guys don’t expose an SSH tunnel to the glitch containers! :frowning: However! The fanciness goes on! I’ve done some homework! I’ve reverse-engineered the glitch terminal source code (or WeTTy, a terminal in the browser), and within a few weeks of developing glitchi, you will be able to use glitchi to warp you inside the glitch terminal! In your own terminal!

$ glitchi terminal <project-name>

Browsing Glitch

Did you really think that was it? Oh h*ll no! I got some more stuffs for y’all! Not only does glitchi enhance your development cycle, but ya know, if you just casually hang around in your terminal some evening and you know, just wanna browse glitch for random projects or something like that you know. Guess what!? You’re right! We got you covered! Glitchi loves the Glitch community, no way are we going to forget that.

Glitchi will allow you to browse, search, etc on all of glitch. All the collections on glitch, or perhaps you want to stalk another user, I feel you… Anyhow, this is not our biggest priority, this might take some time to be released! But it will!

Oh hey!

If you have any requests or ideas of your own for Glitchi, please don’t be scared of the comment field! It doesn’t bite!

Beta Testers

Before release I want to make sure that the software is at its best, so if some of you awesome glitchers out there want to take a hit for the community, please hop into my DMs and we’ll chat about giving you beta access to the software!

Now, I want y’all to have a good day or evening!

14 Likes

This looks amazing!

Any big benefits that you can achieve? Glitch is already a Git repo, and restarts every time you push. Is this gonna make it so once you login all you’ve got to do is select a project directly via the CLI?

1 Like

Glitch does allow you to push, but you must configure the server to allow incoming push requests, which is something my CLI tool will configure automatically if not configured. And no, glitch doesn’t automatically refresh the container when pushing to the container using git, sadly. But my CLI application will also take care of that :slight_smile:

When you login using the CLI you will gain access to do stuff you otherwise wouldn’t have access too, say update the name of a project.

The CLI allows you to download Glitch remotes (or glitch projects/containers) to you local machine, say you have a project called my-blog, you could simply download the project using glitchi project fetch my-blog. That will download the project and navigate it into the new my-blog folder.

Once in the folder you may write some code and push it to glitch using glitchi push.

6 Likes

That sounds :fire:, I can’t wait!

4 Likes

Me neither!

My fingers gotta move fast :zap::zap:

4 Likes

@ihack2712 I would like to try the CLI, but do I use Linux for testing things on the CLI? Is it open-source or not yet?

Hi, thanks for the interest in Glitchi!

Glitchi will be cross-platform and will work on all operative systems that run Node.js, you can run any operative system that you want :slight_smile:

The project will be open-source within the first stable release, until then it will remain unlicensed (a.k.a. closed source).

If you want to join the closed beta you can send me a DM regarding how you use Glitch (that will help with your application regarding if you should be given access to the closed beta). Of course you can always wait for the open beta which will be around when the project is open-sourced under an MIT license.

3 Likes

Status Update

Alright, I got some good news, and some bad news.

Bad news, external logins doesn’t seem to work at the moment (Glitch’s problem).

Good news, GitHub logins now work! (Except for logging into Glitch).

I’ll look furthermore into the issue and see if the API has changed somehow.

Waiting for Glitch response regarding a HTTP redirect issue with the Glitch API.

Follow up:

Is that Groot on your terminal? :joy:

1 Like

Yes :joy:

5 Likes

What program are you using for the board?

@Misly

im guessing wekan cant run on glitch?

I’m not sure, but you can take a look at their repo: https://github.com/wekan/wekan

1 Like

Sorry to mention you @glitch_support, but could you please tell me why my requests to https://api.glitch.com/boot are being redirected? I’m doing exactly the same as the editor does it:

	/**
	 * Fetch the final `gitAccessToken` from Glitch.
	 * @param persistentToken The `persistentToken` received after login.
	 */
	public final (persistentToken: string): Promise<string>
	{
		return new Promise<string>(async (resolve, reject) => {
			try
			{
				const { data: { user: { gitAccessToken } } } = await Session.API.get(BOOT, { headers: { Authorization: persistentToken } });
				resolve(gitAccessToken);
			} catch (error)
			{
				reject(error);
			}
		});
	}

Where the Session.API is defined as:

	/** An axios instance used to fetch the final git access token from Glitch. */
	public static API: AxiosInstance = Axios.create({
		baseURL: "https://api.glitch.com",
		withCredentials: true,
		maxRedirects: 0,
		headers: {
			Host: "glitch.com",
			Origin: "https://glitch.com",
			Referer: "https://glitch.com/"
		}
	});

See:

I’m thinking about giving this another go… Hmm, should I do it? Hopefully I’ll find away around the stuff.

3 Likes

@ihack2712 1. I never said i am leaving the support forums, so, don’t say a word, and keep this quiet, but, see where the redirect takes you in the headers, the final destination is what you needa send an http request to…

It’s fun how you think that is right :joy: The redirect for a matter of fact not where I want to send my headers to, because it sends me to some editor link which is useless.

When I accessed the url through my browser I got no redirect errors, I got the response I was hoping for. When I did it through scripts it was working the first 2-3 times and then stopped working

Sorry for bump, But it seems like glitch gives 302 HTTP Response to your glitch dashboard…

Anyways, Good job!