Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request refactors the Raid CLI's core functionality by renaming compilation functions to "Load", introducing a new environment management system, consolidating profile commands, and improving code organization.
- Function renaming: Updates
Compile/ForceCompiletoLoad/ForceLoadthroughout the codebase - Environment management: Adds comprehensive environment handling with
.envfile support via godotenv - Command consolidation: Merges profile use functionality into the main profile command
Reviewed Changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/raid/raid.go | Renames compilation functions to Load/ForceLoad |
| src/raid/profile/profile.go | Updates function names and comment formatting |
| src/raid/env/env.go | Adds new environment management API layer |
| src/internal/utils/cobra-ext.go | Extracts error merging to common utilities |
| src/internal/utils/Common.go | Provides shared error merging functionality |
| src/internal/sys/system.go | Improves file creation with error handling |
| src/internal/lib/strings.go | Removes constants (moved to config.go) |
| src/internal/lib/repo.go | Adds environment support to repository struct |
| src/internal/lib/profile.go | Enhances profile caching and environment handling |
| src/internal/lib/lib.go | Updates load functions and context management |
| src/internal/lib/env.go | Implements comprehensive environment management |
| src/internal/lib/config.go | Consolidates configuration constants |
| src/cmd/profile/use.go | Removes standalone use command |
| src/cmd/profile/profile.go | Consolidates profile display and setting |
| src/cmd/profile/list.go | Updates to use new ListAll function |
| src/cmd/env/list.go | Adds environment listing command |
| src/cmd/env/env.go | Implements environment query and execution |
| go.mod | Adds godotenv dependency |
| README.md | Updates documentation with improved structure |
| .github/copilot-instructions.md | Adds comprehensive project architecture guide |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 1 1
Lines 2 2
=====================================
Misses 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| cmd.PrintErrln("Failed to switch environment:", err) | ||
| } | ||
| raid.ForceLoad() | ||
| if err := env.Execute(env.Get()); err != nil { |
There was a problem hiding this comment.
Bug: Environment Variable Conflict and Execution Order Issues
The env command's new logic for setting an environment introduces a local env variable that shadows the imported package, causing compilation errors for env.Contains, env.Set, and env.Execute. Additionally, env.Set() runs before raid.ForceLoad(), which it depends on for context. The command also continues execution without handling errors from raid.ForceLoad() or a failed env.Set().
| return file | ||
|
|
||
| os.MkdirAll(path.Dir(pathEx), os.ModeDir|0755) | ||
| return os.Create(pathEx) |
This pull request introduces significant improvements and refactoring to the Raid CLI's environment and profile management, updates documentation, and adds new dependencies. The environment system is now more robust, supporting listing, activating, and executing environments with improved configuration and variable handling. The profile command is streamlined, and documentation is expanded to give a clearer overview of the project architecture and usage.
Environment Management Enhancements:
.envfiles using the newgodotenvdependency. (src/internal/lib/env.go,go.mod, [1] [2]raid env listcommand to display all available environments. (src/cmd/env/list.go, src/cmd/env/list.goR1-R25)raid envcommand to support querying and setting the active environment, with improved error handling and user feedback. (src/cmd/env/env.go, src/cmd/env/env.goR4-R44)Profile Management Improvements:
raid profilecommand to both display and set the active profile, removing the redundantprofile usesubcommand. (src/cmd/profile/profile.go,src/cmd/profile/use.go, [1] [2] [3]src/internal/lib/profile.go, [1] [2]ListAllmethod. (src/cmd/profile/list.go, src/cmd/profile/list.goL14-R14)Documentation and Usability:
.github/copilot-instructions.md.README.mdwith platform badges, clearer installation instructions, and improved best practices for handling sensitive information. [1] [2]Configuration and Dependency Updates:
src/internal/lib/config.go, src/internal/lib/config.goR8-R16)godotenvpackage for environment variable file management. (go.mod, go.modR11)These changes collectively make environment and profile management more intuitive, robust, and user-friendly, while also improving documentation and code maintainability.
Note
Adds environment listing/activation/execution with .env handling, replaces
profile usewith directprofileset/display, and refactors core compile→load APIs with related config and utilities updates.raid envnow shows active env (no args), sets env, and executes it; newraid env listsubcommand.raid profilenow displays or sets the active profile; removesprofile usesubcommand;profile listuses new listing API.SetEnv,GetEnv,ListEnvs,ExecuteEnv) with.envfile management viagodotenv.ProfileandRepo; cache profile/env inContext.Compile→Load,ForceCompile→ForceLoad).strings.gotoconfig.goand deletestrings.go.sys.CreateFileto return(file, error); addutils.MergeErrand refactor cobra helpers..github/copilot-instructions.mdand expandREADME.mdwith badges, install notes, and best practices.github.com/joho/godotenvfor env file handling.Written by Cursor Bugbot for commit d35f72b. This will update automatically on new commits. Configure here.