A modern, battle-tested CLI tool for creating smart, structured, and beautiful git commit messages with emoji support, conventional commit rules, AI-powered summaries, and comprehensive TypeScript integration.
- π¨ Beautiful Interactive CLI - Intuitive prompts with colorful output using chalk and enquirer
 - π Conventional Commits - Full support for conventional commit standards
 - π Smart Emoji Integration - Contextual emojis for different commit types
 - π€ AI-Powered Summaries - Optional AI-generated commit messages (OpenAI, Anthropic, Mock)
 - βοΈ Highly Configurable - Customize commit types, emojis, and validation rules
 - πͺ Git Hooks Ready - Built-in pre-commit and post-commit hook support
 - π§ Full TypeScript Support - Complete type definitions and IntelliSense
 - π¦ Dual Module Support - Works with both CommonJS and ESM projects
 - π‘οΈ Cross-Platform - Windows, macOS, and Linux support
 - π― Zero Dependencies in Production - Lightweight and fast
 
npm install -g @typeweaver/commitweave# Using npm npm install --save-dev @typeweaver/commitweave # Using yarn yarn add --dev @typeweaver/commitweave # Using pnpm pnpm add --save-dev @typeweaver/commitweave# Navigate to your git repository cd your-project # Initialize configuration (optional) commitweave init # Create a commit interactively commitweave# Interactive commit creation commitweave # Initialize configuration file commitweave init # Show help information commitweave --helpconst { CommitBuilder, defaultConfig, GitUtils } = require('@typeweaver/commitweave'); const builder = new CommitBuilder(defaultConfig); const message = builder .setType('feat') .setSubject('add user authentication') .setBody('Implement JWT-based authentication system') .build(); console.log(message); // Output: feat: β¨ add user authenticationimport { CommitBuilder, defaultConfig, GitUtils, createCommitMessage } from '@typeweaver/commitweave'; // Using the builder pattern const builder = new CommitBuilder(defaultConfig); const message = builder .setType('fix') .setScope('auth') .setSubject('resolve token expiration issue') .setBreakingChange(false) .build(); // Using the helper function const quickMessage = createCommitMessage( 'docs', 'update API documentation', { config: defaultConfig } );import type { Config, CommitType, CommitMessage, AIProvider, AISummaryOptions } from '@typeweaver/commitweave'; import { CommitBuilder, GitUtils, createAIProvider } from '@typeweaver/commitweave'; const config: Config = { commitTypes: [ { type: 'feat', emoji: 'β¨', description: 'A new feature', aliases: ['feature'] } ], emojiEnabled: true, conventionalCommits: true, aiSummary: false, maxSubjectLength: 50, maxBodyLength: 72 }; const gitUtils = new GitUtils(); const aiProvider = createAIProvider({ provider: 'mock' });Commitweave uses glinr-commit.json for configuration. Create one with:
commitweave init{ "commitTypes": [ { "type": "feat", "emoji": "β¨", "description": "A new feature", "aliases": ["feature", "new"] }, { "type": "fix", "emoji": "π", "description": "A bug fix", "aliases": ["bugfix", "hotfix"] }, { "type": "docs", "emoji": "π", "description": "Documentation changes", "aliases": ["documentation"] }, { "type": "style", "emoji": "π", "description": "Code style changes", "aliases": ["formatting"] }, { "type": "refactor", "emoji": "π¦", "description": "Code refactoring", "aliases": ["refactoring"] }, { "type": "perf", "emoji": "π", "description": "Performance improvements", "aliases": ["performance", "optimization"] }, { "type": "test", "emoji": "π¨", "description": "Adding or updating tests", "aliases": ["testing"] }, { "type": "build", "emoji": "π ", "description": "Build system changes", "aliases": ["ci", "deps"] }, { "type": "ci", "emoji": "βοΈ", "description": "CI configuration changes", "aliases": ["continuous-integration"] }, { "type": "chore", "emoji": "β»οΈ", "description": "Other maintenance changes", "aliases": ["maintenance"] }, { "type": "revert", "emoji": "π", "description": "Revert previous changes", "aliases": ["rollback"] } ], "emojiEnabled": true, "conventionalCommits": true, "aiSummary": false, "maxSubjectLength": 50, "maxBodyLength": 72, "ai": { "provider": "mock", "apiKey": "", "model": "gpt-3.5-turbo", "maxTokens": 150, "temperature": 0.7 }, "hooks": { "preCommit": [], "postCommit": [] } }| Option | Type | Default | Description | 
|---|---|---|---|
commitTypes |  CommitType[] |  [Default types] | Available commit types with emojis and aliases | 
emojiEnabled |  boolean |  true |  Include emojis in commit messages | 
conventionalCommits |  boolean |  true |  Follow conventional commit format | 
aiSummary |  boolean |  false |  Enable AI-powered commit generation | 
maxSubjectLength |  number |  50 |  Maximum commit subject length | 
maxBodyLength |  number |  72 |  Maximum line length for commit body | 
ai.provider |  string |  "mock" |  AI provider: openai, anthropic, or mock |  
ai.apiKey |  string |  "" |  API key for the AI provider | 
ai.model |  string |  Provider default | Model to use for AI generation | 
hooks.preCommit |  string[] |  [] |  Commands to run before commit | 
hooks.postCommit |  string[] |  [] |  Commands to run after commit | 
Commitweave supports multiple AI providers for intelligent commit message generation:
{ "ai": { "provider": "openai", "apiKey": "your-openai-api-key", "model": "gpt-3.5-turbo", "maxTokens": 150, "temperature": 0.7 } }{ "ai": { "provider": "anthropic", "apiKey": "your-anthropic-api-key", "model": "claude-3-haiku-20240307", "maxTokens": 150, "temperature": 0.7 } }Perfect for testing and development without API costs:
{ "ai": { "provider": "mock" } }The main class for building commit messages:
class CommitBuilder { constructor(config: Config) setType(type: string): this setScope(scope: string): this setSubject(subject: string): this setBody(body: string): this setFooter(footer: string): this setBreakingChange(isBreaking: boolean): this setEmoji(emoji: string): this build(): string validate(): { valid: boolean; errors: string[] } reset(): this }Git operations wrapper with enhanced functionality:
class GitUtils { constructor(workingDir?: string) async isGitRepository(): Promise<boolean> async getStatus(): Promise<StatusResult> async getStagedChanges(): Promise<StagedChanges> async getDiff(staged?: boolean): Promise<string> async stageAll(): Promise<void> async stageFiles(files: string[]): Promise<void> async commit(message: string, options?: { dryRun?: boolean }): Promise<string> async getCurrentBranch(): Promise<string> async getLastCommitMessage(): Promise<string> async hasUncommittedChanges(): Promise<boolean> }interface AIProvider { generateCommitMessage(diff: string, options?: AISummaryOptions): Promise<CommitSuggestion> isConfigured(): boolean } // Available providers const openaiProvider = new OpenAIProvider(apiKey, model); const anthropicProvider = new AnthropicProvider(apiKey, model); const mockProvider = new MockAIProvider();# Clone the repository git clone https://github.com/typeweaver/commitweave.git cd commitweave # Install dependencies npm install # Build the project (dual CJS/ESM output) npm run build # Run in development mode npm run dev # Test the CLI locally npm startCommitweave uses a sophisticated dual-build system:
- CommonJS Build (
dist/index.js) - For Node.js and older tools - ESM Build (
dist/index.mjs) - For modern ES modules - TypeScript Declarations (
dist/index.d.ts) - For full type support - CLI Binary (
dist/bin.js) - Executable CLI tool 
commitweave/ βββ bin/ β βββ index.ts # ESM CLI entrypoint β βββ index.cjs.ts # CommonJS CLI entrypoint βββ src/ β βββ types/ # TypeScript type definitions β β βββ config.ts # Configuration types β β βββ commit.ts # Commit message types β β βββ git.ts # Git operation types β β βββ ai.ts # AI provider types β β βββ index.ts # Unified type exports β βββ config/ β β βββ defaultConfig.ts # Default configuration β βββ core/ β β βββ commitBuilder.ts # Commit message builder β βββ utils/ β β βββ git.ts # Git operations β β βββ ai.ts # AI integrations β βββ index.ts # Main library exports βββ scripts/ β βββ prepare-dist.js # Build preparation script βββ dist/ # Build output β βββ index.js # CommonJS entry β βββ index.mjs # ESM entry β βββ index.d.ts # Type definitions β βββ bin.js # CLI executable β βββ lib/ # Internal modules βββ tsconfig*.json # TypeScript configurations βββ glinr-commit.json # Default config template βββ README.md # Run tests (when available) npm test # Test package imports node -e "console.log(Object.keys(require('./dist/index.js')))" # Test CLI functionality ./dist/bin.js --helpThe package is optimized for npm distribution with:
- β Dual Module Support - Both CJS and ESM
 - β Complete TypeScript Definitions - Full IntelliSense support
 - β Tree-shakable Exports - Import only what you need
 - β Zero Runtime Dependencies - Production builds are dependency-free
 - β Cross-platform Binary - Works on Windows, macOS, and Linux
 
