Buckets:
| # pdd/cli.py | |
| """ | |
| Command Line Interface (CLI) for the PDD (Prompt-Driven Development) tool. | |
| This module provides the main CLI functionality for PDD, including commands for | |
| generating code, tests, fixing issues, and managing prompts. | |
| """ | |
| from __future__ import annotations | |
| # Pre-parse --quiet flag from sys.argv BEFORE importing modules that configure | |
| # logging at module level (e.g. llm_invoke.py). This ensures module-level | |
| # logger.info() calls are suppressed when the user passes --quiet. | |
| import os as _os | |
| import sys | |
| # Leaf module (stdlib-only) so this pre-parse stays cheap and shares one | |
| # definition with pdd/core/cli.py instead of drifting out of sync. | |
| from .json_invocation import is_machine_json_invocation as _is_structured_json_invocation | |
| if '--quiet' in sys.argv or _is_structured_json_invocation(sys.argv): | |
| _os.environ.setdefault('PDD_QUIET', '1') | |
| _DEFAULTS = { | |
| "__version__": "unknown", | |
| "EXTRACTION_STRENGTH": 0.5, | |
| "DEFAULT_STRENGTH": 1.0, | |
| "DEFAULT_TEMPERATURE": 0.0, | |
| "DEFAULT_TIME": 0.25, | |
| } | |
| def _bootstrap_package_defaults() -> None: | |
| """Populate package-level defaults when `pdd` is loaded as a namespace package. | |
| Some subprocess contexts set `PYTHONPATH` to a parent directory that causes | |
| `pdd` to resolve as a namespace package. In that mode, `pdd.__init__` is not | |
| executed, so imports like `from . import DEFAULT_STRENGTH` fail. Seed | |
| missing attributes here before importing command modules. | |
| """ | |
| pkg = sys.modules.get(__package__) | |
| if pkg is None: | |
| return | |
| for key, value in _DEFAULTS.items(): | |
| if not hasattr(pkg, key): | |
| setattr(pkg, key, value) | |
| _bootstrap_package_defaults() | |
| from .core.cli import cli | |
| from .commands import register_commands | |
| # Register all commands | |
| register_commands(cli) | |
| # Re-export commonly used items for backward compatibility | |
| from .commands.templates import templates_group | |
| from .auto_update import auto_update | |
| from .code_generator_main import code_generator_main | |
| from .context_generator_main import context_generator_main | |
| from .cmd_test_main import cmd_test_main | |
| from .fix_main import fix_main | |
| from .split_main import split_main | |
| from .change_main import change_main | |
| from .update_main import update_main | |
| from .sync_main import sync_main | |
| from .auto_deps_main import auto_deps_main | |
| from .detect_change_main import detect_change_main | |
| from .conflicts_main import conflicts_main | |
| from .bug_main import bug_main | |
| from .crash_main import crash_main | |
| from .trace_main import trace_main | |
| from .agentic_test import agentic_test_main | |
| from .preprocess_main import preprocess_main | |
| from .construct_paths import construct_paths | |
| from .fix_verification_main import fix_verification_main | |
| from .core.errors import console | |
| from .install_completion import install_completion | |
| from .core.utils import _should_show_onboarding_reminder | |
| from .core.cli import process_commands | |
| if __name__ == "__main__": | |
| cli() | |
Xet Storage Details
- Size:
- 2.92 kB
- Xet hash:
- 5295c69ad6ff9c139a9913c0103ad663645803d8120dff5570b929d9bad58f69
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.