Skip to content

Commit 773cde9

Browse files
committed
fix: /login no longer nukes saved settings
handle_login_command was creating a fresh config dict with only github_token + created_at, overwriting model_provider, current_model, search_provider, proxy, etc. Now loads existing config first.
1 parent 78b1b9c commit 773cde9

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

iclaw/commands/auth.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import sys
22
from datetime import datetime, timezone
33

4-
import yaml
5-
64
from iclaw.login import get_device_code, poll_for_access_token
75

86

@@ -33,14 +31,12 @@ def handle_login_command(config_path):
3331
return None
3432

3533
if github_token:
36-
config = {
37-
"github_token": github_token,
38-
"created_at": datetime.now(timezone.utc).isoformat(),
39-
}
40-
config_path.parent.mkdir(parents=True, exist_ok=True)
41-
config_path.write_text(
42-
yaml.dump(config, default_flow_style=False, sort_keys=False)
43-
)
34+
from iclaw.config import _load_config, _save_config
35+
36+
config = _load_config()
37+
config["github_token"] = github_token
38+
config["created_at"] = datetime.now(timezone.utc).isoformat()
39+
_save_config(config)
4440
print(f"\nSaved GitHub token to {config_path}")
4541
return github_token
4642

0 commit comments

Comments
 (0)