Skip to main content

A Python CLI tool for streamlining development workflows with LLMs - commit messages, PR descriptions, code reviews and more

Project description

FlowAI

G'day! FlowAI is your mate for automating development tasks using LLMs. It's a ripper CLI tool that helps you write better commit messages, pull requests, and code reviews.

Quick Start

# Install FlowAI
pipx install glagos-flowai

# Set up your config (you'll need API keys)
flowai --init

# Use predefined commands (easiest way)
flowai --command staged-commit-message  # For staged changes
flowai --command pull-request           # For pull request description
flowai --command code-review           # For code review

# Or use manual mode with prompt files
git diff -w --staged | flowai --prompt-file ~/flowai-prompts/prompt-commit-message.txt
git log main..HEAD | flowai --prompt-file ~/flowai-prompts/prompt-pull-request.txt
git diff -w main..HEAD | flowai --prompt-file ~/flowai-prompts/prompt-code-review.txt

Required API Keys

You'll need at least one of these environment variables set:

Common Commands

Git Workflow

# Using predefined commands (recommended)
flowai --command staged-commit-message  # Generate commit message for staged changes
flowai --command code-review           # Review code changes
flowai --command pull-request          # Create pull request description (will prompt for base branch)

# Using manual mode with prompt files
git diff -w --staged | flowai --prompt-file ~/flowai-prompts/prompt-commit-message.txt
git diff -w main..HEAD | flowai --prompt-file ~/flowai-prompts/prompt-code-review.txt
git log main..HEAD | flowai --prompt-file ~/flowai-prompts/prompt-pull-request.txt

Predefined Commands

FlowAI comes with several predefined commands that make it easy to perform common tasks:

  • staged-commit-message: Generate commit message for staged changes
  • main-commit-message: Generate commit message for all changes
  • pull-request: Create pull request description (prompts for base branch)
  • staged-code-review: Review staged changes
  • code-review: Review all changes

These commands are defined in ~/flowai-prompts/prompt-index.txt and automatically handle running the right git commands and using the appropriate prompt files.

# List available commands
cat ~/flowai-prompts/prompt-index.txt

# Use a command
flowai --command pull-request
# When prompted: Input branch name (example: main, dev, staging, etc): main

Model Selection

# List available models
flowai --list-models

# Use a specific model
flowai --model openai:gpt-4 "Your prompt here"
flowai --model anthropic:claude-3-opus-20240229 "Your prompt here"
flowai --model groq:mixtral-8x7b-32768 "Your prompt here"
flowai --model google:gemini-pro "Your prompt here"
flowai --model ollama:codellama "Your prompt here"

Context Options

# Use a file as context
flowai --context-file error.log "Analyze this error"

# Use command output as context
flowai --context-shell-command "git diff" "Review these changes"

# Use clipboard content as context
flowai --context-from-clipboard "Summarize this"

Advanced Features

Custom Prompts

Create your own prompt templates in ~/flowai-prompts/. See Creating Custom Prompts for details.

# Select a prompt file interactively
flowai --select-prompt-file

# Use a custom prompt file
flowai --prompt-file ~/flowai-prompts/my-custom-prompt.txt

Custom Commands

You can create your own commands by adding them to ~/flowai-prompts/prompt-index.txt. The file uses a CSV format with four columns:

label,description,context_command,prompt_file
  • label: The command name (used with --command)
  • description: A brief description of what the command does
  • context_command: The shell command to run for context (can include user prompts in [brackets])
  • prompt_file: Path to the prompt file to use

When adding commands, make sure to:

  1. Quote any fields containing special characters (commas, brackets, etc.)
  2. Use double quotes (") for quoting fields
  3. Escape any double quotes within fields by doubling them ("")

Example of adding a custom command:

# Add this line to ~/flowai-prompts/prompt-index.txt
"blame-lines","Find who changed specific lines","git blame -L [Enter line range (e.g. 10,20)] [Enter file path]","~/flowai-prompts/my-blame-prompt.txt"

Then use it like:

flowai --command blame-lines
# You'll be prompted for:
# Enter line range (e.g. 10,20): 15,25
# Enter file path: src/main.py

Configuration

# Check current settings
flowai --status

# Reconfigure FlowAI
flowai --init

# Toggle streaming output
flowai --stream "Watch the response in real-time"
flowai --no-stream "Wait for complete response"

Output Formatting

# Default markdown output
flowai "Format this nicely"

# Plain text output
flowai --no-markdown "Keep it simple"

Troubleshooting

  1. Missing API Keys

    • Run flowai --init to see which providers need API keys
    • Check the provider URLs above to get your keys
    • Add keys to your environment variables
  2. Model Issues

    • Run flowai --list-models to see available models
    • Check if your chosen provider is properly configured
    • Verify your API key has access to the model
  3. Command Not Found

    • Make sure pipx is installed
    • Try reinstalling: pipx reinstall glagos-flowai
    • Check your PATH environment variable

Contributing

We'd love your help! Here's how you can contribute:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

We especially need help with:

  • Adding new LLM providers
  • Creating useful prompt templates
  • Writing unit tests
  • Improving documentation

License

MIT License - See LICENSE file for details

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

glagos_flowai-0.4.6.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glagos_flowai-0.4.6-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file glagos_flowai-0.4.6.tar.gz.

File metadata

  • Download URL: glagos_flowai-0.4.6.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.1.0

File hashes

Hashes for glagos_flowai-0.4.6.tar.gz
Algorithm Hash digest
SHA256 5c14f1d1e707b5f19961133472223123672354e4cfb0e6d4b3b8a17ce0afd92e
MD5 1a19434e88de4a63f0b61466f4fd6ace
BLAKE2b-256 30869ecf1803c3ace81b9699cbd73876b4e2edd11f481c88544b6d2b281526c9

See more details on using hashes here.

File details

Details for the file glagos_flowai-0.4.6-py3-none-any.whl.

File metadata

  • Download URL: glagos_flowai-0.4.6-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.1.0

File hashes

Hashes for glagos_flowai-0.4.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c52d053b94c51d88ec4a4ac1ae8a7dbe91e682838dfd9bfcc5b01c2882a7ec90
MD5 0e94a39d8a020d8fec7a1bfedfe8d640
BLAKE2b-256 27ae2d941c048dc5c9525657e73dda02b1f13734a1e14af1ea4631e717f7214b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page