tenant

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidScope      = errors.New("invalid scope")
	ErrInvalidTenantID   = errors.New("invalid tenant ID")
	ErrInvalidTeamID     = errors.New("invalid team ID")
	ErrInvalidProjectID  = errors.New("invalid project ID")
	ErrInvalidCollection = errors.New("invalid collection type")
	ErrAccessDenied      = errors.New("access denied")
)

Common errors.

Functions

func GetDefaultTenantID

func GetDefaultTenantID() string

GetDefaultTenantID returns the default tenant ID for single-tenant mode. Uses git user.name from global config if available, falls back to OS username.

func GetTenantIDForPath

func GetTenantIDForPath(repoPath string) string

GetTenantIDForPath returns a tenant ID, preferring GitHub username from repo remote. Priority: GitHub username from remote → git user.name → $USER → "local"

Types

type CollectionRouter

type CollectionRouter interface {
	// GetCollectionName returns the collection name for the given scope and identifiers.
	GetCollectionName(scope Scope, collectionType CollectionType, tenantID, teamID, projectID string) (string, error)

	// ValidateAccess verifies that the session has access to the specified collection.
	ValidateAccess(sessionTenantID, sessionTeamID, sessionProjectID, collectionName string) error

	// GetSearchCollections returns collections to search based on scope hierarchy.
	GetSearchCollections(scope Scope, collectionType CollectionType, tenantID, teamID, projectID string) ([]string, error)
}

CollectionRouter routes requests to the appropriate collection based on tenant scope. This is a stub interface for contextd-v2 port - full implementation pending.

func NewRouter

func NewRouter(strictMode bool) CollectionRouter

NewRouter creates a new collection router.

type CollectionType

type CollectionType string

CollectionType represents the type of data stored in a collection.

const (
	CollectionMemories      CollectionType = "memories"
	CollectionRemediations  CollectionType = "remediations"
	CollectionCheckpoints   CollectionType = "checkpoints"
	CollectionPolicies      CollectionType = "policies"
	CollectionSkills        CollectionType = "skills"
	CollectionAgents        CollectionType = "agents"
	CollectionSessions      CollectionType = "sessions"
	CollectionCodebase      CollectionType = "codebase"
	CollectionStandards     CollectionType = "coding_standards"
	CollectionRepoStandards CollectionType = "repo_standards"
	CollectionAntiPatterns  CollectionType = "anti_patterns"
	CollectionFeedback      CollectionType = "feedback"
)

type Scope

type Scope string

Scope defines the hierarchy level for multi-tenant collections.

const (
	// ScopeOrg indicates organization-level data (shared across all teams).
	ScopeOrg Scope = "org"
	// ScopeTeam indicates team-level data (shared within a team).
	ScopeTeam Scope = "team"
	// ScopeProject indicates project-level data (isolated per project).
	ScopeProject Scope = "project"
)

Jump to

Keyboard shortcuts

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