Skip to content

Commit d51ffc2

Browse files
committed
Merge upstream/main: resolve conflict keeping both #203 and #349 tests
The conflict was in tests/test_sync_determine_operation.py where both issue #203 (stale test detection) and issue #349 (infinite loop fix) added new test classes at the end of the file. Both sets are retained.
2 parents 5451719 + c6c3491 commit d51ffc2

File tree

281 files changed

+44427
-3575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+44427
-3575
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ __pycache__/
55
*.vsix
66
.tmp/
77
.agentic_prompt*
8+
sync_order.sh
89

910
staging_data_dump.json
1011
.pdd/core_dumps/*

CHANGELOG.md

Lines changed: 240 additions & 15 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,9 @@ regression: ensure-dev-deps
478478
@find staging/regression -type f ! -name ".*" -delete
479479
ifdef TEST_NUM
480480
@echo "Running specific test: $(TEST_NUM)"
481-
@PYTHONPATH=$(PDD_DIR):$$PYTHONPATH bash tests/regression.sh $(TEST_NUM)
481+
@PDD_MODEL_DEFAULT=vertex_ai/gemini-3-flash-preview PYTHONPATH=$(PDD_DIR):$$PYTHONPATH bash tests/regression.sh $(TEST_NUM)
482482
else
483-
@PYTHONPATH=$(PDD_DIR):$$PYTHONPATH bash tests/regression.sh
483+
@PDD_MODEL_DEFAULT=vertex_ai/gemini-3-flash-preview PYTHONPATH=$(PDD_DIR):$$PYTHONPATH bash tests/regression.sh
484484
endif
485485

486486
SYNC_PARALLEL ?= 1
@@ -646,7 +646,16 @@ release: check-deps check-suspicious-files
646646
@$(MAKE) check-suspicious-files
647647
@# Update CHANGELOG.md with changes from this release
648648
@echo "Updating CHANGELOG.md..."
649-
@claude --dangerously-skip-permissions -p "do a git diff between the prior version and the current version to update CHANGELOG.md to make the description more accurate and complete but concise. Be sure to not missing any updates. We are using a prompt driven development approach: docs/prompting_guide.md."
649+
@claude --dangerously-skip-permissions -p "Update CHANGELOG.md for the latest release. Steps: \
650+
1. Run 'git tag | tail -2' to find the prior and current version tags. \
651+
2. Run 'git diff <prior>..HEAD --stat' and 'git log <prior>..HEAD --oneline' to see all changes. \
652+
3. For files with significant changes (>20 lines in the stat), run 'git diff <prior>..HEAD -- <file>' to understand the SEMANTIC meaning of the change, not just that lines changed. Look for: new features, behavior changes, removed constants/functions, generalized logic. \
653+
4. Note any DELETED files (shown as 'delete mode' or '0 insertions, N deletions') - these are often meaningful (e.g., removed prompts, deprecated modules). \
654+
5. IMPORTANT: PR numbers in merge commits (e.g., 'Merge pull request #337') are from the FORK (gltanaka/pdd), NOT the public repo (promptdriven/pdd). Do NOT include fork PR numbers in the CHANGELOG - they will confuse users who look them up on the public repo. \
655+
6. For external contributor credits ONLY: use 'gh pr list --repo promptdriven/pdd --state merged --limit 20' to find upstream PRs. Verify PRs exist with 'gh pr view <num> --repo promptdriven/pdd --json state,title'. Only credit PRs that are actually merged on promptdriven/pdd. \
656+
7. Organize changes into sections: Feat, Fix, Build, Refactor, Docs. \
657+
8. Keep descriptions concise but complete. Every significant code change should be represented. \
658+
We are using a prompt driven development approach: docs/prompting_guide.md."
650659

651660
analysis:
652661
@echo "Running regression analysis"

README.md

Lines changed: 148 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PDD (Prompt-Driven Development) Command Line Interface
22

3-
![PDD-CLI Version](https://img.shields.io/badge/pdd--cli-v0.0.121-blue) [![Discord](https://img.shields.io/badge/Discord-join%20chat-7289DA.svg?logo=discord&logoColor=white)](https://discord.gg/Yp4RTh8bG7)
3+
![PDD-CLI Version](https://img.shields.io/badge/pdd--cli-v0.0.130-blue) [![Discord](https://img.shields.io/badge/Discord-join%20chat-7289DA.svg?logo=discord&logoColor=white)](https://discord.gg/Yp4RTh8bG7)
44

55
## Introduction
66

@@ -28,6 +28,8 @@ For CLI users, PDD also offers powerful **agentic commands** that implement GitH
2828
- `pdd change <issue-url>` - Implement feature requests (12-step workflow)
2929
- `pdd bug <issue-url>` - Create failing tests for bugs
3030
- `pdd fix <issue-url>` - Fix the failing tests
31+
- `pdd generate <issue-url>` - Generate architecture.json from a PRD issue (8-step workflow)
32+
- `pdd test <issue-url>` - Generate UI tests from issue descriptions (9-step workflow)
3133

3234
For prompt-based workflows, the **`sync`** command automates the complete development cycle with intelligent decision-making, real-time visual feedback, and sophisticated state management.
3335

@@ -365,7 +367,7 @@ export PDD_TEST_OUTPUT_PATH=/path/to/tests/
365367

366368
## Version
367369

368-
Current version: 0.0.121
370+
Current version: 0.0.130
369371

370372
To check your installed version, run:
371373
```
@@ -540,6 +542,7 @@ flowchart TB
540542
change["pdd change &lt;url&gt;"]
541543
bug["pdd bug &lt;url&gt;"]
542544
fix_url["pdd fix &lt;url&gt;"]
545+
test_url["pdd test &lt;url&gt;"]
543546
end
544547
545548
sync["pdd sync"]
@@ -570,6 +573,7 @@ flowchart TB
570573
- **[`change`](#8-change)**: Implement feature requests from GitHub issues (12-step workflow)
571574
- **[`bug`](#14-bug)**: Analyze bugs and create failing tests from GitHub issues
572575
- **[`fix`](#6-fix)**: Fix failing tests (supports issue-driven and manual modes)
576+
- **[`test`](#4-test)**: Generate UI tests from GitHub issues (9-step workflow in agentic mode)
573577

574578
### Core Commands (Prompt-Based)
575579
- **[`sync`](#1-sync)**: **[PRIMARY FOR PROMPT WORKFLOWS]** Automated prompt-to-code cycle
@@ -1000,6 +1004,38 @@ pdd [GLOBAL OPTIONS] generate --output src/calculator.py calculator_python.promp
10001004
pdd [GLOBAL OPTIONS] generate --output src/calculator.py --original-prompt old_calculator_python.prompt calculator_python.prompt
10011005
```
10021006

1007+
**Agentic Architecture Mode:**
1008+
1009+
When the positional argument is a GitHub issue URL instead of a prompt file, `generate` enters agentic architecture mode. The issue body serves as the PRD (Product Requirements Document), and an 8-step agentic workflow generates `architecture.json` automatically.
1010+
1011+
```bash
1012+
pdd generate https://github.com/owner/repo/issues/42
1013+
```
1014+
1015+
The 8-step workflow:
1016+
1. **Analyze PRD**: Extract features, tech stack, and requirements from the issue content
1017+
2. **Deep Analysis**: Feature decomposition, module boundaries, shared concerns
1018+
3. **Research**: Web search for tech stack documentation and best practices
1019+
4. **Design**: Module breakdown with dependency graph and priority ordering
1020+
5. **Research Dependencies**: Find relevant API docs and code examples per module
1021+
6. **Generate**: Produce complete `architecture.json` with proper priorities
1022+
7. **Validate**: Check for circular deps, priority ordering, missing deps
1023+
8. **Fix**: Auto-fix validation issues (loops back to step 7, max 5 iterations)
1024+
1025+
Prerequisites:
1026+
- `gh` CLI must be installed and authenticated
1027+
- The issue must contain a PRD describing the project scope
1028+
1029+
**Workflow Resumption**: Re-running `pdd generate <issue-url>` resumes from the last completed step. State is persisted to GitHub issue comments for cross-machine resume.
1030+
1031+
**Hard Stops**: The workflow stops if the PRD content is insufficient, the tech stack is ambiguous, or clarification is needed. Address the issue and re-run.
1032+
1033+
Example:
1034+
```bash
1035+
pdd generate https://github.com/myorg/myrepo/issues/42
1036+
# Generates: architecture.json + architecture_diagram.html
1037+
```
1038+
10031039
#### Prompt Templates
10041040

10051041
Templates are reusable prompt files that generate a specific artifact (code, JSON, tests, etc.). Templates carry human/CLI metadata in YAML front matter (parsed by the CLI and not sent to the LLM), while the body stays concise and model‑focused.
@@ -1110,6 +1146,24 @@ pdd generate --template architecture/architecture_json \
11101146
# Results in: architecture_diagram.html (from existing architecture.json)
11111147
```
11121148

1149+
**Context URLs (optional field):**
1150+
1151+
Architecture entries support an optional `context_urls` array that associates web documentation references with each module. When prompts are generated from the architecture (via `generate_prompt`), these URLs are emitted as `<web>` tags in the Dependencies section, enabling the LLM to fetch relevant API documentation during code generation.
1152+
1153+
```json
1154+
{
1155+
"filename": "orders_api_Python.prompt",
1156+
"dependencies": ["models_Python.prompt"],
1157+
"context_urls": [
1158+
{"url": "https://fastapi.tiangolo.com/tutorial/first-steps/", "purpose": "FastAPI routing patterns"},
1159+
{"url": "https://docs.pydantic.dev/latest/concepts/models/", "purpose": "Pydantic model validation"}
1160+
],
1161+
...
1162+
}
1163+
```
1164+
1165+
The `context_urls` field is populated automatically by the agentic architecture workflow (step 5: research dependencies) but can also be added manually to any architecture entry.
1166+
11131167
Front Matter (YAML) metadata
11141168

11151169
- Templates include YAML front matter with human-readable metadata:
@@ -1414,6 +1468,10 @@ Arguments:
14141468
14151469
Options:
14161470
- `--output LOCATION`: Specify where to save the generated example code. The default file name is `<basename>_example.<language_file_extension>`. If an environment variable `PDD_EXAMPLE_OUTPUT_PATH` is set, the file will be saved in that path unless overridden by this option.
1471+
- `--format FORMAT`: Output format for the generated example (default: `code`). Valid values:
1472+
- `code`: Uses the language-specific file extension (e.g., `.py` for Python, `.js` for JavaScript)
1473+
- `md`: Generates markdown format with `.md` extension
1474+
When `--format` is specified with an explicit `--output` path, the format option constrains the output file extension accordingly.
14171475
14181476
Where used:
14191477
- Dependency references: Examples serve as lightweight (token efficient) interface references for other prompts and can be included as dependencies of a generate target.
@@ -1429,6 +1487,64 @@ pdd [GLOBAL OPTIONS] example --output examples/factorial_calculator_example.py f
14291487
14301488
### 4. test
14311489
1490+
Generate or enhance unit tests for a given code file and its corresponding prompt file. Also supports **agentic mode** for generating UI tests from GitHub issues.
1491+
1492+
#### Agentic Mode (UI Test Generation)
1493+
1494+
Generate UI tests from a GitHub issue. The issue describes what needs to be tested (a webpage, CLI, or desktop app), and an agentic workflow analyzes the target, creates a test plan, and generates comprehensive UI tests.
1495+
1496+
```
1497+
pdd [GLOBAL OPTIONS] test <github-issue-url>
1498+
```
1499+
1500+
**How it works (9-step workflow with GitHub comments):**
1501+
1502+
1. **Duplicate check** - Search for existing issues describing the same test requirements. If found, merge content and close the duplicate. Posts comment with findings.
1503+
1504+
2. **Documentation check** - Review repo documentation and codebase to understand what needs to be tested. Posts comment with findings.
1505+
1506+
3. **Analyze & clarify** - Determine if enough information exists in the issue to create tests. Posts comment requesting clarification if needed.
1507+
1508+
4. **Detect frontend** - Identify the frontend type: web UI (Next.js, React, etc.), CLI, or desktop app. Determines the appropriate testing framework (e.g., Playwright for web). Posts comment with frontend analysis.
1509+
1510+
5. **Create test plan** - Design a comprehensive test plan and verify it's achievable. Posts comment requesting information (e.g., credential access) if plan is blocked.
1511+
1512+
6. **Generate tests** - Create UI tests in a new worktree following the test plan. Posts comment with generated test code.
1513+
1514+
7. **Run tests** - Execute the generated tests against the target. Posts comment with test results.
1515+
1516+
8. **Fix & iterate** - Fix any failing tests and re-run until they pass. Posts comment with fix attempts and final status.
1517+
1518+
9. **Submit PR** - Create a draft pull request with the UI tests linked to the issue. Posts comment with PR link.
1519+
1520+
**Agentic Options:**
1521+
- `--timeout-adder FLOAT`: Add additional seconds to each step's timeout (default: 0.0)
1522+
- `--no-github-state`: Disable GitHub issue comment-based state persistence, use local-only
1523+
- `--manual`: Use legacy prompt-based mode instead of agentic mode
1524+
1525+
**Cross-Machine Resume**: By default, workflow state is stored in a hidden comment on the GitHub issue, enabling resume from any machine. Use `--no-github-state` to disable this feature. You can also set `PDD_NO_GITHUB_STATE=1` environment variable.
1526+
1527+
**Example (Agentic Mode):**
1528+
```bash
1529+
# Generate UI tests from a GitHub issue
1530+
pdd test https://github.com/myorg/myrepo/issues/789
1531+
1532+
# Resume after answering clarifying questions
1533+
pdd test https://github.com/myorg/myrepo/issues/789
1534+
```
1535+
1536+
**Next Step - Fixing Test Issues:**
1537+
1538+
If the generated tests reveal issues that need code fixes, use `pdd fix` with the same issue URL:
1539+
1540+
```bash
1541+
pdd fix https://github.com/myorg/myrepo/issues/789
1542+
```
1543+
1544+
---
1545+
1546+
#### Manual Mode (Prompt-Based)
1547+
14321548
Generate or enhance unit tests for a given code file and its corresponding prompt file.
14331549

14341550
Test organization:
@@ -1437,6 +1553,7 @@ Test organization:
14371553

14381554
```
14391555
pdd [GLOBAL OPTIONS] test [OPTIONS] PROMPT_FILE CODE_OR_EXAMPLE_FILE
1556+
pdd [GLOBAL OPTIONS] test --manual [OPTIONS] PROMPT_FILE CODE_OR_EXAMPLE_FILE
14401557
```
14411558

14421559
Arguments:
@@ -1613,6 +1730,7 @@ pdd [GLOBAL OPTIONS] fix --manual [OPTIONS] PROMPT_FILE CODE_FILE UNIT_TEST_FILE
16131730
- `--manual`: Use manual mode with explicit file arguments (required for legacy/single dev-unit fixing).
16141731
- `--verbose`: Show detailed output during processing.
16151732
- `--quiet`: Suppress all output except errors.
1733+
- `--protect-tests/--no-protect-tests`: When enabled, prevents the LLM from modifying test files. The LLM will treat tests as read-only specifications and only fix the code. This is especially useful when tests created by `pdd bug` are known to be correct. Default: `--no-protect-tests`.
16161734
16171735
#### Agentic E2E Fix Options
16181736
- `--timeout-adder FLOAT`: Additional seconds to add to each step's timeout (default: 0.0).
@@ -1731,6 +1849,9 @@ pdd fix --no-resume https://github.com/myorg/myrepo/issues/42
17311849
17321850
# Disable GitHub state persistence (local-only)
17331851
pdd fix --no-github-state https://github.com/myorg/myrepo/issues/42
1852+
1853+
# Protect tests from modification (only fix code, not tests)
1854+
pdd fix --protect-tests https://github.com/myorg/myrepo/issues/42
17341855
```
17351856
17361857
**Prerequisites:**
@@ -2054,6 +2175,8 @@ pdd [GLOBAL OPTIONS] bug --manual PROMPT_FILE CODE_FILE PROGRAM_FILE CURRENT_OUT
20542175
20552176
5. **Root cause analysis** - Run experiments to identify the root cause. Posts comment explaining the root cause.
20562177
2178+
5.5. **Prompt classification** - Determine if the bug is in the code implementation or in the prompt specification itself. If the prompt is defective, auto-fix the prompt file. Posts comment with classification and any prompt changes. Defaults to "code bug" when uncertain.
2179+
20572180
6. **Test plan** - Design a plan for creating tests to detect the problem. Posts comment with the test plan.
20582181
20592182
7. **Generate test** - Create the failing unit test. Posts comment with the generated test code.
@@ -2093,6 +2216,12 @@ After `pdd bug` creates failing tests and a draft PR, use `pdd fix` with the sam
20932216
pdd fix https://github.com/myorg/myrepo/issues/42
20942217
```
20952218
2219+
**Tip:** If `pdd bug` correctly identified the bug and created valid failing tests, use `--protect-tests` to prevent `pdd fix` from modifying the tests. This ensures the LLM only fixes the code to make the tests pass:
2220+
2221+
```bash
2222+
pdd fix --protect-tests https://github.com/myorg/myrepo/issues/42
2223+
```
2224+
20962225
See the [fix command](#6-fix) documentation for details on the agentic E2E fix workflow.
20972226
20982227
### 15. auto-deps
@@ -2246,10 +2375,22 @@ pdd auth login
22462375
Displays the active account and current authentication state. Exit code is 0 if authenticated, 1 otherwise.
22472376
22482377
```bash
2378+
pdd auth status [OPTIONS]
2379+
```
2380+
2381+
**Options:**
2382+
- `--verify`: Verify authentication by actually attempting to refresh the token. Without this flag, only cached credentials are checked.
2383+
2384+
**Examples:**
2385+
```bash
2386+
# Quick check (uses cached credentials)
22492387
pdd auth status
2388+
2389+
# Deep verification (attempts token refresh)
2390+
pdd auth status --verify
22502391
```
22512392
2252-
**Note:** If only a refresh token exists (no cached JWT), the status will show "Authenticated as: Unknown" since user info is extracted from the cached JWT. Run `pdd auth login` to refresh the token and display the full account information.
2393+
**Note:** If only a refresh token exists (no cached JWT), the status will show a warning that the token is expired and will refresh on next use. Use `--verify` to actually test if the refresh will succeed, or run `pdd auth login` to refresh the token immediately.
22532394
22542395
##### auth logout
22552396
@@ -2418,6 +2559,7 @@ PDD automatically detects the appropriate context based on:
24182559
3. **Fallback**: Uses `default` context if no path matches
24192560
24202561
**Available Context Settings**:
2562+
- `prompts_dir`: Directory where prompt files are located (default: "prompts")
24212563
- `generate_output_path`: Where generated code files are saved
24222564
- `test_output_path`: Where test files are saved
24232565
- `example_output_path`: Where example files are saved
@@ -2462,6 +2604,7 @@ PDD uses several environment variables to customize its behavior:
24622604
24632605
**Note**: When using `.pddrc` configuration, context-specific settings take precedence over these global environment variables.
24642606
2607+
- **`PDD_PROMPTS_DIR`**: Default directory where prompt files are located (default: "prompts").
24652608
- **`PDD_GENERATE_OUTPUT_PATH`**: Default path for the `generate` command.
24662609
- **`PDD_EXAMPLE_OUTPUT_PATH`**: Default path for the `example` command.
24672610
- **`PDD_TEST_OUTPUT_PATH`**: Default path for the unit test file.
@@ -2486,6 +2629,7 @@ PDD uses several environment variables to customize its behavior:
24862629
- **`PDD_VERIFY_RESULTS_OUTPUT_PATH`**: Default path for the results log file generated by the `verify` command.
24872630
- **`PDD_VERIFY_CODE_OUTPUT_PATH`**: Default path for the final code file generated by the `verify` command.
24882631
- **`PDD_VERIFY_PROGRAM_OUTPUT_PATH`**: Default path for the final program file generated by the `verify` command.
2632+
- **`PDD_CLOUD_TIMEOUT`**: Cloud request timeout in seconds. Default is 900 (15 minutes). Increase this value if you experience timeouts with long-running cloud operations.
24892633
24902634
### Configuration Priority
24912635
@@ -2599,6 +2743,7 @@ Here are some common issues and their solutions:
25992743
7. **Command Timeout**:
26002744
- Check internet connection
26012745
- Try running with `--local` flag to compare
2746+
- Increase timeout with `export PDD_CLOUD_TIMEOUT=1800` (30 minutes) for long-running operations
26022747
- If persistent, check PDD Cloud status page
26032748
26042749
8. **Sync-Specific Issues**:

SETUP_WITH_GEMINI.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,37 @@ hello
217217
```
218218

219219

220+
---
221+
222+
## 10. Try the Web Interface with `pdd connect`
223+
224+
PDD also provides a web-based interface for generating code and managing projects. Start the local server:
225+
226+
```bash
227+
pdd connect
228+
```
229+
230+
This launches a FastAPI server on `http://localhost:9876` and opens your browser automatically.
231+
232+
From the web interface you can:
233+
- Generate code from prompts visually
234+
- Implement GitHub issues automatically
235+
- Manage PDD projects through a GUI
236+
237+
Common options:
238+
239+
```bash
240+
# Use a different port
241+
pdd connect --port 8000
242+
243+
# Don't auto-open the browser
244+
pdd connect --no-browser
245+
246+
# View API docs at http://localhost:9876/docs
247+
```
248+
249+
Press `Ctrl+C` to stop the server when you're done.
250+
251+
---
252+
220253
✅ That's it! You've installed PDD, configured Gemini, and used `pdd sync` to generate your first module.

0 commit comments

Comments
 (0)