Add --version flag showing git tag and sha
``` │ Agent powering down. Goodbye! │ │ Interaction Summary │ Session ID: 66751fe9-fcad-4221-a90a-34d84d303807 │ Tool Calls: 15 ( ✓ 15 x 0 ) │ Success Rate: 100.0% │ User Agreement: 100.0% (15 reviewed) │ Code Changes: +81 -0 │ │ Performance │ Wall Time: 9m 51s │ Agent Active: 2m 50s │ » API Time: 1m 40s (58.6%) │ » Tool Time: 1m 10s (41.4%) │ │ │ Model Usage Reqs Input Tokens Cache Reads Output Tokens │ ──────────────────────────────────────────────────────────────────────────── │ gemini-2.5-flash-lite 2 2,635 0 199 │ gemini-3-pro-preview 15 54,232 163,544 1,828 │ │ Savings Highlight: 163,544 (74.2%) of input tokens were served from the cache, reducing costs. ```
This commit is contained in:
38
vibe_coding_log/session_2026_01_10_version_flag.md
Normal file
38
vibe_coding_log/session_2026_01_10_version_flag.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# Session Log: Add Version Flag
|
||||
|
||||
**Date**: Saturday, January 10, 2026
|
||||
**Model**: Gemini (CLI Agent)
|
||||
**Goal**: Add a `--version` flag that displays the git tag and short SHA.
|
||||
**Outcome**: Implemented dynamic versioning using `build.rs` and `clap`.
|
||||
|
||||
---
|
||||
|
||||
## Transcript Summary
|
||||
|
||||
### 1. Version Flag Implementation
|
||||
|
||||
**User**: Requested a `--version` flag that output the latest git tag. If the current commit is not exactly on a tag, it should append the short SHA (e.g., `v0.6-gd8a9fc`).
|
||||
|
||||
**Agent Action**:
|
||||
1. Analyzed `Cargo.toml` and `src/main.rs`.
|
||||
2. Created a `build.rs` script to handle the logic:
|
||||
* Tries `git describe --tags --exact-match`.
|
||||
* If that fails, tries `git describe --tags --abbrev=0` (latest tag) combined with `git rev-parse --short HEAD` (current SHA).
|
||||
* Sets the `GIT_VERSION` environment variable.
|
||||
3. Modified `src/main.rs`:
|
||||
* Updated the `clap` `Args` struct to use `#[command(version = env!("GIT_VERSION"))]`.
|
||||
4. Verified the output using `cargo run -- --version`.
|
||||
|
||||
### 2. Verification
|
||||
|
||||
**User**: Implicitly relied on agent verification.
|
||||
|
||||
**Agent Action**:
|
||||
1. Ran `cargo run -- --version` -> Output: `gitea-mirror v0.6-gf13906d` (correct format).
|
||||
2. Created a temporary tag `v0.7.0-test`, verified output was `gitea-mirror v0.7.0-test`, then deleted the tag.
|
||||
3. Ran `cargo clippy` (clean).
|
||||
4. Committed changes including the new `build.rs` and updated `src/main.rs`.
|
||||
|
||||
## Final State
|
||||
|
||||
The application now supports `gitea-mirror --version` which dynamically reports the git version at build time.
|
||||
Reference in New Issue
Block a user