Thank you for your interest in contributing to Frontal CLI! This guide will help you get started with contributing to the project.
- Getting Started
- Development Setup
- Project Structure
- Coding Standards
- Testing
- Submitting Changes
- Release Process
- Community Guidelines
- Node.js: Version 18.0.0 or higher
- Bun: Version 1.3.8 or higher (recommended)
- Git: Latest stable version
-
Fork the repository on GitHub
-
Clone your fork locally:
git clone https://github.com/your-username/frontal-cli.git cd frontal-cli -
Add the upstream remote:
git remote add upstream https://github.com/frontal-labs/frontal-cli.git
-
Install dependencies:
bun install
-
Build the project:
bun run build
-
Run tests to verify setup:
bun run test
-
Create a new branch for your feature:
git checkout -b feature/your-feature-name
-
Make your changes following the coding standards
-
Run tests and linting:
bun run test bun run lint bun run type-check -
Commit your changes:
git add . git commit -m "feat: add new feature"
-
Push to your fork:
git push origin feature/your-feature-name
-
Create a pull request
frontal-cli/
├── bin/ # Executable scripts
│ └── frontal.ts # Main CLI entry point
├── src/ # Source code
│ ├── commands/ # Command implementations
│ ├── config/ # Configuration management
│ ├── errors/ # Error handling
│ ├── http/ # HTTP client
│ ├── output/ # Output formatting
│ ├── utils/ # Utility functions
│ ├── index.ts # Main entry point
│ └── version.ts # Version information
├── tests/ # Test files
├── docs/ # Documentation
├── .github/ # GitHub workflows and templates
├── package.json # Package configuration
├── tsconfig.json # TypeScript configuration
├── biome.jsonc # Linting and formatting
└── bunfig.toml # Bun configuration
- Use TypeScript for all new code
- Enable strict mode in TypeScript
- Prefer explicit return types
- Use interfaces for object shapes
We use Biome for linting and formatting. Configuration is in biome.jsonc.
- 2 space indentation
- Double quotes for strings
- Semicolons required
- 80 character line width
- LF line endings
- Files: kebab-case (e.g.,
api-client.ts) - Variables: camelCase (e.g.,
apiClient) - Functions: camelCase (e.g.,
fetchData) - Classes: PascalCase (e.g.,
ApiClient) - Constants: UPPER_SNAKE_CASE (e.g.,
API_BASE_URL) - Interfaces: PascalCase with
Iprefix (e.g.,IUser)
Each command should follow this structure:
import type { Command } from "commander";
import { handleError } from "../errors/handler.js";
export function registerCommandName(program: Command): void {
const command = program
.command("command-name")
.description("Command description")
.option("--option <value>", "Option description")
.action(async (opts, cmd) => {
try {
// Command implementation
} catch (err) {
handleError(err, cmd.optsWithGlobals());
}
});
}- Use the centralized error handler
- Create specific error types
- Provide helpful error messages
- Include context in errors
- Write unit tests for all new functionality
- Use Vitest as the test runner
- Aim for high test coverage
- Mock external dependencies
# Run all tests
bun run test
# Run tests in watch mode
bun run test:watch
# Run tests with coverage
bun run test:coverage
# Run specific test file
bun run test path/to/test.test.tsimport { describe, it, expect, beforeEach } from "vitest";
import { functionToTest } from "../src/module.js";
describe("functionToTest", () => {
beforeEach(() => {
// Setup before each test
});
it("should do something", () => {
const result = functionToTest();
expect(result).toBe(expectedValue);
});
});Integration tests are in the tests/integration/ directory and test the CLI end-to-end.
Follow the Conventional Commits specification:
feat:New featurefix:Bug fixdocs:Documentation changesstyle:Code style changes (formatting, etc.)refactor:Code refactoringtest:Adding or updating testschore:Maintenance tasks
Examples:
feat: add support for new API endpoint
fix: resolve authentication timeout issue
docs: update installation guide
-
Ensure your branch is up to date:
git fetch upstream git rebase upstream/main
-
Run all tests and ensure they pass
-
Update documentation if needed
-
Create a pull request with:
- Clear title and description
- Link to relevant issues
- Screenshots for UI changes
- Testing instructions
Use the provided pull request template in .github/pull_request_template.md.
We follow Semantic Versioning:
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
-
Update version in
package.json -
Update
CHANGELOG.md -
Create a release tag:
git tag v1.2.3 git push origin v1.2.3
-
The GitHub Actions workflow will automatically:
- Build the project
- Run tests
- Publish to NPM
- Create GitHub release
- Be respectful and inclusive
- Welcome newcomers and help them learn
- Focus on constructive feedback
- Assume good intentions
- Check existing issues and documentation
- Ask questions in discussions
- Join our community channels
- Tag maintainers for urgent issues
- Use the issue templates provided
- Provide detailed reproduction steps
- Include environment information
- Add relevant logs and screenshots
- Use
--debugflag for verbose logging - Check logs in
~/.frontal/logs/ - Use VS Code debugger with launch configuration
- Profile commands that are slow
- Optimize API calls
- Use caching where appropriate
- Monitor bundle size
- Update docs for new features
- Include examples in docstrings
- Keep README up to date
- Document breaking changes
- Code follows style guidelines
- Tests are included and passing
- Documentation is updated
- Breaking changes are documented
- Security implications considered
- Performance impact assessed
- Provide constructive feedback
- Explain the reasoning behind suggestions
- Focus on the code, not the author
- Respond to comments in a timely manner
Contributors are recognized in:
- README.md contributors section
- Release notes
- Annual contributor highlights
- Community spotlights
Thank you for contributing to Frontal CLI! Your contributions help make the project better for everyone.