MCPcopy Create free account
hub / github.com/astercloud/aster / Save

Method Save

pkg/memory/project/file_store.go:47–65  ·  view source on GitHub ↗

Save 保存项目记忆

(ctx context.Context, memory *ProjectMemory)

Source from the content-addressed store, hash-verified

45
46// Save 保存项目记忆
47func (s *FileStore) Save(ctx context.Context, memory *ProjectMemory) error {
48 filePath := s.getFilePath(memory.ProjectID)
49
50 // 确保目录存在
51 dir := filepath.Dir(filePath)
52 if err := os.MkdirAll(dir, 0755); err != nil {
53 return fmt.Errorf("create directory failed: %w", err)
54 }
55
56 // 生成 Markdown 内容
57 content := s.generateMarkdown(memory)
58
59 // 写入文件
60 if err := os.WriteFile(filePath, []byte(content), 0644); err != nil {
61 return fmt.Errorf("write file failed: %w", err)
62 }
63
64 return nil
65}
66
67// Delete 删除项目记忆
68func (s *FileStore) Delete(ctx context.Context, projectID string) error {

Callers 3

AppendEntryMethod · 0.95
UpdateWorkflowStepMethod · 0.95
RecordParamsMethod · 0.95

Calls 2

getFilePathMethod · 0.95
generateMarkdownMethod · 0.95

Tested by

no test coverage detected