Documentation
¶
Overview ¶
Package project owns a project's portable identity marker at <projectRoot>/.contenox/workspace.id: a stable UUID plus an optional friendly Name, travelling with the directory rather than the host-local grant list.
Index ¶
- Constants
- func DisplayName(projectRoot string) string
- func HasMarker(projectRoot string) bool
- func MarkerName(projectRoot string) string
- func NormalizeName(raw string) (string, error)
- type Marker
- func EnsureInContenoxDir(contenoxDir, name string) (Marker, error)
- func EnsureInProjectRoot(projectRoot, name string) (Marker, error)
- func ReadFromContenoxDir(contenoxDir string) (Marker, bool)
- func ReadFromProjectRoot(projectRoot string) (Marker, bool)
- func Register(projectRoot, name string) (Marker, error)
Constants ¶
const ( // ContenoxDirName is a project's per-directory config/marker dir (like .git). ContenoxDirName = ".contenox" // MarkerFileName is the identity marker inside ContenoxDirName. MarkerFileName = "workspace.id" // MaxNameLen bounds a friendly name, in runes — a display-name limit applied // by NormalizeName at every boundary a name enters through. MaxNameLen = 120 )
Variables ¶
This section is empty.
Functions ¶
func DisplayName ¶
DisplayName is the marker's Name, or the project root's basename when there is no marker or the marker carries no name — so a root is always presentable.
func MarkerName ¶
MarkerName is the project's explicit marker name — "" when the root carries no marker or an unnamed one. Unlike DisplayName it never invents a fallback.
func NormalizeName ¶
NormalizeName validates and canonicalizes a friendly project name: trimmed, "" means "no name given". Control characters and names over MaxNameLen runes are refused, since the name renders verbatim in the UI.
Types ¶
type Marker ¶
type Marker struct {
// ID is the stable workspace UUID — the DB scoping token. Never changes once
// written, so existing session/message rows stay attached to the project.
ID string `json:"id"`
// Name is the friendly display name (optional; empty falls back to basename).
Name string `json:"name,omitempty"`
}
Marker is a project's portable identity, stored as JSON in the marker file.
func EnsureInContenoxDir ¶
EnsureInContenoxDir makes contenoxDir a project, creating a marker when absent and otherwise returning the existing one. An empty name never clears an existing one, and the ID is never rewritten.
func EnsureInProjectRoot ¶
EnsureInProjectRoot is EnsureInContenoxDir for a project root.
func ReadFromContenoxDir ¶
ReadFromContenoxDir reads the marker from a `.contenox` dir. ok is false when the file is absent or unreadable.
func ReadFromProjectRoot ¶
ReadFromProjectRoot reads the marker at <projectRoot>/.contenox/workspace.id.