vein-database 0.1.0

Database layer for Vein - shared memory system for AI agents and tools
Documentation
use anyhow::Result;
use std::fs;
use crate::paths::Paths;

pub fn list_model_tables() -> Result<Vec<String>> {
    let db_path = Paths::get_insights_db();

    if !db_path.exists() {
        return Ok(Vec::new());
    }

    let mut tables = Vec::new();

    for entry in fs::read_dir(db_path)? {
        let entry = entry?;
        let path = entry.path();

        if path.is_dir()
            && let Some(name) = path.file_name()
            && let Some(name_str) = name.to_str() {
                // Remove .lance suffix if present to get clean table name
                let clean_name = if name_str.ends_with(".lance") {
                    name_str.trim_end_matches(".lance")
                } else {
                    name_str
                };
                tables.push(clean_name.to_string());
        }
    }

    tables.sort();
    Ok(tables)
}