paths

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntireDir         = ".entire"
	EntireTmpDir      = ".entire/tmp"
	EntireMetadataDir = ".entire/metadata"
)

Directory constants

View Source
const (
	ContextFileName          = "context.md"
	PromptFileName           = "prompt.txt"
	SummaryFileName          = "summary.txt"
	TranscriptFileName       = "full.jsonl"
	TranscriptFileNameLegacy = "full.log"
	MetadataFileName         = "metadata.json"
	CheckpointFileName       = "checkpoint.json"
	ContentHashFileName      = "content_hash.txt"
	SettingsFileName         = "settings.json"
)

Metadata file names

View Source
const MetadataBranchName = "entire/checkpoints/v1"

MetadataBranchName is the orphan branch used by auto-commit and manual-commit strategies to store metadata

Variables

This section is empty.

Functions

func AbsPath

func AbsPath(relPath string) (string, error)

AbsPath returns the absolute path for a relative path within the repository. If the path is already absolute, it is returned as-is. Uses RepoRoot() to resolve paths relative to the repository root.

func CheckpointPath deprecated

func CheckpointPath(checkpointID id.CheckpointID) string

CheckpointPath returns the sharded storage path for a checkpoint ID. Uses first 2 characters as shard (256 buckets), remaining as folder name. Example: "a3b2c4d5e6f7" -> "a3/b2c4d5e6f7"

Deprecated: Use checkpointID.Path() directly instead.

func ClearRepoRootCache

func ClearRepoRootCache()

ClearRepoRootCache clears the cached repository root. This is primarily useful for testing when changing directories.

func ExtractSessionIDFromTranscriptPath

func ExtractSessionIDFromTranscriptPath(transcriptPath string) string

ExtractSessionIDFromTranscriptPath attempts to extract a session ID from a transcript path. Claude transcripts are stored at ~/.claude/projects/<project>/sessions/<id>.jsonl If the path doesn't match expected format, returns empty string.

func GetClaudeProjectDir

func GetClaudeProjectDir(repoPath string) (string, error)

GetClaudeProjectDir returns the directory where Claude stores session transcripts for the given repository path.

In test environments, set ENTIRE_TEST_CLAUDE_PROJECT_DIR to override the default location.

func GetLastTimestampFromBytes

func GetLastTimestampFromBytes(data []byte) time.Time

GetLastTimestampFromBytes extracts the timestamp from the last non-empty line of JSONL content. Returns zero time if not found.

func GetLastTimestampFromFile

func GetLastTimestampFromFile(path string) time.Time

GetLastTimestampFromFile reads the last non-empty line from a JSONL file and extracts the timestamp field. Returns zero time if file doesn't exist or no valid timestamp is found.

func GetWorktreeID

func GetWorktreeID(worktreePath string) (string, error)

GetWorktreeID returns the internal git worktree identifier for the given path. For the main worktree (where .git is a directory), returns empty string. For linked worktrees (where .git is a file), extracts the name from .git/worktrees/<name>/ path. This name is stable across `git worktree move`.

func IsInfrastructurePath

func IsInfrastructurePath(path string) bool

IsInfrastructurePath returns true if the path is part of CLI infrastructure (i.e., inside the .entire directory)

func ParseTimestampFromJSONL

func ParseTimestampFromJSONL(line string) time.Time

ParseTimestampFromJSONL extracts the timestamp from a JSONL line. Returns zero time if the line is empty or doesn't contain a valid timestamp.

func RepoRoot

func RepoRoot() (string, error)

RepoRoot returns the git repository root directory. Uses 'git rev-parse --show-toplevel' which works from any subdirectory. The result is cached per working directory. Returns an error if not inside a git repository.

func RepoRootOr

func RepoRootOr(fallback string) string

RepoRootOr returns the git repository root directory, or the current directory if not inside a git repository. This is useful for functions that need a fallback.

func SanitizePathForClaude

func SanitizePathForClaude(path string) string

SanitizePathForClaude converts a path to Claude's project directory format. Claude replaces any non-alphanumeric character with a dash.

func SessionMetadataDirFromSessionID

func SessionMetadataDirFromSessionID(sessionID string) string

SessionMetadataDirFromSessionID returns the path to a session's metadata directory for the given Entire session ID. The sessionID must be the full, already date-prefixed Entire session identifier as stored on disk, not an agent-specific or raw Claude ID.

func ToRelativePath

func ToRelativePath(absPath, cwd string) string

ToRelativePath converts an absolute path to relative. Returns empty string if the path is outside the working directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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