đ¤ Contributing to FLX CLI
FLX CLI-āĻ contribution āĻāϰāĻžāϰ āĻāύā§āϝ āϧāύā§āϝāĻŦāĻžāĻĻ! āĻāĻŽāϰāĻž community contributions āĻā§ āϏā§āĻŦāĻžāĻāϤ āĻāĻžāύāĻžāĻ āĻāĻŦāĻ project-āĻā§ āĻāϰāĻ āĻāĻžāϞ āĻāϰāϤ⧠āĻāĻĒāύāĻžāϰ āϏāĻžāĻšāĻžāϝā§āϝ āĻāĻžāĻāĨ¤
Getting Startedâ
Prerequisitesâ
Contributing āĻāϰāĻžāϰ āĻāĻā§ āύāĻŋāĻļā§āĻāĻŋāϤ āĻšāύ āϝ⧠āĻāĻĒāύāĻžāϰ system-āĻ āĻāĻā§āϞ⧠installed āĻāĻā§:
# Dart SDK (latest stable)
dart --version
# Git
git --version
# IDE (VS Code/IntelliJ/Android Studio)
code --version
Setting Up Development Environmentâ
- Repository Fork āĻāϰā§āύ:
# Fork the repository to your GitHub account
# Then clone your fork
git clone https://github.com/YOUR_USERNAME/flx_cli.git
cd flx_cli
- Dependencies Install āĻāϰā§āύ:
# Install dependencies
dart pub get
# Run tests to ensure everything works
dart test
- Development Branch āϤā§āϰāĻŋ āĻāϰā§āύ:
# Create a new branch for your feature
git checkout -b feature/your-feature-name
Development Guidelinesâ
Code Styleâ
āĻāĻŽāϰāĻž consistent code style maintain āĻāϰāĻŋāĨ¤ āĻĒā§āϰāϤāĻŋāĻāĻŋ contribution-āĻ āĻāĻ guidelines follow āĻāϰā§āύ:
// â
Good: Clear naming and proper formatting
class FeatureGenerator {
final String featureName;
final TemplateType templateType;
FeatureGenerator({
required this.featureName,
required this.templateType,
});
Future<void> generateFeature() async {
await _validateFeatureName();
await _createDirectoryStructure();
await _generateFiles();
}
Future<void> _validateFeatureName() async {
if (featureName.isEmpty) {
throw ValidationException('Feature name cannot be empty');
}
}
}
// â Bad: Poor naming and formatting
class fg {
String n;
var t;
fg(this.n, this.t);
void gen() async {
if(n=="") throw Exception("bad");
// more code...
}
}
Project Structureâ
lib/
âââ core/ # Core utilities and constants
â âââ commands/ # Base command classes
â âââ generators/ # Code generation utilities
â âââ templates/ # Template management
â âââ utils/ # Helper utilities
âââ features/ # Feature-specific implementations
â âââ auth/ # Authentication feature generator
â âââ dashboard/ # Dashboard generator
â âââ common/ # Common features
âââ cli/ # CLI interface and argument parsing
Testing Standardsâ
āĻāĻŽāϰāĻž comprehensive testing maintain āĻāϰāĻŋāĨ¤ āĻĒā§āϰāϤāĻŋāĻāĻŋ contribution-āĻ tests āĻĨāĻžāĻāϤ⧠āĻšāĻŦā§:
// Unit Test Example
import 'package:test/test.dart';
import 'package:flx_cli/features/auth/auth_generator.dart';
void main() {
group('AuthGenerator', () {
late AuthGenerator generator;
setUp(() {
generator = AuthGenerator(
featureName: 'user_auth',
stateManagement: StateManagement.getx,
);
});
test('should generate auth files correctly', () async {
// Arrange
final expectedFiles = [
'auth_controller.dart',
'auth_binding.dart',
'auth_page.dart',
];
// Act
final result = await generator.generate();
// Assert
expect(result.isSuccess, isTrue);
expect(result.generatedFiles, containsAll(expectedFiles));
});
test('should throw exception for invalid feature name', () {
// Arrange & Act & Assert
expect(
() => AuthGenerator(featureName: '', stateManagement: StateManagement.getx),
throwsA(isA<ValidationException>()),
);
});
});
}
Integration Testsâ
// Integration Test Example
import 'package:test/test.dart';
import 'package:flx_cli/cli/flx_cli.dart';
void main() {
group('CLI Integration Tests', () {
test('should generate complete feature structure', () async {
// Arrange
final cli = FlxCli();
final args = ['gen', 'feature', 'product', '--state-management=getx'];
// Act
final result = await cli.run(args);
// Assert
expect(result.exitCode, equals(0));
expect(result.output, contains('Feature generated successfully'));
// Verify files exist
expect(File('lib/features/product/presentation/pages/product_page.dart').exists(), isTrue);
expect(File('lib/features/product/domain/entities/product_entity.dart').exists(), isTrue);
});
});
}
Types of Contributionsâ
đ Bug Fixesâ
Bug fix āĻāϰāĻžāϰ āĻāύā§āϝ:
- Issue āϤā§āϰāĻŋ āĻāϰā§āύ bug report āϏāĻš
- Root cause analyze āĻāϰā§āύ
- Test case āϞāĻŋāĻā§āύ bug reproduce āĻāϰāĻžāϰ āĻāύā§āϝ
- Fix implement āĻāϰā§āύ
- Test case pass āĻāϰāĻžāύ
⨠New Featuresâ
New feature add āĻāϰāĻžāϰ āĻāύā§āϝ:
- Feature proposal āϤā§āϰāĻŋ āĻāϰā§āύ GitHub issue-āĻ
- Design document āϞāĻŋāĻā§āύ
- Community feedback āύāĻŋāύ
- Implementation plan āĻāϰā§āύ
- Code āĻāĻŦāĻ tests āϞāĻŋāĻā§āύ
đ Documentationâ
Documentation improve āĻāϰāĻžāϰ āĻāύā§āϝ:
- Current documentation review āĻāϰā§āύ
- Missing āĻŦāĻž unclear parts identify āĻāϰā§āύ
- Clear āĻāĻŦāĻ comprehensive content āϞāĻŋāĻā§āύ
- Examples āĻāĻŦāĻ code samples āϝā§āĻ āĻāϰā§āύ
đ¨ Templatesâ
New template āϤā§āϰāĻŋ āĻāϰāĻžāϰ āĻāύā§āϝ:
// Template Example
class CustomPageTemplate extends PageTemplate {
String generate(PageConfig config) {
return '''
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class ${config.className}Page extends StatelessWidget {
const ${config.className}Page({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('${config.title}'),
),
body: const Center(
child: Text('${config.className} Page'),
),
);
}
}
''';
}
}
Pull Request Processâ
Before Submittingâ
- Code quality check āĻāϰā§āύ:
# Format code
dart format .
# Analyze code
dart analyze
# Run tests
dart test
# Check test coverage
dart test --coverage
- Commit messages follow āĻāϰā§āύ:
# Feature commits
feat: add authentication feature generator
# Bug fix commits
fix: resolve null pointer exception in template parser
# Documentation commits
docs: update installation guide with Windows steps
# Test commits
test: add unit tests for dashboard generator
Pull Request Templateâ
## Description
Brief description of changes made
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Performance improvement
## Testing
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing completed
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] Tests pass locally
Review Processâ
- Automated checks: CI/CD pipeline āϏāĻŦ tests āĻāĻŦāĻ quality checks run āĻāϰāĻŦā§
- Code review: Maintainers code review āĻāϰāĻŦā§
- Feedback: Review feedback address āĻāϰā§āύ
- Approval: Approved āĻšāϞ⧠merge āĻšāĻŦā§
Community Guidelinesâ
Code of Conductâ
āĻāĻŽāϰāĻž inclusive āĻāĻŦāĻ welcoming community maintain āĻāϰāĻŋ:
- Respectful communication: āϏāĻŦāĻžāϰ āϏāĻžāĻĨā§ respectful āĻāĻžāĻŦā§ communicate āĻāϰā§āύ
- Constructive feedback: Helpful āĻāĻŦāĻ constructive feedback āĻĻāĻŋāύ
- Collaborative spirit: Team work āĻāĻŦāĻ knowledge sharing encourage āĻāϰā§āύ
- Learning mindset: āύāϤā§āύ āĻļā§āĻāĻžāϰ āĻāύā§āϝ open āĻĨāĻžāĻā§āύ
Communication Channelsâ
- GitHub Issues: Bug reports āĻāĻŦāĻ feature requests
- GitHub Discussions: General discussions āĻāĻŦāĻ questions
- Discord: Real-time chat āĻāĻŦāĻ community support
- Twitter: Updates āĻāĻŦāĻ announcements
Development Resourcesâ
Useful Commandsâ
# Generate new command template
dart run lib/tools/generate_command.dart command_name
# Run specific test file
dart test test/specific_test.dart
# Generate coverage report
dart test --coverage && genhtml coverage/lcov.info -o coverage/html
# Build executable
dart compile exe bin/flx.dart -o flx
Local Testingâ
# Test CLI locally
dart run bin/flx.dart gen feature test_feature
# Test with custom configuration
dart run bin/flx.dart config --state-management=bloc
# Test help system
dart run bin/flx.dart --help
Debuggingâ
// Add debug logging
import 'package:logging/logging.dart';
final _logger = Logger('FeatureGenerator');
void generateFeature() {
_logger.info('Starting feature generation');
// Your code here
_logger.fine('Feature generation completed');
}
Release Processâ
Version Numberingâ
āĻāĻŽāϰāĻž Semantic Versioning āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāĻŋ:
- Major (1.0.0): Breaking changes
- Minor (1.1.0): New features (backward compatible)
- Patch (1.1.1): Bug fixes
Release Checklistâ
- Version bump āĻāϰā§āύ
pubspec.yaml
-āĻ - CHANGELOG.md update āĻāϰā§āύ
- Tag āϤā§āϰāĻŋ āĻāϰā§āύ
git tag v1.2.3
- Release notes āϞāĻŋāĻā§āύ
- Binary publish āĻāϰā§āύ
Getting Helpâ
Documentationâ
- API Documentation: Comprehensive API docs
- Examples: Code examples āĻāĻŦāĻ tutorials
- Best Practices: Development best practices guide
Supportâ
- GitHub Issues: Technical problems āĻāĻŦāĻ bug reports
- Discord Community: Real-time help āĻāĻŦāĻ discussions
- Email: maintainers@flxcli.dev
Mentorshipâ
āύāϤā§āύ contributors-āĻĻā§āϰ āĻāύā§āϝ mentorship program available:
- First-time contributor guide
- Assigned mentor complex contributions-āĻāϰ āĻāύā§āϝ
- Regular check-ins progress track āĻāϰāĻžāϰ āĻāύā§āϝ
āĻāĻĒāύāĻžāϰ contribution FLX CLI community-āĻā§ āĻāϰāĻ strong āĻāϰ⧠āϤā§āϞāĻŦā§āĨ¤ āĻāĻŽāϰāĻž āĻāĻĒāύāĻžāϰ participation-āĻāϰ āĻāύā§āϝ āĻāύā§āĻŽā§āĻ!