@l4yercak3/cli 1.1.3 ā 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.
|
@@ -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'));
|
|
@@ -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(() => {
|