Refactored environment detection. Now excluding session loading and asset merging for CLI requests