feat(auth): add automatic backup of settings.json before auth modification#1952
Merged
tanzhenxin merged 2 commits intomainfrom Feb 27, 2026
Merged
feat(auth): add automatic backup of settings.json before auth modification#1952tanzhenxin merged 2 commits intomainfrom
tanzhenxin merged 2 commits intomainfrom
Conversation
- Add backupSettingsFile() utility to create .orig backup before modifying settings - Update success message to indicate backup was created - Sync i18n translations for all supported languages - Update documentation to reflect the change Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Contributor
📋 Review SummaryThis PR adds an automatic backup mechanism for settings.json before the /auth command modifies it, creating a .orig backup file. The changes also update documentation and i18n messages to reflect that both API keys and model configs are saved, along with the backup creation. 🔍 General Feedback
🟡 High
🟢 Medium
🔵 Low
Note: No specific issues identified in Critical category. ✅ Highlights
|
Contributor
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Adds automatic backup of
settings.jsonbefore the/authcommand modifies it. The backup is created with a.origsuffix to allow users to recover their original configuration if needed. Also updates success messages and documentation to reflect that both API keys and model configs are saved.Dive Deeper
This change introduces a safety mechanism for the authentication flow:
Backup functionality: Added
backupSettingsFile()insettingsUtils.tsthat creates a.origbackup of the settings file before any modifications. If a backup already exists, it won't overwrite it.Integration: The backup is called in
useAuth.tsbefore writing the API key and model configuration tosettings.json. If backup fails for any reason (permissions, disk space, etc.), the operation continues without blocking.Documentation updates: Fixed references from
settings.envtoenvfield insettings.jsonacross auth and model-providers docs for clarity.i18n updates: Updated success messages in all 6 supported languages to indicate that both API key and model configs are saved, and that a backup was created.
Reviewer Test Plan
settings.jsonfile/authcommand and complete authentication with either China or Global regionsettings.json.origis created alongsidesettings.json/authagain and verify the original.origfile is preserved (not overwritten)settings.jsonto ensure the flow works for first-time usersTesting Matrix
Linked issues / bugs