Record the *currently running* binary's version in user config just before the binary is replaced. The new binary reads this on startup as `previous_version` and decides whether reinstall is required for the transition (e.g. minor/major bumps re-register agents to pick up new MCP tools or hook changes; patch bumps just update the field).
()
| 699 | /// transition (e.g. minor/major bumps re-register agents to pick up new MCP |
| 700 | /// tools or hook changes; patch bumps just update the field). |
| 701 | fn record_previous_version() { |
| 702 | let current = env!("CARGO_PKG_VERSION"); |
| 703 | let mut cfg = UserConfig::load(); |
| 704 | if cfg.previous_version == current { |
| 705 | return; |
| 706 | } |
| 707 | cfg.previous_version = current.to_string(); |
| 708 | if !cfg.save() { |
| 709 | eprintln!( |
| 710 | " \x1b[33mwarning:\x1b[0m could not record previous version; \ |
| 711 | run `tracedecay reinstall` manually if new tools aren't registered" |
| 712 | ); |
| 713 | } |
| 714 | } |
| 715 | |
| 716 | /// Returns the path the new binary was installed at, when known. |
| 717 | fn perform_upgrade( |
no test coverage detected