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
@@ -0,0 +1,45 @@
1
+ You are fixing a verification failure in a PDD (Prompt-Driven Development) project.
2
+ You are running as FALLBACK after PDD's normal verify loop failed multiple times to fix the code and/or program file so that the program output aligns with the prompt's intent.
3
+
4
+ ## PDD Principle
5
+ The PROMPT FILE is the source of truth. Code is a generated artifact.
6
+ The PROGRAM FILE runs the code to verify its behavior against the prompt's intent.
7
+
8
+ ## Files (you have full read/write access)
9
+ - Prompt file (THE SPEC): {prompt_path}
10
+ - Code file: {code_path}
11
+ - Program file: {program_path}
12
+ - Project root: {project_root}
13
+
14
+ ## Previous Fix Attempts
15
+ The following shows what PDD's normal verify loop already tried.
16
+ DO NOT repeat these approaches - try something different.
17
+ <previous_attempts>
18
+ {previous_attempts}
19
+ </previous_attempts>
20
+
21
+ ## Your Task
22
+ 1. Read the prompt file to understand the intended behavior
23
+ 2. Read the code and program files
24
+ 3. Explore related files (imports, dependencies, helper modules, etc.) if needed
25
+ 4. Determine what needs fixing:
26
+ - Code doesn't produce output matching prompt intent -> fix the code
27
+ - Program has implementation issues -> fix the program
28
+ - Issue requires changes to other files -> make those changes
29
+ 5. Make ALL necessary changes so the program output aligns with the prompt
30
+ 6. Run the program file to verify the fix
31
+ 7. Repeat steps 4-6 until the program output aligns with the prompt's intent
32
+ 8. Output a JSON string with the following fields:
33
+ - success: bool
34
+ - message: str
35
+ - cost: float
36
+ - model: str
37
+ - changed_files: list[str]
38
+
39
+ ## Critical Rules
40
+ - The prompt file defines what's correct - code should conform to it
41
+ - DO NOT repeat approaches from the fix history above
42
+ - You may modify code, program, or other supporting files
43
+ - IMPORTANT: Read actual source files before assuming what functions/classes exist
44
+ - Do NOT guess at imports or API names
45
+ - Explore the codebase to understand actual exports
@@ -12,10 +12,28 @@ You are a prompt expert that helps select the necessary subset of "includes" (li
12
12
  'Step 1.' - A string of possible includes based on the input_prompt.
13
13
  'Step 2.' - A string explaining why an include might or might not be necessary for the prompt.
14
14
  'Step 3.' - A string of the minimum set of includes required to achieve the goal of the input_prompt.
15
- 'Step 4.' - A string of the string_of_includes based on Step 3.
15
+ 'Step 4.' - A string of the string_of_includes based on Step 3 (see strict tag naming rules below).
16
16
  </output>
17
17
  </definitions>
18
18
 
19
+ <tag_naming_rules_for_step_4>
20
+ IMPORTANT: Step 4 must emit XML snippets that wrap each <include> in a canonical dotted Python module tag.
21
+
22
+ Format:
23
+ <CANONICAL_MODULE_PATH><include>INCLUDE_PATH</include></CANONICAL_MODULE_PATH>
24
+
25
+ Canonical tag name rules:
26
+ - The wrapper tag MUST be a dotted Python import path (examples: utils.auth_helpers, utils.db_helpers, models.user).
27
+ - NEVER use *_example as the wrapper tag (e.g. do NOT output <auth_helpers_example>...</auth_helpers_example>).
28
+ - If INCLUDE_PATH is a context example (e.g. context/auth_helpers_example.py), the wrapper tag must be the real module
29
+ being exemplified (e.g. utils.auth_helpers). Prefer extracting the module path from the input_prompt text. If it is not
30
+ explicitly present, infer from filename + summary:
31
+ - default to utils.<base_name> for helpers/config/clients/etc
32
+ - default to models.<base_name> for data models
33
+ - If INCLUDE_PATH is not a context example, derive CANONICAL_MODULE_PATH from the file path by stripping the extension and
34
+ replacing '/' with '.' (e.g. core/change_handler.py -> core.change_handler).
35
+ </tag_naming_rules_for_step_4>
36
+
19
37
  <context>
20
38
  Here is the input_prompt to find the includes for: <input_prompt>{input_prompt}</input_prompt>
21
39
  Here is the available_includes: <available_includes>{available_includes}</available_includes>
@@ -63,57 +81,32 @@ Here are some examples of how to do this:
63
81
  Step 3. Return the success status, list of modified prompts, total cost, and model name.
64
82
  </example_input_prompt>
65
83
  <example_available_includes>
66
- context/DSPy_example.py
67
- context/anthropic_counter_example.py
68
- context/autotokenizer_example.py
69
- context/bug_to_unit_test_example.py
70
- context/bug_to_unit_test_failure_example.py
71
- context/change_example.py
72
- context/cli_example.py
73
- context/cli_python_preprocessed.prompt
74
- context/click_example.py
75
- context/cloud_function_call.py
76
- context/code_generator_example.py
77
- context/comment_line_example.py
78
- context/conflicts_in_prompts_example.py
79
- context/conflicts_in_prompts_python.prompt
80
- context/construct_paths_example.py
81
- context/context_generator_example.py
82
- context/continue_generation_example.py
83
- context/detect_change_example.py
84
- context/execute_bug_to_unit_test_failure.py
85
- context/final_llm_output.py
86
- context/find_section_example.py
87
- context/fix_code_module_errors_example.py
88
- context/fix_error_loop_example.py
89
- context/fix_errors_from_unit_tests_example.py
90
- context/generate_output_paths_example.py
91
- context/generate_test_example.py
92
- context/get_comment_example.py
93
- context/get_extension_example.py
94
- context/get_language_example.py
95
- context/git_update_example.py
96
- context/langchain_lcel_example.py
97
- context/llm_selector_example.py
98
- context/llm_token_counter_example.py
99
- context/postprocess_0_example.py
100
- context/postprocess_example.py
101
- context/postprocessed_runnable_llm_output.py
102
- context/preprocess_example.py
103
- context/process_csv_change_example.py
104
- context/prompt_caching.ipynb
105
- context/split_example.py
106
- context/tiktoken_example.py
107
- context/trace_example.py
108
- context/unfinished_prompt_example.py
109
- context/unrunnable_raw_llm_output.py
110
- context/update_prompt_example.py
111
- context/xml_tagger_example.py
84
+ File: utils/csv_parser.py
85
+ Summary: Utility functions for parsing and processing CSV files with pandas
86
+ File: utils/file_processor.py
87
+ Summary: Generic file processing utilities for reading and writing various formats
88
+ File: core/change_handler.py
89
+ Summary: Main function for applying changes to code files with validation
90
+ File: models/data_validator.py
91
+ Summary: Pydantic models and validation functions for input data
92
+ File: cli/command_interface.py
93
+ Summary: Click-based command line interface utilities
94
+ File: database/connection.py
95
+ Summary: Database connection and query utilities
96
+ File: api/http_client.py
97
+ Summary: HTTP client for making API requests with retry logic
98
+ File: processing/text_analyzer.py
99
+ Summary: Text analysis and natural language processing functions
100
+ File: config/settings.py
101
+ Summary: Configuration management and environment variable handling
102
+ File: logging/logger.py
103
+ Summary: Centralized logging configuration and utilities
112
104
  </example_available_includes>
113
105
  <example_string_of_includes>
114
106
  % Here are examples of how to use internal modules:
115
107
  <internal_example_modules>
116
- % Here is an example of the change function that will be used: <change_example><include>context/change_example.py</include></change_example>
108
+ % Here is an example of the change function that will be used:
109
+ <core.change_handler><include>core/change_handler.py</include></core.change_handler>
117
110
  </internal_example_modules>
118
111
  </example_string_of_includes>
119
112
  </example_1>
@@ -155,70 +148,74 @@ Here are some examples of how to do this:
155
148
  Step 7. Return the unit_test, total_cost and model_name
156
149
  </example_input_prompt>
157
150
  <example_available_includes>
158
- context/DSPy_example.py
159
- context/anthropic_counter_example.py
160
- context/autotokenizer_example.py
161
- context/bug_to_unit_test_example.py
162
- context/bug_to_unit_test_failure_example.py
163
- context/change_example.py
164
- context/cli_example.py
165
- context/cli_python_preprocessed.prompt
166
- context/click_example.py
167
- context/cloud_function_call.py
168
- context/code_generator_example.py
169
- context/comment_line_example.py
170
- context/conflicts_in_prompts_example.py
171
- context/conflicts_in_prompts_python.prompt
172
- context/construct_paths_example.py
173
- context/context_generator_example.py
174
- context/continue_generation_example.py
175
- context/detect_change_example.py
176
- context/execute_bug_to_unit_test_failure.py
177
- context/final_llm_output.py
178
- context/find_section_example.py
179
- context/fix_code_module_errors_example.py
180
- context/fix_error_loop_example.py
181
- context/fix_errors_from_unit_tests_example.py
182
- context/generate_output_paths_example.py
183
- context/generate_test_example.py
184
- context/get_comment_example.py
185
- context/get_extension_example.py
186
- context/get_language_example.py
187
- context/git_update_example.py
188
- context/langchain_lcel_example.py
189
- context/llm_selector_example.py
190
- context/llm_token_counter_example.py
191
- context/postprocess_0_example.py
192
- context/postprocess_example.py
193
- context/postprocessed_runnable_llm_output.py
194
- context/preprocess_example.py
195
- context/process_csv_change_example.py
196
- context/prompt_caching.ipynb
197
- context/split_example.py
198
- context/tiktoken_example.py
199
- context/trace_example.py
200
- context/unfinished_prompt_example.py
201
- context/unrunnable_raw_llm_output.py
202
- context/update_prompt_example.py
203
- context/xml_tagger_example.py
151
+ File: frameworks/langchain_utils.py
152
+ Summary: LangChain LCEL utilities and chain composition helpers
153
+ File: llm/model_selector.py
154
+ Summary: Dynamic LLM model selection based on task requirements
155
+ File: llm/token_counter.py
156
+ Summary: Token counting utilities for various LLM providers
157
+ File: processing/prompt_processor.py
158
+ Summary: Prompt preprocessing and template management functions
159
+ File: testing/test_generator.py
160
+ Summary: Automated unit test generation from code and prompts
161
+ File: processing/completion_detector.py
162
+ Summary: Functions to detect incomplete LLM outputs and continue generation
163
+ File: processing/output_postprocessor.py
164
+ Summary: Post-processing utilities for cleaning and formatting LLM outputs
165
+ File: utils/file_reader.py
166
+ Summary: Safe file reading utilities with encoding detection
167
+ File: config/environment.py
168
+ Summary: Environment variable management and project path resolution
169
+ File: markdown/renderer.py
170
+ Summary: Rich markdown rendering and formatting utilities
204
171
  </example_available_includes>
205
172
  <example_string_of_includes>
206
- % Here is an example of a LangChain Expression Language (LCEL) program: <lcel_example><include>context/langchain_lcel_example.py</include></lcel_example>
173
+ % Here is an example of a LangChain Expression Language (LCEL) program:
174
+ <frameworks.langchain_utils><include>frameworks/langchain_utils.py</include></frameworks.langchain_utils>
207
175
 
208
176
  % Here are examples of how to use internal modules:
209
177
  <internal_example_modules>
210
- % Here is an example how to preprocess the prompt from a file: <preprocess_example><include>./context/preprocess_example.py</include></preprocess_example>
178
+ % Here is an example how to preprocess the prompt from a file:
179
+ <processing.prompt_processor><include>processing/prompt_processor.py</include></processing.prompt_processor>
211
180
 
212
- % Example of selecting a Langchain LLM and counting tokens using llm_selector: <llm_selector_example><include>./context/llm_selector_example.py</include></llm_selector_example>
181
+ % Example of selecting a Langchain LLM and counting tokens using llm_selector:
182
+ <llm.model_selector><include>llm/model_selector.py</include></llm.model_selector>
213
183
 
214
- % Example usage of the unfinished_prompt function: <unfinished_prompt_example><include>./context/unfinished_prompt_example.py</include></unfinished_prompt_example>
184
+ % Example usage of the unfinished_prompt function:
185
+ <processing.completion_detector><include>processing/completion_detector.py</include></processing.completion_detector>
215
186
 
216
- % Here is an example how to continue the generation of a model output: <continue_generation_example><include>context/continue_generation_example.py</include></continue_generation_example>
187
+ % Here is an example how to continue the generation of a model output:
188
+ <processing.completion_detector><include>processing/completion_detector.py</include></processing.completion_detector>
217
189
 
218
- % Here is an example how to postprocess the model output result: <postprocess_example><include>context/postprocess_example.py</include></postprocess_example>
190
+ % Here is an example how to postprocess the model output result:
191
+ <processing.output_postprocessor><include>processing/output_postprocessor.py</include></processing.output_postprocessor>
219
192
  </internal_example_modules>
220
193
  </example_string_of_includes>
221
194
  </example_2>
195
+
196
+ <example_3>
197
+ <example_input_prompt>
198
+ % You are an expert Python engineer. Build an admin-only HTTP endpoint.
199
+ % The function must be decorated with @require_admin from utils.auth_helpers.
200
+ % Use utils.db_helpers to query Firestore and utils.error_handling for structured errors.
201
+ </example_input_prompt>
202
+ <example_available_includes>
203
+ File: context/auth_helpers_example.py
204
+ Summary: Example usage of authentication/authorization helpers such as require_admin
205
+ File: context/db_helpers_example.py
206
+ Summary: Example usage of Firestore database helper utilities for queries and pagination
207
+ File: context/error_handling_example.py
208
+ Summary: Example usage of structured error handling and custom exceptions
209
+ </example_available_includes>
210
+ <example_string_of_includes>
211
+ % Here are examples of how to use internal modules:
212
+ <internal_example_modules>
213
+ <utils.auth_helpers><include>context/auth_helpers_example.py</include></utils.auth_helpers>
214
+ <utils.db_helpers><include>context/db_helpers_example.py</include></utils.db_helpers>
215
+ <utils.error_handling><include>context/error_handling_example.py</include></utils.error_handling>
216
+ </internal_example_modules>
217
+ </example_string_of_includes>
218
+ </example_3>
222
219
  </examples>
223
220
 
224
221
  <instructions>
@@ -226,5 +223,5 @@ Here are some examples of how to do this:
226
223
  Step 1. Select possible includes from the available_includes based on the input_prompt.
227
224
  Step 2. Explain why an include might or might not be necessary for the prompt.
228
225
  Step 3. Determine the minimum set of includes required to achieve the goal of the input_prompt.
229
- Step 4. Generate the string_of_includes based on Step 3.
226
+ Step 4. Generate the string_of_includes based on Step 3, following <tag_naming_rules_for_step_4>.
230
227
  </instructions>
@@ -15,9 +15,7 @@
15
15
  </inputs_outputs_definitions>
16
16
 
17
17
  <change_prompt_examples>
18
- <include>
19
- ../prompts/xml/change_example_partial_processed.prompt
20
- </include>
18
+ [File not found: ../prompts/xml/change_example_partial_processed.prompt]
21
19
  </change_prompt_examples>
22
20
 
23
21
  <context>