Contributing
Agent Cloud is an open-source project and contributions are welcome. This guide covers how to set up a development environment, understand the codebase, and submit changes.
Getting Started
Section titled “Getting Started”Prerequisites
Section titled “Prerequisites”- Node.js 18 or higher
- npm (comes with Node.js)
- Git
- A code editor (VS Code recommended)
- Docker (optional, for testing container deployments)
- At least one cloud CLI installed (optional, for end-to-end testing)
Clone and Setup
Section titled “Clone and Setup”git clone https://github.com/intojhanurag/agent-cloud.gitcd agent-cloudnpm installCreate a .env file
Section titled “Create a .env file”# For AI-powered features (optional for development)GOOGLE_GENERATIVE_AI_API_KEY=your-key# OROPENAI_API_KEY=your-keyRun from Source
Section titled “Run from Source”# Using tsx (TypeScript executor, no build step needed)npm run cli
# Or with argumentsnpx tsx src/cli/index.ts analyzenpx tsx src/cli/index.ts deploy --cloud awsBuild and Test
Section titled “Build and Test”# Type-check without emittingnpm run type-check
# Full build (TypeScript + Mastra)npm run build
# Run testsnpm test
# Run the built CLInpm run cli:buildProject Structure
Section titled “Project Structure”agent-cloud/ src/ cli/ # CLI layer (Commander.js) index.ts # Entry point, command registration commands.ts # init, analyze, history, info workflow-commands.ts # deploy, status (uses Mastra) banner.ts # Terminal UI helpers error-handler.ts # Global error handling prompts.ts # Inquirer prompt definitions
mastra/ # AI layer (Mastra framework) index.ts # Mastra instance wiring agents/ analyzer.ts # Project analysis agent deployment.ts # Deployment planning agent validator.ts # Environment validation agent tools/ index.ts # File system & dependency tools deployment.ts # Service mapping, cost, commands validator.ts # CLI, auth, env, network checks executor.ts # Shell command execution workflows/ deployment.ts # 5-phase deployment workflow
providers/ # Cloud execution layer aws/index.ts # AWS (ECS, Lambda, S3) gcp/index.ts # GCP (Cloud Run, Functions, Firebase) azure/index.ts # Azure (Container Apps, Functions, etc.)
types/ index.ts # Shared TypeScript types
utils/ config.ts # Configuration & deployment history logger.ts # File-based logging error-handler.ts # Custom error classes progress.ts # Spinners & progress bars shell.ts # Input sanitization
docs/ # This documentation site (Starlight) package.json tsconfig.json mastra.config.ts # Mastra framework configDevelopment Workflow
Section titled “Development Workflow”Adding a New CLI Command
Section titled “Adding a New CLI Command”- Define the command handler in
src/cli/commands.ts(orworkflow-commands.tsif it uses AI) - Register the command in
src/cli/index.tsusing Commander.js - Add types if needed in
src/types/index.ts
Adding a New Tool
Section titled “Adding a New Tool”- Create the tool with
createTool()from@mastra/core/agent - Define
inputSchemaandoutputSchemawith Zod - Implement the
executefunction - Add the tool to the relevant agent’s
toolsobject - The agent will automatically have access to the new tool
Adding a New Cloud Provider
Section titled “Adding a New Cloud Provider”- Create a new directory under
src/providers/your-provider/ - Implement the provider class with methods for each deployment target
- Add authentication and cleanup methods
- Register the provider in the deployment workflow
- Update the service mapper tool with new service mappings
- Add the provider to the
CloudProvidertype union
Modifying Agent Behavior
Section titled “Modifying Agent Behavior”Agent behavior is primarily controlled by the instructions string in the agent definition. To change how an agent works:
- Edit the
instructionsfield in the relevant agent file - Be specific about the expected output format
- Test with different project types to ensure the changes work broadly
Code Conventions
Section titled “Code Conventions”- TypeScript with strict mode enabled
- ESM modules (
"type": "module"in package.json) - Zod for all runtime schema validation
- async/await for all asynchronous operations
- chalk for terminal colors (no raw ANSI codes)
- File names use kebab-case
- Types and interfaces use PascalCase
- Functions and variables use camelCase
Testing
Section titled “Testing”Tests are run with Vitest:
# Run all testsnpm test
# Run in watch modenpx vitest --watch
# Run a specific test filenpx vitest src/utils/shell.test.tsWhat to Test
Section titled “What to Test”- Utility functions (shell sanitization, config management) — unit tests
- Tool execute functions — unit tests with mock file systems
- CLI command handlers — integration tests (consider mocking AI calls)
- Provider classes — integration tests (mock shell commands)
Testing Tips
Section titled “Testing Tips”- Mock
child_process.execwhen testing provider classes to avoid real cloud calls - Mock the AI model responses when testing workflow integration
- Use temporary directories for file system tests
- The
ConfigManagercan be instantiated with a custom path for isolated testing
Submitting Changes
Section titled “Submitting Changes”- Fork the repository on GitHub
- Create a branch for your change:
git checkout -b feature/my-feature - Make your changes following the conventions above
- Add tests for new functionality
- Run the test suite:
npm test - Type-check:
npm run type-check - Commit with a descriptive message
- Push your branch and open a Pull Request
Pull Request Guidelines
Section titled “Pull Request Guidelines”- Keep PRs focused on a single change
- Include a description of what changed and why
- Add or update tests as appropriate
- Make sure the type checker and tests pass
- Link related issues if applicable
Areas for Contribution
Section titled “Areas for Contribution”Here are some areas where contributions would be valuable:
- New cloud providers (DigitalOcean, Vercel, Fly.io, Railway)
- New language detection (Rust, Java, Ruby, PHP)
- Improved cost estimation with real-time pricing data
- Better Dockerfile generation for more frameworks
- Test coverage for existing code
- Documentation improvements and corrections
- Bug fixes from GitHub issues
License
Section titled “License”Agent Cloud is licensed under the MIT License. By contributing, you agree that your contributions will be licensed under the same terms.