-
Notifications
You must be signed in to change notification settings - Fork 55
Closed
Description
Local config settings issues investigation report
Problem Description
Investigating issue #191 about local config settings not working properly. The specific questions were:
- Where are local config settings saved to?
- Why can't individual values be cleared?
Findings
Where local config settings are saved to
- Global config: Stored in
~/.mycoder/config.json - Project config: Stored in
.mycoder/config.jsonin the project directory
The system correctly creates these files when settings are modified. However, there's no explicit indication to users about where these files are located.
Issues with clearing individual config values
I've identified a critical bug in the configuration system. When a user attempts to clear an individual configuration key using mycoder config clear <key>, the system behaves incorrectly:
- Instead of removing just the specified key from the config file, it copies the entire merged configuration (from all levels) into the target config file.
- This effectively overrides all configuration settings at that level with the current merged values, rather than just removing the specified key.
Steps to reproduce:
- Set a project-level config:
mycoder config set temperature 0.5 - Check the project config file: Contains only
{"temperature": 0.5} - Try to clear that value:
mycoder config clear temperature - Check the project config file again: Now contains ALL configuration values from all levels
Code issue:
The problem is in the config.ts file in the config clear command handler (around line 280-320). When clearing a specific key, it:
- Gets the current merged config from all levels
- Creates a new object without the specified key
- Calls
updateConfig(newConfig)with the entire object - This replaces the entire config file instead of just removing the key
This behavior contradicts the expected functionality of the clearConfigKey function defined in settings/config.ts which should be used but isn't.
Additional Issues
- Global flag issues: The
--globalflag doesn't seem to be properly defined in the command options. - Confusing feedback: When clearing a key, the system reports "Cleared at level, now using: (from project config)" even when the key wasn't actually removed from the config file.
Recommended Fixes
- Fix the
clearcommand: Modify theconfig.tscommand handler to use theclearConfigKeyfunction when clearing individual keys. - Add global flag: Ensure the
--globalflag is properly defined in the command options. - Improve documentation: Add clear documentation about where config files are stored.
- Add verbose output option: Allow users to see the exact file paths being used.
Technical Implementation Plan
- Update the
config.tscommand handler to useclearConfigKeyinstead of manually creating a new object and callingupdateConfig. - Add the global flag to the command options if it's missing.
- Enhance the
config listcommand to show which level each setting is coming from. - Add a verbose mode that shows the file paths being used.
Metadata
Metadata
Assignees
Labels
No labels