From 495bfc3f4204c757a4474f8265ea817208d18df0 Mon Sep 17 00:00:00 2001
From: ai_xiaopei <xiaopei@aisim.cn>
Date: Sun, 26 Jul 2026 10:20:26 +0800
Subject: [PATCH] refactor: help 格式对齐 axin-cli 风格

---
 cmd/index.go |   63 ++++---------------------------
 1 files changed, 8 insertions(+), 55 deletions(-)

diff --git a/cmd/index.go b/cmd/index.go
index 2930efc..e59bec8 100644
--- a/cmd/index.go
+++ b/cmd/index.go
@@ -20,59 +20,22 @@
 var indexBuildCmd = &cobra.Command{
 	Use:   "build",
 	Short: "构建或重建知识库索引",
-	Long: `# index build - 构建或重建知识库索引
-kb-cli index build [--vault=<路径>]
-
-操作说明:
-  1. 扫描知识库目录下的所有 Markdown 文件
-  2. 解析 frontmatter、标签、实体、wikilinks
-  3. 构建知识图谱并写入 SQLite 数据库
-  4. 创建 FTS5 全文索引
-
-参数:
-  --vault <路径>    知识库根目录(默认:~/aisim/note/001/笔记001)
-  --db <路径>       索引数据库路径(默认:~/.cache/kb-cli/kb.db)`,
-	RunE: runIndexBuild,
+	Long:  `kb-cli index build [--vault=<路径>] [--db=<路径>] # 构建或重建知识库索引`,
+	RunE:  runIndexBuild,
 }
 
 var indexStatusCmd = &cobra.Command{
 	Use:   "status",
 	Short: "查看索引状态信息",
-	Long: `# index status - 查看索引状态信息
-kb-cli index status
-
-输出信息:
-  - 知识库路径
-  - 索引文件路径
-  - 节点数量
-  - 边数量
-  - 索引 commit
-  - 当前 commit
-  - 构建时间
-  - 是否需要更新
-
-参数:
-  --vault <路径>    知识库根目录(默认:~/aisim/note/001/笔记001)
-  --db <路径>       索引数据库路径(默认:~/.cache/kb-cli/kb.db)`,
-	RunE: runIndexStatus,
+	Long:  `kb-cli index status [--vault=<路径>] [--db=<路径>] # 查看索引状态(节点数、边数、commit、构建时间)`,
+	RunE:  runIndexStatus,
 }
 
 var indexGcCmd = &cobra.Command{
 	Use:   "gc",
 	Short: "清理孤立节点和边",
-	Long: `# index gc - 清理孤立节点和边
-kb-cli index gc
-
-操作说明:
-  1. 扫描索引中的所有节点
-  2. 检查对应的 Markdown 文件是否存在
-  3. 删除不存在的文件对应的节点和边
-  4. 输出清理的节点数量
-
-参数:
-  --vault <路径>    知识库根目录(默认:~/aisim/note/001/笔记001)
-  --db <路径>       索引数据库路径(默认:~/.cache/kb-cli/kb.db)`,
-	RunE: runIndexGc,
+	Long:  `kb-cli index gc [--vault=<路径>] [--db=<路径>] # 清理索引中文件已删除的孤立节点和边`,
+	RunE:  runIndexGc,
 }
 
 var gitCmd = &cobra.Command{
@@ -83,18 +46,8 @@
 var gitSyncCmd = &cobra.Command{
 	Use:   "sync",
 	Short: "同步知识库到 Git 仓库",
-	Long: `# git sync - 同步知识库到 Git 仓库
-kb-cli git sync
-
-操作说明:
-  1. 检查知识库目录是否是 Git 仓库
-  2. 执行 git add -A 添加所有变更
-  3. 如果有变更,执行 git commit(自动生成提交信息)
-  4. 执行 git push 推送到远程仓库
-
-参数:
-  --vault <路径>    知识库根目录(默认:~/aisim/note/001/笔记001)`,
-	RunE: runGitSync,
+	Long:  `kb-cli git sync [--vault=<路径>] # 执行 git add、commit、push 同步知识库`,
+	RunE:  runGitSync,
 }
 
 func init() {

--
Gitblit v1.9.1