Skip to content

Commit 196c768

Browse files
feat(cli): update version command and add version tag to init (#1820)
## Summary - Updates the version command to display in the format `v1.3.0-rc.1 (abc123...)` instead of showing build timestamp - Adds version tag to openvm dependency when running `cargo openvm init` - Dependencies now include `tag = "v1.3.0-rc.1"` for reproducible builds ## Changes 1. Modified `OPENVM_VERSION_MESSAGE` in `crates/cli/src/lib.rs` to show version and commit hash 2. Updated `crates/cli/build.rs` to only emit git SHA (removed build timestamp) 3. Enhanced `add_openvm_dependency` function in `crates/cli/src/commands/init.rs` to include version tag ## Test plan - [x] Built cargo-openvm with `cargo build -p cargo-openvm` - [x] Tested version command: `./target/debug/cargo-openvm openvm --version` outputs `v1.3.0-rc.1 (46160dd)` - [x] Tested init command: `cargo openvm init` now adds dependency with version tag 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <[email protected]>
1 parent 3c80007 commit 196c768

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

book/src/getting-started/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This will generate an OpenVM-specific starter package. Notice `Cargo.toml` has t
1414

1515
```toml
1616
[dependencies]
17-
openvm = { git = "https://github.com/openvm-org/openvm.git", features = ["std"] }
17+
openvm = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.2.0", features = ["std"] }
1818
```
1919

2020
Note that `std` is not enabled by default, so explicitly enabling it is required.

crates/cli/build.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
fn main() {
2-
vergen::EmitBuilder::builder()
3-
.build_timestamp()
4-
.git_sha(true)
5-
.emit()
6-
.unwrap();
2+
vergen::EmitBuilder::builder().git_sha(true).emit().unwrap();
73
}

crates/cli/src/commands/init.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ fn add_openvm_dependency(path: &Path, features: &[&str]) -> Result<()> {
152152
"git",
153153
Value::from("https://github.com/openvm-org/openvm.git"),
154154
);
155+
156+
// Add version tag
157+
let version_tag = format!("v{}", env!("CARGO_PKG_VERSION"));
158+
openvm_table.insert("tag", Value::from(version_tag));
159+
155160
openvm_table.insert("features", Value::Array(openvm_features));
156161
doc["dependencies"]["openvm"] = Item::Value(toml_edit::Value::InlineTable(openvm_table));
157162
write(cargo_toml_path, doc.to_string())?;

crates/cli/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ use eyre::{Context, Result};
1010
pub const RUSTUP_TOOLCHAIN_NAME: &str = "nightly-2025-02-14";
1111

1212
pub const OPENVM_VERSION_MESSAGE: &str = concat!(
13-
"openvm",
13+
"v",
14+
env!("CARGO_PKG_VERSION"),
1415
" (",
1516
env!("VERGEN_GIT_SHA"),
16-
" ",
17-
env!("VERGEN_BUILD_TIMESTAMP"),
1817
")"
1918
);
2019

0 commit comments

Comments
 (0)