## 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
53 lines
953 B
Go
53 lines
953 B
Go
package config
|
|
|
|
import "time"
|
|
|
|
func DefaultConfig() *Config {
|
|
return &Config{
|
|
Core: CoreConfig{
|
|
Version: 1,
|
|
Shell: "",
|
|
Mode: "last",
|
|
Debug: false,
|
|
},
|
|
UI: UIConfig{
|
|
Style: "modern",
|
|
GhostText: true,
|
|
MaxSuggestions: 100,
|
|
MaxHeight: 15,
|
|
NerdFonts: true,
|
|
},
|
|
Git: GitConfig{
|
|
FilterActiveBranch: true,
|
|
DeduplicateBranches: true,
|
|
},
|
|
Updater: UpdaterConfig{
|
|
CheckOnStartup: true,
|
|
Channel: "stable",
|
|
CheckInterval: Duration(24 * time.Hour),
|
|
},
|
|
AI: AIConfig{
|
|
Enabled: false,
|
|
Provider: "",
|
|
DebounceMS: 500,
|
|
MinIntervalMS: 1000,
|
|
Providers: nil,
|
|
SuggestOnEmpty: SuggestOnEmptyConfig{
|
|
Enabled: false,
|
|
DebounceMS: 800,
|
|
MinIntervalMS: 5000,
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
func DefaultState() *State {
|
|
return &State{
|
|
LastMode: "spec",
|
|
Updater: UpdaterState{
|
|
LastCheckTime: time.Time{},
|
|
SeenVersion: "",
|
|
},
|
|
}
|
|
}
|