Documentation
¶
Overview ¶
Package lighthouse exposes the local Lighthouse database to Go programs.
Open a database path once, use Database methods with a context, and close it when finished. Applications can import this package directly or install the CLI separately with `go install github.com/paulwritescode/lighthouse/cmd/lighthouse@latest`.
Index ¶
- func DefaultDatabasePath() (string, error)
- type Artifact
- type ArtifactInput
- type ChangeEvent
- type ContextPack
- type Counts
- type Database
- func (db *Database) Audit(ctx context.Context, limit int) ([]ChangeEvent, error)
- func (db *Database) Close() error
- func (db *Database) Counts(ctx context.Context) (Counts, error)
- func (db *Database) CreateArtifact(ctx context.Context, input ArtifactInput) (Artifact, error)
- func (db *Database) CreateMemory(ctx context.Context, input MemoryInput) (Memory, error)
- func (db *Database) DeleteArtifact(ctx context.Context, id string) error
- func (db *Database) DeleteMemory(ctx context.Context, id string) error
- func (db *Database) GetArtifact(ctx context.Context, id string) (Artifact, error)
- func (db *Database) GetMemory(ctx context.Context, id string) (Memory, error)
- func (db *Database) ListArtifacts(ctx context.Context, project string, limit int) ([]Artifact, error)
- func (db *Database) ListMemory(ctx context.Context, project string, limit int) ([]Memory, error)
- func (db *Database) LoadMemory(ctx context.Context, session, project string, limit int) (ContextPack, error)
- func (db *Database) SearchArtifacts(ctx context.Context, query, project string, limit int) ([]Artifact, error)
- func (db *Database) UpdateArtifact(ctx context.Context, id string, fields map[string]any) (Artifact, error)
- func (db *Database) UpdateMemory(ctx context.Context, id string, input MemoryInput) error
- type Memory
- type MemoryInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDatabasePath ¶
DefaultDatabasePath returns the path used by the Lighthouse CLI, honoring LIGHTHOUSE_DB before the operating-system user configuration directory.
Types ¶
type ArtifactInput ¶
type ArtifactInput struct {
Title string
Content string
Project string
Agent string
Kind string
Fields map[string]any
}
ArtifactInput contains the indexed fields and optional per-record JSON fields.
type ContextPack ¶
type ContextPack = store.ContextPack
ContextPack contains the context and sources loaded for a project or session.
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database is a handle to one local Lighthouse SQLite database.
func Open ¶
Open opens or creates a Lighthouse SQLite database at path and applies the current Lighthouse migrations. Use ":memory:" for an ephemeral database.
func OpenDefault ¶
OpenDefault opens the same database file used by the CLI by default.
func (*Database) CreateArtifact ¶
CreateArtifact creates an indexed result with optional JSON-compatible fields.
func (*Database) CreateMemory ¶
CreateMemory creates or updates a memory item with the same project/key.
func (*Database) DeleteArtifact ¶
DeleteArtifact removes an artifact and records an audit event.
func (*Database) DeleteMemory ¶
DeleteMemory retracts a memory item and records an audit event.
func (*Database) GetArtifact ¶
GetArtifact returns an artifact by its stable ID.
func (*Database) ListArtifacts ¶
func (db *Database) ListArtifacts(ctx context.Context, project string, limit int) ([]Artifact, error)
ListArtifacts returns the most recently created artifacts in the project scope.
func (*Database) ListMemory ¶
ListMemory returns active memory items in the requested project scope.
func (*Database) LoadMemory ¶
func (db *Database) LoadMemory(ctx context.Context, session, project string, limit int) (ContextPack, error)
LoadMemory creates a context snapshot for the session and project.
func (*Database) SearchArtifacts ¶
func (db *Database) SearchArtifacts(ctx context.Context, query, project string, limit int) ([]Artifact, error)
SearchArtifacts finds artifacts by full text and optional project scope.
func (*Database) UpdateArtifact ¶
func (db *Database) UpdateArtifact(ctx context.Context, id string, fields map[string]any) (Artifact, error)
UpdateArtifact applies indexed attributes and merges JSON fields by key.
func (*Database) UpdateMemory ¶
UpdateMemory replaces the selected memory item's key, body, scope, and metadata.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
lighthouse
command
|
|
|
internal
|
|
|
codecall
Package codecall provides a constrained Starlark interface to Lighthouse.
|
Package codecall provides a constrained Starlark interface to Lighthouse. |
|
transfer
Package transfer handles portable Lighthouse exports.
|
Package transfer handles portable Lighthouse exports. |