Documentation
¶
Overview ¶
Package config resuelve las rutas del store local de nem (~/.nem) y la configuración persistida en config.toml.
Index ¶
- func AddTeam(name string, t Team) error
- func ChatsDir() (string, error)
- func ConfigPath() (string, error)
- func DBPath() (string, error)
- func Dir() (string, error)
- func FactsBudget() int
- func Get(key string) (string, error)
- func Keys() []string
- func RemoveTeam(name string) error
- func Save(f *File) error
- func Scopes() (map[string]Scope, error)
- func Set(key, value string) error
- func StoreDir() (string, error)
- func TeamChatsDir(name string) (string, error)
- func TeamDBPath(name string) (string, error)
- func TeamDir(name string) (string, error)
- func Teams() (map[string]Team, error)
- func TeamsDir() (string, error)
- func UserName() string
- func ValidTeamName(name string) error
- type Backend
- type FactsConfig
- type File
- type Scope
- type Team
- type UserConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChatsDir ¶
ChatsDir devuelve la ruta donde se exportan los .jsonl por commit (~/.nem/store/chats).
func ConfigPath ¶
ConfigPath devuelve la ruta del archivo de configuración (~/.nem/config.toml).
func FactsBudget ¶ added in v0.6.0
func FactsBudget() int
FactsBudget devuelve el presupuesto configurado de la capa de facts, o 0 si no se fijó (el llamador aplica el default). Nunca falla la lectura silenciosa.
func Keys ¶ added in v0.2.0
func Keys() []string
Keys devuelve las claves configurables (para `nem config list`).
func RemoveTeam ¶ added in v0.7.0
RemoveTeam desregistra un team y persiste la config. No falla si no existía.
func Save ¶ added in v0.2.0
Save escribe el File a config.toml (sobrescribe; los comentarios se pierden).
func TeamChatsDir ¶ added in v0.7.0
TeamChatsDir devuelve el dir de export por-commit de un store de equipo.
func TeamDBPath ¶ added in v0.7.0
TeamDBPath devuelve la ruta de la DB SQLite de un store de equipo.
func TeamDir ¶ added in v0.7.0
TeamDir devuelve el directorio de un store de equipo (~/.nem/teams/<name>). El nombre debe pasar ValidTeamName.
func Teams ¶ added in v0.7.0
Teams devuelve los stores de equipo registrados (mapa vacío si no hay).
func UserName ¶ added in v0.7.0
func UserName() string
UserName devuelve a quién atribuir commits y facts en stores compartidos. Usa config user.name; si no está, cae a `git config user.name`, luego a la variable de entorno de usuario del SO, y por último a "unknown". Nunca falla.
func ValidTeamName ¶ added in v0.7.0
ValidTeamName valida que name sea seguro como segmento de ruta y como clave de config: no vacío, sin separadores ni "..", sin espacios.
Types ¶
type Backend ¶ added in v0.2.0
type Backend struct {
Backend string `toml:"backend,omitempty"`
Model string `toml:"model,omitempty"`
Endpoint string `toml:"endpoint,omitempty"`
}
Backend configura un backend pluggable (summarize/embed): "heuristic" | "ollama" | "api" | "static", con modelo y endpoint opcionales.
type FactsConfig ¶ added in v0.6.0
type FactsConfig struct {
// Budget es el tope de facts estables siempre-cargados (0 → default).
Budget int `toml:"budget,omitempty"`
}
FactsConfig configura la capa semántica siempre-cargada.
type File ¶ added in v0.2.0
type File struct {
Scopes map[string]Scope `toml:"scopes,omitempty"`
Summarize Backend `toml:"summarize,omitempty"`
Embed Backend `toml:"embed,omitempty"`
Facts FactsConfig `toml:"facts,omitempty"`
Teams map[string]Team `toml:"teams,omitempty"`
User UserConfig `toml:"user,omitempty"`
}
File es el contenido completo de ~/.nem/config.toml.
type Scope ¶
type Scope struct {
Titles []string `toml:"titles,omitempty"`
Sources []string `toml:"sources,omitempty"`
Chats []string `toml:"chats,omitempty"`
}
Scope define un alcance de acceso de lectura (ver internal/scope).
type Team ¶ added in v0.7.0
type Team struct {
URL string `toml:"url,omitempty"`
}
Team es un store de equipo registrado. Guarda solo el remote git: la ruta local se deriva siempre del nombre (~/.nem/teams/<name>, vía config.TeamDir), que es más robusto que una ruta absoluta persistida ante cambios de NEM_HOME/home.
type UserConfig ¶ added in v0.7.0
type UserConfig struct {
Name string `toml:"name,omitempty"`
}
UserConfig identifica a quién atribuir commits y facts en stores compartidos.