magicpath-ai 1.3.0-beta.4 → 1.3.0-beta.5
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/commands/auth.d.ts +2 -2
- package/dist/commands/auth.js +106 -36
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/init.js +11 -7
- package/dist/commands/init.js.map +1 -1
- package/package.json +1 -1
package/dist/commands/auth.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
2
|
/**
|
|
3
|
-
* Run the interactive login flow: open browser,
|
|
4
|
-
* Returns true if login succeeded, false if cancelled.
|
|
3
|
+
* Run the interactive login flow: start localhost server, open browser, receive callback with code.
|
|
4
|
+
* Returns true if login succeeded, false if cancelled/timed out.
|
|
5
5
|
*/
|
|
6
6
|
export declare function runLoginFlow(): Promise<boolean>;
|
|
7
7
|
export declare function registerAuthCommands(program: Command): void;
|
package/dist/commands/auth.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import http from 'http';
|
|
2
2
|
import ora from 'ora';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import { exec } from 'child_process';
|
|
@@ -6,46 +6,116 @@ import { MagicPathError } from '../util/error.js';
|
|
|
6
6
|
import { makeWebUrl, makeAuthUrl } from '../util/api.js';
|
|
7
7
|
import { saveTokens, clearTokens, loadTokens } from '../util/auth.js';
|
|
8
8
|
import { isJsonMode, jsonResult, jsonError } from '../util/output.js';
|
|
9
|
+
const LOGIN_TIMEOUT_MS = 120_000;
|
|
10
|
+
const PAGE_STYLE = `
|
|
11
|
+
*{margin:0;padding:0;box-sizing:border-box}
|
|
12
|
+
body{font-family:Geist,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;display:flex;align-items:center;justify-content:center;min-height:100vh;background:#fff;color:#1a1a1a;padding:1rem}
|
|
13
|
+
.card{position:relative;width:100%;max-width:32rem;background:#fff;border-radius:1.5rem;box-shadow:0 1px 3px rgba(0,0,0,.1),0 8px 10px -1px rgba(0,0,0,.1);overflow:hidden}
|
|
14
|
+
.gradient{position:absolute;top:0;left:0;right:0;height:12rem;background:radial-gradient(circle at center top,#DCF1E3 0%,#fff 80%);opacity:.2;pointer-events:none}
|
|
15
|
+
.content{position:relative;z-index:1;padding:2rem;display:flex;flex-direction:column;align-items:center}
|
|
16
|
+
.icon-box{width:4rem;height:4rem;border-radius:1rem;background:rgba(220,241,227,.1);display:flex;align-items:center;justify-content:center;margin-bottom:1rem}
|
|
17
|
+
.icon-box svg{width:2rem;height:2rem}
|
|
18
|
+
h1{font-size:1.5rem;font-weight:600;margin-bottom:.5rem;text-align:center}
|
|
19
|
+
p{color:#999;font-size:.9rem;text-align:center;max-width:24rem;line-height:1.5}
|
|
20
|
+
`;
|
|
21
|
+
const CHECK_ICON = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="#085C34"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg>`;
|
|
22
|
+
const ERROR_ICON = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="#dc2626"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z"/></svg>`;
|
|
23
|
+
const SUCCESS_HTML = `<!DOCTYPE html>
|
|
24
|
+
<html><head><meta charset="utf-8"><title>MagicPath CLI</title>
|
|
25
|
+
<style>${PAGE_STYLE}</style>
|
|
26
|
+
</head><body><div class="card"><div class="gradient"></div><div class="content">
|
|
27
|
+
<div class="icon-box">${CHECK_ICON}</div>
|
|
28
|
+
<h1>Logged in!</h1>
|
|
29
|
+
<p>You can close this tab and return to your terminal.</p>
|
|
30
|
+
</div></div></body></html>`;
|
|
31
|
+
const ERROR_HTML = (msg) => `<!DOCTYPE html>
|
|
32
|
+
<html><head><meta charset="utf-8"><title>MagicPath CLI</title>
|
|
33
|
+
<style>${PAGE_STYLE}</style>
|
|
34
|
+
</head><body><div class="card"><div class="gradient"></div><div class="content">
|
|
35
|
+
<div class="icon-box">${ERROR_ICON}</div>
|
|
36
|
+
<h1>Login failed</h1>
|
|
37
|
+
<p>${msg}</p>
|
|
38
|
+
</div></div></body></html>`;
|
|
9
39
|
/**
|
|
10
|
-
* Run the interactive login flow: open browser,
|
|
11
|
-
* Returns true if login succeeded, false if cancelled.
|
|
40
|
+
* Run the interactive login flow: start localhost server, open browser, receive callback with code.
|
|
41
|
+
* Returns true if login succeeded, false if cancelled/timed out.
|
|
12
42
|
*/
|
|
13
43
|
export async function runLoginFlow() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
44
|
+
return new Promise((resolve, reject) => {
|
|
45
|
+
let settled = false;
|
|
46
|
+
let timeout;
|
|
47
|
+
const server = http.createServer(async (req, res) => {
|
|
48
|
+
const url = new URL(req.url || '/', `http://localhost`);
|
|
49
|
+
if (url.pathname !== '/callback') {
|
|
50
|
+
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
51
|
+
res.end('Not found');
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const code = url.searchParams.get('code');
|
|
55
|
+
if (!code) {
|
|
56
|
+
res.writeHead(400, { 'Content-Type': 'text/html' });
|
|
57
|
+
res.end(ERROR_HTML('No authorization code received.'));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
const response = await axios.post(makeAuthUrl('extension/tokens'), {
|
|
62
|
+
token: code,
|
|
63
|
+
});
|
|
64
|
+
const { access_token, refresh_token } = response.data;
|
|
65
|
+
saveTokens(access_token, refresh_token);
|
|
66
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
67
|
+
res.end(SUCCESS_HTML);
|
|
68
|
+
cleanup();
|
|
69
|
+
spinner.succeed('Logged in successfully!');
|
|
70
|
+
settled = true;
|
|
71
|
+
resolve(true);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
const msg = axios.isAxiosError(error) && error.response?.status === 400
|
|
75
|
+
? 'Invalid or expired authorization code. Please try again.'
|
|
76
|
+
: 'Failed to exchange code. Please try again.';
|
|
77
|
+
res.writeHead(400, { 'Content-Type': 'text/html' });
|
|
78
|
+
res.end(ERROR_HTML(msg));
|
|
79
|
+
cleanup();
|
|
80
|
+
spinner.fail('Login failed');
|
|
81
|
+
settled = true;
|
|
82
|
+
reject(new MagicPathError(msg));
|
|
83
|
+
}
|
|
36
84
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
spinner.fail('Login failed');
|
|
44
|
-
if (axios.isAxiosError(error) && error.response?.status === 400) {
|
|
45
|
-
throw new MagicPathError('Invalid or expired authorization code. Please try again.');
|
|
85
|
+
function cleanup() {
|
|
86
|
+
clearTimeout(timeout);
|
|
87
|
+
server.close();
|
|
46
88
|
}
|
|
47
|
-
|
|
48
|
-
|
|
89
|
+
server.listen(0, '127.0.0.1', () => {
|
|
90
|
+
const addr = server.address();
|
|
91
|
+
if (!addr || typeof addr === 'string') {
|
|
92
|
+
settled = true;
|
|
93
|
+
reject(new MagicPathError('Failed to start local auth server.'));
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const port = addr.port;
|
|
97
|
+
const authUrl = makeWebUrl(`/auth/cli?port=${port}`);
|
|
98
|
+
console.log(`\nOpening your browser to log in...\n`);
|
|
99
|
+
console.log(`If the browser doesn't open, visit: ${authUrl}\n`);
|
|
100
|
+
const platform = process.platform;
|
|
101
|
+
const openCmd = platform === 'darwin'
|
|
102
|
+
? 'open'
|
|
103
|
+
: platform === 'win32'
|
|
104
|
+
? 'start'
|
|
105
|
+
: 'xdg-open';
|
|
106
|
+
exec(`${openCmd} "${authUrl}"`);
|
|
107
|
+
});
|
|
108
|
+
const spinner = ora('Waiting for browser login...').start();
|
|
109
|
+
timeout = setTimeout(() => {
|
|
110
|
+
if (!settled) {
|
|
111
|
+
cleanup();
|
|
112
|
+
spinner.fail('Login timed out');
|
|
113
|
+
console.log('\nTip: You can also log in with `magicpath-ai login --code <code>`.');
|
|
114
|
+
settled = true;
|
|
115
|
+
resolve(false);
|
|
116
|
+
}
|
|
117
|
+
}, LOGIN_TIMEOUT_MS);
|
|
118
|
+
});
|
|
49
119
|
}
|
|
50
120
|
export function registerAuthCommands(program) {
|
|
51
121
|
program
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEtE,MA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M,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAC;YACtC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,UAAU,EAAE;gBAAE,SAAS,CAAC,GAAG,CAAC,CAAC;YACjC,IAAI,GAAG,YAAY,cAAc,EAAE,CAAC;gBAClC,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,mCAAmC,CAAC;SAChD,MAAM,CAAC,GAAG,EAAE;QACX,WAAW,EAAE,CAAC;QACd,IAAI,UAAU,EAAE,EAAE,CAAC;YACjB,UAAU,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAClC,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/commands/init.js
CHANGED
|
@@ -10,9 +10,13 @@ A platform for building, sharing, and installing UI components via AI. Component
|
|
|
10
10
|
|
|
11
11
|
## Getting Started
|
|
12
12
|
|
|
13
|
-
Run \`magicpath-ai info\` to check auth status and project context.
|
|
13
|
+
Run \`magicpath-ai info\` to check auth status and project context.
|
|
14
14
|
|
|
15
|
-
**
|
|
15
|
+
**If not authenticated, follow this flow:**
|
|
16
|
+
|
|
17
|
+
1. Run \`magicpath-ai login\` — this opens the browser for one-click auth (auto-completes if already signed in)
|
|
18
|
+
2. Login completes automatically when the user authorizes in the browser
|
|
19
|
+
3. Verify with \`magicpath-ai whoami\`
|
|
16
20
|
|
|
17
21
|
## Workflow
|
|
18
22
|
|
|
@@ -37,7 +41,7 @@ Run \`magicpath-ai info\` to check auth status and project context. If not authe
|
|
|
37
41
|
|
|
38
42
|
\`\`\`bash
|
|
39
43
|
# Auth
|
|
40
|
-
magicpath-ai login
|
|
44
|
+
magicpath-ai login # one-click browser login
|
|
41
45
|
magicpath-ai whoami # check auth status
|
|
42
46
|
magicpath-ai info # full project context
|
|
43
47
|
|
|
@@ -81,15 +85,15 @@ Returns auth status, user info, projects, and CLI version.
|
|
|
81
85
|
### \`login\` — Authenticate
|
|
82
86
|
|
|
83
87
|
\`\`\`bash
|
|
84
|
-
magicpath-ai login #
|
|
85
|
-
magicpath-ai login --code <code> #
|
|
88
|
+
magicpath-ai login # one-click browser login (auto-completes)
|
|
89
|
+
magicpath-ai login --code <code> # exchange auth code directly (headless fallback)
|
|
86
90
|
\`\`\`
|
|
87
91
|
|
|
88
|
-
|
|
92
|
+
Opens the browser and completes login automatically when the user authorizes.
|
|
89
93
|
|
|
90
94
|
| Flag | Description |
|
|
91
95
|
|------|-------------|
|
|
92
|
-
| \`--code <code>\` | Exchange a browser authorization code
|
|
96
|
+
| \`--code <code>\` | Exchange a browser authorization code directly (headless fallback) |
|
|
93
97
|
|
|
94
98
|
### \`whoami\` — Check authentication
|
|
95
99
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,yEAAyE;AAEzE,MAAM,WAAW,GACf,iZAAiZ,CAAC;AAEpZ,MAAM,WAAW,GAAG
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"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