## Feat * feat(ai): add AI suggestion engine, context gathering, and ghost text overlay (`v0.3.0`) ## Security & Perf * fix(ai): restrict background `--help` execution to a hardcoded command allowlist to prevent RCE * fix(root): defer context cancellation in goroutine to prevent resource leaks * perf(ai): implement LRU eviction and maximum size limit for `ProviderCache` * perf(ai): truncate command context output (`CommandContextProvider.Gather`) to 1000 characters to save tokens ## Bug Fixes * fix(ai): add mutex synchronization and thread-safe snapshotting to `AIEngine.RegisterProvider` and `GatherDynamicContext` * fix(ai): return a copy of fresh `Suggestion` in `AIEngine.Suggest` to prevent cache mutation * fix(ai): use length-prefixed encoding in `EnvSnapshot.Hash` to prevent delimiter collisions * fix(ai): skip variable assignment lines containing `=` when extracting Makefile targets * fix(runner): check `scanner.Err()` and return `nil` on scan errors in justfile generator * test(ci): rename `git commit` to `git checkout` in overlay test to resolve CI `typos` false positive
58 lines
1.4 KiB
Go
58 lines
1.4 KiB
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
"strconv"
|
|
"time"
|
|
)
|
|
|
|
func applyEnv(cfg *Config) {
|
|
if val := os.Getenv("IRIS_CORE_DEBUG"); val != "" {
|
|
if b, err := strconv.ParseBool(val); err == nil {
|
|
cfg.Core.Debug = b
|
|
}
|
|
}
|
|
if val := os.Getenv("IRIS_CORE_SHELL"); val != "" {
|
|
cfg.Core.Shell = val
|
|
}
|
|
if val := os.Getenv("IRIS_CORE_MODE"); val != "" {
|
|
cfg.Core.Mode = val
|
|
}
|
|
if val := os.Getenv("IRIS_UI_GHOST_TEXT"); val != "" {
|
|
if b, err := strconv.ParseBool(val); err == nil {
|
|
cfg.UI.GhostText = b
|
|
}
|
|
}
|
|
if val := os.Getenv("IRIS_UI_MAX_SUGGESTIONS"); val != "" {
|
|
if i, err := strconv.Atoi(val); err == nil {
|
|
cfg.UI.MaxSuggestions = i
|
|
}
|
|
}
|
|
if val := os.Getenv("IRIS_UI_MAX_HEIGHT"); val != "" {
|
|
if i, err := strconv.Atoi(val); err == nil {
|
|
cfg.UI.MaxHeight = i
|
|
}
|
|
}
|
|
if val := os.Getenv("IRIS_UPDATER_CHANNEL"); val != "" {
|
|
cfg.Updater.Channel = val
|
|
}
|
|
if val := os.Getenv("IRIS_UPDATER_INTERVAL"); val != "" {
|
|
if dur, err := time.ParseDuration(val); err == nil {
|
|
cfg.Updater.CheckInterval = Duration(dur)
|
|
}
|
|
}
|
|
if val := os.Getenv("IRIS_UPDATER_CHECK_ON_STARTUP"); val != "" {
|
|
if b, err := strconv.ParseBool(val); err == nil {
|
|
cfg.Updater.CheckOnStartup = b
|
|
}
|
|
}
|
|
if val := os.Getenv("IRIS_AI_ENABLED"); val != "" {
|
|
if b, err := strconv.ParseBool(val); err == nil {
|
|
cfg.AI.Enabled = b
|
|
}
|
|
}
|
|
if val := os.Getenv("IRIS_AI_PROVIDER"); val != "" {
|
|
cfg.AI.Provider = val
|
|
}
|
|
}
|