In the world of modern software development, the CI/CD pipeline is the central nervous system of your operations. It automates testing, builds artifacts, and, most critically, handles deployments. But as projects grow, so does the complexity of deployment. Managing different environments, handling project-specific secrets, and ensuring a consistent process for every developer can quickly become a tangled mess of scripts, documentation, and tribal knowledge.
What if you could consolidate all that complexity into a single, intuitive command? Imagine typing do cli deploy --project my-app --env production and knowing with confidence that a standardized, secure, and repeatable process is kicking off.
This isn't just a dream. With cli.do, you can build powerful, custom deployment CLIs the agentic way—transforming your complex business logic into a simple, shareable tool. Let's walk through how to build a custom deploy command to simplify your entire release process.
Even with CI/CD, deployment logic can become fragmented. You might have:
This lack of standardization introduces risk, slows down development, and makes it difficult to manage and scale your operations. The solution is to treat your deployment process like any other critical piece of software: as Business as Code.
This is where cli.do shines. It's a platform that lets you create and deploy powerful command-line interfaces (CLIs) from a simple API. Instead of wrestling with argument parsing libraries, distribution, and updates, you define your commands as Agentic Workflows. You write the core logic, and cli.do handles the rest, instantly giving you a scalable, secure, and shareable CLI.
Let's build a deploy command that can handle different projects and environments.
With cli.do, you don't build a CLI from scratch; you simply define the behavior of a command. Here’s how you can create a robust deploy command using the @do-sdk/agent.
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 real deployment logic goes here.
// Examples:
// - Trigger a Jenkins job
// - Run an Ansible playbook
// - Call the AWS/GCP/Azure SDK
// - Post a message to a Slack channel
// 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
Let's break down what's happening:
Once this code is deployed, your CLI is instantly live and ready to be used by you, your team, or your entire CI/CD pipeline.
Now for the magic. You can replace complex script calls in your CI/CD configuration with your new, clean command. For example, in a GitHub Actions workflow, your deployment step becomes incredibly simple and readable:
# .github/workflows/deploy.yml
name: Deploy to Production
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
# Other steps like build, test, etc.
- name: Deploy Application
env:
DO_API_KEY: ${{ secrets.DO_API_KEY }} # Securely inject your key
run: do cli deploy --project my-awesome-app --env production
By standardizing on a single command, you've made your pipeline more robust, easier to maintain, and simpler for anyone to understand.
A deployment tool is just the beginning. Any repeatable workflow is a candidate for a cli.do command. Think about what your team does every day:
If you can define it in code, you can expose it as a powerful, secure CLI for your team. You control who has access, ensuring that sensitive operations are only executable by authorized users.
Stop writing boilerplate code and managing complex deployment scripts. With cli.do, you can focus on what matters: the functionality of your tools. Transform your most critical business logic into intuitive, shareable command-line interfaces.
Ready to streamline your DevOps process? Visit cli.do to turn your workflows into powerful CLIs today.