gptdiff 0.1.11__py3-none-any.whl → 0.1.13__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -0,0 +1,9 @@
1
+ gptdiff/__init__.py,sha256=yGjgwv7tNvH1ZLPsQyoo1CxpTOl1iCAwwDBp-_17ksQ,89
2
+ gptdiff/gptdiff.py,sha256=HbnFkP1o5jQ-WIC99y-et_X6BeBsArtKqiFb2FG6X28,36694
3
+ gptdiff/gptdiffapply.py,sha256=j1ez4dGPQMNReZcx036t-svkfhtfIH4MHec-0KucC-o,1613
4
+ gptdiff-0.1.13.dist-info/LICENSE.txt,sha256=zCJk7yUYpMjFvlipi1dKtaljF8WdZ2NASndBYYbU8BY,1228
5
+ gptdiff-0.1.13.dist-info/METADATA,sha256=tjYhieEkjK5viAfrdQTmv3abvox4moJl4HXXQ5Ks12I,7799
6
+ gptdiff-0.1.13.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
+ gptdiff-0.1.13.dist-info/entry_points.txt,sha256=kMvSBshTNlOsot8xx9I0LmFziWf7i4X0lU6r90Ihn5U,86
8
+ gptdiff-0.1.13.dist-info/top_level.txt,sha256=XNkQkQGINaDndEwRxg8qToOrJ9coyfAb-EHrSUXzdCE,8
9
+ gptdiff-0.1.13.dist-info/RECORD,,
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
+ gptapply = gptdiff.gptdiffapply:main
2
3
  gptdiff = gptdiff.gptdiff:main
@@ -1,8 +0,0 @@
1
- gptdiff/__init__.py,sha256=yGjgwv7tNvH1ZLPsQyoo1CxpTOl1iCAwwDBp-_17ksQ,89
2
- gptdiff/gptdiff.py,sha256=HbnFkP1o5jQ-WIC99y-et_X6BeBsArtKqiFb2FG6X28,36694
3
- gptdiff-0.1.11.dist-info/LICENSE.txt,sha256=zCJk7yUYpMjFvlipi1dKtaljF8WdZ2NASndBYYbU8BY,1228
4
- gptdiff-0.1.11.dist-info/METADATA,sha256=pCTb2Mu4w0Y6HSAY5A8F8jwrJrLfq_SQw80PyQvRIXA,7799
5
- gptdiff-0.1.11.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
6
- gptdiff-0.1.11.dist-info/entry_points.txt,sha256=0yvXYEVAZFI-p32kQ4-h3qKVWS0a86jsM9FAwF89t9w,49
7
- gptdiff-0.1.11.dist-info/top_level.txt,sha256=XNkQkQGINaDndEwRxg8qToOrJ9coyfAb-EHrSUXzdCE,8
8
- gptdiff-0.1.11.dist-info/RECORD,,