A brief description of your gitLlama project
Project description
GitLlama ๐ฆ
Automate git operations with ease
GitLlama is a powerful Python CLI tool that automates common git workflows. Clone repositories, create branches, make changes, commit, and push - all with a single command.
Features
- ๐ One-command automation - Complete git workflows in a single command
- ๐ง Highly configurable - Customize changes, commit messages, and workflows
- ๐ Modular design - Easy to extend with custom change logic
- ๐ก๏ธ Error handling - Robust error handling and rollback capabilities
- ๐ Multiple output formats - JSON and text output support
- ๐ Dry run mode - Test operations without making actual changes
- ๐ Template system - Predefined change templates for common operations
Installation
From PyPI (Coming Soon)
pip install gitllama
From Source
git clone https://github.com/your-org/gitllama.git
cd gitllama
pip install -e .
Development Installation
git clone https://github.com/your-org/gitllama.git
cd gitllama
pip install -e ".[dev]"
Quick Start
Basic Usage
# Clone a repo, create a branch, make changes, commit and push
gitllama https://github.com/user/repo.git
# Use a custom branch name
gitllama https://github.com/user/repo.git --branch my-feature-branch
# Dry run (no commits or pushes)
gitllama https://github.com/user/repo.git --dry-run
Custom Changes
Create a changes.json file:
{
"type": "create_file",
"filename": "hello.txt",
"content": "Hello from GitLlama!"
}
Then run:
gitllama https://github.com/user/repo.git --changes-file changes.json
Advanced Usage
# Custom commit message
gitllama https://github.com/user/repo.git -m "Add automated documentation"
# Skip pushing to remote
gitllama https://github.com/user/repo.git --no-push
# Verbose output
gitllama https://github.com/user/repo.git --verbose
# JSON output format
gitllama https://github.com/user/repo.git --output-format json
Configuration
Change Types
GitLlama supports several types of changes:
1. Create File
{
"type": "create_file",
"filename": "new_file.txt",
"content": "File content here"
}
2. Modify File
{
"type": "modify_file",
"filename": "existing_file.txt",
"append_content": "\nAppended content"
}
3. Delete File
{
"type": "delete_file",
"filename": "file_to_delete.txt"
}
Configuration File
Create ~/.config/gitllama/config.yaml:
git:
default_branch: "gitllama-automation"
commit_message_template: "Automated changes by GitLlama"
auto_push: true
changes:
default_type: "create_file"
default_filename: "gitllama_changes.txt"
default_content: "This file was created by GitLlama automation tool."
logging:
level: "INFO"
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
Change Templates
Use predefined templates for common operations:
# Available templates: add_readme, add_gitignore, modify_readme, add_license_note
gitllama https://github.com/user/repo.git --changes-json '{"template": "add_readme"}'
Python API
You can also use GitLlama programmatically:
from gitllama import GitAutomator
# Basic usage
with GitAutomator() as automator:
results = automator.run_full_workflow(
git_url="https://github.com/user/repo.git",
branch_name="my-branch",
changes_config={
"type": "create_file",
"filename": "api_example.txt",
"content": "Created via Python API"
}
)
print(f"Success: {results['success']}")
# Advanced usage with custom changes
changes_config = {
"type": "modify_file",
"filename": "README.md",
"append_content": "\n## Added by GitLlama API"
}
with GitAutomator(working_dir="/tmp/gitllama") as automator:
# Step by step
repo_path = automator.clone_repository("https://github.com/user/repo.git")
automator.checkout_branch("api-changes")
modified_files = automator.make_changes(changes_config)
commit_hash = automator.commit_changes("API-driven changes")
push_output = automator.push_changes()
Extending GitLlama
Custom Change Types
Add your own change logic by extending the make_changes method:
from gitllama import GitAutomator
class CustomGitAutomator(GitAutomator):
def _custom_change_type(self, config):
"""Implement your custom change logic here."""
# Your implementation
return ["modified_file.txt"]
def make_changes(self, changes_config=None):
if changes_config and changes_config.get("type") == "my_custom_type":
return self._custom_change_type(changes_config)
return super().make_changes(changes_config)
Custom Workflows
from gitllama import GitAutomator
def my_custom_workflow(git_url, **kwargs):
with GitAutomator() as automator:
# Clone repository
automator.clone_repository(git_url)
# Your custom logic here
# - Multiple branches
# - Complex change sequences
# - Conditional logic
return results
Command Line Reference
usage: gitllama [-h] [--branch BRANCH] [--working-dir WORKING_DIR]
[--commit-message COMMIT_MESSAGE] [--changes-file CHANGES_FILE]
[--changes-json CHANGES_JSON] [--dry-run] [--no-push]
[--verbose] [--quiet] [--config CONFIG]
[--output-format {text,json}]
git_url
GitLlama - Automate git operations with ease
positional arguments:
git_url Git repository URL to clone and modify
optional arguments:
-h, --help show this help message and exit
--branch BRANCH, -b BRANCH
Branch name to create (default: gitllama-automation)
--working-dir WORKING_DIR, -w WORKING_DIR
Working directory for operations (default: temporary directory)
--commit-message COMMIT_MESSAGE, -m COMMIT_MESSAGE
Custom commit message
--changes-file CHANGES_FILE, -c CHANGES_FILE
JSON file containing changes configuration
--changes-json CHANGES_JSON
JSON string containing changes configuration
--dry-run Perform all operations except commit and push
--no-push Don't push changes to remote repository
--verbose, -v Enable verbose logging
--quiet, -q Suppress all output except errors
--config CONFIG Configuration file path
--output-format {text,json}
Output format (default: text)
Development
Setting up Development Environment
git clone https://github.com/your-org/gitllama.git
cd gitllama
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e ".[dev]"
Running Tests
pytest
Code Quality
# Format code
black src tests
# Lint code
flake8 src tests
# Type checking
mypy src
Pre-commit Hooks
pre-commit install
pre-commit run --all-files
Building and Publishing
Local Build
# Install build dependencies
pip install build twine
# Build the package
python -m build
# Check the build
twine check dist/*
Publishing to PyPI
Test PyPI (Recommended for testing)
# Create account at https://test.pypi.org/
# Create API token in account settings
# Upload to test PyPI
twine upload --repository testpypi dist/*
# Test installation
pip install --index-url https://test.pypi.org/simple/ gitllama
Production PyPI
# Create account at https://pypi.org/
# Create API token in account settings
# Upload to PyPI
twine upload dist/*
# Verify installation
pip install gitllama
GitHub Actions (CI/CD)
Create .github/workflows/ci.yml:
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[test]"
- name: Run tests
run: pytest
- name: Run linting
run: |
pip install flake8 black mypy
flake8 src tests
black --check src tests
mypy src
publish:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*
Project Structure
gitllama/
โโโ src/
โ โโโ gitllama/
โ โโโ __init__.py # Package initialization
โ โโโ cli.py # Command-line interface
โ โโโ git_operations.py # Core git automation logic
โ โโโ config.py # Configuration and logging
โโโ tests/ # Test suite
โโโ docs/ # Documentation
โโโ .github/ # GitHub Actions workflows
โโโ pyproject.toml # Package configuration
โโโ README.md # This file
โโโ LICENSE # GPL v3 License
โโโ .gitignore # Git ignore rules
โโโ .flake8 # Flake8 configuration
โโโ .pre-commit-config.yaml # Pre-commit hooks
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for your changes
- Run the test suite (
pytest) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Changelog
v0.1.0 (Initial Release)
- Basic git automation functionality
- CLI interface with comprehensive options
- Configuration system with YAML/JSON support
- Change templates system
- Dry run and no-push modes
- JSON and text output formats
- Comprehensive error handling
- Python API for programmatic usage
Roadmap
- Web interface for managing workflows
- Integration with popular CI/CD platforms
- Plugin system for custom change types
- Database storage for workflow history
- Parallel processing for multiple repositories
- Advanced conflict resolution
- Integration with code review tools
Support
- ๐ Documentation
- ๐ Bug Reports
- ๐ฌ Discussions
- ๐ง Email Support
Made with โค๏ธ by the GitLlama team
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitllama-0.1.0.tar.gz.
File metadata
- Download URL: gitllama-0.1.0.tar.gz
- Upload date:
- Size: 27.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85ecac2c2e99b2e848f73105bd711fe2da15fb0535ddf9f8c9a7373740c11509
|
|
| MD5 |
328555ff6486a3762073d401cfc551ec
|
|
| BLAKE2b-256 |
696b6b2cbad5dcecdafb77a1bf699134041e1b1b0acc097c711d35c2a389ece6
|
File details
Details for the file gitllama-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gitllama-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dc597f4897af689483e3fe0d6f16d2ad037096f23a37ace2433bdf8532b67f0
|
|
| MD5 |
e818f57be5b6c570189bf82f98fda0cd
|
|
| BLAKE2b-256 |
d7ecd2169dc754385c61f804a21f22a9f0414cd51e6edc37ff5f06435d2ee230
|