pdd-cli 0.0.59__py3-none-any.whl → 0.0.61__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.
Potentially problematic release.
This version of pdd-cli might be problematic. Click here for more details.
- pdd/__init__.py +1 -1
- pdd/cli.py +16 -4
- pdd/pdd_completion.fish +24 -2
- pdd/pdd_completion.sh +18 -2
- pdd/pdd_completion.zsh +66 -0
- pdd/setup_tool.py +376 -277
- pdd/templates/generic/generate_prompt.prompt +142 -0
- {pdd_cli-0.0.59.dist-info → pdd_cli-0.0.61.dist-info}/METADATA +3 -3
- {pdd_cli-0.0.59.dist-info → pdd_cli-0.0.61.dist-info}/RECORD +13 -12
- {pdd_cli-0.0.59.dist-info → pdd_cli-0.0.61.dist-info}/WHEEL +0 -0
- {pdd_cli-0.0.59.dist-info → pdd_cli-0.0.61.dist-info}/entry_points.txt +0 -0
- {pdd_cli-0.0.59.dist-info → pdd_cli-0.0.61.dist-info}/licenses/LICENSE +0 -0
- {pdd_cli-0.0.59.dist-info → pdd_cli-0.0.61.dist-info}/top_level.txt +0 -0
pdd/__init__.py
CHANGED
pdd/cli.py
CHANGED
|
@@ -348,14 +348,26 @@ def process_commands(ctx: click.Context, results: List[Optional[Tuple[Any, float
|
|
|
348
348
|
invoked_subcommands = ctx.obj.get('invoked_subcommands', []) or []
|
|
349
349
|
except Exception:
|
|
350
350
|
invoked_subcommands = []
|
|
351
|
-
|
|
351
|
+
# Normalize results: Click may pass a single return value (e.g., a 3-tuple)
|
|
352
|
+
# rather than a list of results. Wrap single 3-tuples so we treat them as
|
|
353
|
+
# one step in the summary instead of three separate items.
|
|
354
|
+
if results is None:
|
|
355
|
+
normalized_results: List[Any] = []
|
|
356
|
+
elif isinstance(results, list):
|
|
357
|
+
normalized_results = results
|
|
358
|
+
elif isinstance(results, tuple) and len(results) == 3:
|
|
359
|
+
normalized_results = [results]
|
|
360
|
+
else:
|
|
361
|
+
# Fallback: wrap any other scalar/iterable as a single result
|
|
362
|
+
normalized_results = [results]
|
|
363
|
+
|
|
352
364
|
num_commands = len(invoked_subcommands)
|
|
353
|
-
num_results = len(
|
|
365
|
+
num_results = len(normalized_results) # Number of results actually received
|
|
354
366
|
|
|
355
367
|
if not ctx.obj.get("quiet"):
|
|
356
368
|
console.print("\n[info]--- Command Execution Summary ---[/info]")
|
|
357
369
|
|
|
358
|
-
for i, result_tuple in enumerate(
|
|
370
|
+
for i, result_tuple in enumerate(normalized_results):
|
|
359
371
|
# Use the retrieved subcommand name (might be "Unknown Command X" in tests)
|
|
360
372
|
command_name = invoked_subcommands[i] if i < num_commands else f"Unknown Command {i+1}"
|
|
361
373
|
|
|
@@ -395,7 +407,7 @@ def process_commands(ctx: click.Context, results: List[Optional[Tuple[Any, float
|
|
|
395
407
|
|
|
396
408
|
if not ctx.obj.get("quiet"):
|
|
397
409
|
# Only print total cost if at least one command potentially contributed cost
|
|
398
|
-
if any(res is not None and isinstance(res, tuple) and len(res) == 3 for res in
|
|
410
|
+
if any(res is not None and isinstance(res, tuple) and len(res) == 3 for res in normalized_results):
|
|
399
411
|
console.print(f"[info]Total Estimated Cost:[/info] ${total_cost:.6f}")
|
|
400
412
|
# Indicate if the chain might have been incomplete due to errors
|
|
401
413
|
if num_results < num_commands and not all(res is None for res in results): # Avoid printing if all failed
|
pdd/pdd_completion.fish
CHANGED
|
@@ -10,6 +10,8 @@ complete -c pdd -n "__fish_use_subcommand" -l quiet -d "Decrease output verbosit
|
|
|
10
10
|
complete -c pdd -n "__fish_use_subcommand" -l output-cost -r -d "Enable cost tracking and output CSV file"
|
|
11
11
|
complete -c pdd -n "__fish_use_subcommand" -l review-examples -d "Review few-shot examples before execution"
|
|
12
12
|
complete -c pdd -n "__fish_use_subcommand" -l local -d "Run commands locally"
|
|
13
|
+
complete -c pdd -n "__fish_use_subcommand" -l context -r -d "Override .pddrc context"
|
|
14
|
+
complete -c pdd -n "__fish_use_subcommand" -l list-contexts -d ".pddrc contexts and exit"
|
|
13
15
|
complete -c pdd -n "__fish_use_subcommand" -l help -d "Show help message"
|
|
14
16
|
complete -c pdd -n "__fish_use_subcommand" -l version -d "Show version information"
|
|
15
17
|
|
|
@@ -29,12 +31,16 @@ complete -c pdd -n "__fish_use_subcommand" -a trace -d "Trace code line to promp
|
|
|
29
31
|
complete -c pdd -n "__fish_use_subcommand" -a bug -d "Generate unit test from bug report"
|
|
30
32
|
complete -c pdd -n "__fish_use_subcommand" -a auto-deps -d "Analyze and insert dependencies from directory or glob"
|
|
31
33
|
complete -c pdd -n "__fish_use_subcommand" -a verify -d "Verify functional correctness using LLM judgment"
|
|
34
|
+
complete -c pdd -n "__fish_use_subcommand" -a sync -d "Synchronize prompt, code, examples, tests"
|
|
35
|
+
complete -c pdd -n "__fish_use_subcommand" -a setup -d "Interactive setup and completion install"
|
|
36
|
+
complete -c pdd -n "__fish_use_subcommand" -a install_completion -d "Install shell completion"
|
|
37
|
+
complete -c pdd -n "__fish_use_subcommand" -a pytest-output -d "Run pytest and capture structured output"
|
|
32
38
|
|
|
33
39
|
# Command-specific completions
|
|
34
40
|
complete -c pdd -n "__fish_seen_subcommand_from generate" -l output -r -d "Output location for generated code"
|
|
35
41
|
complete -c pdd -n "__fish_seen_subcommand_from generate" -l original-prompt -r -d "Original prompt file for incremental generation"
|
|
36
42
|
complete -c pdd -n "__fish_seen_subcommand_from generate" -l incremental -d "Force incremental patching"
|
|
37
|
-
complete -c pdd -n "__fish_seen_subcommand_from generate" -s e -l env -xa "(env | cut -d= -f1 | sed 's
|
|
43
|
+
complete -c pdd -n "__fish_seen_subcommand_from generate" -s e -l env -xa "(env | cut -d= -f1 | sed 's/.*/&=/' | sort -u)" -d "Set template variable (KEY=VALUE) or read KEY from env"
|
|
38
44
|
complete -c pdd -n "__fish_seen_subcommand_from generate" -a "(__fish_complete_suffix .prompt)"
|
|
39
45
|
|
|
40
46
|
complete -c pdd -n "__fish_seen_subcommand_from example" -l output -r -d "Output location for example code"
|
|
@@ -126,10 +132,26 @@ complete -c pdd -n "__fish_seen_subcommand_from verify" -l budget -x -d "Max bud
|
|
|
126
132
|
complete -c pdd -n "__fish_seen_subcommand_from verify" -a "(__fish_complete_suffix .prompt)"
|
|
127
133
|
complete -c pdd -n "__fish_seen_subcommand_from verify" -a "(__fish_complete_suffix .py .js .java .cpp .rb .go)" # For CODE_FILE and PROGRAM_FILE
|
|
128
134
|
|
|
135
|
+
# sync command
|
|
136
|
+
complete -c pdd -n "__fish_seen_subcommand_from sync" -l max-attempts -x -d "Max attempts for loops"
|
|
137
|
+
complete -c pdd -n "__fish_seen_subcommand_from sync" -l budget -x -d "Total budget for sync"
|
|
138
|
+
complete -c pdd -n "__fish_seen_subcommand_from sync" -l skip-verify -d "Skip functional verification"
|
|
139
|
+
complete -c pdd -n "__fish_seen_subcommand_from sync" -l skip-tests -d "Skip unit test generation"
|
|
140
|
+
complete -c pdd -n "__fish_seen_subcommand_from sync" -l target-coverage -x -d "Desired coverage percentage"
|
|
141
|
+
complete -c pdd -n "__fish_seen_subcommand_from sync" -l log -d "Show analysis instead of running"
|
|
142
|
+
|
|
143
|
+
# setup and install_completion have no options
|
|
144
|
+
complete -c pdd -n "__fish_seen_subcommand_from setup" -d "Run interactive setup"
|
|
145
|
+
complete -c pdd -n "__fish_seen_subcommand_from install_completion" -d "Install shell completion"
|
|
146
|
+
|
|
147
|
+
# pytest-output command
|
|
148
|
+
complete -c pdd -n "__fish_seen_subcommand_from pytest-output" -l json-only -d "Print only JSON"
|
|
149
|
+
complete -c pdd -n "__fish_seen_subcommand_from pytest-output" -a "(__fish_complete_suffix .py)"
|
|
150
|
+
|
|
129
151
|
# File completion for all commands
|
|
130
152
|
complete -c pdd -n "__fish_seen_subcommand_from generate example test preprocess fix split change update detect conflicts crash trace bug auto-deps verify" -a "(__fish_complete_suffix .prompt)"
|
|
131
153
|
complete -c pdd -n "__fish_seen_subcommand_from generate example test preprocess fix split change update detect conflicts crash trace bug auto-deps verify" -a "(__fish_complete_suffix .py .js .java .cpp .rb .go)"
|
|
132
154
|
complete -c pdd -n "__fish_seen_subcommand_from generate example test preprocess fix split change update detect conflicts crash trace bug auto-deps verify" -a "(__fish_complete_suffix .log .txt .csv)"
|
|
133
155
|
|
|
134
156
|
# Help completion
|
|
135
|
-
complete -c pdd -n "__fish_seen_subcommand_from help" -a "generate example test preprocess fix split change update detect conflicts crash trace bug auto-deps verify" -d "Show help for specific command"
|
|
157
|
+
complete -c pdd -n "__fish_seen_subcommand_from help" -a "generate example test preprocess fix split change update detect conflicts crash trace bug auto-deps verify sync setup install_completion pytest-output" -d "Show help for specific command"
|
pdd/pdd_completion.sh
CHANGED
|
@@ -15,10 +15,10 @@ _pdd() {
|
|
|
15
15
|
cword=$COMP_CWORD
|
|
16
16
|
|
|
17
17
|
# Global options
|
|
18
|
-
local global_opts="--force --strength --time --temperature --verbose --quiet --output-cost --review-examples --local --help --version"
|
|
18
|
+
local global_opts="--force --strength --time --temperature --verbose --quiet --output-cost --review-examples --local --context --list-contexts --help --version"
|
|
19
19
|
|
|
20
20
|
# Commands
|
|
21
|
-
local commands="generate example test preprocess fix split change update detect conflicts crash trace bug auto-deps verify"
|
|
21
|
+
local commands="generate example test preprocess fix split change update detect conflicts crash trace bug auto-deps verify sync setup install_completion pytest-output"
|
|
22
22
|
|
|
23
23
|
# Command-specific options
|
|
24
24
|
local generate_opts="--output --original-prompt --incremental --env -e"
|
|
@@ -36,6 +36,8 @@ _pdd() {
|
|
|
36
36
|
local bug_opts="--output --language"
|
|
37
37
|
local auto_deps_opts="--output --csv --force-scan"
|
|
38
38
|
local verify_opts="--output-results --output-code --output-program --max-attempts --budget"
|
|
39
|
+
local sync_opts="--max-attempts --budget --skip-verify --skip-tests --target-coverage --log"
|
|
40
|
+
local pytest_output_opts="--json-only"
|
|
39
41
|
|
|
40
42
|
# Complete global options before command
|
|
41
43
|
if [[ $cword -eq 1 ]]; then
|
|
@@ -141,6 +143,20 @@ _pdd() {
|
|
|
141
143
|
_complete_files
|
|
142
144
|
COMPREPLY+=($(compgen -W "$verify_opts" -- "$cur"))
|
|
143
145
|
;;
|
|
146
|
+
sync)
|
|
147
|
+
# BASENAME (not a file), offer options
|
|
148
|
+
COMPREPLY+=($(compgen -W "$sync_opts" -- "$cur"))
|
|
149
|
+
;;
|
|
150
|
+
setup)
|
|
151
|
+
# no command-specific options
|
|
152
|
+
;;
|
|
153
|
+
install_completion)
|
|
154
|
+
# no command-specific options
|
|
155
|
+
;;
|
|
156
|
+
pytest-output)
|
|
157
|
+
_complete_files
|
|
158
|
+
COMPREPLY+=($(compgen -W "$pytest_output_opts" -- "$cur"))
|
|
159
|
+
;;
|
|
144
160
|
*)
|
|
145
161
|
COMPREPLY=($(compgen -W "$global_opts" -- "$cur"))
|
|
146
162
|
;;
|
pdd/pdd_completion.zsh
CHANGED
|
@@ -57,6 +57,8 @@ _pdd_global_opts=(
|
|
|
57
57
|
'--output-cost[Enable cost tracking and output a CSV file with usage details.]:filename:_files'
|
|
58
58
|
'--review-examples[Review and optionally exclude few-shot examples before command execution.]'
|
|
59
59
|
'--local[Run commands locally instead of in the cloud.]'
|
|
60
|
+
'--context[Override automatic .pddrc context]:context-name:_guard'
|
|
61
|
+
'--list-contexts[List available .pddrc contexts and exit]'
|
|
60
62
|
'--help[Show help message and exit.]'
|
|
61
63
|
'--version[Show version and exit.]'
|
|
62
64
|
)
|
|
@@ -396,6 +398,54 @@ _pdd_verify() {
|
|
|
396
398
|
'*:filename:_files'
|
|
397
399
|
}
|
|
398
400
|
|
|
401
|
+
# sync
|
|
402
|
+
# Usage: pdd [GLOBAL OPTIONS] sync [OPTIONS] BASENAME
|
|
403
|
+
# Options:
|
|
404
|
+
# --max-attempts [INT]
|
|
405
|
+
# --budget [FLOAT]
|
|
406
|
+
# --skip-verify
|
|
407
|
+
# --skip-tests
|
|
408
|
+
# --target-coverage [FLOAT]
|
|
409
|
+
# --log
|
|
410
|
+
# Arg:
|
|
411
|
+
# 1: BASENAME
|
|
412
|
+
_pdd_sync() {
|
|
413
|
+
_arguments -s \
|
|
414
|
+
$_pdd_global_opts \
|
|
415
|
+
'--max-attempts=[Maximum attempts for iterative loops (default 3)]:int' \
|
|
416
|
+
'--budget=[Maximum total cost for sync (default 10.0)]:float' \
|
|
417
|
+
'--skip-verify[Skip the functional verification step]' \
|
|
418
|
+
'--skip-tests[Skip unit test generation and fixing]' \
|
|
419
|
+
'--target-coverage=[Desired code coverage percentage]:float' \
|
|
420
|
+
'--log[Show analysis instead of executing operations]' \
|
|
421
|
+
'1:basename: ' \
|
|
422
|
+
'*: :'
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
# setup (no options)
|
|
426
|
+
_pdd_setup() {
|
|
427
|
+
_arguments -s $_pdd_global_opts
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
# install_completion (no options)
|
|
431
|
+
_pdd_install_completion() {
|
|
432
|
+
_arguments -s $_pdd_global_opts
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
# pytest-output
|
|
436
|
+
# Usage: pdd [GLOBAL OPTIONS] pytest-output [OPTIONS] TEST_FILE
|
|
437
|
+
# Options:
|
|
438
|
+
# --json-only
|
|
439
|
+
# Arg:
|
|
440
|
+
# 1: TEST_FILE
|
|
441
|
+
_pdd_pytest_output() {
|
|
442
|
+
_arguments -s \
|
|
443
|
+
$_pdd_global_opts \
|
|
444
|
+
'--json-only[Print only JSON to stdout]' \
|
|
445
|
+
'1:test-file:_files' \
|
|
446
|
+
'*:filename:_files'
|
|
447
|
+
}
|
|
448
|
+
|
|
399
449
|
##
|
|
400
450
|
# Main PDD completion dispatcher
|
|
401
451
|
##
|
|
@@ -421,6 +471,10 @@ _pdd() {
|
|
|
421
471
|
'bug:Generate a unit test based on incorrect vs desired outputs'
|
|
422
472
|
'auto-deps:Analyze a prompt and include deps from a directory or glob'
|
|
423
473
|
'verify:Verify functional correctness using LLM judgment and iteratively fix'
|
|
474
|
+
'sync:Synchronize prompt, code, examples, tests with analysis'
|
|
475
|
+
'setup:Interactive setup and completion install'
|
|
476
|
+
'install_completion:Install shell completion for current shell'
|
|
477
|
+
'pytest-output:Run pytest and capture structured output'
|
|
424
478
|
)
|
|
425
479
|
|
|
426
480
|
# If there's no subcommand yet (i.e., user typed only "pdd " or "pdd -<Tab>"), offer global opts or subcommands.
|
|
@@ -480,6 +534,18 @@ _pdd() {
|
|
|
480
534
|
verify)
|
|
481
535
|
_pdd_verify
|
|
482
536
|
;;
|
|
537
|
+
sync)
|
|
538
|
+
_pdd_sync
|
|
539
|
+
;;
|
|
540
|
+
setup)
|
|
541
|
+
_pdd_setup
|
|
542
|
+
;;
|
|
543
|
+
install_completion)
|
|
544
|
+
_pdd_install_completion
|
|
545
|
+
;;
|
|
546
|
+
pytest-output)
|
|
547
|
+
_pdd_pytest_output
|
|
548
|
+
;;
|
|
483
549
|
# If the subcommand is unknown or not typed yet, fall back to showing the list of subcommands.
|
|
484
550
|
*)
|
|
485
551
|
_describe -t subcommands 'pdd subcommand' _pdd_subcommands
|