We welcome contributions! Here's how to get started:
- Fork the repository
 - Create a feature branch: 
git checkout -b feature/amazing-feature - Make your changes with proper TypeScript types
 - Test your changes: 
npm run build && npm test - Commit using commitweave: 
commitweave - Push to your branch: 
git push origin feature/amazing-feature - Open a Pull Request
 
- Use TypeScript for all new code
 - Follow the existing code style and patterns
 - Add type definitions for all new APIs
 - Update documentation for new features
 - Test both CommonJS and ESM imports
 - Ensure cross-platform compatibility
 
MIT License - see LICENSE for details.
- Interactive CLI with beautiful prompts
 - Conventional commit support
 - Emoji integration
 - Full TypeScript support
 - Dual module system (CJS/ESM)
 - AI provider infrastructure
 
- Full OpenAI integration
 - Full Anthropic integration
 - Smart diff analysis
 - Context-aware suggestions
 
- Git hooks implementation
 - Configuration validation
 - Template system for custom formats
 - Plugin architecture
 
- Interactive configuration wizard
 - VS Code extension
 - GitHub Actions integration
 - Commit message templates
 
- Conventional Commits - For the commit message standard
 - Inquirer.js/Enquirer - For beautiful CLI prompts
 - Chalk - For colorful terminal output
 - Simple Git - For Git operations
 - Zod - For runtime type validation
 
Made with β€οΈ by TypeWeaver