codevaultAI 1.1.1__py3-none-any.whl

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.
codevault/__init__.py ADDED
@@ -0,0 +1,16 @@
1
+ """
2
+ CodeVault - AI-Powered Version Control System
3
+
4
+ A lightweight version control system with:
5
+ - Automatic conflict detection
6
+ - AI-powered merge resolution
7
+ - Semantic versioning
8
+ - AI-generated commit messages
9
+ """
10
+
11
+ __version__ = "1.1.0"
12
+ __author__ = "Your Name"
13
+
14
+ from .vault import CodeVault, MergeConflict
15
+
16
+ __all__ = ['CodeVault', 'MergeConflict']
codevault/cli.py ADDED
@@ -0,0 +1,142 @@
1
+ """Command-line interface for CodeVault"""
2
+ import argparse
3
+ from codevault.vault import CodeVault
4
+
5
+
6
+ def main():
7
+ """CLI interface"""
8
+ parser = argparse.ArgumentParser(
9
+ description="CodeVault - GitHub-like Version Control System with AI-Powered Merge",
10
+ formatter_class=argparse.RawDescriptionHelpFormatter,
11
+ epilog="""
12
+ Examples:
13
+ codevault init Initialize repository
14
+ codevault push src/ -m "Add features" Push with manual message
15
+ codevault push script.py --auto-detect Push with AI-generated message
16
+ codevault check-conflicts script.py Check for merge conflicts
17
+ codevault auto-merge src/ --strategy ai Auto-resolve conflicts with AI
18
+ codevault auto-merge src/ --strategy local Keep local changes
19
+ codevault auto-merge src/ --strategy remote Keep remote changes
20
+ codevault log -n 20 Show last 20 commits
21
+ codevault pull abc123 -o ./restored Restore commit to directory
22
+ codevault delete abc123 Delete a commit
23
+ codevault status Show repo status
24
+ codevault auth set your-api-key Set GROQ API key
25
+ """
26
+ )
27
+
28
+ subparsers = parser.add_subparsers(dest="command", help="Commands")
29
+
30
+ # Init command
31
+ subparsers.add_parser("init", help="Initialize repository")
32
+
33
+ # Push command
34
+ push_parser = subparsers.add_parser("push", help="Push code changes")
35
+ push_parser.add_argument("files", nargs="+", help="Files or directories to push")
36
+ push_parser.add_argument("-m", "--message", help="Commit message")
37
+ push_parser.add_argument("--auto-detect", action="store_true",
38
+ help="Use AI to generate commit message")
39
+ push_parser.add_argument("--force", action="store_true",
40
+ help="Force push even with conflicts (not recommended)")
41
+
42
+ # Check conflicts command
43
+ check_parser = subparsers.add_parser("check-conflicts",
44
+ help="Check for merge conflicts")
45
+ check_parser.add_argument("files", nargs="+",
46
+ help="Files or directories to check")
47
+
48
+ # Auto-merge command
49
+ merge_parser = subparsers.add_parser("auto-merge",
50
+ help="Automatically resolve merge conflicts")
51
+ merge_parser.add_argument("files", nargs="+",
52
+ help="Files or directories to merge")
53
+ merge_parser.add_argument("--strategy",
54
+ choices=["ai", "local", "remote"],
55
+ default="ai",
56
+ help="""Merge strategy:
57
+ ai - Use AI to intelligently merge (default)
58
+ local - Keep your local changes
59
+ remote - Keep remote (last committed) changes""")
60
+
61
+ # Pull command
62
+ pull_parser = subparsers.add_parser("pull", help="Restore code from commit")
63
+ pull_parser.add_argument("commit_id", help="Commit ID to restore")
64
+ pull_parser.add_argument("-o", "--output", default=".",
65
+ help="Output directory")
66
+
67
+ # Delete command
68
+ delete_parser = subparsers.add_parser("delete", help="Delete a commit")
69
+ delete_parser.add_argument("commit_id", help="Commit ID to delete")
70
+
71
+ # Log command
72
+ log_parser = subparsers.add_parser("log", help="Show commit history")
73
+ log_parser.add_argument("-n", "--limit", type=int, default=10,
74
+ help="Number of commits to show")
75
+
76
+ # Status command
77
+ subparsers.add_parser("status", help="Show repository status")
78
+
79
+ # Auth command
80
+ auth_parser = subparsers.add_parser("auth", help="Authentication settings")
81
+ auth_sub = auth_parser.add_subparsers(dest="auth_command")
82
+ auth_set = auth_sub.add_parser("set", help="Set GROQ API key")
83
+ auth_set.add_argument("api_key", help="GROQ API key")
84
+
85
+ # Changelog command
86
+ changelog_parser = subparsers.add_parser("changelog", help="Generate changelog")
87
+ changelog_parser.add_argument("-n", "--limit", type=int, default=100,
88
+ help="Max commits to include")
89
+
90
+ # Insight command
91
+ insight_parser = subparsers.add_parser("insight", help="Show commit insight")
92
+ insight_parser.add_argument("commit_id", help="Commit ID to inspect")
93
+
94
+ args = parser.parse_args()
95
+
96
+ vault = CodeVault()
97
+
98
+ if args.command == "init":
99
+ result = "[OK] Repository initialized at .codevault/"
100
+
101
+ elif args.command == "push":
102
+ result = vault.push(args.files, args.message, args.auto_detect, args.force)
103
+
104
+ elif args.command == "check-conflicts":
105
+ result = vault.check_conflicts(args.files)
106
+
107
+ elif args.command == "auto-merge":
108
+ result = vault.auto_merge(args.files, args.strategy)
109
+
110
+ elif args.command == "pull":
111
+ result = vault.pull(args.commit_id, args.output)
112
+
113
+ elif args.command == "delete":
114
+ result = vault.delete(args.commit_id)
115
+
116
+ elif args.command == "log":
117
+ result = vault.log(args.limit)
118
+
119
+ elif args.command == "status":
120
+ result = vault.status()
121
+
122
+ elif args.command == "auth":
123
+ if args.auth_command == "set":
124
+ result = vault.set_api_key(args.api_key)
125
+ else:
126
+ result = "Use: codevault auth set <api-key>"
127
+
128
+ elif args.command == "changelog":
129
+ result = vault.changelog(args.limit)
130
+
131
+ elif args.command == "insight":
132
+ result = vault.insight(args.commit_id)
133
+
134
+ else:
135
+ parser.print_help()
136
+ return
137
+
138
+ print(result)
139
+
140
+
141
+ if __name__ == "__main__":
142
+ main()