Add safe prompt confirmation for cleanup before deleting backups and logs

What does this merge request do and why?

gdk pristine deletes generated backups and logs. This change prevents accidental data loss during troubleshooting by requiring explicit user confirmation before destructive cleanup.

Related Issues

Resolves #2626 (closed)

Summary

gitlab-development-kit/lib/gdk/command/pristine.rb: added a TTY-only confirmation in GDK::Command::Pristine#gdk_tmp_clean.

When run in an interactive terminal the command now prints: "This will delete GDK backups and logs. Continue? [y/N]".

If the user types y or yes the existing git clean -fX -- tmp/ runs; any other answer skips the clean and returns true.

If stdin is not a TTY (CI/non-interactive), behavior is unchanged — the clean runs without prompting.

How to set up and validate locally

  • After installing prerequisites, check out this branch.

  • Run gdk pristine.

  • You will see the confirmation message:

    This will delete GDK backups and logs. Continue? [y/N]
  • Press y or to proceed or n to abort.

Screenshots ( running local )

Confirm_Command.png

Impacted categories

The following categories relate to this merge request:

Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading