Skip to main content

GitHub-like version control system with AI-powered auto-updates and merge conflict resolution

Project description

CodeVault - AI-Powered Version Control System

PyPI version Python 3.8+ License: MIT

A lightweight, GitHub-like version control system with AI-powered merge conflict resolution. Perfect for solo developers and small teams who want the power of version control without the complexity of Git.

โœจ What's New in v1.1.0

๐ŸŽ‰ AI-Powered Merge Conflict Resolution - When two people edit the same file, CodeVault uses AI to intelligently merge both changes automatically!

No more cryptic conflict markers. No more manual merging. Just smart, automatic resolution that preserves functionality from both versions.

๐Ÿš€ Features

Core Version Control

  • ๐Ÿ“ฆ Push: Store code snapshots with automatic change detection
  • โฌ‡๏ธ Pull: Restore code from any previous commit
  • ๐Ÿ—‘๏ธ Delete: Remove commits from history
  • ๐Ÿ“œ Log: View commit history with timestamps and insights
  • ๐Ÿท๏ธ Semantic Versioning: Auto-bumps version based on change type

AI Superpowers โœจ

  • ๐Ÿค– Auto-Commit Messages: AI analyzes your code and generates professional commit messages
  • ๐Ÿ”€ Smart Merge: Automatically resolves conflicts when multiple people edit the same file
  • ๐Ÿ“Š Code Insights: AI classifies changes (feat/fix/refactor) and risk level
  • ๐ŸŽฏ Impact Analysis: Identifies which functions/modules were affected

Merge Conflict Resolution ๐Ÿ†•

  • Automatic Detection: Knows when your changes conflict with the latest version
  • Three Strategies:
    • ai - AI intelligently merges both versions (recommended)
    • local - Keep your changes
    • remote - Keep their changes
  • Safe Workflow: Automatic backups before merging
  • Manual Fallback: Traditional conflict markers if AI can't resolve

๐Ÿ“ฆ Installation

pip install selfvcs

Setup API Key (for AI features)

Get a free API key from Groq Console

# Option 1: Environment variable
export GROQ_API_KEY="gsk_your_key_here"

# Option 2: Save to config (persistent)
codevault auth set gsk_your_key_here

๐ŸŽฏ Quick Start

Basic Usage

# Initialize repository
codevault init

# Push code with AI-generated message
codevault push myfile.py --auto-detect

# Or use manual message
codevault push myfile.py -m "Add new feature"

# View history
codevault log

# Restore old version
codevault pull abc12345

Handling Merge Conflicts

Scenario: You and a teammate both edited app.py

# Try to push - conflict detected!
codevault push app.py -m "My changes"
# โš  Merge conflicts detected in 1 file(s)

# Check what's conflicting
codevault check-conflicts app.py

# Let AI resolve it automatically
codevault auto-merge app.py --strategy ai
# โœ“ AI resolved: app.py

# Review the merged code
cat app.py

# Push the merge
codevault push app.py -m "Merged changes"

๐Ÿ“– Complete Command Reference

Repository Management

codevault init                    # Initialize repository
codevault status                  # Show repo status
codevault log -n 20              # Show last 20 commits

Version Control

codevault push <files> -m "msg"         # Commit with message
codevault push <files> --auto-detect    # AI generates message
codevault push <files> --force          # Force push (skip conflict check)
codevault pull <commit-id>              # Restore commit
codevault delete <commit-id>            # Delete commit

Merge Conflicts ๐Ÿ†•

codevault check-conflicts <files>           # Check for conflicts
codevault auto-merge <files> --strategy ai  # AI merge (default)
codevault auto-merge <files> --strategy local   # Keep local changes
codevault auto-merge <files> --strategy remote  # Keep remote changes

Insights & Analytics

codevault insight <commit-id>    # View commit details
codevault changelog -n 50        # Generate changelog

Configuration

codevault auth set <api-key>     # Set GROQ API key

๐Ÿ’ก Real-World Example

Problem: Two developers, same file

Developer A adds shipping logic:

def calculate_total(items):
    total = sum(item.price * item.qty for item in items)
    shipping = 5.99 if total < 50 else 0
    return total + shipping

Developer B adds tax calculation:

def calculate_total(items):
    total = sum(item.price * item.qty for item in items)
    tax = total * 0.08
    return total + tax

Solution: AI Auto-Merge

# Developer A tries to push
codevault push app.py -m "Add shipping"
# โš  Merge conflicts detected

# AI resolves automatically
codevault auto-merge app.py --strategy ai

Result: AI merges BOTH features:

def calculate_total(items):
    total = sum(item.price * item.qty for item in items)
    tax = total * 0.08
    shipping = 5.99 if total < 50 else 0
    return total + tax + shipping

โœ… Both shipping AND tax preserved!
โœ… No manual editing needed!
โœ… Code works correctly!

๐ŸŽจ Use Cases

  • Solo Developers: Track your code history without Git complexity
  • Small Teams: Collaborate without merge headaches
  • Learning: Understand version control concepts
  • Prototyping: Quick versioning for experiments
  • Code Reviews: AI-assisted merging of feedback

