config

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigFileName = "mit.yaml"
	DataDir        = ".mit"
	ModelsDir      = ".mit/models"
)
View Source
var DefaultIndexIgnore = []string{

	".git", ".sl", "node_modules", "vendor", ".next",
	"dist", "build", "__pycache__", ".cache", "target",
	DataDir, DataDir + "-worktrees",

	"package-lock.json", "yarn.lock", "pnpm-lock.yaml",
	"go.sum", "Gemfile.lock", "poetry.lock", "composer.lock",
	"Cargo.lock", "Pipfile.lock",

	".env",
}

DefaultIndexIgnore contains names (dirs and files) always skipped during indexing.

View Source
var SchemaComment = "# yaml-language-server: $schema=https://raw.githubusercontent.com/gabemeola/mit/refs/heads/main/mit.schema.json\n"

Functions

func FindRoot

func FindRoot(dir string) (string, error)

FindRoot walks up from dir looking for mit.yaml, returns the directory containing it.

func Save

func Save(dir string, cfg *Config) error

Save writes the config to mit.yaml in the given directory.

func SaveFile

func SaveFile(path string, cfg *Config) error

SaveFile writes the config to the given path.

Types

type Config

type Config struct {
	Version   string          `yaml:"version"`
	Workspace WorkspaceConfig `yaml:"workspace"`
	Repos     map[string]Repo `yaml:"repos"`
	Index     IndexConfig     `yaml:"index,omitempty"`
}

Config represents the top-level mit.yaml configuration.

func Load

func Load(dir string) (*Config, error)

Load reads and parses mit.yaml from the given directory.

func LoadFile

func LoadFile(path string) (*Config, error)

LoadFile reads and parses a mit.yaml from the given path.

func Parse

func Parse(data []byte) (*Config, error)

Parse parses mit.yaml content from bytes.

func (*Config) IndexIgnoreSet

func (c *Config) IndexIgnoreSet() map[string]bool

IndexIgnoreSet returns a set of all directories to ignore during indexing, combining defaults with user-configured ignores.

func (*Config) ResolveAll

func (c *Config) ResolveAll() []ResolvedRepo

ResolveAll returns all repos with defaults applied.

type IndexConfig

type IndexConfig struct {
	Ignore []string     `yaml:"ignore,omitempty"`
	Model  *ModelConfig `yaml:"model,omitempty"`
}

IndexConfig holds configuration for the semantic index.

type ModelConfig

type ModelConfig struct {
	URL string `yaml:"url"`
}

ModelConfig specifies a custom embedding model.

type Repo

type Repo struct {
	URL    string `yaml:"url"`
	Path   string `yaml:"path,omitempty"`
	Branch string `yaml:"branch,omitempty"`
	Forge  string `yaml:"forge,omitempty"` // overrides workspace.forge
}

Repo represents a single repository declaration in mit.yaml.

func (Repo) Resolve

func (r Repo) Resolve(name, workspaceForge string) ResolvedRepo

Resolve applies defaults to the repo configuration. name is the key from the repos map. workspaceForge is the workspace-level forge default (may be empty).

type ResolvedRepo

type ResolvedRepo struct {
	Name   string
	URL    string
	Path   string
	Branch string
	Forge  string // resolved: repo.Forge || workspace.Forge || ""
}

ResolvedRepo is a Repo with all defaults applied.

type WorkspaceConfig

type WorkspaceConfig struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description,omitempty"`
	Forge       string `yaml:"forge,omitempty"` // "github" or "gitlab" — default for all repos
}

WorkspaceConfig holds workspace-level metadata.

Jump to

Keyboard shortcuts

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