wave-code 0.17.10 → 0.17.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoginCommand.d.ts","sourceRoot":"","sources":["../../src/components/LoginCommand.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LoginCommand.d.ts","sourceRoot":"","sources":["../../src/components/LoginCommand.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAuBhD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA0MpD,CAAC"}
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useState } from "react";
|
|
3
3
|
import { Box, Text, useInput } from "ink";
|
|
4
|
+
import { execFile } from "child_process";
|
|
5
|
+
import { promisify } from "util";
|
|
4
6
|
import { authService } from "wave-agent-sdk";
|
|
7
|
+
const execFileAsync = promisify(execFile);
|
|
8
|
+
function openBrowser(url) {
|
|
9
|
+
const platform = process.platform;
|
|
10
|
+
try {
|
|
11
|
+
if (platform === "darwin") {
|
|
12
|
+
execFileAsync("open", [url]);
|
|
13
|
+
}
|
|
14
|
+
else if (platform === "win32") {
|
|
15
|
+
execFileAsync("cmd", ["/c", "start", "", url]);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
execFileAsync("xdg-open", [url]);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// Browser not available — URL is still displayed in the UI
|
|
23
|
+
}
|
|
24
|
+
}
|
|
5
25
|
export const LoginCommand = ({ onCancel }) => {
|
|
6
26
|
const [isLoading, setIsLoading] = useState(false);
|
|
7
27
|
const [message, setMessage] = useState("");
|
|
@@ -73,6 +93,7 @@ export const LoginCommand = ({ onCancel }) => {
|
|
|
73
93
|
await authService.login({
|
|
74
94
|
onAuthUrl: (url) => {
|
|
75
95
|
setAuthUrl(url);
|
|
96
|
+
openBrowser(url);
|
|
76
97
|
setMessage("Paste the authorization code from your browser URL bar:");
|
|
77
98
|
},
|
|
78
99
|
readToken,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-code",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.12",
|
|
4
4
|
"description": "CLI-based code assistant powered by AI, built with React and Ink",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"semver": "^7.7.4",
|
|
43
43
|
"yargs": "^17.7.2",
|
|
44
44
|
"zod": "^3.23.8",
|
|
45
|
-
"wave-agent-sdk": "0.17.
|
|
45
|
+
"wave-agent-sdk": "0.17.12"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/react": "^19.1.8",
|
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
import React, { useRef, useState } from "react";
|
|
2
2
|
import { Box, Text, useInput } from "ink";
|
|
3
|
+
import { execFile } from "child_process";
|
|
4
|
+
import { promisify } from "util";
|
|
3
5
|
import { authService } from "wave-agent-sdk";
|
|
4
6
|
|
|
7
|
+
const execFileAsync = promisify(execFile);
|
|
8
|
+
|
|
9
|
+
function openBrowser(url: string): void {
|
|
10
|
+
const platform = process.platform;
|
|
11
|
+
try {
|
|
12
|
+
if (platform === "darwin") {
|
|
13
|
+
execFileAsync("open", [url]);
|
|
14
|
+
} else if (platform === "win32") {
|
|
15
|
+
execFileAsync("cmd", ["/c", "start", "", url]);
|
|
16
|
+
} else {
|
|
17
|
+
execFileAsync("xdg-open", [url]);
|
|
18
|
+
}
|
|
19
|
+
} catch {
|
|
20
|
+
// Browser not available — URL is still displayed in the UI
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
5
24
|
export interface LoginCommandProps {
|
|
6
25
|
onCancel: () => void;
|
|
7
26
|
}
|
|
@@ -91,6 +110,7 @@ export const LoginCommand: React.FC<LoginCommandProps> = ({ onCancel }) => {
|
|
|
91
110
|
await authService.login({
|
|
92
111
|
onAuthUrl: (url: string) => {
|
|
93
112
|
setAuthUrl(url);
|
|
113
|
+
openBrowser(url);
|
|
94
114
|
setMessage("Paste the authorization code from your browser URL bar:");
|
|
95
115
|
},
|
|
96
116
|
readToken,
|