Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Test plugin loading
run: |
zsh -c "
source zsh-git-ai.zsh 2>/dev/null || true
source zsh-git-ai.plugin.zsh 2>/dev/null || true
if [[ -z \"\$ZSH_GIT_AI_PROVIDER\" ]]; then
echo 'ERROR: Plugin failed to load'
exit 1
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Test provider validation
run: |
zsh -c "
source zsh-git-ai.zsh 2>/dev/null || true
source zsh-git-ai.plugin.zsh 2>/dev/null || true

# Test anthropic provider validation
export ZSH_GIT_AI_PROVIDER='anthropic'
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
- name: Test load_provider function
run: |
zsh -c "
source zsh-git-ai.zsh 2>/dev/null || true
source zsh-git-ai.plugin.zsh 2>/dev/null || true

# Test loading valid provider
export ANTHROPIC_API_KEY='test-key'
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ When adding/modifying AI providers:
### Common Tasks
- **Adding a new provider**: Copy existing provider pattern, add tests
- **Modifying commit generation**: Update provider logic and test with various diff formats
- **Changing main script logic**: Update `zsh-git-ai.zsh` and test in `tests/main.test.zsh`
- **Changing main script logic**: Update `zsh-git-ai.plugin.zsh` and test in `tests/main.test.zsh`

### Important Notes
- This is a shell-only project - no Node.js, Python, or other runtimes
Expand Down
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ That's it! We'll help you with the rest.

```bash
# Try out your changes
source zsh-git-ai.zsh
source zsh-git-ai.plugin.zsh

# Test with a real commit
git add some-file
Expand Down Expand Up @@ -44,8 +44,10 @@ Just follow the existing style you see in the codebase. When in doubt:
To test your changes:

```bash
# 1. Source the plugin
# 1. Source the plugin (both work for backward compatibility)
source zsh-git-ai.zsh
# or
source zsh-git-ai.plugin.zsh

# 2. Create some test changes
echo "test" > test.txt
Expand Down
24 changes: 12 additions & 12 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ brew tap matheusml/zsh-git-ai
brew install zsh-git-ai

# Add to your .zshrc
echo "source $(brew --prefix)/share/zsh-git-ai/zsh-git-ai.zsh" >> ~/.zshrc
echo "source $(brew --prefix)/share/zsh-git-ai/zsh-git-ai.plugin.zsh" >> ~/.zshrc

# Set your API key
echo 'export ANTHROPIC_API_KEY="your-api-key-here"' >> ~/.zshrc
Expand All @@ -35,7 +35,7 @@ source ~/.zshrc
git clone https://github.com/matheusml/zsh-git-ai ~/.zsh-git-ai

# Add to your .zshrc
echo "source ~/.zsh-git-ai/zsh-git-ai.zsh" >> ~/.zshrc
echo "source ~/.zsh-git-ai/zsh-git-ai.plugin.zsh" >> ~/.zshrc

# Set your API key
echo 'export ANTHROPIC_API_KEY="your-api-key-here"' >> ~/.zshrc
Expand All @@ -56,7 +56,7 @@ brew tap matheusml/zsh-git-ai
brew install zsh-git-ai

# Add to your shell configuration
echo "source $(brew --prefix)/share/zsh-git-ai/zsh-git-ai.zsh" >> ~/.zshrc
echo "source $(brew --prefix)/share/zsh-git-ai/zsh-git-ai.plugin.zsh" >> ~/.zshrc

# Reload shell
source ~/.zshrc
Expand All @@ -83,7 +83,7 @@ brew untap matheusml/zsh-git-ai
git clone https://github.com/matheusml/zsh-git-ai ~/Apps/zsh-git-ai

# Source in your .zshrc
echo "source ~/Apps/zsh-git-ai/zsh-git-ai.zsh" >> ~/.zshrc
echo "source ~/Apps/zsh-git-ai/zsh-git-ai.plugin.zsh" >> ~/.zshrc

# Reload
source ~/.zshrc
Expand Down Expand Up @@ -122,14 +122,14 @@ zplug "matheusml/zsh-git-ai"

```bash
# Download the script directly
curl -o ~/.zsh-git-ai.zsh \
https://raw.githubusercontent.com/matheusml/zsh-git-ai/main/zsh-git-ai.zsh
curl -o ~/.zsh-git-ai.plugin.zsh \
https://raw.githubusercontent.com/matheusml/zsh-git-ai/main/zsh-git-ai.plugin.zsh

# Make it executable
chmod +x ~/.zsh-git-ai.zsh
chmod +x ~/.zsh-git-ai.plugin.zsh

# Source it
echo "source ~/.zsh-git-ai.zsh" >> ~/.zshrc
echo "source ~/.zsh-git-ai.plugin.zsh" >> ~/.zshrc
source ~/.zshrc
```

Expand Down Expand Up @@ -284,7 +284,7 @@ echo $SHELL # Should show /bin/zsh or similar

2. Verify source path:
```bash
ls -la ~/.zsh-git-ai/zsh-git-ai.zsh # File should exist
ls -la ~/.zsh-git-ai/zsh-git-ai.plugin.zsh # File should exist
```

3. Check .zshrc:
Expand Down Expand Up @@ -318,7 +318,7 @@ curl -X POST https://api.anthropic.com/v1/messages \
### Permission Denied

```bash
chmod +x ~/.zsh-git-ai/zsh-git-ai.zsh
chmod +x ~/.zsh-git-ai/zsh-git-ai.plugin.zsh
```

### Conflicts with Other Plugins
Expand All @@ -334,7 +334,7 @@ alias | grep git # Check aliases
2. Load order matters in .zshrc:
```bash
# Load zsh-git-ai after other git plugins
source ~/.zsh-git-ai/zsh-git-ai.zsh
source ~/.zsh-git-ai/zsh-git-ai.plugin.zsh
```

## Uninstallation
Expand Down Expand Up @@ -389,7 +389,7 @@ echo 'alias update-zsh-git-ai="cd ~/.zsh-git-ai && git pull && cd - && source ~/
git clone https://github.com/matheusml/zsh-git-ai /custom/path/zsh-git-ai

# Source from custom path
echo "source /custom/path/zsh-git-ai/zsh-git-ai.zsh" >> ~/.zshrc
echo "source /custom/path/zsh-git-ai/zsh-git-ai.plugin.zsh" >> ~/.zshrc
```

> 📚 **For more advanced configuration options**, including:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ brew tap matheusml/zsh-git-ai
brew install zsh-git-ai

# 2. Add to your shell
echo "source $(brew --prefix)/share/zsh-git-ai/zsh-git-ai.zsh" >> ~/.zshrc
echo "source $(brew --prefix)/share/zsh-git-ai/zsh-git-ai.plugin.zsh" >> ~/.zshrc

# 3. Set up your API key
export ANTHROPIC_API_KEY="your-api-key-here"
Expand All @@ -63,7 +63,7 @@ git commit # No -m needed!
```bash
# 1. Clone the repository
git clone https://github.com/matheusml/zsh-git-ai ~/.zsh-git-ai
echo "source ~/.zsh-git-ai/zsh-git-ai.zsh" >> ~/.zshrc
echo "source ~/.zsh-git-ai/zsh-git-ai.plugin.zsh" >> ~/.zshrc

# 2. Set up your API key
export ANTHROPIC_API_KEY="your-api-key-here"
Expand Down
8 changes: 4 additions & 4 deletions tests/main.test.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ source "${0:A:h}/test_helper.zsh"
test_default_provider() {
setup_test_env
unset ZSH_GIT_AI_PROVIDER
source "$PLUGIN_DIR/zsh-git-ai.zsh" 2>/dev/null || true
source "$PLUGIN_DIR/zsh-git-ai.plugin.zsh" 2>/dev/null || true
# Default should be anthropic
assert_equals "$ZSH_GIT_AI_PROVIDER" "anthropic"
teardown_test_env
Expand All @@ -24,7 +24,7 @@ test_load_provider_success() {
}

# Source just the load_provider function
source "$PLUGIN_DIR/zsh-git-ai.zsh" 2>/dev/null || true
source "$PLUGIN_DIR/zsh-git-ai.plugin.zsh" 2>/dev/null || true
local result
load_provider "anthropic" >/dev/null 2>&1
result=$?
Expand All @@ -38,7 +38,7 @@ test_load_provider_invalid() {
export ZSH_GIT_AI_PROVIDER="invalid_provider"

# Source just the load_provider function
source "$PLUGIN_DIR/zsh-git-ai.zsh" 2>/dev/null || true
source "$PLUGIN_DIR/zsh-git-ai.plugin.zsh" 2>/dev/null || true
local output
output=$(load_provider "invalid_provider" 2>&1)
local result=$?
Expand All @@ -50,7 +50,7 @@ test_load_provider_invalid() {

test_spinner_function_exists() {
setup_test_env
source "$PLUGIN_DIR/zsh-git-ai.zsh" 2>/dev/null || true
source "$PLUGIN_DIR/zsh-git-ai.plugin.zsh" 2>/dev/null || true

# Check if show_spinner function is defined
if type show_spinner >/dev/null 2>&1; then
Expand Down
2 changes: 1 addition & 1 deletion zsh-git-ai.zsh → zsh-git-ai.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Git Commit AI - Generate commit messages with AI providers

# Get the directory where this script is located
SCRIPT_DIR="${0:A:h}"
local SCRIPT_DIR="${0:A:h}"

# Default provider
ZSH_GIT_AI_PROVIDER="${ZSH_GIT_AI_PROVIDER:-anthropic}"
Expand Down