gptdiff 0.1.11__tar.gz → 0.1.13__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: gptdiff
3
- Version: 0.1.11
3
+ Version: 0.1.13
4
4
  Summary: A tool to generate and apply git diffs using LLMs
5
5
  Author: 255labs
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Command line tool to apply a unified diff directly to a file system.
4
+
5
+ Usage:
6
+ gptapply --diff "<diff text>"
7
+ or
8
+ gptapply path/to/diff.patch
9
+
10
+ This tool uses the same patch-application logic as gptdiff.
11
+ """
12
+
13
+ import sys
14
+ import argparse
15
+ from pathlib import Path
16
+ from gptdiff.gptdiff import apply_diff
17
+
18
+
19
+ def parse_arguments():
20
+ parser = argparse.ArgumentParser(
21
+ description="Apply a unified diff to the file system using GPTDiff's patch logic."
22
+ )
23
+ group = parser.add_mutually_exclusive_group(required=True)
24
+ group.add_argument(
25
+ "--diff",
26
+ type=str,
27
+ help="Unified diff text to apply (provide as a string)."
28
+ )
29
+ group.add_argument(
30
+ "diff_file",
31
+ nargs="?",
32
+ help="Path to a file containing the unified diff."
33
+ )
34
+ parser.add_argument(
35
+ "--project-dir",
36
+ type=str,
37
+ default=".",
38
+ help="Project directory where the diff should be applied (default: current directory)."
39
+ )
40
+ return parser.parse_args()
41
+
42
+
43
+ def main():
44
+ args = parse_arguments()
45
+ if args.diff:
46
+ diff_text = args.diff
47
+ else:
48
+ diff_path = Path(args.diff_file)
49
+ if not diff_path.exists():
50
+ print(f"Error: Diff file '{args.diff_file}' does not exist.")
51
+ sys.exit(1)
52
+ diff_text = diff_path.read_text(encoding="utf8")
53
+
54
+ project_dir = args.project_dir
55
+ success = apply_diff(project_dir, diff_text)
56
+ if success:
57
+ print("✅ Diff applied successfully.")
58
+ else:
59
+ print("❌ Failed to apply diff.")
60
+
61
+
62
+ if __name__ == "__main__":
63
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: gptdiff
3
- Version: 0.1.11
3
+ Version: 0.1.13
4
4
  Summary: A tool to generate and apply git diffs using LLMs
5
5
  Author: 255labs
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -3,6 +3,7 @@ README.md
3
3
  setup.py
4
4
  gptdiff/__init__.py
5
5
  gptdiff/gptdiff.py
6
+ gptdiff/gptdiffapply.py
6
7
  gptdiff.egg-info/PKG-INFO
7
8
  gptdiff.egg-info/SOURCES.txt
8
9
  gptdiff.egg-info/dependency_links.txt
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
+ gptapply = gptdiff.gptdiffapply:main
2
3
  gptdiff = gptdiff.gptdiff:main
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='gptdiff',
5
- version='0.1.11',
5
+ version='0.1.13',
6
6
  description='A tool to generate and apply git diffs using LLMs',
7
7
  author='255labs',
8
8
  packages=find_packages(), # Use find_packages() to automatically discover packages
@@ -19,7 +19,10 @@ setup(
19
19
  'docs': ['mkdocs', 'mkdocs-material']
20
20
  },
21
21
  entry_points={
22
- 'console_scripts': ['gptdiff=gptdiff.gptdiff:main'],
22
+ 'console_scripts': [
23
+ 'gptdiff=gptdiff.gptdiff:main',
24
+ 'gptapply=gptdiff.gptdiffapply:main',
25
+ ],
23
26
  },
24
27
  license=None, # Remove license argument
25
28
  # license_file='LICENSE.txt', # Remove license_file argument
File without changes
File without changes
File without changes
File without changes
File without changes