Coder Social home page Coder Social logo

gmux's Introduction

gmux

Version

A simple command-line tool designed to automate repetitive Git workflows across multiple Github repositories.

Common tasks like cloning repositories and performing commits occur in parallel, while pull requests are dynamically generated - enabling you to ship changes at lightning speed. ⚡

Installation

Before using gmux, make sure you have the required dependencies installed:

# brew install git
git --version

# brew install gh
gh --version

Install gmux using the following command:

pip3 install https://github.com/samlader/gmux/archive/refs/tags/v0.2.1.zip

Usage

1. Initialize a New Directory

Use the init command to create a new working directory for gmux, along with a pull request template:

gmux init --directory=<directory_name>

2. Clone Multiple Repositories

Clone all repositories from a specified GitHub organization or user:

gmux clone --org=<organization_or_user> [--filter=<regex_filter>]

3. Git Commands

Execute any Git command for all repositories. Dynamic variables for each repository can be used.

gmux git [GIT_COMMAND] [--filter=<regex_filter>]

Dynamic Variables

  • @default (default branch of a repository)

  • @current (current branch of the repository)

4. Dynamic Pull Requests

Create pull requests for each repository:

gmux pr

Pull requests use the template (PR_TEMPLATE.md) created in the root directory by default.

Features

Jinja Expressions

Templates support Jinja expressions and the following context variables are provided:

  • repository_name (name of the repository)
  • diff_files (files with changes against the base branch)
Text Generation

Templates support LLM-based text generation using the ollama_chat macro.

This macro requires a local installation of ollama and accepts two arguments:

  • model (name of the model, all available models can be found here)
  • prompt (text prompt given to the model)

Example template

## Overview

This PR contains {{ diff_files|length }} changes for {{ repository_name }}.

{% if "README.md" in diff_files %}
The documentation has been updated to reflect these changes accordingly.
{% endif %}

{{ ollama_chat("llama3", "Write some guidelines on the usage of React hooks") }}

## Changes

{% for diff_file in diff_files %}
- {{ diff_file }}
{% endfor %}

5. Arbitrary Commands

Execute a command in each repository. Useful for batch operations across multiple projects.

gmux cmd [COMMAND] [--filter=<regex_filter>]

Examples

# Initialize a new directory
gmux init

# Clone service repositories from the organization "example-org"
gmux clone --org=example-org --filter="*-service"

# Create a new branch on all repositories
gmux git checkout -b feature-branch

# Run codemod across all repositories
codemod -m --extensions html \
    '<font *color="?(.*?)"?>(.*?)</font>' \
    '<span style="color: \1;">\2</span>'

# Commit changes
gmux git commit -m "Implement new feature"

# Create pull requests for all repositories
gmux pr

Contributions

Contributions and bug reports are welcome! Feel free to open issues, submit pull requests or contact me if you need any support.

License

This project is licensed under the MIT License.

gmux's People

Contributors

samlader avatar

Stargazers

Alex Bit avatar Eugene Klimov avatar Sarang Kharche avatar Akshay Sharma avatar Josh Thomas avatar Olivier Philippon avatar Edgar Ramírez Mondragón avatar  avatar Cal Paterson avatar Simeon avatar

Watchers

 avatar

gmux's Issues

[Feature Request] LLM-generated commit messages

It would be great (or at least, a timesaver) to have a command to generate commit messages based on staged changes.

Ideally, this would be as a standalone command so that it could be used in a script or a hook.

Failing to execute commands

Installed v0.2.0 with pip.
Running any command results in this output:

❯ gmux init
Traceback (most recent call last):
  File "/home/user/.pyenv/versions/3.10.5/bin/gmux", line 5, in <module>
    from gmux.cli import gmux
  File "/home/user/.pyenv/versions/3.10.5/lib/python3.10/site-packages/gmux/cli.py", line 198
    click.echo(f"cloning {org}/{repository["name"]}")
                                            ^^^^
SyntaxError: f-string: unmatched '['

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.