Sitemap
Riskified Tech

Software Engineering, Research, Data, Architecture, Scaling and more, written by our very own engineers and data scientists.

Press enter or click to view image in full size

Unleash Developer Superpowers with a Custom Internal CLI

4 min readMar 19, 2025

--

As engineers, we often face repetitive and time-consuming tasks during our day-to-day development process. These tasks, such as setting up environments, running tests, and managing dependencies, can become a significant overhead and take valuable time away from actual development work.

Automating processes is essential to streamline these tasks and improve efficiency. This allows us to focus more on our main objective: developing new features for our team.

In this post, I will explain how we tackled these challenges by developing an internal CLI. It helps us automate and simplify the repetitive tasks that bog down our local development, making our workflow more efficient and less frustrating.

By the end of this post, you’ll learn how our internal CLI works and how it can help you eliminate the tedious overhead in your development process. If you’re looking for an easy way to enhance your focus on core development activities, this post is for you!

So many services, so little time

Our team works on multiple services in multiple environments. Each time we write and test our code, we need to set up different tools such as docker-compose, kubectl (which communicates with our K8s), logs, and feature flags.

This process takes a lot of our time, and people might forget some steps, but it can be automated. The problem is writing scripts and make them accessible on our local machines.

Press enter or click to view image in full size

We started with a third-party tool, Fig, which gave us the right solution. It had the features of developing internal CLI easily. Unfortunately, the tool was bought by AWS, and thus the specific feature we used was deprecated.

So I decided to write it on my own!

Say hello to our internal CLI

Charm / Bubble Tea

I always had in the back of my mind to use the wonderful Bubble Tea framework written in Go by Charm. This framework gives you the tools to write your own CLI in a very easy way.

Bubble Tea is based on the functional design paradigms of the Elm Architecture. The code consists of a model and three simple methods on the model — Init, Update, and View.

Model is a data structure that holds the application’s state. It represents the current state of the CLI application.

Init is a function that returns an initial command for the application to run.

Update handles incoming events and updates the model accordingly.

View renders the UI based on the data in the model.

Bubble Tea’s architecture made it straightforward to build an interactive CLI tool. By following the functional design principles and separating the application logic into the model, Init, Update, and View functions, I created a robust and maintainable CLI application. The ease of handling user inputs and rendering the UI dynamically helped streamline the development process.

The CLI

I wanted to follow the concept of the third-party tool we first used, as it addressed our problems.

The idea was to have a TUI (Terminal UI) that could enable developers to write their own CLI without worrying about writing the actual CLI. This way, developers can focus on writing their usual shell scripts (or Python scripts) and pick it up in the CLI.

Essentially, you should have a dedicated directory organized in a structured hierarchy of folders and scripts to hold all the necessary bash scripts.

Then the CLI picks up the scripts in the folders you choose and incorporates them into the CLI. This means that each script becomes a command that you can run from within the CLI.

Press enter or click to view image in full size

Here we can see how the folders are shown in the CLI

Press enter or click to view image in full size

Here we can see how the scripts are shown in the CLI

Once the scripts are detected, they are registered as commands in the CLI. This involves mapping each script to a corresponding command invoked from the CLI.

When you navigate through the CLI and select a specific script, the script is executed. This is done by invoking the underlying script file and capturing its output.

Results and Outcome

The CLI gives developers an accessible way to run their scripts. They just need to add their script to a folder; voila, it’s ready to use using the CLI.

Now the developer can focus on what is really important: developing their new features and not maintain [how to add/update various CLIs to use]

This reduced our time planning new features because we knew the usual overhead was gone.

Faster development requires more knowledge

Now that we have a tool that can help us develop faster in our day to day, we need to utilize it correctly.

Every time we have a tedious task when developing, we need to think of a way to automate it.

This reduces the non-important stages in our development process, allowing us to focus on our main objective, which is to write code!

--

--

Riskified Tech
Riskified Tech

Published in Riskified Tech

Software Engineering, Research, Data, Architecture, Scaling and more, written by our very own engineers and data scientists.

No responses yet