session

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package session reads and moves Claude Code session transcripts, which live at <CLAUDE_CONFIG_DIR>/projects/<cwd-dir>/<sessionId>.jsonl. It lets aiacc hand a session off from one account to another: copy the transcript into the target account's projects, preserving its project directory, so `claude --resume` can pick it up there. It never touches credentials — only the transcript file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(s Info, toConfigDir string) (string, error)

Copy writes s into toConfigDir's projects, under the same project directory, so the target account can resume it. It returns the destination path. Transcripts are private (0600), and that mode is preserved.

Types

type Info

type Info struct {
	ID         string    // the session id (also the filename stem)
	Path       string    // absolute path to the .jsonl
	ProjectDir string    // the projects/<name> directory it lives in
	Modified   time.Time // file mtime — the "most recent" ordering key
}

Info identifies one session transcript.

func Find

func Find(configDir, id string) (Info, error)

Find returns the session with the given id under configDir.

func List

func List(configDir string) ([]Info, error)

List returns every session under configDir, newest first. A missing projects directory yields an empty list, not an error.

type Meta

type Meta struct {
	Cwd       string // working directory the session ran in (where to resume)
	Title     string // customTitle, else the last prompt, else ""
	GitBranch string
	Messages  int
}

Meta is the human-facing detail parsed from a transcript on demand.

func ReadMeta

func ReadMeta(path string) (Meta, error)

ReadMeta scans a transcript for its cwd, title, branch, and a rough message count. Lines can be large (pasted content), so the scanner buffer is generous.

Jump to

Keyboard shortcuts

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