You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Complete export functionality for mcpd config
Completes the partially implemented 'mcpd config export' command by adding
support for config file processing alongside the existing runtime file handling.
The export now generates two output files:
1. Portable execution context (secrets.prod.toml) with templated variable references
2. Environment contract (.env) with placeholder mappings for CI/CD systems
Key improvements:
- Processes both config and runtime files (was runtime-only before)
- Supports all server configuration types (env vars, args, bool args)
- Generates consistent placeholder naming: MCPD__{SERVER_NAME}__{VAR_NAME}
- Handles server names with hyphens (converts to underscores in placeholders)
- Validates required configuration fields
- Provides clear success/error messaging
Fixes the bug where only runtime configuration was being exported.
* Add comprehensive testdata for export command testing
Adds structured testdata files for testing export functionality across
different server configurations:
- basic_export: Server with all config types (env, args, bool args)
- multiple_servers: Multiple servers with different requirements
- github_server_hyphens: Server name with hyphens (tests name conversion)
- minimal_server_required_only: Server with required fields only
Each testdata directory contains:
- config.test.toml: Input server configuration
- secrets.test.toml: Input runtime secrets
- context.test.toml: Expected portable execution context output
- contract.test.env: Expected environment contract output
These files enable comprehensive integration testing of the export
functionality without relying on inline test data.
* Fix export bugs and add comprehensive testing
Fixes critical bugs discovered during manual testing:
1. Missing required config fields in AggregateConfigs function
- Added RequiredEnvVars, RequiredValueArgs, RequiredBoolArgs copying
2. Missing environment variables in contract file output
- Created envVarsToContract helper function
- Added proper environment variable placeholder extraction
3. Inconsistent .env file ordering
- Fixed lexicographical sorting using slices.Sort
4. Empty placeholder validation issues
- Added strings.TrimSpace and empty string filtering
Additional improvements:
- Added comprehensive unit tests for envVarsToContract function
- Enhanced error handling and validation
- Improved placeholder name consistency across all output formats
These fixes ensure the export functionality works correctly for all
supported configuration scenarios.
* Add comprehensive test suite for export command
Implements a full test suite for the export functionality with:
Integration Tests:
- Tests all server configuration scenarios using testdata files
- Verifies both context and contract output file generation
- Covers edge cases like server names with hyphens
- Tests required-only configurations (no runtime secrets)
Error Tests:
- Tests malformed configuration files
- Tests missing server configurations
- Verifies proper error messages and no output file creation
Unit Tests:
- Tests dotenv file writing with various data scenarios
- Tests lexicographical sorting and newline escaping
Test Infrastructure:
- dataPathsForTest: Helper for consistent testdata file path management
- overrideFlagsForTest: Helper for clean global flag override with automatic cleanup
- Comprehensive constants for test file naming consistency
- Proper use of t.Helper() and t.Cleanup() patterns
0 commit comments