@taj-special/dravix-code 1.1.11 → 1.1.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/dist/services/context.js
CHANGED
|
@@ -119,8 +119,12 @@ export function buildContext(root) {
|
|
|
119
119
|
const files = getProjectFiles(root);
|
|
120
120
|
const git = getGitStatus(root);
|
|
121
121
|
const projectName = path.basename(root);
|
|
122
|
+
const shell = process.platform === 'win32' ? 'Windows — PowerShell'
|
|
123
|
+
: process.platform === 'darwin' ? 'macOS — bash/zsh'
|
|
124
|
+
: 'Linux — bash';
|
|
122
125
|
return `Project: ${projectName}
|
|
123
126
|
Working dir: ${root}
|
|
127
|
+
OS: ${shell}
|
|
124
128
|
Git status:
|
|
125
129
|
${git || '(clean)'}
|
|
126
130
|
Files:
|
|
@@ -405,10 +405,15 @@ export async function executeSingleOp(op, cwd, onStage) {
|
|
|
405
405
|
const safeCmd = /(?:^|\s)npx\s+(?!--yes\b)/i.test(op.command)
|
|
406
406
|
? op.command.replace(/(?<=(?:^|\s))npx(\s+)/i, 'npx --yes$1')
|
|
407
407
|
: op.command;
|
|
408
|
-
|
|
409
|
-
|
|
408
|
+
const isWindows = process.platform === 'win32';
|
|
409
|
+
// On PowerShell 5.1, 'curl' is an alias for Invoke-WebRequest — use curl.exe for real HTTP
|
|
410
|
+
const finalCmd = isWindows
|
|
411
|
+
? safeCmd.replace(/\bcurl\b(?!\.\w)/g, 'curl.exe')
|
|
412
|
+
: safeCmd;
|
|
410
413
|
const out = await new Promise((res, rej) => {
|
|
411
|
-
const child =
|
|
414
|
+
const child = isWindows
|
|
415
|
+
? spawn('powershell.exe', ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', finalCmd], { cwd: runCwd, windowsHide: true })
|
|
416
|
+
: spawn('bash', ['-c', finalCmd], { cwd: runCwd });
|
|
412
417
|
child.stdout?.setEncoding('utf-8');
|
|
413
418
|
child.stderr?.setEncoding('utf-8');
|
|
414
419
|
let stdout = '';
|