/** * Project detection utilities * * Detects project identity from git repo or filesystem path. * Handles git worktrees by finding the main repository. */ export interface ProjectInfo { /** Unique resource ID for this project (used for thread grouping) */ resourceId: string; /** Human-readable project name */ name: string; /** Absolute path to the project root */ rootPath: string; /** Git remote URL if available */ gitUrl?: string; /** Current git branch */ gitBranch?: string; /** Whether this is a git worktree */ isWorktree: boolean; /** Path to main git repo (different from rootPath if worktree) */ mainRepoPath?: string; /** Whether the resourceId was explicitly overridden (env var or config) */ resourceIdOverride?: boolean; } /** * Detect project info from a directory path */ export declare function detectProject(projectPath: string): ProjectInfo; /** * Get the current git branch for a given directory. * Lightweight alternative to detectProject() for refreshing just the branch. */ export declare function getCurrentGitBranch(cwd: string): string | undefined; /** * Async version of getCurrentGitBranch — avoids blocking the event loop * with execSync. Falls back to undefined on any failure. */ export declare function getCurrentGitBranchAsync(cwd: string): Promise; /** * Get the application data directory for mastracode * - macOS: ~/Library/Application Support/mastracode * - Linux: ~/.local/share/mastracode * - Windows: %APPDATA%/mastracode */ export declare function getAppDataDir(): string; /** * Get the database path for mastracode * Can be overridden with the MASTRA_DB_PATH environment variable for debugging. */ export declare function getDatabasePath(): string; /** * Get the vector database path for mastracode. * Separate from the main DB to avoid bloating it with embedding data. */ export declare function getVectorDatabasePath(): string; /** * Get the observability DuckDB database path for mastracode. * Separate from the main DB — DuckDB is used for OLAP-style trace/score/feedback queries. * Can be overridden with the MASTRA_OBSERVABILITY_DB_PATH environment variable. */ export declare function getObservabilityDatabasePath(): string; import type { StorageSettings } from '../onboarding/settings.js'; /** * LibSQL storage configuration. */ export interface LibSQLStorageConfig { backend: 'libsql'; url: string; authToken?: string; isRemote: boolean; } /** * PostgreSQL storage configuration. */ export interface PgStorageConfig { backend: 'pg'; connectionString?: string; host?: string; port?: number; database?: string; user?: string; password?: string; schemaName?: string; disableInit?: boolean; skipDefaultIndexes?: boolean; } /** * Resolved storage configuration for either backend. */ export type StorageConfig = LibSQLStorageConfig | PgStorageConfig; /** * Get the resolved storage configuration. * * Priority (highest to lowest): * 1. Environment variables: MASTRA_STORAGE_BACKEND + backend-specific vars * 2. Global settings (from /settings): settings.storage * 3. Legacy config files: .mastracode/database.json (LibSQL only) * 4. Local file database (LibSQL default) * * For PG, the env vars are: * MASTRA_STORAGE_BACKEND=pg * MASTRA_PG_CONNECTION_STRING or MASTRA_PG_HOST/PORT/DATABASE/USER/PASSWORD * MASTRA_PG_SCHEMA_NAME (optional) * * For LibSQL, the legacy env vars still work: * MASTRA_DB_URL + MASTRA_DB_AUTH_TOKEN */ export declare function getStorageConfig(projectDir?: string, storageSettings?: StorageSettings, configDirName?: string): StorageConfig; /** * Get the current user identity. * * Priority: * 1. MASTRA_USER_ID environment variable * 2. git config user.email (from project dir or global) * 3. OS username as fallback */ export declare function getUserId(projectDir?: string): string; /** * Get the current user's display name. * * Priority: * 1. git config user.name * 2. OS username as fallback */ export declare function getUserName(projectDir?: string): string; /** * Observational memory scope: "thread" (per-conversation) or "resource" (shared across threads). */ export type OmScope = 'thread' | 'resource'; /** * Get the configured observational memory scope. * * Priority: * 1. MASTRA_OM_SCOPE environment variable ("thread" or "resource") * 2. Project config: .mastracode/database.json → omScope * 3. Global config: ~/.mastracode/database.json → omScope * 4. Default: "thread" */ export declare function getOmScope(projectDir?: string, configDirName?: string): OmScope; /** * Get an explicit resource ID override, if configured. * * Resource IDs act as shared tags — two users who set the same resourceId * will share threads and observations for that resource. * * Priority: * 1. MASTRA_RESOURCE_ID environment variable * 2. Project config: .mastracode/database.json → resourceId * 3. Global config: ~/.mastracode/database.json → resourceId * 4. null (use auto-detected value) */ export declare function getResourceIdOverride(projectDir?: string, configDirName?: string): string | null; //# sourceMappingURL=project.d.ts.map