projectid

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: CC0-1.0 Imports: 10 Imported by: 0

Documentation

Overview

Package projectid resolves the canonical identity of the project a prosa session ran in. See INTENT.md §5 for the contract:

  1. `git remote get-url origin` on the session's cwd → canonical URL. Stable cross-device: two clones of the same repo on two machines end up with the same project_remote.
  2. .prosa.yaml in cwd or any ancestor, with `project: <name>` → marker. Explicit override for repos without a shared remote (private vendor drops, monorepos with per-subdir projects, …).
  3. cwd itself, marked "unscoped" — last fallback. Visible in the timeline but never the basis of auto-filter.

Resolve fails soft: missing git binary, unreadable .prosa.yaml, or a path that simply isn't a repo all yield Identity{Path: cwd} with no error. Callers only have to inspect the populated pointers to decide which dimension matched.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(sess *session.Session)

Apply populates sess.ProjectRemote / sess.ProjectMarker from Resolve(*sess.ProjectPath). No-op when ProjectPath is nil.

Types

type Identity

type Identity struct {
	// Remote is the canonical `git remote get-url origin` URL when the
	// session's cwd resolves as a git repo. nil otherwise.
	Remote *string

	// Marker is the `project:` value from the nearest .prosa.yaml. nil
	// when no marker file is reachable.
	Marker *string

	// Path is the session's cwd, normalized (filepath.Clean) — useful as
	// the universal fallback for display and the legacy substring filter.
	Path string
}

Identity is the resolved triple. At least Path is always populated.

func Resolve

func Resolve(cwd string) Identity

Resolve produces the Identity for the given cwd. A non-existent cwd (legacy bundle path on a different machine) is returned as Identity{Path: cleaned} — Remote/Marker stay nil.

Jump to

Keyboard shortcuts

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