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
68 changes: 68 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build and Release

on:
push:
branches:
- main

jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}
release_name: Release v${{ github.run_number }}
draft: false
prerelease: false

build_and_upload:
name: Build and Upload on ${{ matrix.os }}
needs: create_release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
asset_name: ai-commit-linux
asset_path_suffix: AI-Commit
- os: windows-latest
asset_name: ai-commit-windows.exe
asset_path_suffix: AI-Commit.exe
- os: macos-latest
asset_name: ai-commit-macos
asset_path_suffix: AI-Commit
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.10

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Build with PyInstaller
run: pyinstaller --name "AI-Commit" --windowed --onefile --icon="assets/icon.ico" main.py

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./dist/${{ matrix.asset_path_suffix }}
asset_name: ${{ matrix.asset_name }}
asset_content_type: application/octet-stream
43 changes: 43 additions & 0 deletions .github/workflows/pull-request-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Test and Build on PR

on:
pull_request:
branches: [ "main" ]

jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10"]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

# Placeholder for tests. Uncomment and adapt when have tests.
# - name: Run Tests
# run: |
# pip install pytest
# pytest

- name: Build with PyInstaller
run: pyinstaller --name "AI-Commit" --windowed --onefile --icon="assets/icon.ico" main.py

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: AI-Commit-${{ matrix.os }}
path: dist/
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ src/__pycache__
src/core/__pycache__
src/gui/__pycache__
src/utils/__pycache__
venv
build
AI-Commit.spec
dist
*.spec
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Binary file removed dist/AI-Commit.exe
Binary file not shown.
7 changes: 6 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
google-generativeai>=0.3.0
openai>=1.0.0
pathlib2>=2.3.0; python_version < '3.4'
pathlib2>=2.3.0; python_version < '3.4'
pyinstaller>=5.0.0
pre-commit>=3.0.0
ruff>=0.1.0
black>=23.0.0
Pillow>=10.0.0
8 changes: 8 additions & 0 deletions scripts/ai-commit.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Name=AI-Commit
Comment=Generate commit messages with AI
Exec=/usr/local/bin/ai-commit
Icon=ai-commit
Terminal=false
Type=Application
Categories=Development;
26 changes: 26 additions & 0 deletions scripts/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@echo off
setlocal

echo --- Starting Windows build process ---

:: 1. Create & activate virtual environment
echo --- Setting up Python virtual environment ---
if not exist venv ( py -m venv venv )
call venv\Scripts\activate

:: 2. Install dependencies
echo --- Installing dependencies from requirements.txt ---
pip install -r requirements.txt

:: 3. Run PyInstaller
echo --- Building executable with PyInstaller ---
pyinstaller --name "AI-Commit" --windowed --onefile --icon="assets/icon.ico" main.py

echo --- Executable build complete! ---
echo Executable created in the 'dist' folder.
echo.
echo To create the Windows installer (.exe), install Inno Setup from https://jrsoftware.org/isinfo.php
echo then right-click and 'Compile' the 'scripts/installer.iss' file.

endlocal
pause
52 changes: 52 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
# Script to create the AICommit installer for Linux
# Exit on error
set -e

echo "--- Starting Linux build process ---"

# 1. Create & activate virtual environment
echo "--- Setting up Python virtual environment ---"
python3 -m venv venv
source venv/bin/activate

# 2. Install dependencies
echo "--- Installing dependencies from requirements.txt ---"
pip install -r requirements.txt

# 3. Run PyInstaller
echo "--- Building executable with PyInstaller ---"
pyinstaller --name "AICommit" --windowed --onefile --icon="assets/icon.ico" main.py

# 4. Prepare installer package
echo "--- Creating Linux installer package ---"
INSTALLER_DIR="AICommit-linux-installer"
rm -rf $INSTALLER_DIR
mkdir -p $INSTALLER_DIR/usr/local/bin
mkdir -p $INSTALLER_DIR/usr/share/applications
mkdir -p $INSTALLER_DIR/usr/share/icons/hicolor/256x256/apps

# Copy necessary files
cp dist/AICommit $INSTALLER_DIR/usr/local/bin/AICommit
cp assets/icon.png $INSTALLER_DIR/usr/share/icons/hicolor/256x256/apps/AICommit.png
cp scripts/AICommit.desktop $INSTALLER_DIR/usr/share/applications/

