@v-aranda/artifice 1.0.2 → 1.0.3

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v-aranda/artifice",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "CLI para scaffolding e orquestração de agentes de IA",
5
5
  "type": "module",
6
6
  "bin": { "artifice": "./bin/artifice.js" },
@@ -7,9 +7,16 @@ import { getLocalConfig, saveLocalConfig } from '../utils/config.js';
7
7
 
8
8
  export const GOOGLE_SCOPE = 'https://www.googleapis.com/auth/cloud-platform';
9
9
 
10
+ export function getBrowserLaunchCommand(url, platform = process.platform) {
11
+ // Do not invoke cmd.exe here: it treats '&' in OAuth query strings as command
12
+ // separators and silently drops parameters such as response_type=code.
13
+ const command = platform === 'win32' ? 'rundll32.exe' : platform === 'darwin' ? 'open' : 'xdg-open';
14
+ const args = platform === 'win32' ? ['url.dll,FileProtocolHandler', url] : [url];
15
+ return { command, args };
16
+ }
17
+
10
18
  function openBrowser(url) {
11
- const command = process.platform === 'win32' ? 'cmd' : process.platform === 'darwin' ? 'open' : 'xdg-open';
12
- const args = process.platform === 'win32' ? ['/c', 'start', '', url] : [url];
19
+ const { command, args } = getBrowserLaunchCommand(url);
13
20
  execFile(command, args, () => {});
14
21
  }
15
22