@unifiedmemory/cli 1.3.12 → 1.3.13
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/.env.example +8 -0
- package/commands/login.js +92 -7
- package/lib/config.js +11 -1
- package/package.json +1 -1
package/.env.example
CHANGED
|
@@ -37,6 +37,14 @@
|
|
|
37
37
|
# REDIRECT_URI=http://localhost:3333/callback
|
|
38
38
|
# PORT=3333
|
|
39
39
|
|
|
40
|
+
# ============================================
|
|
41
|
+
# OAuth Success Page Link
|
|
42
|
+
# ============================================
|
|
43
|
+
# Optional website link shown on the OAuth success page
|
|
44
|
+
# Users can visit this URL to manage their account or subscription
|
|
45
|
+
# Default: https://unifiedmemory.ai/oauth/callback
|
|
46
|
+
# OAUTH_SUCCESS_URL=https://unifiedmemory.ai/oauth/callback
|
|
47
|
+
|
|
40
48
|
# ============================================
|
|
41
49
|
# Clerk Client Secret (Optional)
|
|
42
50
|
# ============================================
|
package/commands/login.js
CHANGED
|
@@ -143,15 +143,100 @@ export async function login() {
|
|
|
143
143
|
// Debug: Log the token response structure
|
|
144
144
|
console.log(chalk.gray('\nToken response keys:'), Object.keys(tokenData));
|
|
145
145
|
|
|
146
|
-
// Send success response to browser
|
|
146
|
+
// Send success response to browser
|
|
147
147
|
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
148
148
|
res.end(`
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
<
|
|
153
|
-
<
|
|
154
|
-
<
|
|
149
|
+
<!DOCTYPE html>
|
|
150
|
+
<html lang="en">
|
|
151
|
+
<head>
|
|
152
|
+
<meta charset="UTF-8">
|
|
153
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
154
|
+
<title>Login Successful</title>
|
|
155
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
156
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
157
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
158
|
+
<style>
|
|
159
|
+
* {
|
|
160
|
+
margin: 0;
|
|
161
|
+
padding: 0;
|
|
162
|
+
box-sizing: border-box;
|
|
163
|
+
}
|
|
164
|
+
body {
|
|
165
|
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
166
|
+
background: hsl(220, 30%, 8%);
|
|
167
|
+
color: hsl(0, 0%, 100%);
|
|
168
|
+
min-height: 100vh;
|
|
169
|
+
display: flex;
|
|
170
|
+
align-items: center;
|
|
171
|
+
justify-content: center;
|
|
172
|
+
padding: 2rem;
|
|
173
|
+
}
|
|
174
|
+
.card {
|
|
175
|
+
background: hsl(220, 25%, 12%);
|
|
176
|
+
border: 1px solid hsl(220, 20%, 20%);
|
|
177
|
+
border-radius: 0.5rem;
|
|
178
|
+
padding: 2rem;
|
|
179
|
+
text-align: center;
|
|
180
|
+
max-width: 32rem;
|
|
181
|
+
width: 100%;
|
|
182
|
+
}
|
|
183
|
+
.logo {
|
|
184
|
+
width: 64px;
|
|
185
|
+
height: 64px;
|
|
186
|
+
margin: 0 auto 1.5rem;
|
|
187
|
+
display: block;
|
|
188
|
+
}
|
|
189
|
+
h1 {
|
|
190
|
+
font-size: 1.875rem;
|
|
191
|
+
font-weight: 700;
|
|
192
|
+
margin-bottom: 0.5rem;
|
|
193
|
+
color: hsl(0, 0%, 100%);
|
|
194
|
+
}
|
|
195
|
+
.description {
|
|
196
|
+
font-size: 1.125rem;
|
|
197
|
+
color: hsl(0, 0%, 65%);
|
|
198
|
+
margin-bottom: 1.5rem;
|
|
199
|
+
}
|
|
200
|
+
.message {
|
|
201
|
+
color: hsl(0, 0%, 65%);
|
|
202
|
+
line-height: 1.6;
|
|
203
|
+
}
|
|
204
|
+
.optional-link {
|
|
205
|
+
margin-top: 2rem;
|
|
206
|
+
padding-top: 1.5rem;
|
|
207
|
+
border-top: 1px solid hsl(220, 20%, 20%);
|
|
208
|
+
font-size: 0.8125rem;
|
|
209
|
+
color: hsl(0, 0%, 50%);
|
|
210
|
+
line-height: 1.5;
|
|
211
|
+
}
|
|
212
|
+
.optional-link a {
|
|
213
|
+
color: hsl(0, 0%, 55%);
|
|
214
|
+
text-decoration: none;
|
|
215
|
+
border-bottom: 1px solid transparent;
|
|
216
|
+
transition: border-color 0.2s;
|
|
217
|
+
}
|
|
218
|
+
.optional-link a:hover {
|
|
219
|
+
border-bottom-color: hsl(0, 0%, 55%);
|
|
220
|
+
}
|
|
221
|
+
</style>
|
|
222
|
+
</head>
|
|
223
|
+
<body>
|
|
224
|
+
<div class="card">
|
|
225
|
+
<img src="https://unifiedmemory.ai/images/theme/axolotl-logo.png" alt="UnifiedMemory.ai Logo" class="logo" />
|
|
226
|
+
<h1>Login Successful</h1>
|
|
227
|
+
<p class="description">Your authentication is complete.</p>
|
|
228
|
+
<p class="message">You may now close this tab and return to the terminal to continue using the CLI.</p>
|
|
229
|
+
<div class="optional-link">
|
|
230
|
+
You can manage your account or subscription on the web at<br>
|
|
231
|
+
<a href="https://unifiedmemory.ai/account">unifiedmemory.ai</a>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
<script>
|
|
235
|
+
// Auto-close window after 10 seconds
|
|
236
|
+
setTimeout(() => {
|
|
237
|
+
window.close();
|
|
238
|
+
}, 10000);
|
|
239
|
+
</script>
|
|
155
240
|
</body>
|
|
156
241
|
</html>
|
|
157
242
|
`);
|
package/lib/config.js
CHANGED
|
@@ -19,7 +19,10 @@ export const config = {
|
|
|
19
19
|
|
|
20
20
|
// OAuth flow configuration (localhost defaults for callback server)
|
|
21
21
|
redirectUri: process.env.REDIRECT_URI || 'http://localhost:3333/callback',
|
|
22
|
-
port: parseInt(process.env.PORT || '3333', 10)
|
|
22
|
+
port: parseInt(process.env.PORT || '3333', 10),
|
|
23
|
+
|
|
24
|
+
// OAuth success page configuration (optional website link for account management)
|
|
25
|
+
oauthSuccessUrl: process.env.OAUTH_SUCCESS_URL || 'https://unifiedmemory.ai/oauth/callback'
|
|
23
26
|
};
|
|
24
27
|
|
|
25
28
|
// Validation function - validates configuration values
|
|
@@ -41,5 +44,12 @@ export function validateConfig() {
|
|
|
41
44
|
throw new Error('CLERK_CLIENT_ID cannot be empty');
|
|
42
45
|
}
|
|
43
46
|
|
|
47
|
+
// Validate oauthSuccessUrl format if provided
|
|
48
|
+
try {
|
|
49
|
+
new URL(config.oauthSuccessUrl);
|
|
50
|
+
} catch (e) {
|
|
51
|
+
throw new Error(`OAUTH_SUCCESS_URL must be a valid URL (got: ${config.oauthSuccessUrl})`);
|
|
52
|
+
}
|
|
53
|
+
|
|
44
54
|
return true;
|
|
45
55
|
}
|