diff --git a/.claude/commands/commit.md b/.claude/commands/commit.md new file mode 100644 index 0000000..f6c5848 --- /dev/null +++ b/.claude/commands/commit.md @@ -0,0 +1,517 @@ +# Git Commit İşlemleri - Code Intelligence MCP Project + +## Görev + +Code Intelligence MCP projesindeki değişiklikleri analiz et ve uygun commit stratejisi ile işle. + +## 🔍 Smart Commit Context with Agent Integration + +### Pre-Commit Analysis with Agents + +Before committing, use specialized agents to ensure code quality: + +```bash +# 1. First, verify test coverage AND test execution for changes +Task(description="Verify test coverage and execution", + prompt="Analyze staged changes, ensure comprehensive test coverage exists for modified files, and verify related tests pass without failures", + subagent_type="test-coverage-analyzer") + +# 2. Run tests for modified modules - ProjectAra specific test commands +# Unit tests for TypeScript/React +npm run test:unit +# Contract tests for MCP protocol compliance +npm run test:contract +# Integration tests if API changes +npm run test:integration + +# 3. Check for any skipped or disabled tests in both TypeScript and Rust +grep -r "\.skip\|\.only\|xit\|fit" --include="*.spec.ts" --include="*.test.ts" --exclude-dir=node_modules . +grep -r "#\[ignore\]" rust-core/ --include="*.rs" + +# 4. Analyze commit history for patterns (manual) +git log --oneline --grep="feat(" --grep="fix(" --grep="docs(" --grep="refactor(" -n 20 + +# Search for related historical changes in git history +git log --oneline --all --grep="[feature/module]" -n 10 +git log --oneline --all -S "[changed-functionality]" -n 5 + +# Find commit message conventions from recent commits +git log --oneline -n 50 | grep -E "(feat|fix|docs|refactor|chore|style|test|perf):" + +# 5. Check for breaking change patterns +git log --grep="BREAKING CHANGE" --grep="BC:" --oneline -n 10 +``` + +### Enhanced Smart Change Analysis (with MCP-REPL) + +Using agents, semantic search, and systematic analysis: + +**🚀 Semantic Commit Pattern Discovery:** + +```bash +# Intelligent commit pattern analysis +mcp__mcp-repl__searchcode "commit patterns [feature_type] best practices conventions" +mcp__mcp-repl__searchcode "similar changes [module_name] historical implementation" +``` + +**🔍 Code Change Structural Analysis:** + +```bash +# Analyze code changes with AST patterns +mcp__mcp-repl__astgrep_search --pattern "export const $NAME = ($$$PROPS) => { $$$ }" +mcp__mcp-repl__astgrep_search --pattern "interface $NAME { $$$PROPS }" +``` + +**📊 Systematic Commit Strategy Documentation:** + +```bash +# Document commit analysis and strategy +mcp__mcp-repl__sequentialthinking [ + "Analyzed staged changes: 8 files across 3 modules (backend, frontend, types)", + "Identified change type: Feature addition with breaking changes to API", + "Found similar historical commits: feat(api): add user preferences v0.8.24", + "Commit strategy: Single atomic commit with proper BREAKING CHANGE notation", + "Test coverage verified: 12 new tests added, coverage maintained at 100%" +] +``` + +Combined approach ensures comprehensive commit readiness: + +- Agent identifies missing tests and suggests test templates +- Agent fixes code quality issues automatically +- **Semantic search** finds related modules and past implementations +- **Systematic documentation** tracks commit strategy and reasoning + +## İşlem Adımları + +### 1. Dosya Analizi ve Filtreleme + +```bash +# Check current git status +git status --porcelain + +# Run version consistency check for ProjectAra +./scripts/check-version-consistency.sh + +# Run comprehensive pre-commit checks +./scripts/pre-commit-checks.sh + +# Check TypeScript types +npm run check + +# Run linter +npm run lint +``` + +- Tüm değişiklikleri kategorize et (Added, Modified, Deleted, Renamed) +- **Hook System Integration**: Pre-commit hooks will automatically validate: + - Chakra UI v3 compliance (`@tms/ui` import enforcement) + - Code quality and formatting + - Documentation consistency +- Aşağıdaki dosyaları ASLA commit etme: + - `.tmp/`, `temp/`, `.trae/tmp/`, `typescript-mcp/.tmp/` klasörlerindeki tüm dosyalar + - `*.test.*`, `*.spec.*` test dosyaları (eğer test implementasyonu değilse) + - `.env`, `.env.local` gibi environment dosyaları + - `node_modules/`, `dist/`, `build/` klasörleri + - `*.log`, `*.tmp`, `*.cache` uzantılı dosyalar + - IDE config dosyaları (`.idea/`, `.vscode/settings.json`) + - Hook configuration changes without approval + +### 2. Değişiklik Gruplandırması + +```bash +# Use manual analysis to understand change patterns in ProjectAra +grep -r "import.*[changed-file]" . --include="*.ts" --include="*.tsx" --include="*.rs" +find . -name "*.ts" -o -name "*.tsx" -o -name "*.rs" | xargs grep -l "[modified-module]" + +# Find dependencies of modified modules +grep -r "from.*[modified-module]" . --include="*.ts" --include="*.tsx" +find . -name "package.json" -o -name "Cargo.toml" | xargs grep -l "[modified-package]" +``` + +Değişiklikleri mantıksal gruplara ayır: + +- **Feature**: Yeni özellik eklemeleri +- **Fix**: Bug düzeltmeleri +- **Refactor**: Kod iyileştirmeleri (davranış değişikliği olmadan) +- **Docs**: Dokümantasyon güncellemeleri +- **Style**: Formatting, missing semi-colons, etc. +- **Test**: Test eklemeleri veya düzeltmeleri +- **Chore**: Build process, auxiliary tools, libraries güncellemeleri +- **Perf**: Performance iyileştirmeleri + +### 3. Commit Stratejisi Belirleme + +- Tek bir mantıksal değişiklik = Tek commit +- Farklı modüllere ait değişiklikler = Ayrı commitler +- Büyük feature = Ana commit + destekleyici commitler + +### 4. Agent-Driven Quality Checks + +Before finalizing commits, agents will help identify issues: + +```bash +# Enhanced test verification for ProjectAra +Task(description="Comprehensive test verification", + prompt="1. Check test coverage for staged changes in TypeScript and Rust + 2. Run unit tests (npm test) and Rust tests (cargo test) + 3. Run contract tests if MCP protocol changes detected + 4. Verify no tests are skipped or disabled + 5. Check performance benchmarks if Rust core modified", + subagent_type="test-coverage-analyzer") + +# ProjectAra specific test execution +# TypeScript/React tests +npm run test:unit +# Rust core tests if rust files changed +if git diff --staged --name-only | grep -q "rust-core/"; then + cd rust-core && cargo test && cd .. +fi +# Contract tests if MCP changes +if git diff --staged --name-only | grep -q "typescript-mcp/"; then + npm run test:contract +fi +``` + +**Test Scope Note:** + +- Only tests related to staged changes are validated +- Tests from unchanged modules are OUT OF SCOPE +- Focus is on ensuring modified code doesn't break its own tests +- Existing failing tests in other modules don't block commits + +### 5. Emin Olamadığın Durumlar İçin Sorgulama + +Aşağıdaki durumlarda kullanıcıya mutlaka sor: + +- Generated dosyalar (örn: `package-lock.json` yanında `package.json` değişikliği yoksa) +- Migration dosyaları (veritabanı şema değişiklikleri) +- Config dosyalarındaki değişiklikler (`.claude/`, `docker-compose.yml`) +- Hook configuration modifications (`.claude/hooks/`, `.claude/settings.local.json`) +- Binary dosyalar (images, PDFs, etc.) +- Büyük dosyalar (> 1MB) +- Documentation size approaching limits (CLAUDE.md > 38,000 chars) +- Direct Chakra UI imports instead of @tms/ui (agents will auto-fix this) +- **RULE 15 RED FLAGS** (agents will detect and fix): + - TODO/FIXME comments with "temporary" or "workaround" + - Hardcoded values that should be configurable + - Duplicated code across multiple files + - Disabled tests or eslint-disable comments + - "Quick fix" or "hotfix" in commit messages without proper solution + +### 6. Commit Mesajı Formatı + +Conventional Commits formatını kullan: + +``` +(): + + + +