pdd-cli 0.0.42__py3-none-any.whl → 0.0.90__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.
Files changed (119) hide show
  1. pdd/__init__.py +4 -4
  2. pdd/agentic_common.py +863 -0
  3. pdd/agentic_crash.py +534 -0
  4. pdd/agentic_fix.py +1179 -0
  5. pdd/agentic_langtest.py +162 -0
  6. pdd/agentic_update.py +370 -0
  7. pdd/agentic_verify.py +183 -0
  8. pdd/auto_deps_main.py +15 -5
  9. pdd/auto_include.py +63 -5
  10. pdd/bug_main.py +3 -2
  11. pdd/bug_to_unit_test.py +2 -0
  12. pdd/change_main.py +11 -4
  13. pdd/cli.py +22 -1181
  14. pdd/cmd_test_main.py +80 -19
  15. pdd/code_generator.py +58 -18
  16. pdd/code_generator_main.py +672 -25
  17. pdd/commands/__init__.py +42 -0
  18. pdd/commands/analysis.py +248 -0
  19. pdd/commands/fix.py +140 -0
  20. pdd/commands/generate.py +257 -0
  21. pdd/commands/maintenance.py +174 -0
  22. pdd/commands/misc.py +79 -0
  23. pdd/commands/modify.py +230 -0
  24. pdd/commands/report.py +144 -0
  25. pdd/commands/templates.py +215 -0
  26. pdd/commands/utility.py +110 -0
  27. pdd/config_resolution.py +58 -0
  28. pdd/conflicts_main.py +8 -3
  29. pdd/construct_paths.py +281 -81
  30. pdd/context_generator.py +10 -2
  31. pdd/context_generator_main.py +113 -11
  32. pdd/continue_generation.py +47 -7
  33. pdd/core/__init__.py +0 -0
  34. pdd/core/cli.py +503 -0
  35. pdd/core/dump.py +554 -0
  36. pdd/core/errors.py +63 -0
  37. pdd/core/utils.py +90 -0
  38. pdd/crash_main.py +44 -11
  39. pdd/data/language_format.csv +71 -62
  40. pdd/data/llm_model.csv +20 -18
  41. pdd/detect_change_main.py +5 -4
  42. pdd/fix_code_loop.py +331 -77
  43. pdd/fix_error_loop.py +209 -60
  44. pdd/fix_errors_from_unit_tests.py +4 -3
  45. pdd/fix_main.py +75 -18
  46. pdd/fix_verification_errors.py +12 -100
  47. pdd/fix_verification_errors_loop.py +319 -272
  48. pdd/fix_verification_main.py +57 -17
  49. pdd/generate_output_paths.py +93 -10
  50. pdd/generate_test.py +16 -5
  51. pdd/get_jwt_token.py +48 -9
  52. pdd/get_run_command.py +73 -0
  53. pdd/get_test_command.py +68 -0
  54. pdd/git_update.py +70 -19
  55. pdd/increase_tests.py +7 -0
  56. pdd/incremental_code_generator.py +2 -2
  57. pdd/insert_includes.py +11 -3
  58. pdd/llm_invoke.py +1278 -110
  59. pdd/load_prompt_template.py +36 -10
  60. pdd/pdd_completion.fish +25 -2
  61. pdd/pdd_completion.sh +30 -4
  62. pdd/pdd_completion.zsh +79 -4
  63. pdd/postprocess.py +10 -3
  64. pdd/preprocess.py +228 -15
  65. pdd/preprocess_main.py +8 -5
  66. pdd/prompts/agentic_crash_explore_LLM.prompt +49 -0
  67. pdd/prompts/agentic_fix_explore_LLM.prompt +45 -0
  68. pdd/prompts/agentic_fix_harvest_only_LLM.prompt +48 -0
  69. pdd/prompts/agentic_fix_primary_LLM.prompt +85 -0
  70. pdd/prompts/agentic_update_LLM.prompt +1071 -0
  71. pdd/prompts/agentic_verify_explore_LLM.prompt +45 -0
  72. pdd/prompts/auto_include_LLM.prompt +98 -101
  73. pdd/prompts/change_LLM.prompt +1 -3
  74. pdd/prompts/detect_change_LLM.prompt +562 -3
  75. pdd/prompts/example_generator_LLM.prompt +22 -1
  76. pdd/prompts/extract_code_LLM.prompt +5 -1
  77. pdd/prompts/extract_program_code_fix_LLM.prompt +14 -2
  78. pdd/prompts/extract_prompt_update_LLM.prompt +7 -8
  79. pdd/prompts/extract_promptline_LLM.prompt +17 -11
  80. pdd/prompts/find_verification_errors_LLM.prompt +6 -0
  81. pdd/prompts/fix_code_module_errors_LLM.prompt +16 -4
  82. pdd/prompts/fix_errors_from_unit_tests_LLM.prompt +6 -41
  83. pdd/prompts/fix_verification_errors_LLM.prompt +22 -0
  84. pdd/prompts/generate_test_LLM.prompt +21 -6
  85. pdd/prompts/increase_tests_LLM.prompt +1 -2
  86. pdd/prompts/insert_includes_LLM.prompt +1181 -6
  87. pdd/prompts/split_LLM.prompt +1 -62
  88. pdd/prompts/trace_LLM.prompt +25 -22
  89. pdd/prompts/unfinished_prompt_LLM.prompt +85 -1
  90. pdd/prompts/update_prompt_LLM.prompt +22 -1
  91. pdd/prompts/xml_convertor_LLM.prompt +3246 -7
  92. pdd/pytest_output.py +188 -21
  93. pdd/python_env_detector.py +151 -0
  94. pdd/render_mermaid.py +236 -0
  95. pdd/setup_tool.py +648 -0
  96. pdd/simple_math.py +2 -0
  97. pdd/split_main.py +3 -2
  98. pdd/summarize_directory.py +56 -7
  99. pdd/sync_determine_operation.py +918 -186
  100. pdd/sync_main.py +82 -32
  101. pdd/sync_orchestration.py +1456 -453
  102. pdd/sync_tui.py +848 -0
  103. pdd/template_registry.py +264 -0
  104. pdd/templates/architecture/architecture_json.prompt +242 -0
  105. pdd/templates/generic/generate_prompt.prompt +174 -0
  106. pdd/trace.py +168 -12
  107. pdd/trace_main.py +4 -3
  108. pdd/track_cost.py +151 -61
  109. pdd/unfinished_prompt.py +49 -3
  110. pdd/update_main.py +549 -67
  111. pdd/update_model_costs.py +2 -2
  112. pdd/update_prompt.py +19 -4
  113. {pdd_cli-0.0.42.dist-info → pdd_cli-0.0.90.dist-info}/METADATA +20 -7
  114. pdd_cli-0.0.90.dist-info/RECORD +153 -0
  115. {pdd_cli-0.0.42.dist-info → pdd_cli-0.0.90.dist-info}/licenses/LICENSE +1 -1
  116. pdd_cli-0.0.42.dist-info/RECORD +0 -115
  117. {pdd_cli-0.0.42.dist-info → pdd_cli-0.0.90.dist-info}/WHEEL +0 -0
  118. {pdd_cli-0.0.42.dist-info → pdd_cli-0.0.90.dist-info}/entry_points.txt +0 -0
  119. {pdd_cli-0.0.42.dist-info → pdd_cli-0.0.90.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,11 @@
1
- from typing import Optional, Tuple
2
- from datetime import datetime, UTC
1
+ from typing import Callable, Optional, Tuple
2
+ from datetime import datetime
3
+ try:
4
+ from datetime import UTC
5
+ except ImportError:
6
+ # Python < 3.11 compatibility
7
+ from datetime import timezone
8
+ UTC = timezone.utc
3
9
  from io import StringIO
4
10
  import os
5
11
  import glob
@@ -82,7 +88,8 @@ def summarize_directory(
82
88
  temperature: float,
83
89
  verbose: bool,
84
90
  time: float = DEFAULT_TIME,
85
- csv_file: Optional[str] = None
91
+ csv_file: Optional[str] = None,
92
+ progress_callback: Optional[Callable[[int, int], None]] = None
86
93
  ) -> Tuple[str, float, str]:
87
94
  """
88
95
  Summarize files in a directory and generate a CSV containing the summaries.
@@ -94,6 +101,8 @@ def summarize_directory(
94
101
  verbose (bool): Whether to print out the details of the function.
95
102
  time (float): Time budget for LLM calls.
96
103
  csv_file (Optional[str]): Current CSV file contents if it already exists.
104
+ progress_callback (Optional[Callable[[int, int], None]]): Callback for progress updates.
105
+ Called with (current, total) for each file processed. Used by TUI ProgressBar.
97
106
 
98
107
  Returns:
99
108
  Tuple[str, float, str]: A tuple containing:
@@ -125,17 +134,57 @@ def summarize_directory(
125
134
  raise ValueError("Invalid CSV file format.")
126
135
  existing_data = parse_existing_csv(csv_file, verbose)
127
136
 
137
+ # Expand directory_path: support plain directories or glob patterns
138
+ try:
139
+ normalized_input = normalize_path(directory_path)
140
+ except Exception:
141
+ normalized_input = directory_path
142
+
143
+ if os.path.isdir(normalized_input):
144
+ # Recursively include all files under the directory
145
+ search_pattern = os.path.join(normalized_input, "**", "*")
146
+ else:
147
+ # Treat as a glob pattern (may be a single file path too)
148
+ search_pattern = directory_path
149
+
128
150
  # Get list of files first to ensure consistent order
129
- files = sorted(glob.glob(directory_path, recursive=True))
130
- if not files:
151
+ all_files = sorted(glob.glob(search_pattern, recursive=True))
152
+ if not all_files:
131
153
  if verbose:
132
154
  print("[yellow]No files found.[/yellow]")
133
155
  return csv_output, total_cost, model_name
134
156
 
157
+ # Pre-filter to get only processable files (for accurate progress count)
158
+ files = [
159
+ f for f in all_files
160
+ if not os.path.isdir(f)
161
+ and '__pycache__' not in f
162
+ and not f.endswith(('.pyc', '.pyo'))
163
+ ]
164
+
165
+ if not files:
166
+ if verbose:
167
+ print("[yellow]No processable files found.[/yellow]")
168
+ return csv_output, total_cost, model_name
169
+
135
170
  # Get all modification times at once to ensure consistent order
136
171
  file_mod_times = {f: os.path.getmtime(f) for f in files}
137
172
 
138
- for file_path in track(files, description="Processing files..."):
173
+ # Determine iteration method: use callback if provided, else track()
174
+ # Disable track() when in TUI context (COLUMNS env var set) or callback provided
175
+ total_files = len(files)
176
+ use_track = progress_callback is None and "COLUMNS" not in os.environ
177
+
178
+ if use_track:
179
+ file_iterator = track(files, description="Processing files...")
180
+ else:
181
+ file_iterator = files
182
+
183
+ for idx, file_path in enumerate(file_iterator):
184
+ # Report progress if callback provided
185
+ if progress_callback is not None:
186
+ progress_callback(idx + 1, total_files)
187
+
139
188
  try:
140
189
  relative_path = os.path.relpath(file_path)
141
190
  normalized_path = normalize_path(relative_path)
@@ -213,4 +262,4 @@ def summarize_directory(
213
262
 
214
263
  except Exception as e:
215
264
  print(f"[red]An error occurred: {str(e)}[/red]")
216
- raise
265
+ raise