//! The `pkh new` interactive wizard. //! //! [`run`] is the single entry point: on an interactive terminal it asks the //! questions of the spec's "Proposed UX" transcript, fills a //! [`NewCli`] with the answers (explicit flags are never re-asked), and //! reuses [`options::resolve`] as the single source of truth for defaults, //! detection and validation — so the non-interactive and interactive paths //! cannot drift apart. Without a terminal (or with `--defaults`) it goes //! straight through [`options::resolve`], whose error lists every missing //! answer. //! //! After the summary screen is confirmed, the wizard offers the two //! verification builds of the spec ([`offer_verification`]); a failed //! verification never undoes the scaffold. //! //! The prompt calls live in `run_wizard` and `offer_verification` only; //! everything else in this module is pure and unit-tested. use std::error::Error; use std::io::IsTerminal; use std::path::PathBuf; use indicatif::MultiProgress; use crate::new::detect::{self, Detection}; use crate::new::git; use crate::new::licenses; use crate::new::options::{self, NewCli, NewOptions, SourceDir, SourceFormat, TemplateId}; use crate::new::origin::GitOrigin; use crate::new::templates::{self, ProbeResult, ScaffoldOutcome}; use crate::ui::prompt; /// Answer of the "where is the source code?" question: fresh skeleton. const SOURCE_SKELETON: &str = "Create a new project skeleton here"; /// Answer of the "where is the source code?" question: this directory. const SOURCE_HERE: &str = "Package the sources in this directory"; /// Answer of the "where is the source code?" question: another directory. const SOURCE_PATH: &str = "Package the sources in another directory…"; /// The "everything else" entry of the license menu. const LICENSE_OTHER: &str = "Other (enter a SPDX identifier)"; /// Labels of the interactive `select` questions. `prompt::select` renders /// `>