Load 加载项目记忆
(ctx context.Context, projectID string)
| 29 | |
| 30 | // Load 加载项目记忆 |
| 31 | func (s *FileStore) Load(ctx context.Context, projectID string) (*ProjectMemory, error) { |
| 32 | filePath := s.getFilePath(projectID) |
| 33 | |
| 34 | content, err := os.ReadFile(filePath) |
| 35 | if err != nil { |
| 36 | if os.IsNotExist(err) { |
| 37 | return nil, fmt.Errorf("project memory not found: %s", projectID) |
| 38 | } |
| 39 | return nil, fmt.Errorf("read file failed: %w", err) |
| 40 | } |
| 41 | |
| 42 | // 解析 Markdown 内容 |
| 43 | return s.parseMarkdown(projectID, string(content)) |
| 44 | } |
| 45 | |
| 46 | // Save 保存项目记忆 |
| 47 | func (s *FileStore) Save(ctx context.Context, memory *ProjectMemory) error { |
no test coverage detected