bmad-method 6.8.1-next.11 → 6.8.1-next.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -75,6 +75,9 @@ module.exports = {
|
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
const { checkWindowsNodeFromWsl } = require('../core/wsl-node-check');
|
|
79
|
+
await checkWindowsNodeFromWsl();
|
|
80
|
+
|
|
78
81
|
// Set debug flag as environment variable for all components
|
|
79
82
|
if (options.debug) {
|
|
80
83
|
process.env.BMAD_DEBUG_MANIFEST = 'true';
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const prompts = require('../prompts');
|
|
2
|
+
|
|
3
|
+
const WSL_UNC_PATTERN = /^\\\\wsl(?:\.localhost|\$)?\\/i;
|
|
4
|
+
|
|
5
|
+
function normalizePath(value) {
|
|
6
|
+
return typeof value === 'string' ? value.replaceAll('/', '\\').toLowerCase() : '';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function isLinuxStylePath(value) {
|
|
10
|
+
return (
|
|
11
|
+
typeof value === 'string' &&
|
|
12
|
+
value.startsWith('/') &&
|
|
13
|
+
!value.startsWith('//') &&
|
|
14
|
+
!/^\/[a-z](?:\/|$)/i.test(value) &&
|
|
15
|
+
!/^\/cygdrive\/[a-z](?:\/|$)/i.test(value)
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function isWslUncPath(value) {
|
|
20
|
+
return WSL_UNC_PATTERN.test(value || '');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Detect the broken interop case where WSL resolved node/npx to Windows.
|
|
25
|
+
* @param {Object} [runtime]
|
|
26
|
+
* @param {string} [runtime.platform]
|
|
27
|
+
* @param {Object} [runtime.env]
|
|
28
|
+
* @param {string} [runtime.cwd]
|
|
29
|
+
* @param {string} [runtime.execPath]
|
|
30
|
+
* @returns {{isMismatch: boolean, reason: string|null, execPath: string}}
|
|
31
|
+
*/
|
|
32
|
+
function detectWindowsNodeFromWsl(runtime = {}) {
|
|
33
|
+
const platform = runtime.platform || process.platform;
|
|
34
|
+
const env = runtime.env || process.env;
|
|
35
|
+
const cwd = runtime.cwd || safeCwd();
|
|
36
|
+
const execPath = runtime.execPath || process.execPath || '';
|
|
37
|
+
|
|
38
|
+
if (platform !== 'win32') {
|
|
39
|
+
return { isMismatch: false, reason: null, execPath };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (env.WSL_DISTRO_NAME) {
|
|
43
|
+
return { isMismatch: true, reason: 'WSL_DISTRO_NAME is set', execPath };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (env.WSL_INTEROP) {
|
|
47
|
+
return { isMismatch: true, reason: 'WSL_INTEROP is set', execPath };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (isLinuxStylePath(env.PWD)) {
|
|
51
|
+
return { isMismatch: true, reason: 'PWD is a Linux path', execPath };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (isWslUncPath(cwd)) {
|
|
55
|
+
return { isMismatch: true, reason: 'current directory is a WSL UNC path', execPath };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const normalizedExecPath = normalizePath(execPath);
|
|
59
|
+
if (normalizedExecPath.includes('\\wsl$\\') || normalizedExecPath.includes('\\wsl.localhost\\')) {
|
|
60
|
+
return { isMismatch: true, reason: 'Node executable path is under a WSL UNC path', execPath };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return { isMismatch: false, reason: null, execPath };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function safeCwd() {
|
|
67
|
+
try {
|
|
68
|
+
return process.cwd();
|
|
69
|
+
} catch {
|
|
70
|
+
return '';
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function formatWindowsNodeFromWslMessage(detection) {
|
|
75
|
+
const lines = [
|
|
76
|
+
'Windows Node.js was launched from a WSL shell.',
|
|
77
|
+
'',
|
|
78
|
+
'This usually means Node.js is not installed inside the WSL distro, so WSL resolved `node`/`npx` to Windows.',
|
|
79
|
+
'The installer cannot safely continue because Linux paths may be interpreted as Windows paths.',
|
|
80
|
+
'',
|
|
81
|
+
'Install Node.js inside WSL, then rerun the same command from the WSL terminal.',
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
if (detection.execPath) {
|
|
85
|
+
lines.push('', `Detected Node executable: ${detection.execPath}`);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (detection.reason) {
|
|
89
|
+
lines.push(`Detection signal: ${detection.reason}`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return lines.join('\n');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async function checkWindowsNodeFromWsl() {
|
|
96
|
+
const detection = module.exports.detectWindowsNodeFromWsl();
|
|
97
|
+
if (!detection.isMismatch) {
|
|
98
|
+
return detection;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
await prompts.log.error(formatWindowsNodeFromWslMessage(detection));
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
module.exports = {
|
|
106
|
+
checkWindowsNodeFromWsl,
|
|
107
|
+
detectWindowsNodeFromWsl,
|
|
108
|
+
formatWindowsNodeFromWslMessage,
|
|
109
|
+
};
|