|
1 | 1 | # PDD (Prompt-Driven Development) Command Line Interface |
2 | 2 |
|
3 | | - [](https://discord.gg/Yp4RTh8bG7) |
| 3 | + [](https://discord.gg/Yp4RTh8bG7) |
4 | 4 |
|
5 | 5 | ## Introduction |
6 | 6 |
|
@@ -285,7 +285,7 @@ export PDD_TEST_OUTPUT_PATH=/path/to/tests/ |
285 | 285 |
|
286 | 286 | ## Version |
287 | 287 |
|
288 | | -Current version: 0.0.100 |
| 288 | +Current version: 0.0.101 |
289 | 289 |
|
290 | 290 | To check your installed version, run: |
291 | 291 | ``` |
@@ -458,7 +458,7 @@ Here is a brief overview of the main commands provided by PDD. Click the command |
458 | 458 | - **[`conflicts`](#11-conflicts)**: Finds and suggests resolutions for conflicts between two prompt files. |
459 | 459 | - **[`crash`](#12-crash)**: Fixes errors in a code module and its calling program that caused a crash. Includes an agentic fallback mode for complex errors. |
460 | 460 | - **[`trace`](#13-trace)**: Finds the corresponding line number in a prompt file for a given code line. |
461 | | -- **[`bug`](#14-bug)**: Generates a unit test based on observed vs. desired program outputs. |
| 461 | +- **[`bug`](#14-bug)**: Generates a unit test from a GitHub issue via an agentic workflow that analyzes, reproduces, and creates failing tests. |
462 | 462 | - **[`auto-deps`](#15-auto-deps)**: Analyzes and inserts needed dependencies into a prompt file. |
463 | 463 | - **[`verify`](#16-verify)**: Verifies functional correctness by running a program and judging its output against the prompt's intent using an LLM. |
464 | 464 |
|
@@ -1395,7 +1395,7 @@ Options: |
1395 | 1395 |
|
1396 | 1396 | #### XML-like Tags |
1397 | 1397 |
|
1398 | | -PDD supports the following XML-like tags in prompt files: |
| 1398 | +PDD supports the following XML-like tags in prompt files. Note: XML-like tags (`<include>`, `<include-many>`, `<shell>`, `<web>`) are left untouched inside fenced code blocks (``` or ~~~) or inline single backticks so documentation examples remain literal. |
1399 | 1399 |
|
1400 | 1400 | 1. **`include`**: Includes the content of the specified file in the prompt. The tag is replaced directly with the file content. |
1401 | 1401 | ```xml |
@@ -1802,26 +1802,46 @@ This will print out the line number in the prompt file for the associated the co |
1802 | 1802 |
|
1803 | 1803 | ### 14. bug |
1804 | 1804 |
|
1805 | | -Generate a unit test based on observed and desired outputs, given the original prompt and code. |
| 1805 | +Generate a unit test from a GitHub issue. The issue serves as the source of truth for both the error output and expected behavior. An agentic workflow analyzes the issue, reproduces the bug, and creates a failing test. |
1806 | 1806 |
|
1807 | 1807 | ``` |
1808 | | -pdd [GLOBAL OPTIONS] bug [OPTIONS] PROMPT_FILE CODE_FILE PROGRAM_FILE CURRENT_OUTPUT_FILE DESIRED_OUTPUT_FILE |
| 1808 | +pdd [GLOBAL OPTIONS] bug <github-issue-url> |
| 1809 | +pdd [GLOBAL OPTIONS] bug --manual PROMPT_FILE CODE_FILE PROGRAM_FILE CURRENT_OUTPUT DESIRED_OUTPUT |
1809 | 1810 | ``` |
1810 | 1811 |
|
| 1812 | +**How it works (step-by-step with GitHub comments):** |
| 1813 | +
|
| 1814 | +1. **Duplicate check** - Search for existing issues describing the same problem. If found, merge content and close the duplicate. Posts comment with findings. |
| 1815 | +
|
| 1816 | +2. **Documentation check** - Review repo documentation to determine if this is a bug or user error. Posts comment with findings. |
| 1817 | +
|
| 1818 | +3. **Reproduce** - Attempt to reproduce the issue locally. Posts comment confirming reproduction (or failure to reproduce). |
| 1819 | +
|
| 1820 | +4. **Root cause analysis** - Run experiments to identify the root cause. Posts comment explaining the root cause. |
| 1821 | +
|
| 1822 | +5. **Test plan** - Design a plan for creating tests to detect the problem. Posts comment with the test plan. |
| 1823 | +
|
| 1824 | +6. **Generate test** - Create the failing unit test. Posts comment with the generated test code. |
| 1825 | +
|
| 1826 | +7. **Verify detection** - Confirm the test successfully detects the bug. Posts comment confirming verification. |
| 1827 | +
|
| 1828 | +8. **Create draft PR** - Create a draft pull request with the failing test and link it to the issue. Posts comment with PR link. |
| 1829 | +
|
1811 | 1830 | Arguments: |
1812 | | -- `PROMPT_FILE`: Filename of the prompt file that generated the code. |
1813 | | -- `CODE_FILE`: Filename of the code file being tested. |
1814 | | -- `PROGRAM_FILE`: Filename of the program used to run the code under test. |
1815 | | -- `CURRENT_OUTPUT_FILE`: File containing the current (incorrect) output of the program. |
1816 | | -- `DESIRED_OUTPUT_FILE`: File containing the desired (correct) output of the program. |
| 1831 | +- `ISSUE_URL`: GitHub issue URL (e.g., https://github.com/owner/repo/issues/123) |
1817 | 1832 |
|
1818 | 1833 | Options: |
1819 | | -- `--output LOCATION`: Specify where to save the generated unit test. The default file name is `test_<basename>_bug.<language_extension>`. If an output file with the specified name already exists, a new file with a numbered suffix (e.g., `test_calculator_bug_1.py`) will be created instead of overwriting. |
1820 | | -- `--language`: Specify the programming language for the unit test (default is "Python"). |
| 1834 | +- `--manual`: Use legacy mode with explicit file arguments (PROMPT_FILE, CODE_FILE, PROGRAM_FILE, CURRENT_OUTPUT, DESIRED_OUTPUT) |
| 1835 | +- `--output LOCATION`: Specify where to save the generated unit test. Default: `test_<module>_bug.py` |
| 1836 | +- `--language LANG`: Specify the programming language for the unit test (default is "Python"). |
1821 | 1837 |
|
1822 | 1838 | Example: |
1823 | | -``` |
1824 | | -pdd [GLOBAL OPTIONS] bug --output tests/test_factorial_calculator_bug.py factorial_calculator_python.prompt src/factorial_calculator.py main_program.py current_output.txt desired_output.txt |
| 1839 | +```bash |
| 1840 | +# Agentic mode (recommended) |
| 1841 | +pdd bug https://github.com/myorg/myrepo/issues/42 |
| 1842 | +
|
| 1843 | +# Manual mode (legacy) |
| 1844 | +pdd bug --manual prompt.prompt code.py main.py current.txt desired.txt |
1825 | 1845 | ``` |
1826 | 1846 |
|
1827 | 1847 | ### 15. auto-deps |
@@ -2014,6 +2034,10 @@ PDD automatically detects the appropriate context based on: |
2014 | 2034 | - `budget`: Default budget for iterative commands |
2015 | 2035 | - `max_attempts`: Default maximum attempts for fixing operations |
2016 | 2036 |
|
| 2037 | +**Path Behavior**: |
| 2038 | +- Paths ending with `/` are treated as explicit directories and do **not** preserve subdirectory basenames (e.g., `commands/analysis` -> `pdd/analysis.py`). |
| 2039 | +- Paths without trailing `/` preserve subdirectory basenames when the path is an existing directory (e.g., `commands/analysis` -> `pdd/commands/analysis.py`). |
| 2040 | +
|
2017 | 2041 | **Usage Examples**: |
2018 | 2042 | ```bash |
2019 | 2043 | # Auto-detect context from current directory |
|
0 commit comments