diff --git a/src-tauri/src/commands/blueprint.rs b/src-tauri/src/commands/blueprint.rs index c3d0363..79fe0f8 100644 --- a/src-tauri/src/commands/blueprint.rs +++ b/src-tauri/src/commands/blueprint.rs @@ -4,10 +4,10 @@ use std::path::Path; // ── 主节点:master CONVENTIONS.md 内容和版本(编译时嵌入)──────────────────── const MASTER_CONVENTIONS: &str = include_str!("../../../.blueprint/CONVENTIONS.md"); -const MASTER_CONVENTIONS_VERSION: &str = "1.4.0"; +const MASTER_CONVENTIONS_VERSION: &str = "1.4.2"; // CLAUDE.md 蓝图管理区模板(版本与 CONVENTIONS 保持一致) -const CLAUDE_MANAGED_TEMPLATE: &str = r#" +const CLAUDE_MANAGED_TEMPLATE: &str = r#" ## 项目蓝图 本项目使用 `.blueprint/` 目录维护项目全景架构图,驱动需求讨论和任务管理。 @@ -1192,23 +1192,26 @@ pub fn get_flywheel_stats(project_paths: Vec) -> Result) -> Result "1.4.10" 问题) + let parse_semver = |s: &str| -> (u32, u32, u32) { + let mut parts = s.splitn(3, '.'); + let major = parts.next().and_then(|x| x.parse().ok()).unwrap_or(0); + let minor = parts.next().and_then(|x| x.parse().ok()).unwrap_or(0); + let patch = parts.next().and_then(|x| x.parse().ok()).unwrap_or(0); + (major, minor, patch) + }; + cohorts.sort_by(|a, b| { + parse_semver(&b.conventions_version).cmp(&parse_semver(&a.conventions_version)) + }); // TOP10 blocked reasons let mut sorted_reasons: Vec<_> = reason_counts.into_iter().collect(); @@ -1507,9 +1519,11 @@ fn append_usage_snapshot(bp_dir: &Path, manifest: &BlueprintManifest, stats: &Bl .unwrap_or("unknown") .to_string(); - // 读取 CONVENTIONS 版本 - let conventions_version = read_frontmatter_version(&bp_dir.join("CONVENTIONS.md")) - .unwrap_or_else(|| "unknown".to_string()); + // 读取 CONVENTIONS 版本;缺失时跳过快照写入,避免产生 vunknown 脏数据 + let conventions_version = match read_frontmatter_version(&bp_dir.join("CONVENTIONS.md")) { + Some(v) => v, + None => return, + }; // UTC 时间 let now = chrono::Utc::now();