# Create the installation script
cat > $INSTALLER_DIR/install.sh <<EOL
#!/bin/bash
echo "Installing AICommit..."
sudo cp -r usr /
echo "Updating icon cache..."
sudo gtk-update-icon-cache /usr/share/icons/hicolor || echo "Failed to update icon cache."
echo "Installation complete. Run 'AICommit' from your terminal or find it in your applications menu."
EOL
chmod +x $INSTALLER_DIR/install.sh

# Create the tar.gz archive
TARBALL_NAME="AICommit-Linux-Installer.tar.gz"
echo "--- Packaging installer into $TARBALL_NAME ---"
tar -czvf $TARBALL_NAME -C $INSTALLER_DIR .

echo "--- Build complete! ---"
echo "Installer created: $TARBALL_NAME"
echo "To install, extract the archive and run './install.sh'"
41 changes: 41 additions & 0 deletions scripts/installer.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
; Inno Setup script, generated by AI

#define MyAppName "AI-Commit"
#define MyAppVersion "1.0.0"
#define MyAppPublisher "Ryucode"
#define MyAppURL "https://github.com/RyuCode-Digital-Solution/AI-Commit"
#define MyAppExeName "AI-Commit.exe"

[Setup]
AppId={{AUTO}}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
OutputDir=..\installers ; Save installer to 'installers' folder in project root
OutputBaseFilename=AI-Commit-Setup
Compression=lzma
SolidCompression=yes
WizardStyle=modern
IconFile=..\assets\icon.ico

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "..\dist\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\assets\icon.ico"; DestDir: "{app}";

[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
24 changes: 13 additions & 11 deletions settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"gemini_api_key": "",
"openai_api_key": "",
"gemini_model": "gemini-2.5-flash",
"openai_model": "gpt-4o-mini",
"github_username": "",
"github_token": "",
"parent_folder": "/path/to/your/home",
"recent_repos": [],
"auto_push": true,
"dark_mode": false
}
"gemini_api_key": "AIzaSyCszUa-HuMx_RQRUUR3jZ-lTu7XFhU0MpQ",
"openai_api_key": "",
"gemini_model": "gemini-2.5-flash",
"openai_model": "gpt-4o-mini",
"github_username": "",
"github_token": "",
"parent_folder": "/path/to/your/home",
"recent_repos": [
"/home/fiandev/projects/ryucode/AI-Commit"
],
"auto_push": true,
"dark_mode": false
}
50 changes: 50 additions & 0 deletions src/gui/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

"""
Constants for the GUI
"""

class UI_STRINGS:
TITLE = "AI Commit by RyuCode"
GEOMETRY = "950x750"

# Header
HEADER_TITLE = "AI Commit V1"
SETTINGS_BUTTON = "⚙️ Settings"
THEME_LABEL = "🌙"
THEME_BUTTON = "Dark Mode"

# Settings Frame
SETTINGS_FRAME_TITLE = "⚙️ Settings"
AI_PROVIDER_LABEL = "AI Provider:"
GEMINI_RADIO = "Gemini (Free)"
CHATGPT_RADIO = "ChatGPT"
AUTO_PUSH_CHECKBOX = "Auto Push to Origin"

# Repo Frame
REPO_FRAME_TITLE = "📂 Select Repository"
SCAN_BUTTON = "🔍 Scan"
BROWSE_BUTTON = "📁 Browse"
REFRESH_BUTTON = "🔄 Refresh"

# Files Frame
FILES_FRAME_TITLE = "📝 Changed Files"
SELECT_ALL_BUTTON = "✅ Select All"
CLEAR_SELECTION_BUTTON = "❌ Clear Selection"
ADD_TO_STAGE_BUTTON = "➕ Add to Stage"
INFO_LABEL = "ℹ️ Select files and click 'Add to Stage' before generating commit message"

# Commit Message Frame
COMMIT_FRAME_TITLE = "💬 Commit Message"
GENERATE_BUTTON = "🤖 Generate with AI"
CLEAR_BUTTON = "🗑️ Clear"

# Action Buttons
COMMIT_PUSH_BUTTON = "✅ Commit & Push"
COMMIT_ONLY_BUTTON = "💾 Commit Only"
CANCEL_BUTTON = "❌ Cancel"

# Log Frame
LOG_FRAME_TITLE = "📋 Activity Log"

# Status Bar
STATUS_READY = "Ready"
Loading
Loading