feat: update changelog (#131)
closes #130 - CHANGELOG.md file for people who can view changelog from github --- `iris changelog` command: `iris changelog [version]` (e.g. iris changelog v0.5.1) `iris changelog -n 3` (see changelog of 3 latest releaseas) => `iris changelog` looks just like CHANGELOG.md, grouped headers and all. It only stops looking that way if we personally overwrite that release's description with something else => With 1-hour local cache (invalidated on updater-channel change), `--refresh` flag to bypass, graceful fallback to stale cache on GitHub rate-limiting --- - New auto update config ```toml # 0 = off (default, notify only), 1 = auto-install, 2 = always confirm first auto-update = 1 ``` - New just debug-changelog and just debug-autoupdate recipes (fully offline, mocked HTTP servers, no real network/config touched)
This commit is contained in:
@@ -61,6 +61,8 @@ type UpdaterConfig struct {
|
||||
CheckOnStartup bool `toml:"check-on-startup"`
|
||||
Channel string `toml:"channel"`
|
||||
CheckInterval Duration `toml:"check-interval"`
|
||||
// AutoUpdate: 0 = off (default), 1 = auto-install, 2 = always confirm first
|
||||
AutoUpdate int `toml:"auto-update"`
|
||||
}
|
||||
|
||||
type KeybindingsConfig struct {
|
||||
@@ -281,6 +283,10 @@ func validate(cfg *Config) error {
|
||||
return fmt.Errorf("updater.channel: invalid value %q (want: stable|nightly)", cfg.Updater.Channel)
|
||||
}
|
||||
|
||||
if cfg.Updater.AutoUpdate < 0 || cfg.Updater.AutoUpdate > 2 {
|
||||
return fmt.Errorf("updater.auto-update: invalid value %d (want: 0=off, 1=auto, 2=confirm)", cfg.Updater.AutoUpdate)
|
||||
}
|
||||
|
||||
if cfg.UI.MaxSuggestions < 1 || cfg.UI.MaxSuggestions > 500 {
|
||||
return fmt.Errorf("ui.max-suggestions: must be between 1 and 500")
|
||||
}
|
||||
|
||||
@@ -186,6 +186,24 @@ model = "qwen-2.5-coder-32b"
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateAutoUpdateRange(t *testing.T) {
|
||||
cfg := DefaultConfig()
|
||||
|
||||
for _, valid := range []int{0, 1, 2} {
|
||||
cfg.Updater.AutoUpdate = valid
|
||||
if err := validate(cfg); err != nil {
|
||||
t.Errorf("expected auto-update=%d to be valid, got error: %v", valid, err)
|
||||
}
|
||||
}
|
||||
|
||||
for _, invalid := range []int{-1, 3} {
|
||||
cfg.Updater.AutoUpdate = invalid
|
||||
if err := validate(cfg); err == nil {
|
||||
t.Errorf("expected auto-update=%d to be rejected", invalid)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadSave(t *testing.T) {
|
||||
tmpDir, err := os.MkdirTemp("", "iris-config-test")
|
||||
if err != nil {
|
||||
|
||||
@@ -32,6 +32,7 @@ func DefaultConfig() *Config {
|
||||
CheckOnStartup: true,
|
||||
Channel: "stable",
|
||||
CheckInterval: Duration(24 * time.Hour),
|
||||
AutoUpdate: 0,
|
||||
},
|
||||
AI: AIConfig{
|
||||
Enabled: false,
|
||||
@@ -59,8 +60,11 @@ func DefaultState() *State {
|
||||
return &State{
|
||||
LastMode: "spec",
|
||||
Updater: UpdaterState{
|
||||
LastCheckTime: time.Time{},
|
||||
SeenVersion: "",
|
||||
LastCheckTime: time.Time{},
|
||||
SeenVersion: "",
|
||||
AutoUpdateTarget: "",
|
||||
AutoUpdateAttempt: 0,
|
||||
DeclinedVersion: "",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,10 @@ import (
|
||||
type UpdaterState struct {
|
||||
LastCheckTime time.Time `toml:"last-check-time"`
|
||||
SeenVersion string `toml:"seen-version"`
|
||||
// auto-update escalation ladder state, see decideAutoUpdateAction
|
||||
AutoUpdateTarget string `toml:"auto-update-target"`
|
||||
AutoUpdateAttempt int `toml:"auto-update-attempt"`
|
||||
DeclinedVersion string `toml:"declined-version"`
|
||||
}
|
||||
|
||||
type State struct {
|
||||
|
||||
Reference in New Issue
Block a user