feat(install): add version detection and upgrade support to install scripts

Add --version flag to codeg-server binary and enhance both install.sh
and install.ps1 with version detection (skip if already up-to-date),
running process stop before upgrade, and post-upgrade restart guidance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
xintaofei
2026-04-07 21:53:29 +08:00
parent 8d97ba6f44
commit 923303f516
3 changed files with 146 additions and 2 deletions

View File

@@ -9,6 +9,13 @@ use codeg_lib::web::{
#[tokio::main]
async fn main() {
// Support --version flag
let args: Vec<String> = std::env::args().collect();
if args.iter().any(|a| a == "--version" || a == "-V") {
println!("{}", env!("CARGO_PKG_VERSION"));
return;
}
codeg_lib::process::ensure_user_npm_prefix_in_path();
let port: u16 = std::env::var("CODEG_PORT")