Documentation
¶
Overview ¶
Package app wires together the mnemos configuration, logger, and storage into a single App value shared across CLI commands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
type App struct {
Config *config.Config
Logger *slog.Logger
DB *sql.DB
// contains filtered or unexported fields
}
App holds the process-wide dependencies: parsed configuration, a structured logger, and an open database handle. Commands receive a built App rather than reaching for globals.
func Load ¶
Load builds an App: it resolves and layers configuration (defaults, then ~/.mnemos.toml and ./.mnemos.toml, or the explicit configPath when set) and constructs the logger. It does NOT open the database; call OpenStore once the storage path is known and the directory exists.
A relative storage.path is resolved here, once, against the same tree root as capture/forget/move (the --config directory, or the current directory in auto-discovery mode) so the stored path is absolute and every command, log line, and error message shares a single source of truth. Without this, a relative path silently followed the process cwd — which, for an MCP stdio server launched by a client, is not the project directory.
func (*App) OpenStore ¶
OpenStore opens the configured SQLite database and runs migrations, storing the handle on the App. Callers are responsible for ensuring the parent directory exists.
allowCreate gates database creation. Write/populate commands (init, ingest, watch, okfy) pass true and may create a fresh database. Read commands (serve, search, ls, status, task, reindex, forget, mv) pass false: if the database is absent or empty, OpenStore returns an actionable error rather than letting the SQLite driver silently create an empty database — the failure mode that made a misconfigured MCP server return no results while appearing to work.