haansi 0.1.15 → 0.1.17
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/haansi.js +7 -7
- package/package.json +1 -1
package/dist/haansi.js
CHANGED
|
@@ -39,7 +39,7 @@ var require_package = __commonJS({
|
|
|
39
39
|
"package.json"(exports2, module2) {
|
|
40
40
|
module2.exports = {
|
|
41
41
|
name: "haansi",
|
|
42
|
-
version: "0.1.
|
|
42
|
+
version: "0.1.17",
|
|
43
43
|
description: "Haansi CLI - Session collector and MCP server for Claude Code",
|
|
44
44
|
bin: {
|
|
45
45
|
haansi: "./dist/haansi.js"
|
|
@@ -83,11 +83,11 @@ function sleep(ms) {
|
|
|
83
83
|
}
|
|
84
84
|
async function authLogin() {
|
|
85
85
|
const apiUrl = process.env.HAANSI_API_URL ?? DEFAULT_API_URL;
|
|
86
|
-
const appUrl = process.env.HAANSI_APP_URL ?? DEFAULT_APP_URL;
|
|
87
86
|
console.log("Haansi CLI \u2014 Browser Login\n");
|
|
88
87
|
const initiateRes = await fetch(`${apiUrl}/api/v1/auth/extension/initiate`, {
|
|
89
88
|
method: "POST",
|
|
90
|
-
headers: { "Content-Type": "application/json" }
|
|
89
|
+
headers: { "Content-Type": "application/json" },
|
|
90
|
+
body: JSON.stringify({ client_type: "cli" })
|
|
91
91
|
});
|
|
92
92
|
if (!initiateRes.ok) {
|
|
93
93
|
const body = await initiateRes.text().catch(() => "");
|
|
@@ -95,8 +95,9 @@ async function authLogin() {
|
|
|
95
95
|
`Failed to start auth session (${initiateRes.status}): ${body.slice(0, 200)}`
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
|
-
const { session_id } = await initiateRes.json();
|
|
99
|
-
const
|
|
98
|
+
const { session_id, auth_url: vsCodeAuthUrl } = await initiateRes.json();
|
|
99
|
+
const frontendOrigin = new URL(vsCodeAuthUrl).origin;
|
|
100
|
+
const authUrl = `${frontendOrigin}/auth/cli?session_id=${session_id}`;
|
|
100
101
|
const opened = openBrowser(authUrl);
|
|
101
102
|
if (opened) {
|
|
102
103
|
console.log("A browser window has been opened for you to log in.");
|
|
@@ -171,7 +172,7 @@ Authenticated successfully${orgName ? ` (${orgName})` : ""}!`);
|
|
|
171
172
|
"Run `haansi collect` to upload sessions or `haansi setup-mcp` to configure Claude Code."
|
|
172
173
|
);
|
|
173
174
|
}
|
|
174
|
-
var import_node_child_process, import_node_fs, import_node_path, import_node_os, DEFAULT_API_URL,
|
|
175
|
+
var import_node_child_process, import_node_fs, import_node_path, import_node_os, DEFAULT_API_URL, HAANSI_DIR, CREDENTIALS_FILE, POLL_INTERVAL_MS, TIMEOUT_MS;
|
|
175
176
|
var init_auth_login = __esm({
|
|
176
177
|
"src/commands/auth-login.ts"() {
|
|
177
178
|
"use strict";
|
|
@@ -180,7 +181,6 @@ var init_auth_login = __esm({
|
|
|
180
181
|
import_node_path = require("node:path");
|
|
181
182
|
import_node_os = require("node:os");
|
|
182
183
|
DEFAULT_API_URL = "https://api.haansi.co";
|
|
183
|
-
DEFAULT_APP_URL = "https://app.haansi.co";
|
|
184
184
|
HAANSI_DIR = (0, import_node_path.join)((0, import_node_os.homedir)(), ".haansi");
|
|
185
185
|
CREDENTIALS_FILE = (0, import_node_path.join)(HAANSI_DIR, "credentials.json");
|
|
186
186
|
POLL_INTERVAL_MS = 2e3;
|