@l4yercak3/cli 1.1.2 ā 1.1.4
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/.claude/settings.local.json +2 -1
- package/docs/microsass_production_machine/CLI_API_REFERENCE.md +1 -1
- package/package.json +1 -1
- package/src/commands/login.js +20 -9
- package/src/commands/spread.js +2 -18
- package/src/config/config-manager.js +4 -3
- package/tests/commands/login.test.js +2 -0
- package/tests/config-manager.test.js +2 -2
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"Bash(gh repo create:*)",
|
|
15
15
|
"Bash(npm whoami:*)",
|
|
16
16
|
"Bash(npm pkg fix:*)",
|
|
17
|
-
"Bash(git push:*)"
|
|
17
|
+
"Bash(git push:*)",
|
|
18
|
+
"Bash(session\" errors when trying to use features.\n\nNow the login command validates the session with the backend first.\nIf validation fails, it clears the local session and prompts for\nfresh login, avoiding the confusing loop.\n\nš¤ Generated with [Claude Code]\\(https://claude.com/claude-code\\)\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")"
|
|
18
19
|
]
|
|
19
20
|
}
|
|
20
21
|
}
|
package/package.json
CHANGED
package/src/commands/login.js
CHANGED
|
@@ -121,7 +121,7 @@ function startCallbackServer(expectedState) {
|
|
|
121
121
|
*/
|
|
122
122
|
async function handleLogin() {
|
|
123
123
|
try {
|
|
124
|
-
// Check if already logged in
|
|
124
|
+
// Check if already logged in (local check)
|
|
125
125
|
if (configManager.isLoggedIn()) {
|
|
126
126
|
const session = configManager.getSession();
|
|
127
127
|
|
|
@@ -129,15 +129,26 @@ async function handleLogin() {
|
|
|
129
129
|
console.log('');
|
|
130
130
|
showLogo(false);
|
|
131
131
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
// Validate session with backend to ensure it's actually valid
|
|
133
|
+
console.log(chalk.gray(' Validating session with backend...'));
|
|
134
|
+
const validationResult = await backendClient.validateSession();
|
|
135
|
+
|
|
136
|
+
if (validationResult) {
|
|
137
|
+
console.log(chalk.green(' ā
You are already logged in'));
|
|
138
|
+
if (session.email) {
|
|
139
|
+
console.log(chalk.gray(` Email: ${session.email}`));
|
|
140
|
+
}
|
|
141
|
+
console.log(chalk.gray(` Session expires: ${new Date(session.expiresAt).toLocaleString()}\n`));
|
|
137
142
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
// Still offer the setup wizard
|
|
144
|
+
await promptSetupWizard();
|
|
145
|
+
return;
|
|
146
|
+
} else {
|
|
147
|
+
// Session is invalid on backend - clear it and proceed to login
|
|
148
|
+
console.log(chalk.yellow(' ā ļø Your session has expired or is invalid'));
|
|
149
|
+
console.log(chalk.gray(' Starting fresh login...\n'));
|
|
150
|
+
configManager.clearSession();
|
|
151
|
+
}
|
|
141
152
|
}
|
|
142
153
|
|
|
143
154
|
console.log(chalk.cyan(' š Opening browser for authentication...\n'));
|
package/src/commands/spread.js
CHANGED
|
@@ -411,24 +411,8 @@ async function handleSpread() {
|
|
|
411
411
|
oauthProviders = providers;
|
|
412
412
|
}
|
|
413
413
|
|
|
414
|
-
// Step 6: Backend URL
|
|
415
|
-
const
|
|
416
|
-
const { backendUrl } = await inquirer.prompt([
|
|
417
|
-
{
|
|
418
|
-
type: 'input',
|
|
419
|
-
name: 'backendUrl',
|
|
420
|
-
message: 'Backend API URL:',
|
|
421
|
-
default: defaultBackendUrl,
|
|
422
|
-
validate: (input) => {
|
|
423
|
-
try {
|
|
424
|
-
new URL(input);
|
|
425
|
-
return true;
|
|
426
|
-
} catch {
|
|
427
|
-
return 'Please enter a valid URL';
|
|
428
|
-
}
|
|
429
|
-
},
|
|
430
|
-
},
|
|
431
|
-
]);
|
|
414
|
+
// Step 6: Backend URL (fixed to Convex HTTP endpoint)
|
|
415
|
+
const backendUrl = 'https://aromatic-akita-723.convex.site';
|
|
432
416
|
|
|
433
417
|
// Step 7: Production domain (for OAuth redirect URIs)
|
|
434
418
|
let productionDomain = null;
|
|
@@ -27,13 +27,13 @@ class ConfigManager {
|
|
|
27
27
|
*/
|
|
28
28
|
getConfig() {
|
|
29
29
|
this.ensureConfigDir();
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
if (!fs.existsSync(this.configFile)) {
|
|
32
32
|
return {
|
|
33
33
|
session: null,
|
|
34
34
|
organizations: [],
|
|
35
35
|
settings: {
|
|
36
|
-
backendUrl: process.env.L4YERCAK3_BACKEND_URL || 'https://
|
|
36
|
+
backendUrl: process.env.L4YERCAK3_BACKEND_URL || 'https://aromatic-akita-723.convex.site',
|
|
37
37
|
},
|
|
38
38
|
};
|
|
39
39
|
}
|
|
@@ -115,10 +115,11 @@ class ConfigManager {
|
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
117
|
* Get backend URL from config or env
|
|
118
|
+
* This is the Convex HTTP URL for all API calls
|
|
118
119
|
*/
|
|
119
120
|
getBackendUrl() {
|
|
120
121
|
const config = this.getConfig();
|
|
121
|
-
return config.settings?.backendUrl || process.env.L4YERCAK3_BACKEND_URL || 'https://
|
|
122
|
+
return config.settings?.backendUrl || process.env.L4YERCAK3_BACKEND_URL || 'https://aromatic-akita-723.convex.site';
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
/**
|
|
@@ -57,6 +57,8 @@ describe('Login Command', () => {
|
|
|
57
57
|
|
|
58
58
|
configManager.getSession.mockReturnValue(null);
|
|
59
59
|
backendClient.getLoginUrl.mockReturnValue('https://backend.test.com/auth/cli-login');
|
|
60
|
+
// Mock validateSession to return valid result by default
|
|
61
|
+
backendClient.validateSession.mockResolvedValue({ valid: true, userId: 'user-123' });
|
|
60
62
|
});
|
|
61
63
|
|
|
62
64
|
afterEach(() => {
|
|
@@ -36,7 +36,7 @@ describe('ConfigManager', () => {
|
|
|
36
36
|
session: null,
|
|
37
37
|
organizations: [],
|
|
38
38
|
settings: {
|
|
39
|
-
backendUrl: 'https://
|
|
39
|
+
backendUrl: 'https://aromatic-akita-723.convex.site',
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
42
|
});
|
|
@@ -204,7 +204,7 @@ describe('ConfigManager', () => {
|
|
|
204
204
|
|
|
205
205
|
const url = ConfigManager.getBackendUrl();
|
|
206
206
|
|
|
207
|
-
expect(url).toBe('https://
|
|
207
|
+
expect(url).toBe('https://aromatic-akita-723.convex.site');
|
|
208
208
|
});
|
|
209
209
|
|
|
210
210
|
it('returns configured URL from settings', () => {
|