browse

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSNode

type FSNode struct {
	Name      string
	Type      string // "dir" or "file"
	Children  []*FSNode
	MemoryID  string
	Content   string
	CreatedAt time.Time
}

FSNode represents a node in the memory filesystem tree.

type MemoryFS

type MemoryFS struct {
	Root *FSNode
	// contains filtered or unexported fields
}

MemoryFS provides a filesystem-style interface for browsing memories.

func NewMemoryFS

func NewMemoryFS() *MemoryFS

NewMemoryFS creates a new MemoryFS with an empty root directory.

func (*MemoryFS) Add

func (fs *MemoryFS) Add(path string, item MemoryItem) error

Add inserts a memory item at the specified path. Intermediate directories are created as needed. The final path component becomes the file name.

func (*MemoryFS) BuildFromMemories

func (fs *MemoryFS) BuildFromMemories(memories []MemoryItem) *MemoryFS

BuildFromMemories organizes flat memory items into a tree structure grouped by Category (first level directory) and Type (second level directory). Each memory becomes a file node named by its ID.

func (*MemoryFS) Get

func (fs *MemoryFS) Get(path string) *FSNode

Get returns the node at the given path, similar to `cat` for files.

func (*MemoryFS) List

func (fs *MemoryFS) List(path string) []*FSNode

List returns the children of the directory at the given path, similar to `ls`. Returns nil if the path does not exist or is not a directory.

func (*MemoryFS) Remove

func (fs *MemoryFS) Remove(path string) error

Remove deletes the node at the specified path.

func (*MemoryFS) Search

func (fs *MemoryFS) Search(query string) []*FSNode

Search finds nodes whose Name or Content contains the query string (case-insensitive). Returns all matching nodes.

func (*MemoryFS) Tree

func (fs *MemoryFS) Tree(path string, depth int) string

Tree returns a visual tree representation of the filesystem starting at the given path, up to the specified depth. Use depth <= 0 for unlimited depth.

type MemoryItem

type MemoryItem struct {
	ID        string
	Content   string
	Category  string
	Type      string
	CreatedAt time.Time
}

MemoryItem represents a flat memory entry to be organized into the filesystem.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL