devpulse-ai 0.1.0 → 0.1.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.
- package/dist/browser-auth.js +9 -3
- package/dist/commands/login.js +4 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/browser-auth.js
CHANGED
|
@@ -50,6 +50,9 @@ export function waitForBrowserAuth(apiUrl, onReady) {
|
|
|
50
50
|
settled = true;
|
|
51
51
|
if (timer)
|
|
52
52
|
clearTimeout(timer);
|
|
53
|
+
// Force-close lingering browser keep-alive connections so the CLI exits.
|
|
54
|
+
server.closeIdleConnections?.();
|
|
55
|
+
server.closeAllConnections();
|
|
53
56
|
server.close();
|
|
54
57
|
if (err)
|
|
55
58
|
reject(err);
|
|
@@ -58,21 +61,24 @@ export function waitForBrowserAuth(apiUrl, onReady) {
|
|
|
58
61
|
}
|
|
59
62
|
const server = http.createServer((req, res) => {
|
|
60
63
|
if (!req.url?.startsWith("/callback")) {
|
|
61
|
-
res.writeHead(404);
|
|
64
|
+
res.writeHead(404, { Connection: "close" });
|
|
62
65
|
res.end("Not found");
|
|
66
|
+
req.socket.destroy();
|
|
63
67
|
return;
|
|
64
68
|
}
|
|
65
69
|
const url = new URL(req.url, "http://127.0.0.1");
|
|
66
70
|
const token = url.searchParams.get("token");
|
|
67
71
|
const returnedState = url.searchParams.get("state");
|
|
68
72
|
if (!token || returnedState !== state) {
|
|
69
|
-
res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
|
|
73
|
+
res.writeHead(400, { "Content-Type": "text/html; charset=utf-8", Connection: "close" });
|
|
70
74
|
res.end(errorHtml("Invalid or missing authorization parameters."));
|
|
75
|
+
req.socket.destroy();
|
|
71
76
|
finish(new Error("Authorization callback rejected."));
|
|
72
77
|
return;
|
|
73
78
|
}
|
|
74
|
-
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
79
|
+
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8", Connection: "close" });
|
|
75
80
|
res.end(successHtml());
|
|
81
|
+
req.socket.destroy();
|
|
76
82
|
finish(null, { token });
|
|
77
83
|
});
|
|
78
84
|
server.on("error", (err) => finish(err));
|
package/dist/commands/login.js
CHANGED
|
@@ -36,8 +36,7 @@ export async function login(opts) {
|
|
|
36
36
|
}
|
|
37
37
|
if (!token) {
|
|
38
38
|
ui.error("No token provided.");
|
|
39
|
-
process.
|
|
40
|
-
return;
|
|
39
|
+
process.exit(1);
|
|
41
40
|
}
|
|
42
41
|
config.token = token.trim();
|
|
43
42
|
try {
|
|
@@ -47,6 +46,8 @@ export async function login(opts) {
|
|
|
47
46
|
saveConfig(config);
|
|
48
47
|
ui.success(`Logged in as ${res.user.name ?? res.user.email ?? res.user.id} → team "${res.team.name ?? res.team.id}".`);
|
|
49
48
|
ui.dim("Run `devpulse sync` to upload your AI coding sessions.");
|
|
49
|
+
// Browser login starts a localhost callback server; force-exit so the shell prompt returns.
|
|
50
|
+
process.exit(0);
|
|
50
51
|
}
|
|
51
52
|
catch (err) {
|
|
52
53
|
if (err instanceof ApiError && err.status === 401) {
|
|
@@ -55,6 +56,6 @@ export async function login(opts) {
|
|
|
55
56
|
else {
|
|
56
57
|
ui.error(`Login failed: ${err.message}`);
|
|
57
58
|
}
|
|
58
|
-
process.
|
|
59
|
+
process.exit(1);
|
|
59
60
|
}
|
|
60
61
|
}
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const program = new Command();
|
|
|
9
9
|
program
|
|
10
10
|
.name("devpulse")
|
|
11
11
|
.description("DevPulse AI — sync local AI coding sessions to your team dashboard.")
|
|
12
|
-
.version("0.1.
|
|
12
|
+
.version("0.1.2");
|
|
13
13
|
program
|
|
14
14
|
.command("login")
|
|
15
15
|
.description("Authenticate the CLI (opens your browser by default).")
|