mirror of
https://github.com/hanzoai/cc.git
synced 2026-09-24 16:57:40 +00:00
5.2 KiB
5.2 KiB
Contributing
Thank you for your interest in contributing to tweakcc! This document provides guidelines and workflows for contributing to the project.
Development Setup
Prerequisites
- Node.js: 24.x (20.0.0 or higher required)
- pnpm: 11.0.9 or higher
pnpm install
Running in Development
# Build for development (no minification)
pnpm build:dev
# Watch mode for iterative development
pnpm watch
# Run the CLI locally after building
pnpm start
Code Style
This project uses ESLint and Prettier for code formatting and linting.
Prettier Configuration
- Quotes: Single quotes
- Print Width: 80 characters
- Semicolons: Yes
- Indentation: 2 spaces (no tabs)
- Arrow Function Parentheses: Avoid when possible
- Trailing Commas: ES5
Running Linting and Formatting
# Lint and type-check
pnpm lint
# Format code
pnpm format
# Check formatting without modifying files (used in CI)
pnpm prettier --check src
Pre-commit hooks are configured via Husky and lint-staged to automatically format staged files before commit.
TypeScript Best Practices
- Use strict type checking (enabled in
tsconfig.json) - Avoid
anytypes - preferunknownwith type guards - Use
@/alias for imports within thesrc/directory - Define interfaces for all configuration objects (see
src/types.ts)
Naming Conventions
- Components: PascalCase (e.g.,
ThinkingVerbsView) - Functions: camelCase (e.g.,
findClaudeInstallation) - Constants: UPPER_SNAKE_CASE (e.g.,
DEFAULT_CONFIG_PATH) - Files: camelCase (e.g.,
systemPromptSync.ts) or PascalCase for React components (e.g.,MainView.tsx)
Making Changes
Branching Strategy
-
Create a new branch from
mainfor your feature or fix:git checkout -b your-branch-name -
Branch naming conventions:
feature/your-feature-namefix/your-fix-descriptiondocs/your-documentation-update
Development Workflow
- Make your changes following the code style guidelines
- Run linting and tests locally:
pnpm lint pnpm run test - Build your changes:
pnpm build:dev - Test your changes by running the CLI locally:
pnpm start
Testing
Run tests before submitting:
# Run all tests once
pnpm run test
# Run tests in watch mode for development
pnpm run test:dev
Test files are located in:
src/tests/*.test.ts- Unit tests for core functionalitysrc/patches/*.test.ts- Tests for specific patches
Testing patterns:
- Use Vitest globals (
describe,it,expect,beforeEach,afterEach) - Mock dependencies using
vi.mock() - Test edge cases and error conditions
Commit Messages
Follow these conventions for clear, meaningful commit messages:
<type> <subject> (#<issue-number>)
<body>
Types:
Add- New featuresFix- Bug fixesPrompts for- Update for new Claude versionSort- Sorting or reorganization changesUpdate- Updates to existing featuresRefactor- Code refactoring (no functional changes)
Examples:
Add support for dangerously bypassing permissionsFix remaining patching errorsPrompts for 2.1.34Add auto-accept plan mode patch
Submitting Pull Requests
Before Submitting
- Ensure all tests pass:
pnpm run test - Ensure linting passes:
pnpm lint - Ensure formatting is correct:
pnpm format - Rebuild the project:
pnpm build:dev - Test your changes locally with
pnpm start
PR Description Template
## Summary
<Brief description of what this PR changes>
## Changes
- Change 1
- Change 2
## Testing
- [ ] Tests added/updated
- [ ] Manual testing completed
- [ ] All existing tests pass
## Related Issues
Closes #(issue-number) or Relates to #(issue-number)
Review Process
- PRs will be reviewed by maintainers
- Address review feedback promptly
- Keep the PR focused on a single change if possible
- Ensure commit history is clean (squash/rebase as needed)
What Happens After Merge
- Your changes will be included in the next release
- You'll be credited in the changelog
- Your contribution is greatly appreciated! 🎉
Types of Contributions Welcome
- Bug fixes - Help squash issues
- New features - Propose new patches or customizations
- Documentation improvements - Clarify usage or add examples
- Test coverage - Add tests for existing functionality
- Performance improvements - Optimize CLI startup or execution
- Prompt updates - Contribute prompts for new Claude versions
Reporting Issues
When reporting bugs, please include:
- Version:
tweakcc --version - Operating System: macOS / Linux / WSL
- Node.js version:
node --version - Steps to reproduce: Clear reproduction steps
- Expected behavior: What you expected to happen
- Actual behavior: What actually happened
- Logs: Relevant error messages or logs
Getting Help
- Check existing Issues for similar problems
- Read the README for usage documentation
- Ask questions in a new issue with the
questionlabel
Thank you for contributing! 🙌