Documentation
¶
Index ¶
- func FindSessions(dir string, opts FindOptions) ([]Session, ScanReport, error)
- func NormalizeGitHubRemote(remote string) (string, error)
- func RepoRoot(dir string) (string, error)
- func VerifyRepositoryRoots(ctx context.Context, fullName string, candidates []string) []string
- type FindOptions
- type Repository
- type ScanReport
- type Session
- type SessionFile
- type SkippedFile
- type Store
- type StoreOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindSessions ¶
func FindSessions(dir string, opts FindOptions) ([]Session, ScanReport, error)
FindSessions returns the local Claude Code, Codex, and Cursor sessions relevant to the git repository containing dir, ordered by modification time: those whose recorded working directory is the checkout containing dir, one of opts.Worktrees or opts.PreviousPaths, or a directory inside one of them. The report names every session file discovery had to drop.
func NormalizeGitHubRemote ¶
NormalizeGitHubRemote converts a supported GitHub origin URL to owner/name.
Types ¶
type FindOptions ¶
type FindOptions struct {
// ClaudeProjectsDir overrides the Claude Code session store
// (default ~/.claude/projects).
ClaudeProjectsDir string
// CodexSessionsDir overrides the Codex session store
// (default ~/.codex/sessions).
CodexSessionsDir string
// CursorStorePaths overrides Cursor state store discovery. Each entry is
// either a state.vscdb file or a directory searched for one; empty means
// the default global Cursor store.
CursorStorePaths []string
// PreviousPaths are directories the repository previously lived at.
PreviousPaths []string
// Worktrees are the clone's working trees, the main one first, as
// gitlocal.Worktrees lists them. A session recorded in any of them belongs
// to the repository, whichever of them dir is in. Empty means only the
// checkout containing dir, and the worktrees git remembers inside it.
Worktrees []string
// ClaudeHeads, when set, remembers each Claude Code transcript's head
// between calls, so an unchanged transcript is not opened again.
ClaudeHeads *claudecode.HeadCache
// CodexCache remembers each Codex rollout's first record between calls and,
// within one of its passes, the scan of the store. Nil uses codex.Shared,
// the process-wide cache.
CodexCache *codex.Cache
// Since skips Claude Code transcripts and Cursor conversations last
// modified before it without opening them. Zero keeps every session.
Since time.Time
// ExcludeNestedClones drops sessions that ran in an independent clone
// nested inside one of the roots: they belong to that clone's own
// repository. Uploads set it, so a session is sent to one repository only.
ExcludeNestedClones bool
}
type Repository ¶
type Repository struct {
FullName string
Root string
SessionCount int
LatestSession time.Time
OtherCheckouts []string
Roots []string
}
Repository is a local Git checkout referenced by one or more agent sessions.
type ScanReport ¶
type ScanReport = model.ScanReport
Session and SessionFile are the shared discovery result shape.
func FindRepositories ¶
func FindRepositories(ctx context.Context, opts StoreOptions) (map[string]Repository, ScanReport, error)
FindRepositories maps whole-machine session metadata to GitHub checkouts. When multiple checkouts have the same origin, the one with more sessions (or the newest session on a tie) wins and the alternatives remain reportable.
type SessionFile ¶
type SessionFile = model.SessionFile
Session and SessionFile are the shared discovery result shape.
type SkippedFile ¶
type SkippedFile = model.SkippedFile
Session and SessionFile are the shared discovery result shape.
type Store ¶
type Store struct {
Source vendors.Slug `json:"source"`
Path string `json:"path"`
// ModifiedAt is the file's last modification time, and the only cheap
// signal for filtering by recency before a store is parsed.
ModifiedAt time.Time `json:"modified_at"`
SizeBytes int64 `json:"size_bytes"`
}
Store is one local file holding agent session data. Most sources write one session per file; Cursor keeps every session of an editor profile in a single SQLite state store, so a store is not the same thing as a session.
func FindStores ¶
func FindStores(opts StoreOptions) ([]Store, error)
FindStores locates every local agent session store on this machine, without scoping to a repository. It is the discovery path for whole-machine reporting; FindSessions remains the repository-scoped path used for backfill and upload, where one file must map to exactly one session.
Missing stores yield no results rather than an error, so the search works on a machine that has only some of these tools installed.
type StoreOptions ¶
type StoreOptions struct {
// ClaudeProjectsDir overrides the Claude Code session store
// (default ~/.claude/projects).
ClaudeProjectsDir string
// CodexSessionsDir overrides the Codex session store
// (default ~/.codex/sessions).
CodexSessionsDir string
// CursorStorePaths overrides Cursor state store discovery. Each entry is
// either a `state.vscdb` file or a directory searched for one.
CursorStorePaths []string
// Sources restricts the search; empty means every known source.
Sources []vendors.Slug
// Since and Until, when set, bound a store's modification time.
Since time.Time
Until time.Time
}
StoreOptions configures FindStores.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package entire finds Entire checkpoints in the user's own clone.
|
Package entire finds Entire checkpoints in the user's own clone. |
|
Package entirearchive reads bounded checkpoint archives independently of Git transport.
|
Package entirearchive reads bounded checkpoint archives independently of Git transport. |