gptdiff 0.1.30__py3-none-any.whl → 0.1.31__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.
gptdiff/gptdiff.py CHANGED
@@ -417,6 +417,10 @@ prepended to the system prompt.
417
417
  """
418
418
  if model is None:
419
419
  model = os.getenv('GPTDIFF_MODEL', 'deepseek-reasoner')
420
+ # Use ANTHROPIC_BUDGET_TOKENS env var if set and no cli override provided
421
+ if anthropic_budget_tokens is None:
422
+ anthropic_budget_tokens = os.getenv('ANTHROPIC_BUDGET_TOKENS')
423
+
420
424
  if prepend:
421
425
  if prepend.startswith("http://") or prepend.startswith("https://"):
422
426
  import urllib.request
@@ -438,7 +442,7 @@ prepended to the system prompt.
438
442
  max_tokens=max_tokens,
439
443
  api_key=api_key,
440
444
  base_url=base_url,
441
- budget_tokens=anthropic_budget_tokens
445
+ budget_tokens=int(anthropic_budget_tokens) if anthropic_budget_tokens is not None else None
442
446
  )
443
447
  return diff_text
444
448
 
@@ -929,20 +933,17 @@ def swallow_reasoning(full_response: str) -> (str, str):
929
933
  r"(?P<reasoning>>\s*Reasoning.*?Reasoned.*?seconds)",
930
934
  re.DOTALL
931
935
  )
932
- match = pattern.search(full_response)
933
- if match:
936
+ reasoning_list = []
937
+ def replacer(match):
934
938
  raw_reasoning = match.group("reasoning")
935
- # Remove any leading '+' characters and extra whitespace from each line
936
939
  reasoning_lines = [line.lstrip('+').strip() for line in raw_reasoning.splitlines()]
937
940
  reasoning = "\n".join(reasoning_lines).strip()
938
-
939
- # Remove the reasoning block from the response using its exact span
940
- final_content = full_response[:match.start()] + full_response[match.end():]
941
- final_content = final_content.strip()
942
- else:
943
- reasoning = ""
944
- final_content = full_response.strip()
945
- return final_content, reasoning
941
+ reasoning_list.append(reasoning)
942
+ return ""
943
+
944
+ final_content = re.sub(pattern, replacer, full_response)
945
+ reasoning = "\n".join(reasoning_list)
946
+ return final_content.strip(), reasoning
946
947
 
947
948
  def strip_bad_output(updated: str, original: str) -> str:
948
949
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: gptdiff
3
- Version: 0.1.30
3
+ Version: 0.1.31
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
@@ -31,30 +31,48 @@ GPTDiff: Create and apply diffs using AI.
31
31
  This tool leverages natural language instructions to modify project codebases.
32
32
  -->
33
33
 
34
+ ## Table of Contents
35
+
36
+ - [Quick Start](#quick-start)
37
+ - [Example Usage](#example-usage-of-gptdiff)
38
+ - [Basic Usage](#basic-usage)
39
+ - [Simple Command Line Agent Loops](#simple-command-line-agent-loops)
40
+ - [Why Choose GPTDiff?](#why-choose-gptdiff)
41
+ - [Core Capabilities](#core-capabilities)
42
+ - [CLI Excellence](#-cli-excellence)
43
+ - [Magic Diff Generation](#-magic-diff-generation)
44
+ - [Smart Apply System](#-smart-apply-system)
45
+ - [Get Started](#get-started)
46
+ - [Installation](#installation)
47
+ - [Configuration](#configuration)
48
+ - [Command Line Usage](#command-line-usage)
49
+
34
50
  🚀 **Create and apply diffs with AI**
35
51
  Modify your project using plain English.
36
52
 
37
- More documentation at [gptdiff.255labs.xyz](gptdiff.255labs.xyz)
53
+ More documentation at [gptdiff.255labs.xyz](https://gptdiff.255labs.xyz)
54
+
55
+ ## Quick Start
38
56
 
57
+ 1. **Install GPTDiff**
58
+
59
+
39
60
  ### Example Usage of `gptdiff`
40
61
 
41
62
  #### Apply a Patch Directly
42
- ```
43
- bash
63
+ ```bash
44
64
  gptdiff "Add button animations on press" --apply
45
65
  ```
46
66
  ✅ Successfully applied patch
47
67
 
48
68
  #### Generate a Patch File
49
- ```
50
- bash
69
+ ```bash
51
70
  gptdiff "Add API documentation" --call
52
71
  ```
53
72
  🔧 Patch written to `diff.patch`
54
73
 
55
74
  #### Generate a Prompt File Without Calling LLM
56
- ```
57
- bash
75
+ ```bash
58
76
  gptdiff "Improve error messages"
59
77
  ```
60
78
  📄 LLM not called, written to `prompt.txt`
@@ -0,0 +1,10 @@
1
+ gptdiff/__init__.py,sha256=o1hrK4GFvbfKcHPlLVArz4OunE3euIicEBYaLrdDo0k,198
2
+ gptdiff/applydiff.py,sha256=FMLkEtNnOdnU7c8LgYafGuROsDz3utpyXKJVFRs_BvI,11473
3
+ gptdiff/gptdiff.py,sha256=EC2PpES2NchJvcTtNo0U0CfKLH9DdV86OuzOzLCyTr8,37424
4
+ gptdiff/gptpatch.py,sha256=Vqk2vliYs_BxtuTpwdS88n3A8XToh6RvrCA4N8VqOu0,2759
5
+ gptdiff-0.1.31.dist-info/LICENSE.txt,sha256=zCJk7yUYpMjFvlipi1dKtaljF8WdZ2NASndBYYbU8BY,1228
6
+ gptdiff-0.1.31.dist-info/METADATA,sha256=YPye_cME35OcmzklE__dMLncBYY9bhdjKf7j9wczChU,9343
7
+ gptdiff-0.1.31.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
8
+ gptdiff-0.1.31.dist-info/entry_points.txt,sha256=0VlVNr-gc04a3SZD5_qKIBbtg_L5P2x3xlKE5ftcdkc,82
9
+ gptdiff-0.1.31.dist-info/top_level.txt,sha256=XNkQkQGINaDndEwRxg8qToOrJ9coyfAb-EHrSUXzdCE,8
10
+ gptdiff-0.1.31.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.2)
2
+ Generator: setuptools (76.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,10 +0,0 @@
1
- gptdiff/__init__.py,sha256=o1hrK4GFvbfKcHPlLVArz4OunE3euIicEBYaLrdDo0k,198
2
- gptdiff/applydiff.py,sha256=FMLkEtNnOdnU7c8LgYafGuROsDz3utpyXKJVFRs_BvI,11473
3
- gptdiff/gptdiff.py,sha256=i2CYCzfIGn5knvNA7Q5mc4EpGR9akka2l3-aMphK0eU,37362
4
- gptdiff/gptpatch.py,sha256=Vqk2vliYs_BxtuTpwdS88n3A8XToh6RvrCA4N8VqOu0,2759
5
- gptdiff-0.1.30.dist-info/LICENSE.txt,sha256=zCJk7yUYpMjFvlipi1dKtaljF8WdZ2NASndBYYbU8BY,1228
6
- gptdiff-0.1.30.dist-info/METADATA,sha256=6pyrzVyjWTsHWggNr7LkjcGefR24P11oXD9w3w_sZFI,8723
7
- gptdiff-0.1.30.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
8
- gptdiff-0.1.30.dist-info/entry_points.txt,sha256=0VlVNr-gc04a3SZD5_qKIBbtg_L5P2x3xlKE5ftcdkc,82
9
- gptdiff-0.1.30.dist-info/top_level.txt,sha256=XNkQkQGINaDndEwRxg8qToOrJ9coyfAb-EHrSUXzdCE,8
10
- gptdiff-0.1.30.dist-info/RECORD,,