• Store an embedded directory structure in SurrealDB

    This function traverses the embedded directory tree and stores:

    • Project metadata
    • Directory nodes with hierarchical relations
    • File nodes with parent directory relations
    • Chunks with position metadata
    • Embeddings in shared embedding_store (deduplicated by content hash)
    • Graph relations connecting all entities

    All deterministic IDs are generated using SHA256 hashes with delimiters to prevent collisions.

    Uses batched operations for improved performance with progress logging.

    Parameters

    • embeddedDirectory: any

      The embedded directory structure to store

    • rootPath: string

      Original root path of the directory

    • options: StoreOptions = {}

      Storage options (model, dimensions, deleteExisting, hashDelimiter, batchSize)

    Returns Promise<StorageStats>

    Storage statistics

    const result = await embed_directory('/path/to/project');
    const stats = await store_embedded_directory(
    result.embeddedDirectory,
    '/path/to/project',
    { model: 'text-embedding-3-small', dimensions: 1536, hashDelimiter: '::', batchSize: 200 }
    );
    console.log(`Stored ${stats.chunksCreated} chunks with ${stats.embeddingsCreated} new embeddings`);