Add detect_environment() function for runtime re-detection#35
Merged
lunarcloud merged 3 commits intomainfrom Feb 10, 2026
Merged
Add detect_environment() function for runtime re-detection#35lunarcloud merged 3 commits intomainfrom
lunarcloud merged 3 commits intomainfrom
Conversation
Co-authored-by: lunarcloud <1565970+lunarcloud@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add ability to re-run environment detection for users
Add detect_environment() function for runtime re-detection
Feb 10, 2026
lunarcloud
requested changes
Feb 10, 2026
init.sh
Outdated
Owner
There was a problem hiding this comment.
is it possible to call detect_environment here instead of having duplicate code?
Contributor
Author
There was a problem hiding this comment.
Yes! I've moved the detect_environment() function to init.sh and eliminated the duplicate code. The function is now defined once in init.sh (where it's called for initial detection) and can be called later for re-detection. This removes 165 lines of duplicate code from helpers.sh. (commit 4e90bd7)
Co-authored-by: lunarcloud <1565970+lunarcloud@users.noreply.github.com>
lunarcloud
approved these changes
Feb 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Environment detection runs once on initial sourcing. Scripts that switch contexts (CI → interactive) or temporarily force fallback mode have no way to re-detect without re-sourcing the entire library.
Changes
init.sh: Add
detect_environment()function encapsulating all detection logicINTERFACEandGUIvariables (only detects if unset)DETECTED_DESKTOP,INTERFACE,GUI,terminal, tool availability flags, sudo method, etc.README.md: Document function and add usage example
helpers.sh: Remove duplicate detection code to maintain single source of truth
Usage
Backward compatible—existing scripts unchanged. Eliminates code duplication by defining the function once in init.sh.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.