feat(cli): --version/-V + in-app version command + release guard (ADR-0054)
Cargo.toml version is the single source of truth, surfaced by a --version/-V CLI flag and an in-app `version` command (both via cli::version_text -> cli.version_line). release.yaml gains a guard that fails the release unless the v* tag equals v<CARGO_PKG_VERSION>, keeping --version, the release name, and the asset in lockstep. New app command wired across grammar/REGISTRY/dispatch/usage/help/hint-corpus/keys; 6 test-first tests. Also fixes a stale "macOS deferred" comment in release.yaml. ADR-0054 + README index + plan-doc step 1.
This commit is contained in:
+29
@@ -1868,6 +1868,12 @@ impl App {
|
||||
self.note_hint_for_recent_error();
|
||||
Vec::new()
|
||||
}
|
||||
// ADR-0054: the in-app twin of `--version`. Reports the same
|
||||
// single source of truth (`CARGO_PKG_VERSION`, via cli::version_text).
|
||||
AppCommand::Version => {
|
||||
self.note_system(crate::cli::version_text());
|
||||
Vec::new()
|
||||
}
|
||||
AppCommand::Rebuild => vec![Action::PrepareRebuild],
|
||||
AppCommand::Save => self.handle_save_command(false),
|
||||
AppCommand::SaveAs => self.handle_save_command(true),
|
||||
@@ -5737,6 +5743,29 @@ mod tests {
|
||||
));
|
||||
}
|
||||
|
||||
// ── ADR-0054: in-app `version` command ──────────────────────────
|
||||
|
||||
#[test]
|
||||
fn version_command_parses_to_app_version() {
|
||||
use crate::dsl::{parse_command, AppCommand, Command};
|
||||
assert!(matches!(
|
||||
parse_command("version"),
|
||||
Ok(Command::App(AppCommand::Version))
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn version_command_emits_the_cargo_version() {
|
||||
let mut app = App::new();
|
||||
type_str(&mut app, "version");
|
||||
submit(&mut app);
|
||||
assert!(
|
||||
output_contains(&app, env!("CARGO_PKG_VERSION")),
|
||||
"in-app `version` should print CARGO_PKG_VERSION: {}",
|
||||
error_lines(&app),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hint_command_with_no_recent_error_shows_getting_started() {
|
||||
let mut app = App::new();
|
||||
|
||||
Reference in New Issue
Block a user