From 4eb5c1a93559a27b126034a2471ae19c82998520 Mon Sep 17 00:00:00 2001
From: ax_rd <ax_rd@aisim.cn>
Date: Thu, 03 Sep 2026 09:57:28 +0800
Subject: [PATCH] feat: 增量对账 reconcile——(size,mtime,sha256) 对账替代 commit 判据,index build 默认增量
---
internal/graph/builder.go | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/internal/graph/builder.go b/internal/graph/builder.go
index 9b5ca4e..428535b 100644
--- a/internal/graph/builder.go
+++ b/internal/graph/builder.go
@@ -1,6 +1,9 @@
package graph
import (
+ "path/filepath"
+ "strings"
+
"github.com/aisim/kb-cli/internal/vault"
)
@@ -92,5 +95,11 @@
}
// 匹配文件名(不含扩展名和编号前缀)
// 例如:[[充装规格配置]] 匹配 "知识/002-充装规格配置.md"
- return false // 简化版,后续可扩展
+ base := filepath.Base(node.Path)
+ base = strings.TrimSuffix(base, ".md")
+ // 去掉编号前缀(如 "002-")
+ if idx := strings.Index(base, "-"); idx >= 0 {
+ base = base[idx+1:]
+ }
+ return base == link || node.Title == link
}
--
Gitblit v1.10.0