prompt

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTemplate = `` /* 1418-byte string literal not displayed */

DefaultTemplate is the built-in journal entry prompt

Variables

This section is empty.

Functions

func Render

func Render(tmpl string, ctx *Context) (string, error)

Render executes a template string with the given context

func RenderDefault

func RenderDefault(ctx *Context) (string, error)

RenderDefault renders the default template with the given context

Types

type Context

type Context struct {
	Persona       string
	Timestamp     time.Time
	Uptime        string
	CPUPercent    float64
	MemoryPercent float64
	MemoryUsedGB  float64
	MemoryTotalGB float64
	DiskPercent   float64
	DiskUsedGB    float64
	DiskTotalGB   float64

	// Optional metrics (check with HasX methods in templates)
	LoadAverage1  *float64
	LoadAverage5  *float64
	LoadAverage15 *float64
	SwapPercent   *float64
	SwapUsedGB    *float64
	SwapTotalGB   *float64
	ProcessCount  *int
	NetworkSentGB *float64
	NetworkRecvGB *float64
	BatteryPct    *float64
	BatteryChg    *bool
}

Context holds all the data available to a prompt template

func NewContext

func NewContext(personaDescription string, snapshot *metrics.Snapshot) *Context

NewContext creates a prompt context from a persona description and metrics snapshot

func (*Context) HasBattery added in v0.0.3

func (c *Context) HasBattery() bool

HasBattery returns true if battery data is available

func (*Context) HasLoadAverage added in v0.0.3

func (c *Context) HasLoadAverage() bool

HasLoadAverage returns true if load average data is available

func (*Context) HasNetwork added in v0.0.3

func (c *Context) HasNetwork() bool

HasNetwork returns true if network I/O data is available

func (*Context) HasProcessCount added in v0.0.3

func (c *Context) HasProcessCount() bool

HasProcessCount returns true if process count is available

func (*Context) HasSwap added in v0.0.3

func (c *Context) HasSwap() bool

HasSwap returns true if swap data is available

Jump to

Keyboard shortcuts

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