Cosmic CLI
Cosmic CLI is an AI-powered command-line tool to build apps, manage Cosmic content, deploy to Vercel, and orchestrate AI agents from your terminal.
What is Cosmic CLI?
Cosmic CLI is an AI-powered command-line interface that brings Cosmic platform capabilities into a terminal workflow. It’s designed to help you build applications, manage content, deploy to production, and run or orchestrate AI agents without leaving your command line.
Instead of relying only on the Cosmic dashboard, the CLI provides interactive and AI-assisted command modes to carry out multi-step tasks—such as generating a production-ready app with repository setup and deployment—through natural language commands and structured workflows.
Key Features
- One-command install and global CLI usage: Install the CLI globally (with npm or bun) to run Cosmic capabilities from your terminal.
- Interactive shell workspace navigation: Start an interactive session with command history, workspace-aware prompts, filesystem-style navigation, and the ability to run system commands with a configured prefix.
- AI chat modes with content context: Use conversational modes that include full context awareness of your content, with flags to provide additional context for AI operations.
- Natural language app generation with repo setup: Describe what you want to build; the CLI generates a production-ready application connected to your Cosmic project and prepares a GitHub repository for deployment.
- AI-powered code updates from your repository: Connect to an existing repository so a Code Agent can analyze your codebase, create a feature branch, and commit changes based on your instructions.
- Vercel deployment automation: Deploy directly to Vercel with environment variable management, custom domain handling, preview deployments, and production releases, including real-time log streaming.
- CLI control for AI agents and workflows: Create, run, and manage the three agent types from the terminal, including capturing browser authentication sessions for Computer Use Agents, approving pending operations, and chaining agents into AI Workflows with step-by-step monitoring.
- Repository and environment variable management: Manage GitHub repositories, branches, pull requests, environment variables, and custom domains, while automatically configuring local environment settings with the correct Cosmic API keys (including Next.js-specific variants).
- Multiple AI model providers: Select from multiple AI providers and set a default model (examples listed include Claude via Anthropic, GPT via OpenAI, and Gemini via Google).
How to Use Cosmic CLI
- Install the CLI globally using the method you prefer (the article mentions npm and bun).
- Authenticate using one of the two supported methods: user authentication for full dashboard access or bucket key authentication for quick access to a specific bucket.
- Start an interactive session or use direct commands to work within your Cosmic workspace.
- Create or update projects by using natural language commands for app generation or by connecting to an existing Git repository for AI-assisted code changes.
- Deploy to Vercel from the CLI, including preview deployments and production releases, with environment variable and domain configuration handled by the CLI.
- Run AI agents and workflows from the terminal, monitoring execution progress and approving any pending operations where needed.
Use Cases
- From idea to a live app (including content and deployment): Generate a production-ready application connected to your Cosmic project, with a GitHub repository and a live Vercel deployment created through a single end-to-end flow.
- Maintain and scale content operations: Use AI-powered content creation to produce properly structured objects in your Cosmic bucket, and use interactive content chat mode for ongoing content tasks.
- Modify an existing codebase with review-ready changes: Point the CLI at your repository so the Code Agent can create a feature branch and commit changes based on instructions, then open a pull request and deploy a preview.
- Update environment configuration and deploy reliably: Use the CLI to manage environment variables and custom domains during deployments, while streaming logs to track deployment progress.
- Coordinate multi-step AI tasks from the terminal: Run the supported agent types and chain them into AI Workflows, reviewing each step’s progress and canceling runs when needed.
FAQ
-
Does Cosmic CLI require using the Cosmic dashboard? No. The CLI is intended to bring Cosmic capabilities into your terminal, including content management, app creation, deployment, and agent orchestration.
-
How does the CLI handle authentication? The CLI supports two methods: user authentication (full dashboard access) and bucket key authentication (quick access to a specific bucket without logging in).
-
What kinds of AI interactions are available from the CLI? The CLI includes AI chat modes with content context and supports AI agents and AI Workflows that can be controlled from the terminal.
-
Can the CLI deploy to Vercel? Yes. The CLI includes built-in Vercel integration for environment variable management, preview deployments, production releases, custom domains, and real-time log streaming.
-
Are there plan-based limits for CLI usage? The article states that the Cosmic CLI respects the same plan-based limits as the dashboard, including limits for AI Agents.
Alternatives
- API-driven integration (write your own scripts): If you prefer full control, you can build your own terminal scripts around Cosmic’s APIs for content operations, repository automation, and deployments; this trades convenience for customization.
- General-purpose AI coding assistants in your IDE: IDE-focused coding assistants can help with code changes, but they may not directly cover Cosmic-specific content structuring, repository preparation, and Vercel deployment workflows.
- Workflow automation tools (CI/CD and orchestration platforms): Tools that orchestrate jobs and deployments can automate parts of the workflow, but you’d need additional steps to generate structured Cosmic content and coordinate agent interactions.
- Dashboard-first content and app management: Staying within the Cosmic dashboard is an alternative when you want visual tooling, though it doesn’t provide the terminal-driven interactive shell, repo/deployment automation, or CLI-controlled agent workflows described here.
Alternatives
CodeSandbox
CodeSandbox is a cloud development platform for running code in isolated sandboxes—code, collaborate, and execute projects from any device.
zero
Deploy any Docker image to your own server in one command with automatic HTTPS, health-checked zero-downtime switching, previews, and rollback.
Falconer
Falconer is a self-updating knowledge platform for high-speed teams to write, share, and find reliable internal documentation and code context in one place.
OpenFlags
OpenFlags is an open source, self-hosted feature flag system with a control plane and typed SDKs for progressive delivery and safe rollouts.
Devin
Devin is an AI coding agent that helps software teams complete code migrations and large refactoring by running subtasks in parallel.
imgcook
imgcook is an intelligent tool that converts design mockups into high-quality, production-ready code with a single click.