app

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package app wires together the mnemos workspace layout, 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

func NewLogger

func NewLogger(verbose bool) *slog.Logger

NewLogger returns a slog text logger writing to stderr. When verbose is set the level is Debug, otherwise Info.

Types

type App

type App struct {
	Config *config.Config
	Layout workspace.Layout
	Logger *slog.Logger
	DB     *sql.DB
}

App holds the process-wide dependencies: the resolved workspace layout, parsed configuration, a structured logger, and an open database handle. Commands receive a built App rather than reaching for globals.

func Load

func Load(opts LoadOptions) (*App, error)

Load resolves the workspace layout (the single MNEMOS_DIR and every path derived from it) and loads the mnemos.toml found there. It does NOT open the database; call OpenStore once the layout is known and the directory exists.

Every location — knowledge base, capture, index database, models — is a fixed subpath of the resolved MNEMOS_DIR, so the database, writes, and the URI namespace all anchor to one place regardless of the process working directory (which an MCP client does not guarantee).

func (*App) Close

func (a *App) Close() error

Close releases the database handle if one is open.

func (*App) OpenStore

func (a *App) OpenStore(allowCreate bool) error

OpenStore opens the workspace index 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, add, 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.

func (*App) TreeRoot

func (a *App) TreeRoot() string

TreeRoot returns the knowledge base root (MNEMOS_DIR/kb): the directory caller-supplied paths for capture, forget, and move are resolved relative to and confined within, and the base of every citation URI.

type LoadOptions added in v0.3.0

type LoadOptions struct {
	// ConfigPath is --config: an explicit mnemos.toml whose directory becomes the
	// MNEMOS_DIR. Empty means resolve by --mnemos-dir / $MNEMOS_DIR / project /
	// default (see workspace.Resolve).
	ConfigPath string
	// MnemosDir is --mnemos-dir: an explicit MNEMOS_DIR.
	MnemosDir string
	Verbose   bool
}

LoadOptions carries the workspace-selection inputs from the root flags.

Jump to

Keyboard shortcuts

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