dotdir

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package dotdir manages the .tapes/ and ~/.tapes directories.

The checkout state represents a point in a conversation DAG that the user has "checked out" for resuming chat sessions. The state is persisted as a JSON file in the ~/.tapes/ directory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckoutMessage

type CheckoutMessage struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

CheckoutMessage represents a single message in the checked-out conversation.

type CheckoutState

type CheckoutState struct {
	// Hash is the hash of the checked-out node.
	Hash string `json:"hash"`

	// Messages is the conversation history in chronological order
	// (oldest first), up to and including the checked-out node.
	Messages []CheckoutMessage `json:"messages"`
}

CheckoutState represents the persisted checkout state. It contains the hash of the checked-out node and the conversation messages leading up to (and including) that node.

type Manager

type Manager struct{}

func NewManager

func NewManager() *Manager

func (*Manager) ClearCheckout

func (m *Manager) ClearCheckout(overrideDir string) error

ClearCheckout removes the checkout state file. This resets the state so the next chat session starts a new root conversation. If overrideDir is non-empty, it is used instead of the default ~/.tapes/ location. Returns nil if the file doesn't exist (already cleared).

func (*Manager) LoadCheckoutState

func (m *Manager) LoadCheckoutState(overrideDir string) (*CheckoutState, error)

LoadCheckoutState loads the checkout state from a target .tapes/checkout.json. Returns nil, nil if no checkout state exists (empty/new conversation state). If overrideDir is non-empty, it is used instead of the default ~/.tapes/ location.

func (*Manager) SaveCheckout

func (m *Manager) SaveCheckout(state *CheckoutState, overrideDir string) error

SaveCheckout persists the checkout state to a target .tapes/checkout.json.

func (*Manager) Target

func (m *Manager) Target(overrideDir string) (string, error)

Target returns the target absolute path to a .tapes/ directory. Order of precedence is as follows:

  1. Provided override
  2. Local ./.tapes/ dir
  3. Home ~/.tapes/ dir
  4. If none found, returns "", nil (i.e., the empty state)

Jump to

Keyboard shortcuts

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