Documentation
¶
Index ¶
- func IsResumeStale(cwd, sessionID string, maxAge time.Duration) (bool, time.Duration, error)
- func JSONLPath(cwd, sessionID string) (string, error)
- func LatestSession(cwd string, maxAge time.Duration) (string, time.Time, error)
- func NewID() string
- func ProjectSlug(cwd string) string
- type Entry
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsResumeStale ¶ added in v0.2.1
IsResumeStale reports whether the session jsonl at JSONLPath(cwd, sessionID) has not been written in at least maxAge. Returns (false, 0, nil) if the file does not exist — claude will create it, so we should not drop --resume just because the file is missing.
func JSONLPath ¶ added in v0.2.1
JSONLPath returns the absolute path to claude's session jsonl for the given cwd + sessionID. Resolves "~" via os.UserHomeDir.
func LatestSession ¶ added in v0.4.2
LatestSession returns the session ID of the most recently modified <session>.jsonl in claude's project directory for cwd. It mirrors what `/resume` inside claude would show at the top of the list: the session the user was most recently in for this working directory.
Returns ("", zero time, nil) when:
- the project directory does not yet exist (brand-new workspace)
- no .jsonl files are present
- maxAge > 0 and the newest file is older than maxAge
Other filesystem errors are surfaced.
func NewID ¶
func NewID() string
NewID generates a random UUID v4 string. Panics if the system's cryptographic random source is unavailable.
func ProjectSlug ¶ added in v0.2.1
ProjectSlug returns claude's project slug for a working directory. The slug is the folder name under ~/.claude/projects/ that holds <session-id>.jsonl files for sessions launched with that cwd.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages session ID persistence in a JSON file.