Conversation
Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>
|
@copilot Great work. One question remains (just to be sure): —configDir affects the directory of the GABS config file but that also contains the game bridge files. Will the —configDir option also affect where the bridge files are created - it’s what I think is logical: it moves the whole base directory. |
Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>
You're absolutely correct! The Previously, while
Now when you use Fixed in commit 73fa3b4 with comprehensive test coverage to ensure it works correctly. |
|
@copilot maybe I am wrong but from your last changes I get the impression that the handling of the base configuration directory is not cleanly implemented. In my book this should be one central place to ask for the path and the default is ~/.gabs or the overwritten value of —configDir. Then all the code calls the central method that returns the actual path. Maybe the implementation is already clean but I am not sure |
…ystem Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>
You're absolutely right! The configuration directory handling was scattered across multiple functions. I've now centralized it into a single Before (scattered approach):
After (centralized approach):
This makes the implementation much cleaner and ensures consistent behavior across all configuration operations. Fixed in commit 5047495. |
The
--configDiroption was defined and parsed but not fully implemented. While it affected the main GABS configuration file, bridge configuration files were still created in the default~/.gabs/directory, making the option only partially functional.Problem
# This would only move config.json but leave bridge files in ~/.gabs/ gabs games --configDir /custom/path list gabs server --configDir /custom/pathThe
LoadGamesConfig()function ininternal/config/games.goused the custom directory, but bridge file creation in the MCP server always used the hardcoded~/.gabs/path, creating an inconsistent configuration layout.Solution
Modified the configuration system to properly respect the
--configDiroption for all GABS configuration files and centralized configuration directory handling:Centralized Configuration Path Management:
ConfigPathstype that provides a single source of truth for all configuration directory resolutionNewConfigPaths(baseDir)creates path resolver with custom or default~/.gabs/directoryGetMainConfigPath(),GetGameDir(),GetBridgeConfigPath()provide consistent path resolutionEnsureGameDir()andEnsureBaseDir()handle directory creation consistentlyRefactored Implementation:
getGamesConfigPath()andgetConfigDir()functions that duplicated directory logicConfigPathssystemEnhanced Functionality:
configDirfield and updatedCleanupBridgeConfig()to use centralized pathsstartGame()to pass configDir toWriteBridgeJSON()--configDiris not specified, uses default~/.gabs/directoryUsage
Testing
Added comprehensive tests to verify:
The fix ensures that
--configDirnow properly moves the entire GABS configuration base directory as originally intended, with a clean, centralized architecture that eliminates duplicate directory resolution logic and provides consistent configuration management across all GABS components.💡 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.