Thank you for your interest in contributing to CCM! This document provides guidelines for developers who want to contribute to the project.
- Node.js >= 18.0.0
- pnpm (recommended) or npm
- Git
-
Clone the project
git clone https://github.com/markshawn2020/claude-code-manager cd claude-code-manager -
Install dependencies
pnpm install
-
Build the project
pnpm run build
-
Link for global usage
pnpm link
-
Test your changes
ccm stat ccm usage daily
pnpm run build: Compile TypeScript to JavaScript indist/pnpm run dev: Run in development mode with ts-nodepnpm run start: Run the compiled version
src/
├── cli.ts # Main CLI entry point
├── commands/
│ ├── stat.ts # Statistics command implementation
│ ├── backup.ts # Backup command implementation
│ ├── slim.ts # Slim command implementation
│ └── usage.ts # Usage command implementation (ccusage wrapper)
└── utils/ # Utility functions (future expansion)
-
Create a new command file
# Create src/commands/your-command.ts touch src/commands/your-command.ts -
Implement the command function
// src/commands/your-command.ts export function yourCommand(options: { /* your options */ }) { // Implementation here }
-
Register the command in CLI
// src/cli.ts import { yourCommand } from './commands/your-command'; program .command('your-command') .description('Description of your command') .option('--option <value>', 'Option description') .action(yourCommand);
-
Build and test
pnpm run build ccm your-command --help
- Use TypeScript with strict mode
- Follow existing code patterns and conventions
- Use descriptive variable and function names
- Add proper error handling
- Include JSDoc comments for public functions
Currently, testing is manual. When adding new features:
- Test all existing commands to ensure no regressions
- Test edge cases (empty data, invalid options, etc.)
- Test with different Claude Code project configurations
-
Fork the project
-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes
-
Test thoroughly
-
Commit with clear messages
git commit -m "Add: new feature description" -
Push to your fork
git push origin feature/your-feature-name
-
Create a Pull Request
- Add the option to the command definition in
src/cli.ts - Update the command function signature in the respective command file
- Implement the option logic
- Update documentation
Use the development script to test changes:
pnpm run dev stat --current --full-messageThe tool reads from ~/.claude.json. You can create test data:
{
"projects": {
"/path/to/test/project": {
"history": [
{"display": "Test history item 1"},
{"display": "Test history item 2"}
]
}
}
}- Update version in
package.json - Update CHANGELOG.md
- Test all commands
- Create release tag
- Publish to npm (maintainers only)
- Open an issue for bugs or feature requests
- Check existing issues before creating new ones
- Provide detailed reproduction steps for bugs
- Be respectful and inclusive
- Focus on constructive feedback
- Help others learn and grow
- Follow the project's coding standards