project

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

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

View Source
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

func DisplayName(projectRoot string) string

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 HasMarker

func HasMarker(projectRoot string) bool

HasMarker reports whether projectRoot carries a project marker.

func MarkerName

func MarkerName(projectRoot string) string

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

func NormalizeName(raw string) (string, error)

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

func EnsureInContenoxDir(contenoxDir, name string) (Marker, error)

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

func EnsureInProjectRoot(projectRoot, name string) (Marker, error)

EnsureInProjectRoot is EnsureInContenoxDir for a project root.

func ReadFromContenoxDir

func ReadFromContenoxDir(contenoxDir string) (Marker, bool)

ReadFromContenoxDir reads the marker from a `.contenox` dir. ok is false when the file is absent or unreadable.

func ReadFromProjectRoot

func ReadFromProjectRoot(projectRoot string) (Marker, bool)

ReadFromProjectRoot reads the marker at <projectRoot>/.contenox/workspace.id.

func Register

func Register(projectRoot, name string) (Marker, error)

Register makes projectRoot a registered, named project. An empty name defaults to the directory's basename, but never clobbers an already-chosen one.

Jump to

Keyboard shortcuts

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