export

package
v0.107.6 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 12 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 export writes Caprock's normalized record out as a flat table.

Five agents write five undocumented formats — Claude Code JSONL and hooks, Codex rollouts, OpenCode's SQLite, Gemini's telemetry file, DeepSeek — and ingest turns all of them into the same rows. This package is the way back out: one stable, documented column set (docs/schema.md) per table, so a spreadsheet, a notebook or a warehouse reads every agent the same way.

It reads the database directly and read-only. That is what lets it run with the daemon down, and it is why it never writes: the export is a view of the record, not a second owner of it.

Index

Constants

This section is empty.

Variables

View Source
var (
	Tables  = []string{"events", "sessions"}
	Formats = []string{"tsv", "csv", "jsonl"}
	Agents  = []string{"claude", "codex", "opencode", "gemini", "deepseek"}
)

Tables and formats the command accepts.

Functions

func OpenReadOnly

func OpenReadOnly(path string) (*sql.DB, error)

OpenReadOnly opens the database at path without the ability to write it. The path goes through a file: URI so a space (macOS "Application Support"), a '#' or a '?' cannot be read as part of the query string, and a Windows drive path is spelled the way SQLite's URI parser expects (file:///C:/…).

func ParseSince

func ParseSince(s string, now time.Time) (time.Time, error)

ParseSince reads "30d", "12h", "90m" (relative to now) or a date "2006-01-02" (midnight, local time).

func Write

func Write(ctx context.Context, db *sql.DB, w io.Writer, o Options) (int64, error)

Write streams the selected table to w and returns the number of data rows.

Types

type Options

type Options struct {
	Table   string    // "events" (default) or "sessions"
	Format  string    // "tsv" (default), "csv" or "jsonl"
	Since   time.Time // zero: everything
	Agent   string    // empty: every agent
	Payload bool      // events only, jsonl only: include the raw source payload
}

Options selects what is written.

Jump to

Keyboard shortcuts

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