Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pdd/meta/core_cli_python.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"pdd_version": "0.0.301.dev0",
"timestamp": "2026-07-11T20:13:58.087488+00:00",
"pdd_version": "0.0.302.dev0",
"timestamp": "2026-07-11T21:34:57.998075+00:00",
"command": "fix",
"prompt_hash": "38d36818bb40cab97145d9d92d484e1066c90d194e2b0311e8b1947338de38db",
"code_hash": "75eebbcab0f52fdeee132dbfe2760d1161738ea8509e0017c8f58d192bc78024",
"prompt_hash": "041ab8f4feba77b02ce03ce3e6063becb71d17ef1b32d4906eeca29e555aefc8",
"code_hash": "bd12418a3af2519ad7a365ae4f27588489d78e56af22845df697fbd758319160",
"example_hash": null,
"test_hash": null,
"test_files": {},
Expand Down
46 changes: 42 additions & 4 deletions pdd/commands/drift.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""``pdd checkup drift`` subcommand implementation."""

from __future__ import annotations

import json
Expand All @@ -7,12 +8,18 @@

import click

from ..drift_main import DEFAULT_MAX_COST_USD, run_drift
from ..drift_main import DEFAULT_MAX_COST_USD, DriftInputError, run_drift


@click.command("drift")
@click.argument("devunit")
@click.option("--runs", default=1, show_default=True, type=int, help="Number of regeneration runs.")
@click.option(
"--runs",
default=1,
show_default=True,
type=int,
help="Number of regeneration runs.",
)
@click.option("--model", default=None, help="Model override for regeneration runs.")
@click.option(
"--from-evidence",
Expand All @@ -32,7 +39,9 @@
default=False,
help="Do not regenerate; compare current artifact stability only.",
)
@click.option("--json", "as_json", is_flag=True, default=False, help="Emit machine-readable JSON.")
@click.option(
"--json", "as_json", is_flag=True, default=False, help="Emit machine-readable JSON."
)
@click.option(
"--max-cost",
"max_cost_usd",
Expand Down Expand Up @@ -79,7 +88,34 @@ def drift_cmd(
dry_run=dry_run,
max_cost_usd=effective_max_cost,
)
except DriftInputError as exc:
if as_json:
click.echo(
json.dumps(
{
"status": "error",
"error": {"code": exc.code, "message": str(exc)},
},
indent=2,
)
)
raise click.exceptions.Exit(1) from exc
raise click.ClickException(str(exc)) from exc
except (FileNotFoundError, RuntimeError) as exc:
if as_json:
click.echo(
json.dumps(
{
"status": "error",
"error": {
"code": "drift_runtime_error",
"message": str(exc),
},
},
indent=2,
)
)
raise click.exceptions.Exit(1) from exc
raise click.ClickException(str(exc)) from exc

if as_json:
Expand All @@ -93,7 +129,9 @@ def drift_cmd(
click.echo(f"Verify: {payload['verify']}")
click.echo(f"Policy: {payload['policy']}")
if payload.get("policy_check_unavailable"):
click.echo("Policy note: gate command unavailable; policy check failed closed.")
click.echo(
"Policy note: gate command unavailable; policy check failed closed."
)
if payload.get("max_cost_usd") is not None:
click.echo(f"Max cost: ${payload['max_cost_usd']:.4f}")
click.echo(f"Total cost: ${payload['total_cost_usd']:.4f}")
Expand Down
2 changes: 1 addition & 1 deletion pdd/core/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ def _restore_estimate_env(_snapshot=_estimate_env_snapshot):
pass

# Warn users who have not completed interactive setup unless they are running it now
if not estimate_mode and _should_show_onboarding_reminder(ctx):
if not estimate_mode and not json_mode and _should_show_onboarding_reminder(ctx):
console.print(
"[warning]Complete onboarding with `pdd setup` to install tab completion and configure API keys.[/warning]"
)
Expand Down
Loading
Loading