projects

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadProjectConfig

func LoadProjectConfig(p Project, databaseURL string) (*config.Config, error)

LoadProjectConfig loads the optional per-project config file and overlays the registry's RepoPath. It also injects the registry's databaseURL. Project config supplies indexing/provider settings; identity (repo_path, storage_schema) always comes from the registry.

func ValidateSlug

func ValidateSlug(s string) error

ValidateSlug enforces the project slug shape used in CLI flags and MCP URL paths.

func ValidateStorageSchema

func ValidateStorageSchema(s string) error

ValidateStorageSchema enforces a safe Postgres identifier and rejects reserved names.

Types

type Project

type Project struct {
	Slug          string `yaml:"slug"`
	StorageSchema string `yaml:"storage_schema"`
	RepoPath      string `yaml:"repo_path"`
	ConfigPath    string `yaml:"config_path,omitempty"`
}

Project is a single registry entry.

type Registry

type Registry struct {
	DatabaseURL    string    `yaml:"database_url"`
	DefaultProject string    `yaml:"default_project,omitempty"`
	Projects       []Project `yaml:"projects"`
}

Registry is the parsed projects.yaml.

func LoadRegistry

func LoadRegistry(path string) (*Registry, error)

LoadRegistry reads and validates a YAML project registry from path.

func (*Registry) Find

func (r *Registry) Find(slug string) (Project, error)

Find returns the project with the given slug.

func (*Registry) Validate

func (r *Registry) Validate() error

Validate runs all registry-level invariants.

type Runtime

type Runtime struct {
	Slug          string
	StorageSchema string
	RepoPath      string
	Config        *config.Config
	DB            *storage.DB
}

Runtime is everything a CLI command or MCP handler needs to operate on one project: the resolved config, the project-scoped DB pool, and the identity fields used for logs and surfaces.

func Resolve

func Resolve(ctx context.Context, reg *Registry, slug string) (*Runtime, error)

Resolve opens a project-scoped pool and returns a ready Runtime. The caller MUST call Runtime.Close.

func (*Runtime) Close

func (r *Runtime) Close()

Close releases the project's DB pool.

Jump to

Keyboard shortcuts

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