Skip to content

Local config settings not working properly when clearing individual values #194

Closed
@github-actions

Description

@github-actions

Local config settings not working properly

Description

After investigating issue #191, I've identified several issues with local (project-level) configuration settings:

  1. When clearing an individual config value using mycoder config clear <key>, the value is not actually removed from the local config file.
  2. Instead, the entire default configuration gets written to the local config file.
  3. The CLI reports that the value was cleared, but it still shows as coming from the project config.

Steps to reproduce

  1. Create a project directory with a .mycoder subdirectory
  2. Run mycoder config set headless false to set a local config value
  3. Verify the config file contains just the headless setting
  4. Run mycoder config clear headless to clear the setting
  5. Check the config file - it now contains all default settings instead of removing the headless setting

Current behavior

When clearing an individual config key:

  • The key is not removed from the config file
  • The entire default config is merged into the local config file
  • The CLI incorrectly reports where the value is coming from

Expected behavior

  • mycoder config clear <key> should remove the specified key from the config file
  • The config file should only contain explicitly set values
  • After clearing a key, the value should come from the next level in the hierarchy (global or default)

Possible causes

Looking at the implementation in packages/cli/src/settings/config.ts, the clearConfigKey function appears to have an issue. It correctly removes the key from the configuration object, but there may be a problem with how it determines where the new value is coming from after clearing.

Additionally, there seems to be an issue with how the CLI command reports the source of a value after clearing it. In packages/cli/src/commands/config.ts, the logic for determining where a value comes from after clearing may be incorrect.

Possible solution

  1. Fix the clearConfigKey function to properly remove keys from the config file without merging in default values
  2. Update the reporting logic to correctly identify the source of values after clearing
  3. Add more tests for the config clearing functionality

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions