Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mode ¶
type Mode string
Mode selects which backend the binary runs.
const ( // ModeLocal runs the single-binary SQLite + stdio-MCP path. // This is byte-identical to pre-v2 behavior. ModeLocal Mode = "local" // ModeServer runs the multi-tenant PostgreSQL + authenticated HTTP path. // cmd/cortex is the sole bridge to the server composition root. ModeServer Mode = "server" )
DefaultMode is used when no --mode flag is provided on the command line.
func ParseMode ¶
ParseMode extracts the --mode flag from args, returning the resolved Mode and a cleaned copy of args with the flag removed.
When --mode is absent, DefaultMode (ModeLocal) is returned and args are returned unchanged (same slice values, no allocation).
Supports both syntactic forms:
cortex --mode local <command> (space-separated) cortex --mode=local <command> (equals form)
The flag may appear before or after the subcommand without affecting downstream argument parsing in internal/cli.
type Runtime ¶
type Runtime struct {
// App is the local-mode composition root from internal/app.
// Non-nil when Mode == ModeLocal; nil for server mode.
App *app.App
}
Runtime holds the wired services for the selected Mode.
This type is the local composition selector. The server runtime is owned by internal/platform/server and wired directly by cmd/cortex.
func Local ¶
Local wires the local-mode Runtime by delegating to app.Open.
This function MUST NOT duplicate or alter app wiring. It calls app.Open with the exact same (ctx, opts) arguments, preserving byte-identical local behavior: the same SQLite database, the same store bundle, the same config defaults, the same archival lifecycle, the same stdio-MCP transport.
The returned Runtime wraps the *app.App unchanged.
func Select ¶
Select wires the Runtime for the given Mode.
ModeLocal → delegates to Local, which calls app.Open byte-identically
(same SQLite database, same stores, same config defaults).
ModeServer returns an error because this local-only API intentionally cannot import the server composition root. cmd/cortex performs that bridge.