backend

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package backend wires the app layer to a concrete store. LocalBackend opens the embedded SQLite database and constructs every app with the right dependencies. The CLI, server, and MCP surface all call into the same backend — nothing above this package reaches into the store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bootstrap

func Bootstrap(home string) (*sql.DB, *sqlite.Store, error)

Bootstrap opens the database at home without reading config.yaml. It runs migrations and returns a store the caller can use to seed state (e.g. `brainjar init` creating the default workspace). The caller is responsible for closing DB.

Types

type LocalBackend

type LocalBackend struct {
	WorkspaceID models.WorkspaceID
	Home        string

	DB    *sql.DB
	Store *sqlite.Store

	Souls    *apps.SoulApp
	Personas *apps.PersonaApp
	Rules    *apps.RuleApp
	Brains   *apps.BrainApp
	State    *apps.StateApp
	Compose  *apps.ComposeApp
	Versions *apps.VersionApp
	Admin    *apps.AdminApp
}

LocalBackend is the SQLite-backed, single-workspace backend.

func Open

func Open(home string) (*LocalBackend, error)

Open opens the SQLite database under home, runs pending migrations, loads the config to resolve the workspace ID, and wires every app. Returns an error if home has no config — call Bootstrap first.

func (*LocalBackend) Close

func (b *LocalBackend) Close() error

Close closes the underlying database connection.

Jump to

Keyboard shortcuts

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