Command-Line Interfaces (CLIs) are the bedrock of modern software development. They are powerful, scriptable, and offer a direct, unfiltered interface to complex systems. For decades, building these essential tools has followed a familiar pattern: pick a library for your language of choice—like yargs for Node.js, Click for Python, or Cobra for Go—and start wrestling with boilerplate, argument parsing, and distribution.
But what if building a CLI could be as simple as defining an API endpoint?
This is the core premise of cli.do, a service that reframes the entire process through the lens of Agentic Workflows and CLI as an API. Let's break down how this new, agentic approach stacks up against traditional CLI builders.
Building a CLI from scratch, even with a great library, involves a multi-step process that pulls focus away from your core business logic.
This entire process is focused on the scaffolding of the CLI, not the functionality it provides.
cli.do flips the script. Instead of building a CLI application that you then have to distribute, you define your logic as an agentic workflow, and cli.do instantly exposes it as a powerful, globally available CLI.
The philosophy is simple: Your code is the CLI.
Let's look at the cli.do approach using the same example: a deployment command.
import { Agent } from '@do-sdk/agent';
// Define your CLI command as an Agent
const cli = new Agent('cli.do');
// Create a 'deploy' command with project and environment arguments
cli.on('deploy', {
project: { type: 'string', required: true },
env: { type: 'string', default: 'staging' },
}, async (args) => {
console.log(`Deploying ${args.project} to ${args.env}...`);
// Your actual deployment logic here
// await triggerDeployment(args.project, args.env);
return { status: 'success', message: `Deployment of ${args.project} to ${args.env} initiated.` };
});
// Your CLI is now live and callable:
// > do cli deploy --project my-app --env production
Notice the difference?
Feature | Traditional CLI Builders (yargs, Click, Cobra) | cli.do (The Agentic Way) |
---|---|---|
Setup & Boilerplate | Manual project setup, dependency management, entry point | Minimal, declarative code. Focus on the function. |
Argument Parsing | Verbose, imperative API for defining commands & flags | Simple JSON-like object definition. |
Distribution | Manual packaging, publishing to registries (npm, PyPI) | None. Instantly deployed and globally available. |
Updates | Requires re-publishing and user action to update | Seamless and instant for all users upon code change. |
Authentication | Requires custom implementation | Built-in, role-based access control via the .do platform. |
Scalability | Limited to the environment where the CLI is run | Managed and scaled by the .do platform infrastructure. |
The cli.do model redefines a CLI as a friendly, human-readable interface for an API endpoint. This is the essence of Business as Code. Any process, from running complex data analysis to triggering a multi-step cloud deployment or managing customer support tasks, can be codified into an agentic workflow.
By exposing that workflow as a CLI, you empower your entire team.
With traditional tools, you build a program. With cli.do, you build functional, shareable, and scalable capabilities.
Stop wrestling with argument parsers and distribution channels. It's time to build CLIs the agentic way.
Ready to turn your business logic into a powerful command-line tool? Get started with cli.do today!