project

package
v0.9.39 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrProjectUnavailable = errors.New("project directory is unavailable")

Functions

func AssignSessionForDir

func AssignSessionForDir(ctx context.Context, store session.Store, sess *session.Session, dir string) (*session.Project, error)

AssignSessionForDir fills an unassigned session's project identity from its execution directory. Lack of project support or a matching active project is a normal no-op.

func CanonicalStoragePath

func CanonicalStoragePath(path string) string

CanonicalStoragePath normalizes a project path for durable identity.

func CanonicalStoragePathForOS

func CanonicalStoragePathForOS(path, goos string) string

CanonicalStoragePathForOS exposes deterministic platform normalization for tests.

func ClaimMatchingSessions

func ClaimMatchingSessions(ctx context.Context, store session.Store, p session.Project) (int, error)

ClaimMatchingSessions assigns every still-unassigned matching session to p. It is idempotent and safe to race with session creation or another repair.

func MatchesWorkspace

func MatchesWorkspace(ctx context.Context, cwd, worktreeDir string, project Resolved) bool

MatchesWorkspace reports whether an immutable session execution snapshot belongs to project. Git snapshots resolve to the main repository; non-Git projects require an exact resolved directory match.

func MatchingSessions

func MatchingSessions(ctx context.Context, store session.Store, p session.Project) ([]session.ProjectSessionMatch, error)

MatchingSessions returns prevalidated, currently unassigned session workspaces belonging to p. The store rechecks each snapshot when claiming it.

func MatchingSessionsForResolved

func MatchingSessionsForResolved(ctx context.Context, store session.Store, root Resolved) ([]session.ProjectSessionMatch, error)

MatchingSessionsForResolved finds unassigned snapshots for a validated root. It is also used before the first bootstrap project has received an identity.

func ReconcileAll

func ReconcileAll(ctx context.Context, store session.Store) (int, error)

ReconcileAll claims historical unassigned sessions for every active, currently available project. Unavailable project paths are skipped so a later run can repair them when the filesystem is mounted again.

func SameIdentity

func SameIdentity(actual, stored string) bool

SameIdentity compares two already-canonical project paths using platform identity rules.

func SamePath

func SamePath(a, b string) bool

SamePath compares filesystem paths after best-effort canonicalization.

Types

type Resolved

type Resolved struct {
	CanonicalDir string `json:"canonical_dir"`
	DefaultName  string `json:"default_name"`
	Git          bool   `json:"git"`
}

Resolved is the canonical identity of a registered project directory.

func Resolve

func Resolve(ctx context.Context, path string) (Resolved, error)

Resolve validates path and reduces Git checkouts and linked worktrees to the canonical main repository root. Non-Git directories retain their exact path.

Jump to

Keyboard shortcuts

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