โš™๏ธ How AI Merge Works

  1. Detection: Compares local file vs last commit, finds conflicts
  2. Analysis: AI (Llama 70B) examines both versions for:
    • Function signatures and logic
    • Code semantics and intent
    • Style and formatting
  3. Resolution: Generates merged version that:
    • Keeps functionality from both
    • Removes duplicates
    • Maintains consistency
  4. Safety: Creates backup, writes merge, allows review

๐Ÿ”’ Safety Features

  • Automatic Backups: Original files backed up before merge
  • Conflict Detection: Won't let you overwrite accidentally
  • Force Override: Available but requires explicit --force flag
  • Manual Fallback: Traditional markers if AI fails
  • Semantic Versioning: Auto-tracks breaking vs non-breaking changes

๐ŸŽ“ Best Practices

  1. Check before pushing

    codevault check-conflicts myfile.py
    
  2. Review AI merges

    • Check merged file
    • Run tests
    • Then commit
  3. Small, frequent commits

    • Easier to merge
    • Better AI performance
  4. Use auto-detect for messages

    codevault push --auto-detect
    
  5. Choose the right strategy

    • ai - When both changes matter
    • local - When you know yours is right
    • remote - When their version is better

๐Ÿ”ง Advanced Configuration

Multiple Projects

Each project gets its own .codevault/ directory:

cd project1
codevault init
codevault push src/ -m "Project 1 changes"

cd ../project2
codevault init
codevault push app/ -m "Project 2 changes"

API Key Priority

CodeVault checks in this order:

  1. GROQ_API_KEY environment variable
  2. CODEVAULT_GROQ_KEY environment variable
  3. ~/.codevault/config.json (from auth set)

Custom Workflow

from codevault import CodeVault

vault = CodeVault()

# Check conflicts programmatically
has_conflicts, conflicts = vault._detect_merge_conflicts(['app.py'])

if has_conflicts:
    # Auto-resolve
    result = vault.auto_merge(['app.py'], strategy='ai')
    print(result)

๐Ÿ“ Repository Structure

your-project/
โ”œโ”€โ”€ .codevault/
โ”‚   โ”œโ”€โ”€ commits/           # All commit snapshots
โ”‚   โ”‚   โ””โ”€โ”€ abc12345/
โ”‚   โ”‚       โ”œโ”€โ”€ commit.json
โ”‚   โ”‚       โ””โ”€โ”€ file.snapshot
โ”‚   โ”œโ”€โ”€ merge/            # Backup files during merge
โ”‚   โ”œโ”€โ”€ metadata.json     # Repo metadata & history
โ”‚   โ””โ”€โ”€ index.json       # Staging area
โ””โ”€โ”€ your files...

~/.codevault/
โ””โ”€โ”€ config.json          # Global user config (API key)

โ“ FAQ

Q: Do I need Git?
A: No! CodeVault is standalone.

Q: Can I use it without the AI features?
A: Yes! All commands work without an API key. Just use --strategy local or --strategy remote for merges.

Q: Is my code sent to the cloud?
A: Only when using AI features (commit messages, merge). The code snippets sent to Groq are truncated (first ~4000 chars). All commits are stored locally.

Q: What if AI merge fails?
A: CodeVault falls back to traditional conflict markers for manual resolution.

Q: Can I use this in production?
A: CodeVault is great for personal projects and small teams. For large teams or critical production, we still recommend Git.

Q: How much does it cost?
A: CodeVault is free. Groq offers a generous free tier for the AI features.

๐Ÿ› Troubleshooting

"GROQ_API_KEY not set"

export GROQ_API_KEY="your_key"
# or
codevault auth set your_key

"Merge conflicts detected"

# Check details
codevault check-conflicts file.py

# Auto-resolve
codevault auto-merge file.py --strategy ai

"AI failed, added markers"

File now has conflict markers - manually edit and push:

# Edit file to resolve
nano file.py

# Push resolved version
codevault push file.py -m "Manual merge"

๐Ÿค Contributing

Issues and pull requests welcome!

  1. Fork the repo
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit PR

๐Ÿ“„ License

MIT License - see LICENSE file

๐Ÿ™ Credits

  • Groq for fast LLM inference
  • Llama 3 for intelligent code understanding
  • Inspired by Git's version control system

๐Ÿ“ž Support


Made with โค๏ธ to make version control intelligent and accessible

Give it a โญ if you find it useful!

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

codevaultai-1.1.1.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

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

codevaultai-1.1.1-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file codevaultai-1.1.1.tar.gz.

File metadata

  • Download URL: codevaultai-1.1.1.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for codevaultai-1.1.1.tar.gz
Algorithm Hash digest
SHA256 674aeadc38027fdc785b4e9f79d6d544ab7cee308b7cd7eebacff8c5e5935afa
MD5 3bd188b1da437fc6ff378278c4b89933
BLAKE2b-256 f0b2a868e93616bb5640c1011669d4db0f13021748ea71767e5a9688c8e34117

See more details on using hashes here.

File details

Details for the file codevaultai-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: codevaultai-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for codevaultai-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 360ecc0baeea78de02f8ea096fefa41d5b730d3458355de76c5b3741d4180a77
MD5 a860cbdbfbecaccc780e53f1859237fb
BLAKE2b-256 db138c6d9d9dbef7e6ec3a4c521a3694f37d81ac5330c2f8c5e35b2371eae891

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