codevaultAI 1.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,74 @@
1
+ # Changelog
2
+
3
+ All notable changes to CodeVault will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.1.0] - 2024-01-XX
9
+
10
+ ### Added
11
+ - 🎉 **AI-Powered Merge Conflict Resolution**
12
+ - Automatic conflict detection when pushing code
13
+ - Three merge strategies: `ai` (intelligent), `local`, `remote`
14
+ - `check-conflicts` command to preview conflicts
15
+ - `auto-merge` command with AI-powered resolution using Llama 70B
16
+ - Automatic backups before merging
17
+ - Fallback to traditional conflict markers if AI fails
18
+
19
+ - **New Commands**
20
+ - `codevault check-conflicts <files>` - Check for merge conflicts
21
+ - `codevault auto-merge <files> --strategy [ai|local|remote]` - Resolve conflicts
22
+
23
+ - **Enhanced Push Command**
24
+ - Now detects conflicts before committing
25
+ - `--force` flag to bypass conflict detection
26
+ - Better error messages for conflict scenarios
27
+
28
+ ### Changed
29
+ - Improved conflict detection using difflib for precise region identification
30
+ - Enhanced metadata structure to support merge state tracking
31
+ - Better error handling and user feedback
32
+ - Updated documentation with merge conflict examples
33
+
34
+ ### Technical
35
+ - Added `MergeConflict` class for conflict representation
36
+ - New `_detect_merge_conflicts()` method
37
+ - New `_ai_resolve_conflict()` method using Groq Llama 70B
38
+ - New `_create_conflict_markers()` for manual fallback
39
+ - Repository structure now includes `/merge` directory for backups
40
+
41
+ ## [1.0.0] - 2024-01-XX
42
+
43
+ ### Added
44
+ - Initial release
45
+ - Basic version control operations (push, pull, delete, log)
46
+ - AI-powered commit message generation using Groq
47
+ - Semantic commit analysis (type, risk, impact)
48
+ - Automatic version bumping based on semantic type
49
+ - AI code change insights
50
+ - Changelog generation
51
+ - Commit insights command
52
+ - User configuration management
53
+ - Repository status tracking
54
+
55
+ ### Features
56
+ - **Push**: Store code snapshots with change detection
57
+ - **Pull**: Restore code from commits
58
+ - **Delete**: Remove commits from history
59
+ - **Log**: View commit history with metadata
60
+ - **Status**: Repository information
61
+ - **Changelog**: Auto-generated from commits
62
+ - **Insight**: Detailed commit analysis
63
+ - **Auth**: API key management
64
+
65
+ ### Technical
66
+ - SHA-1 based commit IDs
67
+ - JSON-based metadata storage
68
+ - File snapshot system
69
+ - Home directory user config
70
+ - Groq API integration
71
+ - Support for Python 3.8+
72
+
73
+ [1.1.0]: https://github.com/yourusername/codevault/compare/v1.0.0...v1.1.0
74
+ [1.0.0]: https://github.com/yourusername/codevault/releases/tag/v1.0.0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Your Name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CHANGELOG.md
4
+ recursive-include codevault *.py
@@ -0,0 +1,411 @@
1
+ Metadata-Version: 2.4
2
+ Name: codevaultAI
3
+ Version: 1.1.1
4
+ Summary: GitHub-like version control system with AI-powered auto-updates and merge conflict resolution
5
+ Home-page: https://github.com/yourusername/codevault
6
+ Author: Your Name
7
+ Author-email: Kevilrana28@gmail.com
8
+ Project-URL: Bug Reports, https://github.com/yourusername/codevault/issues
9
+ Project-URL: Source, https://github.com/yourusername/codevault
10
+ Project-URL: Documentation, https://github.com/yourusername/codevault#readme
11
+ Keywords: version-control git vcs ai merge-conflicts llm groq
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Software Development :: Version Control
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: License :: OSI Approved :: MIT License
22
+ Classifier: Operating System :: OS Independent
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: groq>=0.4.0
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: home-page
33
+ Dynamic: keywords
34
+ Dynamic: license-file
35
+ Dynamic: project-url
36
+ Dynamic: requires-dist
37
+ Dynamic: requires-python
38
+ Dynamic: summary
39
+
40
+ # CodeVault - AI-Powered Version Control System
41
+
42
+ [![PyPI version](https://badge.fury.io/py/selfvcs.svg)](https://badge.fury.io/py/selfvcs)
43
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
44
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
45
+
46
+ 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.
47
+
48
+ ## ✨ What's New in v1.1.0
49
+
50
+ 🎉 **AI-Powered Merge Conflict Resolution** - When two people edit the same file, CodeVault uses AI to intelligently merge both changes automatically!
51
+
52
+ No more cryptic conflict markers. No more manual merging. Just smart, automatic resolution that preserves functionality from both versions.
53
+
54
+ ## 🚀 Features
55
+
56
+ ### Core Version Control
57
+ - **📦 Push**: Store code snapshots with automatic change detection
58
+ - **⬇️ Pull**: Restore code from any previous commit
59
+ - **🗑️ Delete**: Remove commits from history
60
+ - **📜 Log**: View commit history with timestamps and insights
61
+ - **🏷️ Semantic Versioning**: Auto-bumps version based on change type
62
+
63
+ ### AI Superpowers ✨
64
+ - **🤖 Auto-Commit Messages**: AI analyzes your code and generates professional commit messages
65
+ - **🔀 Smart Merge**: Automatically resolves conflicts when multiple people edit the same file
66
+ - **📊 Code Insights**: AI classifies changes (feat/fix/refactor) and risk level
67
+ - **🎯 Impact Analysis**: Identifies which functions/modules were affected
68
+
69
+ ### Merge Conflict Resolution 🆕
70
+ - **Automatic Detection**: Knows when your changes conflict with the latest version
71
+ - **Three Strategies**:
72
+ - `ai` - AI intelligently merges both versions (recommended)
73
+ - `local` - Keep your changes
74
+ - `remote` - Keep their changes
75
+ - **Safe Workflow**: Automatic backups before merging
76
+ - **Manual Fallback**: Traditional conflict markers if AI can't resolve
77
+
78
+ ## 📦 Installation
79
+
80
+ ```bash
81
+ pip install selfvcs
82
+ ```
83
+
84
+ ### Setup API Key (for AI features)
85
+
86
+ Get a free API key from [Groq Console](https://console.groq.com)
87
+
88
+ ```bash
89
+ # Option 1: Environment variable
90
+ export GROQ_API_KEY="gsk_your_key_here"
91
+
92
+ # Option 2: Save to config (persistent)
93
+ codevault auth set gsk_your_key_here
94
+ ```
95
+
96
+ ## 🎯 Quick Start
97
+
98
+ ### Basic Usage
99
+
100
+ ```bash
101
+ # Initialize repository
102
+ codevault init
103
+
104
+ # Push code with AI-generated message
105
+ codevault push myfile.py --auto-detect
106
+
107
+ # Or use manual message
108
+ codevault push myfile.py -m "Add new feature"
109
+
110
+ # View history
111
+ codevault log
112
+
113
+ # Restore old version
114
+ codevault pull abc12345
115
+ ```
116
+
117
+ ### Handling Merge Conflicts
118
+
119
+ **Scenario**: You and a teammate both edited `app.py`
120
+
121
+ ```bash
122
+ # Try to push - conflict detected!
123
+ codevault push app.py -m "My changes"
124
+ # ⚠ Merge conflicts detected in 1 file(s)
125
+
126
+ # Check what's conflicting
127
+ codevault check-conflicts app.py
128
+
129
+ # Let AI resolve it automatically
130
+ codevault auto-merge app.py --strategy ai
131
+ # ✓ AI resolved: app.py
132
+
133
+ # Review the merged code
134
+ cat app.py
135
+
136
+ # Push the merge
137
+ codevault push app.py -m "Merged changes"
138
+ ```
139
+
140
+ ## 📖 Complete Command Reference
141
+
142
+ ### Repository Management
143
+ ```bash
144
+ codevault init # Initialize repository
145
+ codevault status # Show repo status
146
+ codevault log -n 20 # Show last 20 commits
147
+ ```
148
+
149
+ ### Version Control
150
+ ```bash
151
+ codevault push <files> -m "msg" # Commit with message
152
+ codevault push <files> --auto-detect # AI generates message
153
+ codevault push <files> --force # Force push (skip conflict check)
154
+ codevault pull <commit-id> # Restore commit
155
+ codevault delete <commit-id> # Delete commit
156
+ ```
157
+
158
+ ### Merge Conflicts 🆕
159
+ ```bash
160
+ codevault check-conflicts <files> # Check for conflicts
161
+ codevault auto-merge <files> --strategy ai # AI merge (default)
162
+ codevault auto-merge <files> --strategy local # Keep local changes
163
+ codevault auto-merge <files> --strategy remote # Keep remote changes
164
+ ```
165
+
166
+ ### Insights & Analytics
167
+ ```bash
168
+ codevault insight <commit-id> # View commit details
169
+ codevault changelog -n 50 # Generate changelog
170
+ ```
171
+
172
+ ### Configuration
173
+ ```bash
174
+ codevault auth set <api-key> # Set GROQ API key
175
+ ```
176
+
177
+ ## 💡 Real-World Example
178
+
179
+ ### Problem: Two developers, same file
180
+
181
+ **Developer A** adds shipping logic:
182
+ ```python
183
+ def calculate_total(items):
184
+ total = sum(item.price * item.qty for item in items)
185
+ shipping = 5.99 if total < 50 else 0
186
+ return total + shipping
187
+ ```
188
+
189
+ **Developer B** adds tax calculation:
190
+ ```python
191
+ def calculate_total(items):
192
+ total = sum(item.price * item.qty for item in items)
193
+ tax = total * 0.08
194
+ return total + tax
195
+ ```
196
+
197
+ ### Solution: AI Auto-Merge
198
+
199
+ ```bash
200
+ # Developer A tries to push
201
+ codevault push app.py -m "Add shipping"
202
+ # ⚠ Merge conflicts detected
203
+
204
+ # AI resolves automatically
205
+ codevault auto-merge app.py --strategy ai
206
+ ```
207
+
208
+ **Result**: AI merges BOTH features:
209
+ ```python
210
+ def calculate_total(items):
211
+ total = sum(item.price * item.qty for item in items)
212
+ tax = total * 0.08
213
+ shipping = 5.99 if total < 50 else 0
214
+ return total + tax + shipping
215
+ ```
216
+
217
+ ✅ Both shipping AND tax preserved!
218
+ ✅ No manual editing needed!
219
+ ✅ Code works correctly!
220
+
221
+ ## 🎨 Use Cases
222
+
223
+ - **Solo Developers**: Track your code history without Git complexity
224
+ - **Small Teams**: Collaborate without merge headaches
225
+ - **Learning**: Understand version control concepts
226
+ - **Prototyping**: Quick versioning for experiments
227
+ - **Code Reviews**: AI-assisted merging of feedback
228
+
229
+ ## ⚙️ How AI Merge Works
230
+
231
+ 1. **Detection**: Compares local file vs last commit, finds conflicts
232
+ 2. **Analysis**: AI (Llama 70B) examines both versions for:
233
+ - Function signatures and logic
234
+ - Code semantics and intent
235
+ - Style and formatting
236
+ 3. **Resolution**: Generates merged version that:
237
+ - Keeps functionality from both
238
+ - Removes duplicates
239
+ - Maintains consistency
240
+ 4. **Safety**: Creates backup, writes merge, allows review
241
+
242
+ ## 🔒 Safety Features
243
+
244
+ - **Automatic Backups**: Original files backed up before merge
245
+ - **Conflict Detection**: Won't let you overwrite accidentally
246
+ - **Force Override**: Available but requires explicit `--force` flag
247
+ - **Manual Fallback**: Traditional markers if AI fails
248
+ - **Semantic Versioning**: Auto-tracks breaking vs non-breaking changes
249
+
250
+ ## 🎓 Best Practices
251
+
252
+ 1. **Check before pushing**
253
+ ```bash
254
+ codevault check-conflicts myfile.py
255
+ ```
256
+
257
+ 2. **Review AI merges**
258
+ - Check merged file
259
+ - Run tests
260
+ - Then commit
261
+
262
+ 3. **Small, frequent commits**
263
+ - Easier to merge
264
+ - Better AI performance
265
+
266
+ 4. **Use auto-detect for messages**
267
+ ```bash
268
+ codevault push --auto-detect
269
+ ```
270
+
271
+ 5. **Choose the right strategy**
272
+ - `ai` - When both changes matter
273
+ - `local` - When you know yours is right
274
+ - `remote` - When their version is better
275
+
276
+ ## 🔧 Advanced Configuration
277
+
278
+ ### Multiple Projects
279
+
280
+ Each project gets its own `.codevault/` directory:
281
+
282
+ ```bash
283
+ cd project1
284
+ codevault init
285
+ codevault push src/ -m "Project 1 changes"
286
+
287
+ cd ../project2
288
+ codevault init
289
+ codevault push app/ -m "Project 2 changes"
290
+ ```
291
+
292
+ ### API Key Priority
293
+
294
+ CodeVault checks in this order:
295
+ 1. `GROQ_API_KEY` environment variable
296
+ 2. `CODEVAULT_GROQ_KEY` environment variable
297
+ 3. `~/.codevault/config.json` (from `auth set`)
298
+
299
+ ### Custom Workflow
300
+
301
+ ```python
302
+ from codevault import CodeVault
303
+
304
+ vault = CodeVault()
305
+
306
+ # Check conflicts programmatically
307
+ has_conflicts, conflicts = vault._detect_merge_conflicts(['app.py'])
308
+
309
+ if has_conflicts:
310
+ # Auto-resolve
311
+ result = vault.auto_merge(['app.py'], strategy='ai')
312
+ print(result)
313
+ ```
314
+
315
+ ## 📁 Repository Structure
316
+
317
+ ```
318
+ your-project/
319
+ ├── .codevault/
320
+ │ ├── commits/ # All commit snapshots
321
+ │ │ └── abc12345/
322
+ │ │ ├── commit.json
323
+ │ │ └── file.snapshot
324
+ │ ├── merge/ # Backup files during merge
325
+ │ ├── metadata.json # Repo metadata & history
326
+ │ └── index.json # Staging area
327
+ └── your files...
328
+
329
+ ~/.codevault/
330
+ └── config.json # Global user config (API key)
331
+ ```
332
+
333
+ ## ❓ FAQ
334
+
335
+ **Q: Do I need Git?**
336
+ A: No! CodeVault is standalone.
337
+
338
+ **Q: Can I use it without the AI features?**
339
+ A: Yes! All commands work without an API key. Just use `--strategy local` or `--strategy remote` for merges.
340
+
341
+ **Q: Is my code sent to the cloud?**
342
+ 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.
343
+
344
+ **Q: What if AI merge fails?**
345
+ A: CodeVault falls back to traditional conflict markers for manual resolution.
346
+
347
+ **Q: Can I use this in production?**
348
+ A: CodeVault is great for personal projects and small teams. For large teams or critical production, we still recommend Git.
349
+
350
+ **Q: How much does it cost?**
351
+ A: CodeVault is free. Groq offers a generous free tier for the AI features.
352
+
353
+ ## 🐛 Troubleshooting
354
+
355
+ ### "GROQ_API_KEY not set"
356
+ ```bash
357
+ export GROQ_API_KEY="your_key"
358
+ # or
359
+ codevault auth set your_key
360
+ ```
361
+
362
+ ### "Merge conflicts detected"
363
+ ```bash
364
+ # Check details
365
+ codevault check-conflicts file.py
366
+
367
+ # Auto-resolve
368
+ codevault auto-merge file.py --strategy ai
369
+ ```
370
+
371
+ ### "AI failed, added markers"
372
+ File now has conflict markers - manually edit and push:
373
+ ```bash
374
+ # Edit file to resolve
375
+ nano file.py
376
+
377
+ # Push resolved version
378
+ codevault push file.py -m "Manual merge"
379
+ ```
380
+
381
+ ## 🤝 Contributing
382
+
383
+ Issues and pull requests welcome!
384
+
385
+ 1. Fork the repo
386
+ 2. Create a feature branch
387
+ 3. Make your changes
388
+ 4. Add tests
389
+ 5. Submit PR
390
+
391
+ ## 📄 License
392
+
393
+ MIT License - see LICENSE file
394
+
395
+ ## 🙏 Credits
396
+
397
+ - **Groq** for fast LLM inference
398
+ - **Llama 3** for intelligent code understanding
399
+ - Inspired by Git's version control system
400
+
401
+ ## 📞 Support
402
+
403
+ - 📖 [Full Documentation](https://github.com/yourusername/codevault)
404
+ - 🐛 [Issue Tracker](https://github.com/yourusername/codevault/issues)
405
+ - 💬 [Discussions](https://github.com/yourusername/codevault/discussions)
406
+
407
+ ---
408
+
409
+ **Made with ❤️ to make version control intelligent and accessible**
410
+
411
+ Give it a ⭐ if you find it useful!