An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Correct CLI document metadata https://github.com/siyuan-note/siyuan/issues/18329
Daniel606535b3f885
diff --git a/kernel/cli/cmd/document.go b/kernel/cli/cmd/document.goindex 57e0befc5a..dd9c09406b 100644--- a/kernel/cli/cmd/document.go+++ b/kernel/cli/cmd/document.go@@ -124,19 +124,12 @@ var documentGetCmd = &cobra.Command{fmt.Println(string(data))default:fmt.Printf("ID: %s\n", block.ID)- fmt.Printf("Title: %s\n", block.Name)+ fmt.Printf("Title: %s\n", block.Content)fmt.Printf("Type: %s\n", block.Type)fmt.Printf("Box: %s\n", block.Box)fmt.Printf("HPath: %s\n", block.HPath)fmt.Printf("Created: %s\n", block.Created)fmt.Printf("Updated: %s\n", block.Updated)- if block.Content != "" {- preview := block.Content- if len(preview) > 200 {- preview = preview[:200] + "..."- }- fmt.Printf("Content: %s\n", preview)- }}return nil},diff --git a/kernel/model/search.go b/kernel/model/search.goindex b787685cc0..69a8b36450 100644--- a/kernel/model/search.go+++ b/kernel/model/search.go@@ -2264,6 +2264,8 @@ func fromSQLBlock(sqlBlock *sql.Block, terms string, beforeLen int) (block *BlocType: treenode.FromAbbrType(sqlBlock.Type),SubType: sqlBlock.SubType,Sort: sqlBlock.Sort,+ Created: sqlBlock.Created,+ Updated: sqlBlock.Updated,}if "" != sqlBlock.IAL {block.IAL = map[string]string{}diff --git a/kernel/model/search_test.go b/kernel/model/search_test.goindex 920d8e5dd4..868d736288 100644--- a/kernel/model/search_test.go+++ b/kernel/model/search_test.go@@ -20,8 +20,34 @@ import ("slices""strings""testing"++ "github.com/siyuan-note/siyuan/kernel/conf"+ "github.com/siyuan-note/siyuan/kernel/sql")+func TestFromSQLBlockMapsTimestamps(t *testing.T) {+ previousConf := Conf+ Conf = NewAppConf()+ Conf.Search = conf.NewSearch()+ t.Cleanup(func() {+ Conf = previousConf+ })++ sqlBlock := &sql.Block{+ ID: "20260722120000-abcdefg",+ Created: "20260722120000",+ Updated: "20260722123000",+ }++ block := fromSQLBlock(sqlBlock, "", 0)+ if block.Created != sqlBlock.Created {+ t.Fatalf("created = %q, want %q", block.Created, sqlBlock.Created)+ }+ if block.Updated != sqlBlock.Updated {+ t.Fatalf("updated = %q, want %q", block.Updated, sqlBlock.Updated)+ }+}+func TestValidEmbedBlockIDs(t *testing.T) {firstID := "20260721120000-block01"secondID := "20260721120001-block02"