@husar.ai/cli 0.4.1 → 0.4.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/AGENTS.md +835 -0
- package/dist/auth/api.d.ts +15 -0
- package/dist/auth/api.js +86 -0
- package/dist/auth/api.js.map +1 -0
- package/dist/auth/config.d.ts +32 -0
- package/dist/auth/config.js +95 -0
- package/dist/auth/config.js.map +1 -0
- package/dist/auth/login.d.ts +30 -0
- package/dist/auth/login.js +450 -0
- package/dist/auth/login.js.map +1 -0
- package/dist/cli.js +83 -3
- package/dist/cli.js.map +1 -1
- package/dist/functions/create.d.ts +6 -0
- package/dist/functions/create.js +311 -0
- package/dist/functions/create.js.map +1 -0
- package/dist/mcp.js +20 -14
- package/dist/mcp.js.map +1 -1
- package/dist/types/config.d.ts +3 -1
- package/dist/types/config.js +12 -1
- package/dist/types/config.js.map +1 -1
- package/dist/zeus/const.js +635 -289
- package/dist/zeus/const.js.map +1 -1
- package/dist/zeus/index.d.ts +3079 -1601
- package/dist/zeus/index.js +150 -2
- package/dist/zeus/index.js.map +1 -1
- package/package.json +4 -4
- package/src/auth/api.ts +133 -0
- package/src/auth/config.ts +198 -0
- package/src/auth/login.ts +631 -0
- package/src/cli.ts +96 -4
- package/src/functions/create.ts +489 -0
- package/src/mcp.ts +47 -27
- package/src/types/config.ts +32 -1
- package/src/zeus/const.ts +641 -289
- package/src/zeus/index.ts +2996 -1465
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { createServer } from 'node:http';
|
|
2
|
+
import { URL } from 'node:url';
|
|
3
|
+
import { randomBytes } from 'node:crypto';
|
|
4
|
+
import { exec } from 'node:child_process';
|
|
5
|
+
import { saveCloudAuth, saveProjectAuth } from './config.js';
|
|
6
|
+
const DEFAULT_CALLBACK_PORT = 9876;
|
|
7
|
+
const CLOUD_AUTH_URL = process.env.HUSAR_AUTH_URL || 'https://husar.ai';
|
|
8
|
+
function escapeHtml(str) {
|
|
9
|
+
return str
|
|
10
|
+
.replace(/&/g, '&')
|
|
11
|
+
.replace(/</g, '<')
|
|
12
|
+
.replace(/>/g, '>')
|
|
13
|
+
.replace(/"/g, '"')
|
|
14
|
+
.replace(/'/g, ''');
|
|
15
|
+
}
|
|
16
|
+
function generateState() {
|
|
17
|
+
return randomBytes(32).toString('hex');
|
|
18
|
+
}
|
|
19
|
+
export async function startCloudLoginFlow(options) {
|
|
20
|
+
const port = options?.port ?? DEFAULT_CALLBACK_PORT;
|
|
21
|
+
const timeout = options?.timeout ?? 300000;
|
|
22
|
+
const expectedState = generateState();
|
|
23
|
+
return new Promise((resolve) => {
|
|
24
|
+
let resolved = false;
|
|
25
|
+
const server = createServer((req, res) => {
|
|
26
|
+
if (resolved) {
|
|
27
|
+
res.writeHead(200);
|
|
28
|
+
res.end('Already processed');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const url = new URL(req.url ?? '/', `http://localhost:${port}`);
|
|
32
|
+
if (url.pathname === '/callback') {
|
|
33
|
+
const accessToken = url.searchParams.get('access_token');
|
|
34
|
+
const userEmail = url.searchParams.get('user_email');
|
|
35
|
+
const returnedState = url.searchParams.get('state');
|
|
36
|
+
const error = url.searchParams.get('error');
|
|
37
|
+
if (error) {
|
|
38
|
+
resolved = true;
|
|
39
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
40
|
+
res.end(getErrorHtml(error));
|
|
41
|
+
server.close();
|
|
42
|
+
resolve({ success: false, error });
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (returnedState !== expectedState) {
|
|
46
|
+
resolved = true;
|
|
47
|
+
res.writeHead(400, { 'Content-Type': 'text/html' });
|
|
48
|
+
res.end(getErrorHtml('Invalid state parameter. This may be a CSRF attack.'));
|
|
49
|
+
server.close();
|
|
50
|
+
resolve({ success: false, error: 'State parameter mismatch - possible CSRF attack' });
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (!accessToken) {
|
|
54
|
+
resolved = true;
|
|
55
|
+
res.writeHead(400, { 'Content-Type': 'text/html' });
|
|
56
|
+
res.end(getErrorHtml('Missing access token'));
|
|
57
|
+
server.close();
|
|
58
|
+
resolve({ success: false, error: 'Missing access token from cloud auth' });
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
resolved = true;
|
|
62
|
+
const cloudAuth = {
|
|
63
|
+
email: userEmail ?? undefined,
|
|
64
|
+
accessToken,
|
|
65
|
+
};
|
|
66
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
67
|
+
res.end(getCloudSuccessHtml(userEmail ?? 'user'));
|
|
68
|
+
saveCloudAuth(cloudAuth)
|
|
69
|
+
.then(() => {
|
|
70
|
+
server.close();
|
|
71
|
+
resolve({
|
|
72
|
+
success: true,
|
|
73
|
+
email: userEmail ?? undefined,
|
|
74
|
+
accessToken,
|
|
75
|
+
});
|
|
76
|
+
})
|
|
77
|
+
.catch((err) => {
|
|
78
|
+
server.close();
|
|
79
|
+
resolve({ success: false, error: err.message });
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
res.writeHead(404);
|
|
84
|
+
res.end('Not found');
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
server.listen(port, () => {
|
|
88
|
+
const authUrl = `${CLOUD_AUTH_URL}/en/app/cli-auth?callback_port=${port}&state=${expectedState}`;
|
|
89
|
+
console.log(`\n🔐 Opening browser for cloud authentication...`);
|
|
90
|
+
console.log(` If the browser doesn't open, visit: ${authUrl}\n`);
|
|
91
|
+
openBrowser(authUrl);
|
|
92
|
+
});
|
|
93
|
+
server.on('error', (err) => {
|
|
94
|
+
if (!resolved) {
|
|
95
|
+
resolved = true;
|
|
96
|
+
resolve({ success: false, error: `Server error: ${err.message}` });
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
setTimeout(() => {
|
|
100
|
+
if (!resolved) {
|
|
101
|
+
resolved = true;
|
|
102
|
+
server.close();
|
|
103
|
+
resolve({ success: false, error: 'Cloud login timed out. Please try again.' });
|
|
104
|
+
}
|
|
105
|
+
}, timeout);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
export async function startPanelLoginFlow(panelHost, options) {
|
|
109
|
+
const port = options?.port ?? DEFAULT_CALLBACK_PORT;
|
|
110
|
+
const timeout = options?.timeout ?? 300000;
|
|
111
|
+
const normalizedHost = panelHost.endsWith('/') ? panelHost.slice(0, -1) : panelHost;
|
|
112
|
+
const expectedState = generateState();
|
|
113
|
+
return new Promise((resolve) => {
|
|
114
|
+
let resolved = false;
|
|
115
|
+
const server = createServer((req, res) => {
|
|
116
|
+
if (resolved) {
|
|
117
|
+
res.writeHead(200);
|
|
118
|
+
res.end('Already processed');
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const url = new URL(req.url ?? '/', `http://localhost:${port}`);
|
|
122
|
+
if (url.pathname === '/callback') {
|
|
123
|
+
const adminToken = url.searchParams.get('admin_token');
|
|
124
|
+
const host = url.searchParams.get('host');
|
|
125
|
+
const projectName = url.searchParams.get('project_name');
|
|
126
|
+
const returnedState = url.searchParams.get('state');
|
|
127
|
+
const error = url.searchParams.get('error');
|
|
128
|
+
if (error) {
|
|
129
|
+
resolved = true;
|
|
130
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
131
|
+
res.end(getErrorHtml(error));
|
|
132
|
+
server.close();
|
|
133
|
+
resolve({ success: false, error });
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (returnedState !== expectedState) {
|
|
137
|
+
resolved = true;
|
|
138
|
+
res.writeHead(400, { 'Content-Type': 'text/html' });
|
|
139
|
+
res.end(getErrorHtml('Invalid state parameter. This may be a CSRF attack.'));
|
|
140
|
+
server.close();
|
|
141
|
+
resolve({ success: false, error: 'State parameter mismatch - possible CSRF attack' });
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (!adminToken || !host || !projectName) {
|
|
145
|
+
resolved = true;
|
|
146
|
+
res.writeHead(400, { 'Content-Type': 'text/html' });
|
|
147
|
+
res.end(getErrorHtml('Missing required parameters'));
|
|
148
|
+
server.close();
|
|
149
|
+
resolve({ success: false, error: 'Missing admin_token, host, or project_name from panel' });
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
resolved = true;
|
|
153
|
+
const project = {
|
|
154
|
+
projectName,
|
|
155
|
+
host,
|
|
156
|
+
adminToken,
|
|
157
|
+
};
|
|
158
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
159
|
+
res.end(getPanelSuccessHtml(projectName));
|
|
160
|
+
saveProjectAuth(project)
|
|
161
|
+
.then(() => {
|
|
162
|
+
server.close();
|
|
163
|
+
resolve({
|
|
164
|
+
success: true,
|
|
165
|
+
project,
|
|
166
|
+
});
|
|
167
|
+
})
|
|
168
|
+
.catch((err) => {
|
|
169
|
+
server.close();
|
|
170
|
+
resolve({ success: false, error: err.message });
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
res.writeHead(404);
|
|
175
|
+
res.end('Not found');
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
server.listen(port, () => {
|
|
179
|
+
const authUrl = `${normalizedHost}/connect-device?callback_port=${port}&state=${expectedState}`;
|
|
180
|
+
console.log(`\n🔐 Opening browser for CMS authentication...`);
|
|
181
|
+
console.log(` You'll need your SUPERADMIN credentials (from the welcome email)`);
|
|
182
|
+
console.log(` If the browser doesn't open, visit: ${authUrl}\n`);
|
|
183
|
+
openBrowser(authUrl);
|
|
184
|
+
});
|
|
185
|
+
server.on('error', (err) => {
|
|
186
|
+
if (!resolved) {
|
|
187
|
+
resolved = true;
|
|
188
|
+
resolve({ success: false, error: `Server error: ${err.message}` });
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
setTimeout(() => {
|
|
192
|
+
if (!resolved) {
|
|
193
|
+
resolved = true;
|
|
194
|
+
server.close();
|
|
195
|
+
resolve({ success: false, error: 'Panel login timed out. Please try again.' });
|
|
196
|
+
}
|
|
197
|
+
}, timeout);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
export async function startLoginFlow(options) {
|
|
201
|
+
const port = options?.port ?? DEFAULT_CALLBACK_PORT;
|
|
202
|
+
const timeout = options?.timeout ?? 300000;
|
|
203
|
+
return new Promise((resolve) => {
|
|
204
|
+
let resolved = false;
|
|
205
|
+
const server = createServer((req, res) => {
|
|
206
|
+
if (resolved) {
|
|
207
|
+
res.writeHead(200);
|
|
208
|
+
res.end('Already processed');
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const url = new URL(req.url ?? '/', `http://localhost:${port}`);
|
|
212
|
+
if (url.pathname === '/callback') {
|
|
213
|
+
const host = url.searchParams.get('host');
|
|
214
|
+
const adminToken = url.searchParams.get('admin_token');
|
|
215
|
+
const projectName = url.searchParams.get('project_name');
|
|
216
|
+
const userEmail = url.searchParams.get('user_email');
|
|
217
|
+
const error = url.searchParams.get('error');
|
|
218
|
+
if (error) {
|
|
219
|
+
resolved = true;
|
|
220
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
221
|
+
res.end(getErrorHtml(error));
|
|
222
|
+
server.close();
|
|
223
|
+
resolve({ success: false, error });
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (!host || !adminToken || !projectName) {
|
|
227
|
+
resolved = true;
|
|
228
|
+
res.writeHead(400, { 'Content-Type': 'text/html' });
|
|
229
|
+
res.end(getErrorHtml('Missing required parameters'));
|
|
230
|
+
server.close();
|
|
231
|
+
resolve({ success: false, error: 'Missing required parameters' });
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
resolved = true;
|
|
235
|
+
const project = {
|
|
236
|
+
projectName,
|
|
237
|
+
host,
|
|
238
|
+
adminToken,
|
|
239
|
+
};
|
|
240
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
241
|
+
res.end(getPanelSuccessHtml(projectName, userEmail ?? 'user'));
|
|
242
|
+
Promise.all([
|
|
243
|
+
userEmail ? saveCloudAuth({ email: userEmail, accessToken: adminToken }) : Promise.resolve(),
|
|
244
|
+
saveProjectAuth(project),
|
|
245
|
+
])
|
|
246
|
+
.then(() => {
|
|
247
|
+
server.close();
|
|
248
|
+
resolve({
|
|
249
|
+
success: true,
|
|
250
|
+
email: userEmail ?? undefined,
|
|
251
|
+
project,
|
|
252
|
+
});
|
|
253
|
+
})
|
|
254
|
+
.catch((err) => {
|
|
255
|
+
server.close();
|
|
256
|
+
resolve({ success: false, error: err.message });
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
res.writeHead(404);
|
|
261
|
+
res.end('Not found');
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
server.listen(port, () => {
|
|
265
|
+
const authUrl = `${CLOUD_AUTH_URL}/en/app/cli-auth?callback_port=${port}`;
|
|
266
|
+
console.log(`\n🔐 Opening browser for authentication...`);
|
|
267
|
+
console.log(` If the browser doesn't open, visit: ${authUrl}\n`);
|
|
268
|
+
openBrowser(authUrl);
|
|
269
|
+
});
|
|
270
|
+
server.on('error', (err) => {
|
|
271
|
+
if (!resolved) {
|
|
272
|
+
resolved = true;
|
|
273
|
+
resolve({ success: false, error: `Server error: ${err.message}` });
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
setTimeout(() => {
|
|
277
|
+
if (!resolved) {
|
|
278
|
+
resolved = true;
|
|
279
|
+
server.close();
|
|
280
|
+
resolve({ success: false, error: 'Login timed out. Please try again.' });
|
|
281
|
+
}
|
|
282
|
+
}, timeout);
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
function openBrowser(url) {
|
|
286
|
+
const platform = process.platform;
|
|
287
|
+
let command;
|
|
288
|
+
if (platform === 'darwin') {
|
|
289
|
+
command = `open "${url}"`;
|
|
290
|
+
}
|
|
291
|
+
else if (platform === 'win32') {
|
|
292
|
+
command = `start "" "${url}"`;
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
command = `xdg-open "${url}"`;
|
|
296
|
+
}
|
|
297
|
+
exec(command, (err) => {
|
|
298
|
+
if (err) {
|
|
299
|
+
console.error('Could not open browser automatically.');
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
function getCloudSuccessHtml(email) {
|
|
304
|
+
return `
|
|
305
|
+
<!DOCTYPE html>
|
|
306
|
+
<html>
|
|
307
|
+
<head>
|
|
308
|
+
<meta charset="utf-8">
|
|
309
|
+
<title>Husar CLI - Cloud Login Successful</title>
|
|
310
|
+
<style>
|
|
311
|
+
body {
|
|
312
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
313
|
+
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
|
314
|
+
color: white;
|
|
315
|
+
min-height: 100vh;
|
|
316
|
+
display: flex;
|
|
317
|
+
align-items: center;
|
|
318
|
+
justify-content: center;
|
|
319
|
+
margin: 0;
|
|
320
|
+
}
|
|
321
|
+
.container {
|
|
322
|
+
text-align: center;
|
|
323
|
+
padding: 40px;
|
|
324
|
+
background: rgba(255,255,255,0.05);
|
|
325
|
+
border-radius: 16px;
|
|
326
|
+
border: 1px solid rgba(255,255,255,0.1);
|
|
327
|
+
}
|
|
328
|
+
.success-icon {
|
|
329
|
+
font-size: 64px;
|
|
330
|
+
margin-bottom: 20px;
|
|
331
|
+
}
|
|
332
|
+
h1 { margin: 0 0 10px; }
|
|
333
|
+
p { color: #a0a0a0; margin: 5px 0; }
|
|
334
|
+
.email { color: #60a5fa; font-weight: 600; }
|
|
335
|
+
.close-note {
|
|
336
|
+
margin-top: 30px;
|
|
337
|
+
font-size: 14px;
|
|
338
|
+
color: #666;
|
|
339
|
+
}
|
|
340
|
+
</style>
|
|
341
|
+
</head>
|
|
342
|
+
<body>
|
|
343
|
+
<div class="container">
|
|
344
|
+
<div class="success-icon">✅</div>
|
|
345
|
+
<h1>Cloud Login Successful!</h1>
|
|
346
|
+
<p>Logged in as <span class="email">${escapeHtml(email)}</span></p>
|
|
347
|
+
<p class="close-note">You can close this window and return to the terminal.</p>
|
|
348
|
+
</div>
|
|
349
|
+
</body>
|
|
350
|
+
</html>
|
|
351
|
+
`.trim();
|
|
352
|
+
}
|
|
353
|
+
function getPanelSuccessHtml(projectName, email) {
|
|
354
|
+
const emailLine = email ? `<p>Logged in as <strong>${escapeHtml(email)}</strong></p>` : '';
|
|
355
|
+
return `
|
|
356
|
+
<!DOCTYPE html>
|
|
357
|
+
<html>
|
|
358
|
+
<head>
|
|
359
|
+
<meta charset="utf-8">
|
|
360
|
+
<title>Husar CLI - CMS Connected</title>
|
|
361
|
+
<style>
|
|
362
|
+
body {
|
|
363
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
364
|
+
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
|
365
|
+
color: white;
|
|
366
|
+
min-height: 100vh;
|
|
367
|
+
display: flex;
|
|
368
|
+
align-items: center;
|
|
369
|
+
justify-content: center;
|
|
370
|
+
margin: 0;
|
|
371
|
+
}
|
|
372
|
+
.container {
|
|
373
|
+
text-align: center;
|
|
374
|
+
padding: 40px;
|
|
375
|
+
background: rgba(255,255,255,0.05);
|
|
376
|
+
border-radius: 16px;
|
|
377
|
+
border: 1px solid rgba(255,255,255,0.1);
|
|
378
|
+
}
|
|
379
|
+
.success-icon {
|
|
380
|
+
font-size: 64px;
|
|
381
|
+
margin-bottom: 20px;
|
|
382
|
+
}
|
|
383
|
+
h1 { margin: 0 0 10px; }
|
|
384
|
+
p { color: #a0a0a0; margin: 5px 0; }
|
|
385
|
+
.project { color: #60a5fa; font-weight: 600; }
|
|
386
|
+
.close-note {
|
|
387
|
+
margin-top: 30px;
|
|
388
|
+
font-size: 14px;
|
|
389
|
+
color: #666;
|
|
390
|
+
}
|
|
391
|
+
</style>
|
|
392
|
+
</head>
|
|
393
|
+
<body>
|
|
394
|
+
<div class="container">
|
|
395
|
+
<div class="success-icon">✅</div>
|
|
396
|
+
<h1>CMS Connected!</h1>
|
|
397
|
+
${emailLine}
|
|
398
|
+
<p>Connected to project <span class="project">${escapeHtml(projectName)}</span></p>
|
|
399
|
+
<p class="close-note">You can close this window and return to the terminal.</p>
|
|
400
|
+
</div>
|
|
401
|
+
</body>
|
|
402
|
+
</html>
|
|
403
|
+
`.trim();
|
|
404
|
+
}
|
|
405
|
+
function getErrorHtml(error) {
|
|
406
|
+
return `
|
|
407
|
+
<!DOCTYPE html>
|
|
408
|
+
<html>
|
|
409
|
+
<head>
|
|
410
|
+
<meta charset="utf-8">
|
|
411
|
+
<title>Husar CLI - Error</title>
|
|
412
|
+
<style>
|
|
413
|
+
body {
|
|
414
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
415
|
+
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
|
416
|
+
color: white;
|
|
417
|
+
min-height: 100vh;
|
|
418
|
+
display: flex;
|
|
419
|
+
align-items: center;
|
|
420
|
+
justify-content: center;
|
|
421
|
+
margin: 0;
|
|
422
|
+
}
|
|
423
|
+
.container {
|
|
424
|
+
text-align: center;
|
|
425
|
+
padding: 40px;
|
|
426
|
+
background: rgba(255,255,255,0.05);
|
|
427
|
+
border-radius: 16px;
|
|
428
|
+
border: 1px solid rgba(239,68,68,0.3);
|
|
429
|
+
}
|
|
430
|
+
.error-icon {
|
|
431
|
+
font-size: 64px;
|
|
432
|
+
margin-bottom: 20px;
|
|
433
|
+
}
|
|
434
|
+
h1 { margin: 0 0 10px; color: #ef4444; }
|
|
435
|
+
p { color: #a0a0a0; margin: 5px 0; }
|
|
436
|
+
.error-msg { color: #fca5a5; }
|
|
437
|
+
</style>
|
|
438
|
+
</head>
|
|
439
|
+
<body>
|
|
440
|
+
<div class="container">
|
|
441
|
+
<div class="error-icon">❌</div>
|
|
442
|
+
<h1>Authorization Failed</h1>
|
|
443
|
+
<p class="error-msg">${escapeHtml(error)}</p>
|
|
444
|
+
<p>Please try again or contact support.</p>
|
|
445
|
+
</div>
|
|
446
|
+
</body>
|
|
447
|
+
</html>
|
|
448
|
+
`.trim();
|
|
449
|
+
}
|
|
450
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/auth/login.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAmC,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,eAAe,EAA0B,MAAM,aAAa,CAAC;AAErF,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACnC,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,kBAAkB,CAAC;AAUxE,SAAS,UAAU,CAAC,GAAW;IAC7B,OAAO,GAAG;SACP,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC7B,CAAC;AAMD,SAAS,aAAa;IACpB,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC;AA0CD,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAA6C;IACrF,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,qBAAqB,CAAC;IACpD,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,MAAM,CAAC;IAG3C,MAAM,aAAa,GAAG,aAAa,EAAE,CAAC;IAEtC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,CAAC,IAAI,EAAE,CAAC;AACX,CAAC;AAKD,SAAS,mBAAmB,CAAC,WAAmB,EAAE,KAAc;IAC9D,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,2BAA2B,UAAU,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;IAE3F,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA0CH,SAAS;oDACqC,UAAU,CAAC,WAAW,CAAC;;;;;GAKxE,CAAC,IAAI,EAAE,CAAC;AACX,CAAC;AAKD,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAqCkB,UAAU,CAAC,KAAK,CAAC;;;;;GAKzC,CAAC,IAAI,EAAE,CAAC;AACX,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -4,6 +4,10 @@ import { ConfigMaker } from 'config-maker';
|
|
|
4
4
|
import { parser } from './functions/parser.js';
|
|
5
5
|
import { generateCms } from './functions/generate.js';
|
|
6
6
|
import { startMcpServer } from './mcp.js';
|
|
7
|
+
import { getAdminToken } from "./types/config.js";
|
|
8
|
+
import { startLoginFlow } from './auth/login.js';
|
|
9
|
+
import { clearAuth, getCurrentUser, getConfigPath, isLoggedIn, readAuthConfig } from './auth/config.js';
|
|
10
|
+
import { runCreateCommand } from './functions/create.js';
|
|
7
11
|
const config = new ConfigMaker('husar', { decoders: {} });
|
|
8
12
|
const program = new Command();
|
|
9
13
|
program.name('husar').description('HUSAR CLI for complete generation').version('0.0.5');
|
|
@@ -31,13 +35,14 @@ program
|
|
|
31
35
|
if (!conf.host) {
|
|
32
36
|
throw new Error('Host is not configured. Please run "husar generate" first.');
|
|
33
37
|
}
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
const adminToken = getAdminToken(conf);
|
|
39
|
+
if (!adminToken) {
|
|
40
|
+
throw new Error('Admin token not configured. Set HUSAR_ADMIN_TOKEN env var, or adminTokenEnv in husar.json');
|
|
36
41
|
}
|
|
37
42
|
const result = await parser({
|
|
38
43
|
inputFile,
|
|
39
44
|
opts: { name, type: opts?.type },
|
|
40
|
-
authentication: { HUSAR_MCP_HOST: conf.host, HUSAR_MCP_ADMIN_TOKEN:
|
|
45
|
+
authentication: { HUSAR_MCP_HOST: conf.host, HUSAR_MCP_ADMIN_TOKEN: adminToken },
|
|
41
46
|
});
|
|
42
47
|
console.log(result ? 'File parsed and upserted successfully.' : 'Failed to parse and upsert file.');
|
|
43
48
|
});
|
|
@@ -48,5 +53,80 @@ program
|
|
|
48
53
|
await startMcpServer();
|
|
49
54
|
await new Promise(() => { });
|
|
50
55
|
});
|
|
56
|
+
program
|
|
57
|
+
.command('login')
|
|
58
|
+
.description('Log in to Husar.ai via browser authentication')
|
|
59
|
+
.action(async () => {
|
|
60
|
+
const loggedIn = await isLoggedIn();
|
|
61
|
+
if (loggedIn) {
|
|
62
|
+
const user = await getCurrentUser();
|
|
63
|
+
console.log(`Already logged in as ${user?.email}`);
|
|
64
|
+
console.log('Run "husar logout" to switch accounts.');
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
console.log('Starting Husar.ai authentication...');
|
|
68
|
+
const result = await startLoginFlow();
|
|
69
|
+
if (result.success) {
|
|
70
|
+
console.log(`\n✅ Successfully logged in as ${result.email}`);
|
|
71
|
+
if (result.project) {
|
|
72
|
+
console.log(` Connected to project: ${result.project.projectName}`);
|
|
73
|
+
console.log(` Host: ${result.project.host}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
console.error(`\n❌ Login failed: ${result.error}`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
program
|
|
82
|
+
.command('logout')
|
|
83
|
+
.description('Log out and clear stored credentials')
|
|
84
|
+
.action(async () => {
|
|
85
|
+
const loggedIn = await isLoggedIn();
|
|
86
|
+
if (!loggedIn) {
|
|
87
|
+
console.log('Not logged in.');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const user = await getCurrentUser();
|
|
91
|
+
await clearAuth();
|
|
92
|
+
console.log(`✅ Logged out${user?.email ? ` (was: ${user.email})` : ''}`);
|
|
93
|
+
console.log(` Cleared credentials from ${getConfigPath()}`);
|
|
94
|
+
});
|
|
95
|
+
program
|
|
96
|
+
.command('whoami')
|
|
97
|
+
.description('Display current logged-in user and projects')
|
|
98
|
+
.action(async () => {
|
|
99
|
+
const loggedIn = await isLoggedIn();
|
|
100
|
+
if (!loggedIn) {
|
|
101
|
+
console.log('Not logged in. Run "husar login" to authenticate.');
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const user = await getCurrentUser();
|
|
105
|
+
const authConfig = await readAuthConfig();
|
|
106
|
+
console.log(`\n👤 Logged in as: ${user?.email}`);
|
|
107
|
+
if (authConfig.projects && Object.keys(authConfig.projects).length > 0) {
|
|
108
|
+
console.log('\n📦 Connected projects:');
|
|
109
|
+
for (const [name, project] of Object.entries(authConfig.projects)) {
|
|
110
|
+
console.log(` • ${name}`);
|
|
111
|
+
console.log(` Host: ${project.host}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
console.log('\nNo projects connected. Run "husar create" to set up a new project.');
|
|
116
|
+
}
|
|
117
|
+
console.log(`\n📁 Config: ${getConfigPath()}`);
|
|
118
|
+
});
|
|
119
|
+
program
|
|
120
|
+
.command('create [projectName]')
|
|
121
|
+
.description('Create a new project with Husar CMS integration')
|
|
122
|
+
.option('-f, --framework <framework>', 'Framework to use: nextjs or vite', 'nextjs')
|
|
123
|
+
.option('--skip-install', 'Skip package installation after scaffolding')
|
|
124
|
+
.action(async (projectName, opts) => {
|
|
125
|
+
await runCreateCommand({
|
|
126
|
+
projectName,
|
|
127
|
+
framework: opts.framework,
|
|
128
|
+
skipInstall: opts.skipInstall,
|
|
129
|
+
});
|
|
130
|
+
});
|
|
51
131
|
program.parse(process.argv);
|
|
52
132
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAmB,aAAa,EAAE,0BAA0B;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxG,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,MAAM,GAAG,IAAI,WAAW,CAAkB,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;AAE3E,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,mCAAmC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAExF,OAAO;KAC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