diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f7b6b76 --- /dev/null +++ b/.gitignore @@ -0,0 +1,48 @@ +# Dependencies +node_modules/ + +# Lock files +package-lock.json +bun.lock + +# Environment variables +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +# Logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Coverage directory used by tools like istanbul +coverage/ + +# OS generated files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# IDE files +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# Temporary files +*.tmp +*.temp \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..e1616ac --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,43 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +GIMS (Git Made Simple) is an AI-powered Git CLI tool that automatically generates meaningful commit messages from code changes. It's a Node.js package published to npm that integrates with OpenAI GPT-4 and Google Gemini APIs. + +## Architecture + +- **Single-file CLI**: All functionality is contained in `bin/gims.js` +- **AI Integration**: Supports both OpenAI and Google Gemini APIs with intelligent fallback strategies +- **Git Wrapper**: Built on top of `simple-git` library for Git operations +- **Token Management**: Implements sophisticated content chunking to handle large diffs within AI token limits + +## Key Components + +- **Command System**: Uses `commander.js` for CLI argument parsing with aliases (e.g., `g o` for `gims online`) +- **AI Message Generation**: Multi-strategy approach that falls back from full diff → summary → status → truncated content +- **Commit Resolution**: Supports both commit hashes and numbered indices for referencing commits +- **Safe Operations**: Includes error handling for empty repositories and edge cases + +## Environment Setup + +Required environment variables (at least one): +- `OPENAI_API_KEY` - For OpenAI GPT-4o-mini integration +- `GEMINI_API_KEY` - For Google Gemini 2.0 Flash integration + +## Common Commands + +- **Install globally**: `npm install -g .` +- **Test locally**: `node bin/gims.js --help` +- **Test specific command**: `node bin/gims.js suggest` +- **Run with alias**: `g o` (after global install) + +## Development Notes + +- No test framework is currently configured (package.json shows placeholder test script) +- Node.js version requirement: >=20.0.0 +- Uses CommonJS modules (`require`/`module.exports`) +- Dependencies are minimal and focused on core functionality +- Token estimation uses 4 characters per token approximation +- Maximum context limit set conservatively at 100,000 tokens \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2109675 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Sairaj Jawalikar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.