CLI Development
This guide covers setting up your environment and workflow for contributing to the Compose CLI.
Prerequisites
Setup Steps
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/Compose.gitcd Compose
- Navigate to the CLI directory:
cd cli
- Install dependencies:
npm install
- Build the CLI:
npm run build
- Link the CLI globally for local testing:
npm link
- Verify the installation:
compose --help
Development Workflow
Once you are assigned to an issue:
- Fork the repository.
- Create a new branch for your work.
- Navigate to the
clidirectory. - Implement your changes.
- Run linting:
npm run lint. - Build the project:
npm run build. - Test locally using one of these methods:
- Development mode (with hot reload):
npm run dev -- init - Built version:
npm run build && node dist/index.js init - Linked Package:
npm link && compose init
- Development mode (with hot reload):
- Submit a pull request.
- We will review it and merge it and/or give you feedback on the work.
Available Scripts
npm run build- Compile TypeScript to JavaScript indist/npm run dev- Run in development mode with hot reload usingtsxnpm run start- Run the compiled version fromdist/npm run lint- Run ESLint on the codebase
Project Structure
cli/
├── src/
│ ├── adapters/ # Dependency adapters
│ ├── context/ # Shared context
│ ├── modules/ # Feature modules (init, info, validation, etc.)
│ ├── pipelines/ # Execution pipelines
│ ├── resolver/ # Dependency resolution
│ ├── templates/ # Local template files
│ ├── utils/
│ ├── comander.ts # CLI argument parsing
│ └── index.ts # Entrypoint
├── bases/ # Base preset configurations
├── bin/ # CLI executable
├── package.json
├── tsconfig.json
└── eslint.config.js
Pre-PR Checklist
Before submitting a pull request:
- Run linter:
npm run lint(must pass with no errors). - Build successfully:
npm run build. - Test your changes locally using
npm run devornpm link. - Update documentation if adding new features.
- Follow the modular architecture patterns in existing modules.