Skip to content

Implement EnvironmentManager for safe environment variable and PATH management#55

Merged
gnodet merged 1 commit intomainfrom
environment-manager
Oct 3, 2025
Merged

Implement EnvironmentManager for safe environment variable and PATH management#55
gnodet merged 1 commit intomainfrom
environment-manager

Conversation

@gnodet
Copy link
Copy Markdown
Owner

@gnodet gnodet commented Oct 3, 2025

  • Create EnvironmentManager class with safe environment variable management
  • Add special PATH handling with AddToPath() and AppendToPath() methods
  • Update EnvironmentProvider interface to use EnvironmentManager instead of map
  • Update all tools (Go, Java, Maven, Mvnd, Node) to use new EnvironmentProvider interface
  • Implement comprehensive Go environment setup with GOROOT, GOPATH, and PATH management
  • Add EnvGoPath constant for GOPATH environment variable
  • Fix executor environment setup to properly merge tool-specific PATH modifications
  • Resolve golangci-lint PATH issues by ensuring GOPATH/bin is included in PATH
  • Use 'env golangci-lint run' workaround for mvx-shell interpreter limitations
  • Make Manager.SetupEnvironment() the single source of truth for all environment setup
  • Remove duplicated PATH logic from cmd/env.go and cmd/root.go
  • Simplify executor to use complete environment from Manager
  • Manager now starts with system environment and adds tool-specific modifications
  • Each tool contributes both HOME directories and PATH entries via SetupEnvironment()
  • Eliminates scattered environment logic across multiple files
  • Follows Single Responsibility Principle with centralized environment management

This establishes a robust foundation for environment management across all tools
and resolves the core issue where tool-specific PATH modifications were being
lost during command execution. It also resolves the architectural issue where environment
setup was scattered across multiple files with inconsistent behavior between shell
integration, global setup, and command execution.

@gnodet gnodet force-pushed the environment-manager branch from d7b94e6 to 8f02697 Compare October 3, 2025 19:14
…anagement

- Create EnvironmentManager class with safe environment variable management
- Add special PATH handling with AddToPath() and AppendToPath() methods
- Update EnvironmentProvider interface to use EnvironmentManager instead of map
- Update all tools (Go, Java, Maven, Mvnd, Node) to use new EnvironmentProvider interface
- Implement comprehensive Go environment setup with GOROOT, GOPATH, and PATH management
- Add EnvGoPath constant for GOPATH environment variable
- Fix executor environment setup to properly merge tool-specific PATH modifications
- Resolve golangci-lint PATH issues by ensuring GOPATH/bin is included in PATH
- Use 'env golangci-lint run' workaround for mvx-shell interpreter limitations
- Make Manager.SetupEnvironment() the single source of truth for all environment setup
- Remove duplicated PATH logic from cmd/env.go and cmd/root.go
- Simplify executor to use complete environment from Manager
- Manager now starts with system environment and adds tool-specific modifications
- Each tool contributes both HOME directories and PATH entries via SetupEnvironment()
- Eliminates scattered environment logic across multiple files
- Follows Single Responsibility Principle with centralized environment management

This establishes a robust foundation for environment management across all tools
and resolves the core issue where tool-specific PATH modifications were being
lost during command execution. It also resolves the architectural issue where environment
setup was scattered across multiple files with inconsistent behavior between shell
integration, global setup, and command execution.
@gnodet gnodet force-pushed the environment-manager branch from 8f02697 to c373a5a Compare October 3, 2025 19:28
@gnodet gnodet merged commit 414af83 into main Oct 3, 2025
1 check passed
@gnodet gnodet deleted the environment-manager branch October 6, 2025 09:04
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.

1 participant