diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cc932f1..88ce710 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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' @@ -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' diff --git a/CLAUDE.md b/CLAUDE.md index 7ce7b8b..9d47634 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e6381dd..92a26f2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 @@ -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 diff --git a/INSTALL.md b/INSTALL.md index 243f717..1eb4327 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 ``` @@ -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: @@ -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 @@ -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 @@ -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: diff --git a/README.md b/README.md index 66314b5..0f9d41d 100644 --- a/README.md +++ b/README.md @@ -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" @@ -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" diff --git a/tests/main.test.zsh b/tests/main.test.zsh index 7447a60..a0c6d1b 100644 --- a/tests/main.test.zsh +++ b/tests/main.test.zsh @@ -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 @@ -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=$? @@ -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=$? @@ -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 diff --git a/zsh-git-ai.zsh b/zsh-git-ai.plugin.zsh similarity index 99% rename from zsh-git-ai.zsh rename to zsh-git-ai.plugin.zsh index 8543414..cade3d3 100644 --- a/zsh-git-ai.zsh +++ b/zsh-git-ai.plugin.zsh @@ -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}"