fix: resolve module import error for environment detector

- Use existing interactive-detector.js instead of TypeScript file
- Add WSL and Windows detection to interactive-detector.js
- Fix import path in safe-interactive.js
This commit is contained in:
rUv committed 2025-07-09 15:57:32 +00:00
1 parent 52ecafb1c1
commit dfde37520f
2 files changed
+11 -7

No files matched your search

+3
View File
@@ -63,6 +63,9 @@ export function getEnvironmentType() {
if (process.env.CI) return 'ci-environment';
if (process.env.GITHUB_ACTIONS) return 'github-actions';
if (process.env.DOCKER_CONTAINER) return 'docker';
if (process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP) return 'wsl';
if (process.platform === 'win32') return 'windows';
if (process.env.TERM_PROGRAM === 'vscode') return 'vscode';
if (!isRawModeSupported()) return 'no-raw-mode';
return 'interactive';
}
+8 -7
View File
@@ -3,7 +3,7 @@
*/
import chalk from 'chalk';
import { shouldUseNonInteractiveMode, detectExecutionEnvironment } from './environment-detector.js';
import { isInteractive, isRawModeSupported, getEnvironmentType } from './interactive-detector.js';
/**
* Wraps an interactive function with safety checks
@@ -28,23 +28,24 @@ export function safeInteractive(interactiveFn, fallbackFn, options = {}) {
}
// Auto-detect if we should use non-interactive mode
if (shouldUseNonInteractiveMode()) {
const env = detectExecutionEnvironment({ skipWarnings: true });
if (!isInteractive() || !isRawModeSupported()) {
const envType = getEnvironmentType();
if (!options.silent) {
console.log(chalk.yellow('\n⚠️ Interactive mode not available'));
console.log(chalk.gray(`Detected environment: ${envType}`));
// Provide specific message based on environment
if (env.isWSL) {
if (process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP) {
console.log(chalk.gray('WSL detected - raw mode may cause process hangs'));
console.log(chalk.cyan('💡 Tip: Use --no-interactive flag or run in native Linux'));
} else if (env.isWindows) {
} else if (process.platform === 'win32') {
console.log(chalk.gray('Windows detected - terminal compatibility issues'));
console.log(chalk.cyan('💡 Tip: Use Windows Terminal or WSL2 for better experience'));
} else if (env.isVSCode) {
} else if (process.env.TERM_PROGRAM === 'vscode') {
console.log(chalk.gray('VS Code terminal detected - limited interactive support'));
console.log(chalk.cyan('💡 Tip: Use external terminal for full functionality'));
} else if (!env.supportsRawMode) {
} else if (!isRawModeSupported()) {
console.log(chalk.gray('Terminal does not support raw mode'));
}