Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 8, 2025

Implement config file support and move "use previews" functionality to config file

Summary:
This PR adds a dedicated config file for dnvm settings and migrates the "use previews" functionality from the manifest to this config file. The config file respects platform-specific conventions for configuration storage.

Changes:

  • Created DnvmConfig.cs with JSON serialization for configuration settings
  • Config file location follows platform conventions:
    • Linux: ~/.config/dnvm/ (respects XDG_CONFIG_HOME)
    • macOS: ~/.config/dnvm/
    • Windows: %APPDATA%/dnvm/
  • Moved PreviewsEnabled setting from manifest to config file
  • Removed --enable-dnvm-previews command-line flag (users manually edit dnvmConfig.json)
  • Updated UpdateCommand to read PreviewsEnabled from config instead of manifest
  • Removed automatic migration (users must manually create config file)
  • DnvmConfigFile uses instance methods for better testability
  • Updated help text to reflect command line changes
  • Fixed all tests (175 tests passing: 157 unit + 17 integration + 1 skipped)
  • Security scan passed (0 alerts)

User Impact:
Users who want to enable preview releases will need to manually create the appropriate config file for their platform and set "previewsEnabled": true. This provides a cleaner separation and follows platform conventions for roaming configuration data.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add support for a config file</issue_title>
<issue_description>Two things:

  • Add a config file and read it
  • Move the existing "use previews" functionality into that config file

JSON is fine for now, but once a serde.net TOML backend is available that should be preferred.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 8, 2025 21:38
- Created DnvmConfig.cs with JSON serialization
- Config file respects XDG spec on Linux (~/.config/dnvm/)
- Moved PreviewsEnabled from manifest to config
- Removed --enable-dnvm-previews flag
- Updated help text and tests
- Migration path from old manifests to config file

Co-authored-by: agocke <[email protected]>
- Updated DnvmRunner to pass test config directory via environment variable
- Fixed UpdateTests and SelfInstallTests to use test config directory
- All tests now passing (157 unit tests, 17 integration tests)

Co-authored-by: agocke <[email protected]>
Copilot AI changed the title [WIP] Add support for a config file and move functionality Add config file support and move previews setting from manifest Nov 8, 2025
Copilot AI requested a review from agocke November 8, 2025 21:50
Copilot finished work on behalf of agocke November 8, 2025 21:50
if (!config.PreviewsEnabled)
{
// Migrate the setting to the config file
DnvmConfigFile.Write(config with { PreviewsEnabled = true });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Please remove this -- we don't want to support writing config files right now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the automatic migration code in commit 9dfc5fe. Users will now need to manually create and edit the config file.

Per feedback, removed the automatic migration code that would write to the config file when reading old manifests. Users will need to manually create/edit the config file instead.

Co-authored-by: agocke <[email protected]>
Copilot finished work on behalf of agocke November 9, 2025 22:08
Copilot AI requested a review from agocke November 9, 2025 22:08
Copilot finished work on behalf of agocke November 9, 2025 22:11
/// Get the platform-specific config directory path.
/// - Linux: ~/.config/dnvm/ (XDG_CONFIG_HOME/dnvm)
/// - macOS: ~/Library/Application Support/dnvm/
/// - Windows: %LOCALAPPDATA%/dnvm/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Configuration data should not be local by default -- I think this should be AppData

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to use ApplicationData in commit 8f70456. Config files now use roaming app data: %APPDATA% on Windows and ~/.config on macOS/Linux.

Changed config location to use roaming application data:
- Windows: %APPDATA% instead of %LOCALAPPDATA%
- macOS: ~/.config instead of ~/Library/Application Support
- Linux: unchanged (~/.config)

This is more appropriate for configuration files that can be synced across machines.

Co-authored-by: agocke <[email protected]>
Copilot AI requested a review from agocke November 9, 2025 22:34
Copilot finished work on behalf of agocke November 9, 2025 22:34
/// <summary>
/// Static methods for config file operations.
/// </summary>
public static class DnvmConfigFile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Let's make this a class with instance methods

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored to use instance methods in commit 8c42896. DnvmConfigFile is now a class that can be instantiated and used with instance methods.

Changed DnvmConfigFile from a static class to a regular class with instance methods. This provides better testability and follows standard OOP patterns.

Usage changes:
- Before: var config = DnvmConfigFile.Read();
- After: var configFile = new DnvmConfigFile(); var config = configFile.Read();

Co-authored-by: agocke <[email protected]>
Copilot AI requested a review from agocke November 11, 2025 02:56
Copilot finished work on behalf of agocke November 11, 2025 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for a config file

2 participants