From 832dd311238e61bf82f29f36a1068c9061abb184 Mon Sep 17 00:00:00 2001 From: Matt Lehman Date: Fri, 13 Feb 2026 20:34:23 -0500 Subject: [PATCH] fix: unblock release pipeline and expose cli version --- .github/workflows/release.yml | 2 +- src/main.rs | 1 + tests/cli_contract.rs | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 736da6a..6eae810 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -304,7 +304,7 @@ jobs: - name: Build release binary shell: bash run: | - cargo deb --profile deb --target ${{ env.TARGET }} + cargo deb --target ${{ env.TARGET }} version="${{ needs.create-release.outputs.version }}" echo "DEB_DIR=target/${{ env.TARGET }}/debian" >> $GITHUB_ENV echo "DEB_NAME=precursor_$version-1_amd64.deb" >> $GITHUB_ENV diff --git a/src/main.rs b/src/main.rs index 7cd83b9..56adece 100644 --- a/src/main.rs +++ b/src/main.rs @@ -135,6 +135,7 @@ fn main() { // Create a clap::ArgMatches object to store the CLI arguments let cmd = Command::new("precursor") + .version(env!("CARGO_PKG_VERSION")) .about("Precursor is a PCRE2 payload tagging and similarity hashing CLI (TLSH/LZJD) for text, binary, hex, or base64 input.") .color(ColorChoice::Auto) .long_about("Precursor currently supports the following TLSH algorithms:\n diff --git a/tests/cli_contract.rs b/tests/cli_contract.rs index 9284043..b48252c 100644 --- a/tests/cli_contract.rs +++ b/tests/cli_contract.rs @@ -116,6 +116,13 @@ fn single_packet_emits_protocol_fields() { .unwrap_or(false)); } +#[test] +fn version_flag_emits_package_version() { + let output = run_precursor(&["--version"], ""); + let stdout = String::from_utf8_lossy(&output.stdout); + assert!(stdout.contains(env!("CARGO_PKG_VERSION"))); +} + #[test] fn protocol_hints_include_inference_context() { let line_one =