COMMIT_STRATEGY.md•9.53 kB
# Git Commit Strategy for MCP Router
## 🎯 Overview
This document outlines the step-by-step commit strategy to properly organize and commit the MCP Router codebase to GitHub.
## 📋 Commit Sequence
### Commit 1: Initial Project Structure
```bash
git add package.json package-lock.json tsconfig.json
git commit -m "feat: initialize TypeScript Node.js project with dependencies
- Add TypeScript configuration with relaxed strictness
- Install core dependencies: Fastify, Google APIs, Luxon, Pino
- Set up build scripts and development tools
- Configure ESLint and Prettier for code quality"
```
### Commit 2: Core Utilities and Error Handling
```bash
git add src/util/ src/auth/token-store.ts
git commit -m "feat: implement core utilities and authentication
- Add time utilities with IANA timezone support
- Implement encrypted token store with AES-256-GCM
- Create unified error handling and response types
- Add idempotency management with Redis support"
```
### Commit 3: Google API Adapters
```bash
git add src/adapters/
git commit -m "feat: implement Google Calendar and Gmail adapters
- Add Google Calendar adapter with free/busy queries
- Implement Gmail adapter with template support
- Add conference data and meeting creation
- Include proper error normalization for Google APIs"
```
### Commit 4: Policy Engine and Business Rules
```bash
git add src/policy/
git commit -m "feat: implement policy engine for business rules
- Add working hours validation and enforcement
- Implement calendar allowlist and access control
- Create event overlap prevention logic
- Add attendee and location validation"
```
### Commit 5: OAuth Authentication System
```bash
git add src/auth/oauth.ts
git commit -m "feat: implement OAuth 2.0 PKCE authentication
- Add Google OAuth with PKCE security
- Implement token refresh and expiration handling
- Add state management and CSRF protection
- Support Calendar and Gmail API scopes"
```
### Commit 6: MCP Tools Implementation
```bash
git add src/mcp/tools/
git commit -m "feat: implement all 5 MCP tools
- Add time.resolve for natural language time parsing
- Implement calendar.find_free_slots for availability
- Add calendar.create_event with policy enforcement
- Create calendar.cancel_event with idempotency
- Add email.send with Handlebars templating"
```
### Commit 7: MCP Router Core
```bash
git add src/mcp/index.ts
git commit -m "feat: implement MCP Router with tool registry
- Add tool registration and execution system
- Implement request validation and error handling
- Create metadata and schema management
- Support idempotency across all tools"
```
### Commit 8: Fastify Server and Routes
```bash
git add src/server.ts
git commit -m "feat: implement Fastify server with OAuth routes
- Add OAuth login and callback endpoints
- Implement MCP tool execution routes
- Add health check and metrics endpoints
- Configure CORS, Helmet, and security middleware"
```
### Commit 9: Environment Configuration
```bash
git add .env .env.example
git commit -m "feat: add environment configuration
- Add production-ready environment variables
- Include Google OAuth credentials setup
- Configure Redis and encryption keys
- Add Gmail sender configuration"
```
### Commit 10: Build and Deployment Scripts
```bash
git add setup.sh setup.bat install-deps.js
git commit -m "feat: add cross-platform setup scripts
- Add Windows batch script for setup
- Include Linux/Mac shell script
- Add Node.js dependency installer
- Support both manual and automated setup"
```
### Commit 11: Documentation and README
```bash
git add README.md DEPLOYMENT_PLAN.md
git commit -m "docs: add comprehensive documentation
- Add detailed README with setup instructions
- Include deployment plan for production hosting
- Document all MCP tools and API endpoints
- Add troubleshooting and security guidelines"
```
### Commit 12: TypeScript Build Output
```bash
git add dist/ .gitignore
git commit -m "build: add TypeScript compilation output
- Add compiled JavaScript and type definitions
- Include source maps for debugging
- Configure .gitignore for proper exclusions
- Ready for production deployment"
```
## 🚀 Execution Commands
### Initialize Repository
```bash
# Initialize git repository
git init
# Add remote origin
git remote add origin https://github.com/Thinh-nguyen-03/virtual-assistant-mcp.git
# Set default branch
git branch -M main
```
### Execute Commits (Run in Order)
```bash
# Commit 1: Project Structure
git add package.json package-lock.json tsconfig.json
git commit -m "feat: initialize TypeScript Node.js project with dependencies
- Add TypeScript configuration with relaxed strictness
- Install core dependencies: Fastify, Google APIs, Luxon, Pino
- Set up build scripts and development tools
- Configure ESLint and Prettier for code quality"
# Commit 2: Core Utilities
git add src/util/ src/auth/token-store.ts
git commit -m "feat: implement core utilities and authentication
- Add time utilities with IANA timezone support
- Implement encrypted token store with AES-256-GCM
- Create unified error handling and response types
- Add idempotency management with Redis support"
# Commit 3: Google Adapters
git add src/adapters/
git commit -m "feat: implement Google Calendar and Gmail adapters
- Add Google Calendar adapter with free/busy queries
- Implement Gmail adapter with template support
- Add conference data and meeting creation
- Include proper error normalization for Google APIs"
# Commit 4: Policy Engine
git add src/policy/
git commit -m "feat: implement policy engine for business rules
- Add working hours validation and enforcement
- Implement calendar allowlist and access control
- Create event overlap prevention logic
- Add attendee and location validation"
# Commit 5: OAuth System
git add src/auth/oauth.ts
git commit -m "feat: implement OAuth 2.0 PKCE authentication
- Add Google OAuth with PKCE security
- Implement token refresh and expiration handling
- Add state management and CSRF protection
- Support Calendar and Gmail API scopes"
# Commit 6: MCP Tools
git add src/mcp/tools/
git commit -m "feat: implement all 5 MCP tools
- Add time.resolve for natural language time parsing
- Implement calendar.find_free_slots for availability
- Add calendar.create_event with policy enforcement
- Create calendar.cancel_event with idempotency
- Add email.send with Handlebars templating"
# Commit 7: MCP Router
git add src/mcp/index.ts
git commit -m "feat: implement MCP Router with tool registry
- Add tool registration and execution system
- Implement request validation and error handling
- Create metadata and schema management
- Support idempotency across all tools"
# Commit 8: Server
git add src/server.ts
git commit -m "feat: implement Fastify server with OAuth routes
- Add OAuth login and callback endpoints
- Implement MCP tool execution routes
- Add health check and metrics endpoints
- Configure CORS, Helmet, and security middleware"
# Commit 9: Environment
git add .env .env.example
git commit -m "feat: add environment configuration
- Add production-ready environment variables
- Include Google OAuth credentials setup
- Configure Redis and encryption keys
- Add Gmail sender configuration"
# Commit 10: Scripts
git add setup.sh setup.bat install-deps.js
git commit -m "feat: add cross-platform setup scripts
- Add Windows batch script for setup
- Include Linux/Mac shell script
- Add Node.js dependency installer
- Support both manual and automated setup"
# Commit 11: Documentation
git add README.md DEPLOYMENT_PLAN.md
git commit -m "docs: add comprehensive documentation
- Add detailed README with setup instructions
- Include deployment plan for production hosting
- Document all MCP tools and API endpoints
- Add troubleshooting and security guidelines"
# Commit 12: Build Output
git add dist/ .gitignore
git commit -m "build: add TypeScript compilation output
- Add compiled JavaScript and type definitions
- Include source maps for debugging
- Configure .gitignore for proper exclusions
- Ready for production deployment"
```
### Push to GitHub
```bash
# Push all commits to GitHub
git push -u origin main
```
## 📝 Commit Message Format
Each commit follows the conventional commit format:
- **Type:** `feat`, `fix`, `docs`, `build`, `refactor`
- **Scope:** Brief description of what changed
- **Body:** Detailed list of changes
- **Footer:** Any breaking changes or references
## 🎯 Benefits of This Strategy
1. **Logical Organization:** Each commit represents a complete feature
2. **Easy Review:** Changes are grouped by functionality
3. **Rollback Safety:** Can revert specific features if needed
4. **Clear History:** Git log shows development progression
5. **Professional:** Follows industry best practices
## ⚠️ Important Notes
- **Run commits in order** to maintain logical progression
- **Test each commit** before proceeding to the next
- **Don't skip commits** as they build upon each other
- **Review changes** before pushing to GitHub
- **Keep .env file secure** - consider using .env.example for public repo
## 🚀 Ready to Deploy
After completing all commits:
1. **Verify all files** are committed
2. **Test the build** locally
3. **Push to GitHub** repository
4. **Set up deployment** using the deployment plan
5. **Configure production** environment variables
---
**Total Commits:** 12 logical, well-organized commits
**Repository:** https://github.com/Thinh-nguyen-03/virtual-assistant-mcp.git
**Ready for:** Production deployment and AI agent integration