config

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Endpoint = "https://mcp.talentohq.com/mcp"
	Scope    = "mcp_access"
)
View Source
const ProjectConfigMaxBytes int64 = 64 << 10

Variables

View Source
var ErrProjectConfigNotFound = errors.New("no .talento/config.json found")

Functions

func CanonicalDirectory

func CanonicalDirectory(path string) (string, error)

Types

type File

type File struct {
	SchemaVersion  int                     `json:"schema_version"`
	DefaultProfile string                  `json:"default_profile,omitempty"`
	Profiles       map[string]Profile      `json:"profiles"`
	ManagedFiles   map[string]ManagedFile  `json:"managed_files,omitempty"`
	ProjectTrust   map[string]ProjectTrust `json:"project_trust,omitempty"`
	UpdatedAt      time.Time               `json:"updated_at"`
}

type ManagedFile

type ManagedFile struct {
	Path           string    `json:"path"`
	Digest         string    `json:"digest"`
	Kind           string    `json:"kind"`
	Agent          string    `json:"agent,omitempty"`
	Method         string    `json:"method,omitempty"`
	RegistrationID string    `json:"registration_id,omitempty"`
	Scope          string    `json:"scope"`
	Version        string    `json:"version"`
	UpdatedAt      time.Time `json:"updated_at"`
}

type Paths

type Paths struct {
	ConfigDir     string
	ConfigFile    string
	CredentialDir string
	HomeDir       string
}

func ResolvePaths

func ResolvePaths() (Paths, error)

type Profile

type Profile struct {
	Name              string    `json:"name"`
	Endpoint          string    `json:"endpoint"`
	ClientID          string    `json:"client_id,omitempty"`
	RedirectURI       string    `json:"redirect_uri,omitempty"`
	RegistrationScope string    `json:"registration_scope,omitempty"`
	CreatedAt         time.Time `json:"created_at"`
	UpdatedAt         time.Time `json:"updated_at"`
}

type ProfileSnapshot

type ProfileSnapshot struct {
	Name           string
	Profile        Profile
	Exists         bool
	DefaultProfile string
}

type ProjectLocation

type ProjectLocation struct {
	ProjectDir string `json:"project_dir"`
	ConfigPath string `json:"config_path"`
}

func LocateProjectConfig

func LocateProjectConfig(start string) (ProjectLocation, error)

LocateProjectConfig performs the same canonical, nearest-ancestor and no-symlink checks as discovery without parsing the file. This lets a user remove a stale trust record even after the project file becomes malformed.

type ProjectProfile

type ProjectProfile struct {
	ProjectDir string `json:"project_dir"`
	ConfigPath string `json:"config_path"`
	Profile    string `json:"profile"`
	Digest     string `json:"sha256"`
}

func DiscoverProjectProfile

func DiscoverProjectProfile(start string) (ProjectProfile, error)

DiscoverProjectProfile resolves start to a canonical directory, walks toward the filesystem root, and parses the nearest project selector. The .talento directory and config file must both be real filesystem entries, not symlinks.

type ProjectTrust

type ProjectTrust struct {
	ProjectDir string    `json:"project_dir"`
	ConfigPath string    `json:"config_path"`
	Profile    string    `json:"profile"`
	Digest     string    `json:"sha256"`
	UpdatedAt  time.Time `json:"updated_at"`
}

ProjectTrust is non-secret metadata in the owner-only global config. A record authorizes exactly one canonical path and one exact project file.

func (*ProjectTrust) UnmarshalJSON

func (record *ProjectTrust) UnmarshalJSON(data []byte) error

type ProjectTrustState

type ProjectTrustState string
const (
	ProjectTrusted   ProjectTrustState = "trusted"
	ProjectUntrusted ProjectTrustState = "untrusted"
	ProjectStale     ProjectTrustState = "stale"
)

func ProjectTrustStatus

func ProjectTrustStatus(project ProjectProfile, records map[string]ProjectTrust) ProjectTrustState

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(path string) *Store

func (*Store) CreateProfile

func (s *Store) CreateProfile(name string) (Profile, error)

func (*Store) DeleteProfile

func (s *Store) DeleteProfile(name string) error

func (*Store) Load

func (s *Store) Load() (File, error)

func (*Store) Path

func (s *Store) Path() string

func (*Store) Profile

func (s *Store) Profile(name string) (Profile, error)

func (*Store) ProfileNames

func (s *Store) ProfileNames() ([]string, string, error)

func (*Store) RestoreProfile

func (s *Store) RestoreProfile(snapshot ProfileSnapshot) error

func (*Store) SetDefault

func (s *Store) SetDefault(name string) error

func (*Store) SnapshotProfile

func (s *Store) SnapshotProfile(name string) (ProfileSnapshot, error)

func (*Store) TrustProject

func (s *Store) TrustProject(project ProjectProfile) error

func (*Store) UntrustProject

func (s *Store) UntrustProject(configPath string) (bool, error)

func (*Store) Update

func (s *Store) Update(fn func(*File) error) error

func (*Store) UpsertProfile

func (s *Store) UpsertProfile(p Profile) error

Jump to

Keyboard shortcuts

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