craftvault
v1.4.0
Published
A local-first, high-performance Version Control System with content-addressable storage, web UI, and Git-like workflow
Maintainers
Readme
🛠️ CraftVault
A local-first, high-performance Version Control System with Git-like workflow and beautiful web UI
Built from scratch with content-addressable storage, real-time updates, and zero configuration needed.
✨ Features
- 🚀 Git-like Commands - Familiar workflow:
init,add,commit,log,diff,branch - 🎨 Beautiful Web UI - Modern React interface with real-time updates
- 📦 Content-Addressable Storage - Efficient deduplication using SHA-1 hashing
- ⚡ Real-Time Updates - WebSocket-powered live status and commit tracking
- 🔍 Smart Diff Engine - Myers algorithm for accurate file comparisons
- 📁 .cvignore Support - Gitignore-style pattern matching
- 🌳 Branch Management - Create and switch between branches
- 🔌 REST API - Complete HTTP API for integrations
- 🎯 Zero Configuration - Works out of the box
🚀 Quick Start
Installation (Choose One)
Option 1: Global Install (Recommended)
npm install -g craftvaultOption 2: Use with npx (No Installation)
npx craftvault initOption 3: Local Project
npm install craftvault
npx cv init60-Second Demo
# 1. Create a project and initialize
mkdir my-project && cd my-project
cv init
# 2. Create some files
echo "console.log('Hello');" > app.js
echo "body { margin: 0; }" > style.css
# 3. Track and commit
cv add .
cv commit -m "Initial commit"
# 4. Launch the UI
cv uiThat's it! Your browser will open automatically at http://localhost:3000 showing your commits and changes.
📖 Basic Commands
cv init # Initialize repository
cv status # Show file status
cv add <files...> # Stage files
cv commit -m "message" # Create commit
cv log [--oneline] # View history
cv diff <file> # Show changes
cv branch [name] # Manage branches
cv ui # Launch web interface 🌐🌐 Web UI
Run cv ui to launch the interface:
- 📊 Visual commit history with timestamps
- 📝 Color-coded file diffs (added/removed/modified)
- ✅ Staged vs unstaged files with one-click actions
- 🔄 Real-time auto-updates as you make changes
- 🎨 GitHub-like interface that's familiar and intuitive
How it works:
- Backend server runs on port 3000 (configurable)
- Browser opens automatically
- WebSocket keeps everything in sync
- Press
Ctrl+Cto stop
📂 .cvignore
Automatically created on cv init with sensible defaults:
# .cvignore (uses gitignore syntax)
node_modules/
dist/
*.log
.envWorks exactly like .gitignore - add patterns to exclude files from tracking.
🔄 Complete Workflow Example
# Initialize in your project
cd ~/my-awesome-app
cv init
# Make some changes
echo "const app = 'Hello';" > app.js
mkdir src
echo "export const utils = {};" > src/utils.js
# Check status
cv status
# Stage specific files
cv add app.js src/utils.js
# Or stage everything
cv add .
# Create commit
cv commit -m "Add initial structure"
# View history
cv log
cv log --oneline
# Make more changes
echo "// Updated" >> app.js
# See what changed
cv diff app.js
# Launch UI to visualize everything
cv ui🆚 CraftVault vs Git
| Feature | CraftVault | Git |
|---------|-----------|-----|
| Initialization | cv init | git init |
| Stage Files | cv add . | git add . |
| Commit | cv commit -m "msg" | git commit -m "msg" |
| View History | cv log | git log |
| See Changes | cv diff file | git diff file |
| Web UI | cv ui ✨ Built-in | Requires external tools |
| Real-time Updates | ✅ WebSocket | ❌ Not available |
| Learning Curve | 🟢 Minimal | 🟡 Moderate |
| Remote Push/Pull | 🟡 Coming soon | ✅ Yes |
🏗️ Architecture
CraftVault uses a content-addressable storage model similar to Git:
- Blobs - Store file contents
- Trees - Store directory structure
- Commits - Store snapshots with metadata
- Refs - Store branch pointers
Storage:
.cv/
├── objects/ # All Git objects (blobs, trees, commits)
│ └── ab/ # First 2 chars of SHA-1
│ └── cdef... # Remaining 38 chars
├── refs/
│ └── heads/ # Branch references
│ └── main
├── HEAD # Current branch pointer
└── index # Staging area📚 Documentation
Quick Guides
- Simple Install Guide - Get started in 2 minutes
- Quick Start Guide - Essential commands
Comprehensive Docs
- Architecture - System design and implementation (4,500 words)
- API Reference - REST API documentation (3,000 words)
- User Guide - Complete command reference (3,500 words)
- Contributing - Developer guidelines (2,500 words)
🧪 Testing
# Run integration tests
node test-integration.js
# Results: 146+ tests, 100% pass rateTest coverage:
- Repository initialization
- File tracking and staging
- Commit creation and history
- Branch management
- Diff computation
- CLI commands
- API endpoints
🛠️ Development
Build from Source
# Clone the repository
git clone <repository-url>
cd craftvault
# Install dependencies
npm install
# Build TypeScript
npm run build
# Build UI
cd ui && npm install && npm run build && cd ..
# Link globally for development
npm link
# Now use cv from anywhere
cv --versionProject Structure
craftvault/
├── src/
│ ├── core/ # Core VCS functionality
│ │ ├── blob.ts # File content storage
│ │ ├── tree.ts # Directory structure
│ │ ├── commit.ts # Commit objects
│ │ ├── repository.ts # Repo management
│ │ ├── storage.ts # Object storage
│ │ ├── diff-engine.ts # Myers diff algorithm
│ │ └── ...
│ ├── cli/ # Command-line interface
│ │ └── commands/ # Individual commands
│ ├── api/ # REST API + WebSocket
│ │ └── server.ts # Hono server
│ └── utils/ # Hash, compression, diff, ignore
├── ui/ # React web interface
│ └── src/
│ ├── components/ # UI components
│ └── App.jsx # Main application
├── dist/ # Compiled TypeScript
└── docs/ # Documentation🤝 Contributing
Contributions are welcome! Please read CONTRIBUTING.md for guidelines.
Ways to contribute:
- 🐛 Report bugs
- 💡 Suggest features
- 📝 Improve documentation
- 🔧 Submit pull requests
📄 License
MIT License - see LICENSE for details.
🎓 Learning Resources
For Users
- Start with SIMPLE_INSTALL.md
- Try the 60-second demo above
- Run
cv --helpfor command list - Launch
cv uito explore visually
For Developers
- Read ARCHITECTURE.md for system design
- Check API.md for API integration
- See CONTRIBUTING.md for dev setup
🌟 Highlights
What makes CraftVault special:
- Complete Implementation - Not a toy project. Fully functional VCS with 15,000+ lines of TypeScript
- Modern Stack - TypeScript, React 18, Hono v4, WebSocket
- Production-Ready - Comprehensive testing, error handling, documentation
- Educational - Clear code, detailed architecture docs, great for learning
- User-Friendly - Beautiful UI, sensible defaults, zero configuration
🚀 What's Next?
Planned Features:
- Remote repository support (push/pull)
- Merge conflict resolution UI
- Performance optimizations for large repos
- Plugin system
- VS Code extension
💬 Support
- 📖 Check the documentation
- 🐛 Report issues
- 💡 Request features
Built with ❤️ by the CraftVault team
Making version control simple, visual, and delightful
