feat(cli): auto-stage when nothing staged for g m/g l/g o; docs: update README
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# GIMS - Git Made Simple
|
||||
|
||||
GIMS is an AI-powered Git CLI tool that automatically generates meaningful commit messages from code changes. It's designed to replace generic commit messages with descriptive, professional ones that tell a story.
|
||||
|
||||
## Core Value Proposition
|
||||
- Eliminates the need to write commit messages manually
|
||||
- Uses AI (OpenAI, Google Gemini, Groq) to analyze code diffs and generate contextual messages
|
||||
- Provides a streamlined Git workflow with single-command operations
|
||||
- Supports both local and remote operations with intelligent fallbacks
|
||||
|
||||
## Key Features
|
||||
- AI-powered commit message generation from code diffs
|
||||
- One-command workflow: analyze, commit, and push (`g o`)
|
||||
- Smart suggestions with clipboard integration (`g s`)
|
||||
- Conventional Commits support
|
||||
- Numbered commit history and branch management
|
||||
- Safe operations with confirmations and dry-run support
|
||||
- Graceful fallbacks for large diffs and offline use
|
||||
|
||||
## Target Users
|
||||
Developers who want to maintain clean Git history without spending time crafting commit messages, especially those working on projects where commit message quality matters for collaboration and code review.
|
||||
@@ -0,0 +1,72 @@
|
||||
# Project Structure
|
||||
|
||||
## Directory Layout
|
||||
```
|
||||
gims/
|
||||
├── bin/
|
||||
│ └── gims.js # Main CLI executable and entry point
|
||||
├── node_modules/ # npm dependencies (auto-generated)
|
||||
├── .npm-cache/ # npm cache directory (auto-generated)
|
||||
├── .github/ # GitHub workflows and templates
|
||||
├── .git/ # Git repository data
|
||||
├── .kiro/ # Kiro AI assistant configuration
|
||||
│ └── steering/ # AI guidance documents
|
||||
├── package.json # Project metadata and dependencies
|
||||
├── package-lock.json # Dependency lock file
|
||||
├── README.md # Comprehensive project documentation
|
||||
├── LICENSE # MIT license
|
||||
└── .gitignore # Git ignore patterns
|
||||
```
|
||||
|
||||
## Key Files
|
||||
|
||||
### `bin/gims.js`
|
||||
- **Purpose**: Single-file CLI application containing all functionality
|
||||
- **Structure**: Monolithic approach with utility functions, command handlers, and AI integration
|
||||
- **Exports**: Executable binary via shebang (`#!/usr/bin/env node`)
|
||||
- **Commands**: All CLI commands and subcommands defined in this file
|
||||
|
||||
### `package.json`
|
||||
- **Binary entries**: `gims` and `g` both point to `bin/gims.js`
|
||||
- **Main entry**: Points to `bin/gims.js`
|
||||
- **Scripts**: Minimal test script placeholder
|
||||
- **Keywords**: Focused on git, cli, ai, commit, developer-tools
|
||||
|
||||
### Configuration Files
|
||||
- **`.gimsrc`**: Optional JSON config (project root or home directory)
|
||||
- **Environment variables**: API keys and default settings
|
||||
- **Git integration**: Uses existing `.git` directory and configuration
|
||||
|
||||
## Architecture Principles
|
||||
|
||||
### Single-File Design
|
||||
- All functionality consolidated in `bin/gims.js` for simplicity
|
||||
- No separate modules or complex directory structure
|
||||
- Easy to understand, debug, and maintain
|
||||
- Reduces complexity for a CLI tool
|
||||
|
||||
### Command Structure
|
||||
- Uses commander.js for CLI parsing and command organization
|
||||
- Short aliases for all commands (`g o`, `g s`, `g l`, etc.)
|
||||
- Consistent option patterns across commands
|
||||
- Global options available to all subcommands
|
||||
|
||||
### File Naming Conventions
|
||||
- Executable files in `bin/` directory
|
||||
- Configuration files use dotfile convention (`.gimsrc`)
|
||||
- Standard npm project files (package.json, README.md, LICENSE)
|
||||
- No custom file extensions or special naming schemes
|
||||
|
||||
## Development Guidelines
|
||||
|
||||
### Adding New Features
|
||||
- Add new commands directly to `bin/gims.js`
|
||||
- Follow existing pattern of command definition with commander.js
|
||||
- Maintain consistent error handling and logging patterns
|
||||
- Add appropriate help text and examples
|
||||
|
||||
### Configuration Management
|
||||
- Environment variables for sensitive data (API keys)
|
||||
- JSON config files for user preferences
|
||||
- Runtime detection and fallback logic
|
||||
- Validate configuration at startup when needed
|
||||
@@ -0,0 +1,68 @@
|
||||
# Technology Stack
|
||||
|
||||
## Runtime & Language
|
||||
- **Node.js**: >= 18.18.0 (Node 20+ recommended)
|
||||
- **JavaScript**: CommonJS modules (`"type": "commonjs"`)
|
||||
- **Package Manager**: npm (with package-lock.json)
|
||||
|
||||
## Core Dependencies
|
||||
- **commander**: CLI framework for command parsing and structure
|
||||
- **simple-git**: Git operations and repository management
|
||||
- **clipboardy**: Cross-platform clipboard operations
|
||||
- **@google/genai**: Google Gemini AI integration
|
||||
- **openai**: OpenAI API client
|
||||
|
||||
## Architecture Patterns
|
||||
- Single-file CLI application (`bin/gims.js`)
|
||||
- Functional programming approach with utility functions
|
||||
- Configuration via environment variables and `.gimsrc` JSON files
|
||||
- Graceful fallbacks and error handling throughout
|
||||
- ANSI color utilities without external dependencies
|
||||
|
||||
## Code Style Conventions
|
||||
- Use `const` for immutable values, avoid `var`
|
||||
- Prefer template literals for string interpolation
|
||||
- Use async/await for asynchronous operations
|
||||
- Implement comprehensive error handling with try/catch
|
||||
- Keep functions focused and modular
|
||||
- Use descriptive variable names (e.g., `rawDiff`, `prefProvider`)
|
||||
- Comment complex logic and AI prompt engineering sections
|
||||
|
||||
## Common Commands
|
||||
|
||||
### Development
|
||||
```bash
|
||||
# Install dependencies
|
||||
npm install
|
||||
|
||||
# Test installation
|
||||
npm test # Currently returns "No tests yet"
|
||||
|
||||
# Global installation for testing
|
||||
npm install -g .
|
||||
```
|
||||
|
||||
### Publishing
|
||||
```bash
|
||||
# Update version
|
||||
npm version patch|minor|major
|
||||
|
||||
# Publish to npm
|
||||
npm publish
|
||||
```
|
||||
|
||||
### Local Development Testing
|
||||
```bash
|
||||
# Link for local testing
|
||||
npm link
|
||||
|
||||
# Test CLI commands
|
||||
gims --help
|
||||
g --help
|
||||
```
|
||||
|
||||
## Configuration Management
|
||||
- Environment variables for API keys (`OPENAI_API_KEY`, `GEMINI_API_KEY`, `GROQ_API_KEY`)
|
||||
- Optional `.gimsrc` JSON config in project root or home directory
|
||||
- Runtime provider detection and fallback logic
|
||||
- Support for custom models and base URLs
|
||||
Reference in New Issue
Block a user