Commit 7b7d40a
committed
feat: implement URL replacements for enterprise networks
This commit implements comprehensive URL replacement functionality for enterprise
environments, along with shell integration, environment management improvements,
and enhanced test reliability.
**URL Replacement Features:**
- Global URL replacement configuration in ~/.mvx/config.json5
- Support for simple string replacements (github.com -> nexus.internal)
- Support for regex replacements with capture groups
- CLI commands for managing URL replacements
- Automatic integration with all tool downloads
- First-match-wins processing for predictable behavior
- Comprehensive validation for regex patterns
**New CLI Commands:**
- mvx config show - Display current global configuration
- mvx config set-url-replacement <pattern> <replacement>
- mvx config remove-url-replacement <pattern>
- mvx config clear-url-replacements
- mvx config edit - Open config file in editor
**Shell Integration Features:**
- mvx shell command for executing commands in mvx environment
- Shell activation support for automatic environment setup
- Cross-platform shell hooks and activation scripts
- mvx activate/deactivate commands for shell integration
- mvx env command for environment variable management
**Environment Management Improvements:**
- Safe environment variable management with EnvironmentManager
- Intelligent PATH handling with deduplication
- Change detection to reduce verbose logging noise
- Track original environment variable values
- Only log actual environment changes, not passthrough values
**Test Reliability Improvements:**
- Fix Java executable detection to prevent bin/bin/java path errors
- Add proper working directory restoration in test cleanup
- Skip 'bin' directories when searching for nested Java installations
- Add comprehensive Java installation debug test for CI troubleshooting
- Improved test isolation to prevent cross-test contamination
**Technical Implementation:**
- Added pkg/config/global.go for global configuration management
- Added pkg/tools/url_replacements.go for URL replacement logic
- Added pkg/tools/environment.go for safe environment variable management
- Added pkg/util/log.go for centralized logging utilities
- Enhanced EnvironmentManager with change detection capabilities
- Integrated URL replacements into pkg/tools/download.go
- Added comprehensive test suites and documentation
**Files Added/Modified:**
- cmd/config.go - CLI commands for configuration management
- cmd/shell.go - Shell command implementation
- cmd/activate.go - Shell activation support
- cmd/deactivate.go - Shell deactivation support
- cmd/env.go - Environment variable management
- cmd/root.go - Register new commands
- pkg/config/global.go - Global configuration management
- pkg/tools/url_replacements.go - URL replacement logic
- pkg/tools/environment.go - Environment variable management
- pkg/tools/download.go - Integration with URL replacements
- pkg/tools/manager.go - Enhanced tool management
- pkg/util/log.go - Centralized logging utilities
- website/content/url-replacements.md - Documentation
- test/integration_test.go - Enhanced integration tests
- test/java_debug_test.go - CI debugging capabilities
This implementation uses global-only configuration for security and simplicity,
avoiding the complexity of project-level overrides while providing enterprise
users with the flexibility they need for internal mirrors and proxies.
Closes #401 parent c41eb64 commit 7b7d40a
File tree
46 files changed
+5981
-565
lines changed- .github/workflows
- cmd
- pkg
- config
- executor
- shell
- tools
- util
- test
- website
- content
- data
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
46 files changed
+5981
-565
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
56 | 88 | | |
57 | 89 | | |
58 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| |||
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
| 61 | + | |
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
| |||
199 | 204 | | |
200 | 205 | | |
201 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
202 | 238 | | |
203 | 239 | | |
204 | 240 | | |
| |||
354 | 390 | | |
355 | 391 | | |
356 | 392 | | |
| 393 | + | |
357 | 394 | | |
358 | 395 | | |
359 | 396 | | |
| |||
397 | 434 | | |
398 | 435 | | |
399 | 436 | | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
400 | 443 | | |
401 | 444 | | |
402 | 445 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
0 commit comments