Thank you for your interest in contributing to ZCF (Zero-Config Code Flow)! We welcome contributions from the community and are pleased to have you join us.
- Getting Started
- Development Setup
- Testing Guidelines
- Code Style & Standards
- Pull Request Process
- Bug Reports
- Feature Requests
- Documentation
- Internationalization (i18n)
- Community Guidelines
ZCF is a CLI tool built with TypeScript that provides zero-configuration setup for Claude Code environments. Before contributing, please:
- Read our Code of Conduct
- Check existing issues and pull requests
- Fork the repository and create your feature branch
- Node.js 18+
- pnpm 9.15.9+ (specified in
packageManagerfield)
- Fork and clone the repository:
git clone https://github.com/YOUR_USERNAME/zcf.git
cd zcf- Install dependencies:
pnpm install- Start development:
pnpm dev| Command | Description |
|---|---|
pnpm dev |
Run CLI in development mode using tsx |
pnpm build |
Build for production using unbuild |
pnpm typecheck |
Type checking with TypeScript |
pnpm test |
Run all tests |
pnpm test:watch |
Run tests in watch mode |
pnpm test:ui |
Run tests with UI |
pnpm test:coverage |
Generate coverage report |
pnpm test:run |
Run tests once |
src/
βββ cli.ts # CLI entry point
βββ cli-setup.ts # Command registration
βββ commands/ # CLI commands
βββ config/ # Configuration management
βββ constants.ts # Project constants
βββ i18n/ # Internationalization
βββ types/ # TypeScript type definitions
βββ utils/ # Utility functions
templates/ # Configuration templates
βββ en/ # English templates
βββ zh-CN/ # Chinese templates
βββ settings.json # Default settings
test/ # Test files
βββ unit/ # Unit tests
βββ integration/ # Integration tests
βββ fixtures/ # Test fixtures
We use Test-Driven Development (TDD) methodology:
- Red: Write a failing test first
- Green: Write minimal code to make the test pass
- Refactor: Improve code while keeping tests green
- Core Tests (
*.test.ts): Basic functionality and main flows - Edge Tests (
*.edge.test.ts): Boundary conditions and error scenarios - Coverage Goals: 80% minimum for lines, functions, branches, and statements
# Run specific test file
pnpm vitest src/utils/config.test.ts
# Run tests matching pattern
pnpm vitest --grep "should handle"
# Run with coverage
pnpm test:coverage- Always write tests before implementing functionality
- Use descriptive test names:
should handle invalid config gracefully - Mock external dependencies (file system, commands, prompts)
- Test both success and error scenarios
- Verify test files exist before adding to avoid duplication
Example test structure:
describe('ConfigManager', () => {
it('should create backup before config changes', async () => {
// Arrange
const mockConfig = { /* test config */ }
// Act
await configManager.updateConfig(mockConfig)
// Assert
expect(backupService.createBackup).toHaveBeenCalled()
})
})- Use strict TypeScript with explicit type definitions
- Define interfaces for all options and configurations
- Proper null/undefined handling throughout
- Follow existing type patterns in
src/types/
- Single Responsibility Principle: Each module has one clear purpose
- DRY Principle: Avoid code duplication
- SOLID Principles: Follow object-oriented design principles
- KISS Principle: Keep implementations simple and intuitive
- Use descriptive function and variable names
- Follow existing patterns in the codebase
- Use kebab-case for file names
- Use PascalCase for types/interfaces
- Use camelCase for functions/variables
// Usage: Cross-platform path operations
import { join, resolve } from 'pathe'
// Add usage description before import statements
// Usage: Configuration management utilities
import { createConfig, validateConfig } from './utils/config.ts'- Fork & Branch: Create a feature branch from
main - Write Tests: Follow TDD methodology
- Implement: Write minimal code to pass tests
- Test: Run full test suite and ensure coverage
- Type Check: Run
pnpm typecheck - Build: Run
pnpm buildsuccessfully
- Clear Description: Explain what changes were made and why
- Tests Included: All new functionality must have tests
- Documentation: Update relevant documentation
- No Breaking Changes: Unless discussed in an issue first
- Single Purpose: One feature/fix per PR
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Tests added/updated
- [ ] All tests pass
- [ ] Coverage maintained
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No new warnings introducedWhen reporting bugs, please include:
- ZCF Version: Run
npx zcf --version - Environment: OS, Node.js version, pnpm version
- Steps to Reproduce: Minimal reproduction steps
- Expected Behavior: What should happen
- Actual Behavior: What actually happens
- Error Messages: Any error output or logs
Use our bug report template.
For new features:
- Check Existing Issues: Avoid duplicates
- Use Case: Describe the problem this solves
- Proposed Solution: Your suggested approach
- Alternatives: Other solutions considered
- Implementation: Willing to contribute code?
Use our feature request template.
- README.md: Features, usage, configuration
- CLAUDE.md: AI assistant configuration and development guidelines
- CHANGELOG.md: Version history and breaking changes
- API Documentation: JSDoc comments for public APIs
- Write in clear, concise English
- Include code examples where helpful
- Update documentation alongside code changes
- Maintain consistency with existing style
ZCF supports bilingual functionality (English/Chinese):
- Structure: Translations organized in
src/i18n/locales/{lang}/ - Modules: Separate files for different features (common, api, menu, etc.)
- Usage: Use
t()function fromutils/i18n.ts - Formatting: Use
format()for string interpolation
- Add new keys to both
zh-CNandenlanguages - Use descriptive key names:
errors.config.invalidFormat - Test both language flows
- Update
TranslationKeysinterface for new keys
Example:
// In src/i18n/locales/en/errors.ts
// Usage
import { format, t } from '../utils/i18n.ts'
export default {
config: {
invalidFormat: 'Invalid configuration format: {error}',
},
}
const message = format(t('errors.config.invalidFormat'), { error: 'missing field' })- Be Respectful: Treat all community members with respect
- Be Constructive: Provide helpful feedback and suggestions
- Be Patient: Remember that maintainers and contributors volunteer their time
- Be Collaborative: Work together to improve the project
- Issues: For bugs and feature requests
- Discussions: For questions and general discussion
- Documentation: Check existing docs first
Contributors will be:
- Listed in release notes for significant contributions
- Added to the contributors section (if desired)
- Recognized in project documentation
- Modular Commands: Self-contained commands with options interfaces
- Configuration Merging: Smart merging with backup before modifications
- Cross-Platform Support: Special handling for Windows and Termux
- Error Handling: Graceful degradation with user-friendly messages
- Build System: unbuild (ESM-only output)
- Development: tsx for TypeScript execution
- Testing: Vitest with layered testing approach
- CLI Framework: cac for argument parsing
- Cross-Platform: pathe for path operations, tinyexec for command execution
- Lazy loading of dependencies
- Efficient file operations
- Parallel execution of independent operations
- Template caching for repeated operations
Thank you for contributing to ZCF! Your efforts help make Claude Code more accessible and powerful for developers worldwide.
For questions about contributing, please open an issue or start a discussion.