Skip to content

Add-version-flag-and-embed-build-metadata-in-the-CLI-binary#453

Open
bakarezainab wants to merge 14 commits intoHyperSafeD:mainfrom
bakarezainab:Add-version-flag-and-embed-build-metadata-in-the-CLI-binary
Open

Add-version-flag-and-embed-build-metadata-in-the-CLI-binary#453
bakarezainab wants to merge 14 commits intoHyperSafeD:mainfrom
bakarezainab:Add-version-flag-and-embed-build-metadata-in-the-CLI-binary

Conversation

@bakarezainab
Copy link
Copy Markdown
Contributor

Description

This PR adds a comprehensive --version flag to the sanctifier CLI and embeds build metadata directly into the binary to assist with production debugging. It also ensures that the version is consistently reported in JSON outputs and validated at compile time.

Key Changes:

  • Build Metadata Embedding: Integrated vergen to capture exact commit SHA, commit date, build date, target triple, and rustc version at compile time.
  • Custom Version Flag: Updated the CLI to print a detailed, multi-line version report when --version is invoked.
  • JSON Consistency: Added a mandatory sanctifier_version field to all JSON reports generated by the analyze command.
  • Version Validation: Added a build.rs script that validates the CARGO_PKG_VERSION against a strict SemVer regex pattern during compilation, preventing builds with invalid version tags.

Fixes #313

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Test A
sanctifier 0.1.0
Commit: e4261b58749faa833b1b375e44398e3b1baa103c (2026-02-26)
Build date: 2026-03-28
Target: x86_64-unknown-linux-gnu
Built with: rustc 1.93.0
  • Test B
    Ran sanctifier analyze [path] --format json Expected Result: Every report contains the "sanctifier_version": "0.1.0" field.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

close #313

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 28, 2026

@bakarezainab Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Gbangbolaoluwagbemiga
Copy link
Copy Markdown
Contributor

Please resolve conflicts @bakarezainab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[distribution] Add --version flag and embed build metadata in the CLI binary

2 participants