reader

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package reader — extension methods for the 98-feature implementation. These add search, prompt history, rendered commits, and filtering capabilities on top of the existing Reader interface.

Package reader adapts Devin CLI's internal SQLite schema to model types.

It isolates schema-specific SQL/JSON parsing so that reports and UI never touch the raw DB. When Devin CLI changes its schema, only this package needs a new adapter (e.g. v2.go) selected by DetectSchemaVersion.

Index

Constants

View Source
const MaxSupportedSchema = 999 // current schema has no version row; treat as v1

MaxSupportedSchema is the highest refinery schema version we understand. Bump when a new adapter is added.

Variables

This section is empty.

Functions

func DetectSchemaVersion

func DetectSchemaVersion(dbPath string) (int, error)

DetectSchemaVersion reads refinery_schema_history max(version). Returns 0 if the table is empty or missing (treated as v1 baseline).

func IsTTY

func IsTTY(fd uintptr) bool

IsTTY reports whether the given fd is a terminal.

func ResolveDBPath

func ResolveDBPath(dataDir string) (string, error)

ResolveDBPath finds sessions.db across platforms.

Order: dataDir arg > DEVIN_DATA_DIR env > platform defaults.

func SortedToolNames

func SortedToolNames(tc map[string]int) []string

SortedToolNames returns tool names sorted by count desc, for stable display.

Types

type ErrNoDB

type ErrNoDB struct{ Path string }

ErrNoDB is returned when sessions.db cannot be located.

func (*ErrNoDB) Error

func (e *ErrNoDB) Error() string

type ErrSchemaUnsupported

type ErrSchemaUnsupported struct{ Ver, Max int }

ErrSchemaUnsupported is returned when the schema version exceeds our adapters.

func (*ErrSchemaUnsupported) Error

func (e *ErrSchemaUnsupported) Error() string

type Reader

type Reader interface {
	// Sessions returns all sessions (newest first), with messages aggregated.
	Sessions() ([]model.Session, error)
	// Session returns a single session by ID, with messages.
	Session(id string) (*model.Session, error)
	// SchemaVersion returns the detected refinery schema version (0 if none).
	SchemaVersion() int
	// DBPath returns the resolved database path.
	DBPath() string
	// Close releases any resources.
	Close() error
}

Reader reads normalized data from Devin CLI's session store.

func Open

func Open(dataDir string) (Reader, error)

Open auto-detects the DB path and returns a Reader for the current schema. dataDir overrides the auto-detected directory when non-empty.

Jump to

Keyboard shortcuts

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