@cccarv82/freya 3.8.1 → 3.8.2

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.
@@ -34,14 +34,16 @@ function run(cmd, args, cwd, extraEnv) {
34
34
  const env = extraEnv ? { ...process.env, ...extraEnv } : process.env;
35
35
  try {
36
36
  if (process.platform === 'win32') {
37
- const escapedArgs = args.map(a => {
38
- const escaped = String(a).replace(/'/g, "''");
39
- return `'${escaped}'`;
40
- });
41
- const psCommand = `& '${cmd}' ${escapedArgs.join(' ')}`;
42
- child = spawn('powershell.exe', [
43
- '-NoLogo', '-Command', psCommand
44
- ], { cwd, env, windowsHide: true });
37
+ // If we have a full path to the executable, use it directly with spawn
38
+ // (no shell needed — avoids PowerShell argument mangling).
39
+ // Only fall back to cmd.exe for bare command names.
40
+ if (path.isAbsolute(cmd) || cmd.includes('\\') || cmd.includes('/')) {
41
+ child = spawn(cmd, args, { cwd, env, windowsHide: true });
42
+ } else {
43
+ // Bare command name — use cmd.exe to resolve from PATH
44
+ const comspec = process.env.ComSpec || 'cmd.exe';
45
+ child = spawn(comspec, ['/d', '/s', '/c', cmd, ...args], { cwd, shell: false, env });
46
+ }
45
47
  } else {
46
48
  child = spawn(cmd, args, { cwd, shell: true, env });
47
49
  }
package/cli/web.js CHANGED
@@ -971,17 +971,16 @@ function run(cmd, args, cwd, extraEnv, stdinData) {
971
971
 
972
972
  try {
973
973
  if (process.platform === 'win32') {
974
- // Use PowerShell fnm/nvm set PATH only in PowerShell profile,
975
- // so cmd.exe (shell:true) can't find npm global .cmd shims like copilot.
976
- // Do NOT use -NoProfile: the profile is what loads fnm/nvm PATH entries.
977
- const escapedArgs = args.map(a => {
978
- const escaped = String(a).replace(/'/g, "''");
979
- return `'${escaped}'`;
980
- });
981
- const psCommand = `& '${cmd}' ${escapedArgs.join(' ')}`;
982
- child = spawn('powershell.exe', [
983
- '-NoLogo', '-Command', psCommand
984
- ], { cwd, env, windowsHide: true });
974
+ // getCopilotCmd() resolves the full path via PowerShell/where.
975
+ // Once we have the full path, spawn directly no shell needed.
976
+ // This avoids PowerShell argument mangling issues.
977
+ if (path.isAbsolute(cmd) || cmd.includes('\\') || cmd.includes('/')) {
978
+ child = spawn(cmd, args, { cwd, env, windowsHide: true });
979
+ } else {
980
+ // Bare command name — use cmd.exe to resolve from PATH
981
+ const comspec = process.env.ComSpec || 'cmd.exe';
982
+ child = spawn(comspec, ['/d', '/s', '/c', cmd, ...args], { cwd, shell: false, env });
983
+ }
985
984
  } else {
986
985
  child = spawn(cmd, args, { cwd, shell: true, env });
987
986
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cccarv82/freya",
3
- "version": "3.8.1",
3
+ "version": "3.8.2",
4
4
  "description": "Personal AI Assistant with local-first persistence",
5
5
  "scripts": {
6
6
  "health": "node scripts/validate-data.js && node scripts/validate-structure.js",