# AGI - AI Development Assistant CLI

A minimal, modular CLI tool that uses AI to assist with development tasks. Built with Bun for maximum performance and simplicity.

## Features

- 🚀 **AI-Powered Commit Messages**: Generate meaningful commit messages from your staged changes
- 🎨 **Beautiful Output**: Colored terminal output with progress indicators
- ⚡ **Fast**: Built with Bun for instant startup and execution
- 🔧 **Configurable**: Customize behavior via global config file
- 📦 **Single Binary**: Compile to a standalone executable

## Installation

### Via npm (Recommended)

```bash
# Install globally
npm install -g @agi-cli/core

# Or with bun
bun install -g @agi-cli/core

# Verify installation
agi --version
```

### From Source

```bash
# Clone the repository
git clone https://github.com/ntishxyz/agi.git
cd agi

# Install dependencies
bun install

# Build the binary
bun run build

# Optional: Link globally
bun link
```

### Binary Installation

Download the pre-built binary from releases and add it to your PATH:

```bash
# Download binary (example for macOS)
curl -L https://github.com/ntishxyz/agi/releases/latest/download/agi-macos -o agi
chmod +x agi
sudo mv agi /usr/local/bin/
```

## Usage

### Generate Commit Messages

Stage your changes and run:

```bash
# Generate commit message for staged changes (long form)
agi commit

# Using short alias
agi cm

# Skip confirmation prompt
agi commit --yes
agi cm -y

# Preview without committing (dry run)
agi commit --dry-run
agi cm -d

# Show diff before generating
agi commit --show-diff
agi cm -s
```

## Configuration

AGI uses a global configuration file located at `~/.agi/config.json`.

### Setting up Gemini API Key

1. Get your API key from [Google AI Studio](https://makersuite.google.com/app/apikey)

2. Set the API key using environment variable:
```bash
export GEMINI_API_KEY="your-api-key-here"
```

Or add it to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.)

### Configuration File

The config file is automatically created on first run. You can customize it:

```json
{
  "version": "1.0.0",
  "defaultProvider": "gemini",
  "providers": {
    "gemini": {
      "enabled": true,
      "model": "gemini-2.0-flash-exp",
      "maxTokens": 4096,
      "temperature": 0.7
    }
  },
  "commit": {
    "conventionalCommits": true,
    "includeEmoji": false,
    "maxLength": 72,
    "includeDiff": true,
    "excludePatterns": ["*.lock", "*.min.js"]
  }
}
```

## Development

### Project Structure

```
agi/
├── src/
│   ├── commands/       # Command implementations
│   ├── providers/      # AI provider integrations
│   ├── config/         # Configuration management
│   ├── prompts/        # System prompts (markdown)
│   ├── utils/          # Utility functions
│   └── cli.ts          # Entry point
├── tests/              # Test files
├── dist/               # Built binaries
└── docs/               # Documentation
```

### Running in Development

```bash
# Run CLI in development mode
bun run dev

# Run tests
bun test

# Watch tests
bun test --watch

# Build binary
bun run build
```

### Adding New Commands

1. Create a new file in `src/commands/` (use kebab-case naming)
2. Implement the command function
3. Register it in `src/cli.ts`
4. Add any new prompts to `src/prompts/`

### Code Style

- Use kebab-case for file names
- Keep files under 200 lines
- Prefer simplicity over cleverness
- Use Bun's built-in APIs where possible

See `agents.md` for detailed development guidelines.

## Roadmap

- [x] MVP: Commit message generation with Gemini
- [ ] Multi-provider support (Claude, OpenAI)
- [ ] More commands: `review`, `refactor`, `test`, `docs`
- [ ] Server mode with API
- [ ] Interactive TUI with OpenTUI
- [ ] IDE integrations

See `docs/future-roadmap.md` for detailed plans.

## Contributing

Contributions are welcome! Please read `agents.md` for development guidelines and code standards.

## License

MIT

## Acknowledgments

Built with:
- [Bun](https://bun.sh) - Fast all-in-one JavaScript runtime
- [Commander.js](https://github.com/tj/commander.js) - Node.js command-line interfaces
- [Google Generative AI](https://ai.google.dev/) - Gemini API for AI capabilities