uwonbot 1.0.4 → 1.0.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/bin/uwonbot.js +9 -2
- package/package.json +1 -1
- package/src/auth.js +30 -1
- package/src/firebase-client.js +12 -0
package/bin/uwonbot.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { program } from 'commander';
|
|
3
3
|
import { showBanner } from '../src/banner.js';
|
|
4
|
-
import { loginCommand, logoutCommand, whoamiCommand } from '../src/auth.js';
|
|
4
|
+
import { loginCommand, logoutCommand, whoamiCommand, resetPasswordCommand } from '../src/auth.js';
|
|
5
5
|
import { listAssistants, selectAssistant } from '../src/assistants.js';
|
|
6
6
|
import { startChat } from '../src/chat.js';
|
|
7
7
|
import { getConfig } from '../src/config.js';
|
|
@@ -12,7 +12,7 @@ showBanner();
|
|
|
12
12
|
program
|
|
13
13
|
.name('uwonbot')
|
|
14
14
|
.description('Uwonbot AI Assistant — Your AI controls your computer')
|
|
15
|
-
.version('1.0.
|
|
15
|
+
.version('1.0.5');
|
|
16
16
|
|
|
17
17
|
program
|
|
18
18
|
.command('login')
|
|
@@ -29,6 +29,11 @@ program
|
|
|
29
29
|
.description('Show current logged-in user')
|
|
30
30
|
.action(whoamiCommand);
|
|
31
31
|
|
|
32
|
+
program
|
|
33
|
+
.command('reset-password')
|
|
34
|
+
.description('Send a password reset email')
|
|
35
|
+
.action(resetPasswordCommand);
|
|
36
|
+
|
|
32
37
|
program
|
|
33
38
|
.command('assistants')
|
|
34
39
|
.description('List your AI assistants')
|
|
@@ -118,11 +123,13 @@ if (process.argv.length <= 2) {
|
|
|
118
123
|
console.log(' uwonbot run "..." Ask AI to run a task');
|
|
119
124
|
console.log(' uwonbot agent Start local agent (OS control)');
|
|
120
125
|
console.log(' uwonbot upgrade Upgrade to latest version');
|
|
126
|
+
console.log(' uwonbot reset-password Reset password via email');
|
|
121
127
|
console.log(' uwonbot logout Log out');
|
|
122
128
|
console.log('');
|
|
123
129
|
} else {
|
|
124
130
|
console.log(' Get started:');
|
|
125
131
|
console.log(' uwonbot login Log in to your account');
|
|
132
|
+
console.log(' uwonbot reset-password Reset your password');
|
|
126
133
|
console.log(' uwonbot chat Start chatting after login');
|
|
127
134
|
console.log('');
|
|
128
135
|
}
|
package/package.json
CHANGED
package/src/auth.js
CHANGED
|
@@ -2,7 +2,7 @@ import chalk from 'chalk';
|
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
3
|
import ora from 'ora';
|
|
4
4
|
import { getConfig } from './config.js';
|
|
5
|
-
import { loginWithEmail } from './firebase-client.js';
|
|
5
|
+
import { loginWithEmail, sendPasswordReset } from './firebase-client.js';
|
|
6
6
|
|
|
7
7
|
export async function loginCommand() {
|
|
8
8
|
const config = getConfig();
|
|
@@ -72,6 +72,35 @@ export async function logoutCommand() {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
export async function resetPasswordCommand() {
|
|
76
|
+
const { email } = await inquirer.prompt([{
|
|
77
|
+
type: 'input',
|
|
78
|
+
name: 'email',
|
|
79
|
+
message: 'Email to reset password:',
|
|
80
|
+
validate: v => v.includes('@') || 'Please enter a valid email',
|
|
81
|
+
}]);
|
|
82
|
+
|
|
83
|
+
const spinner = ora('Sending reset email...').start();
|
|
84
|
+
try {
|
|
85
|
+
await sendPasswordReset(email);
|
|
86
|
+
spinner.succeed(chalk.green(`Password reset email sent to ${email}`));
|
|
87
|
+
console.log('');
|
|
88
|
+
console.log(chalk.gray(' 1. Check your email inbox (and spam folder)'));
|
|
89
|
+
console.log(chalk.gray(' 2. Click the reset link to set a new password'));
|
|
90
|
+
console.log(chalk.gray(' 3. Then run: uwonbot login'));
|
|
91
|
+
console.log('');
|
|
92
|
+
} catch (err) {
|
|
93
|
+
spinner.fail(chalk.red('Failed to send reset email'));
|
|
94
|
+
const msg = (err.message || '').toUpperCase();
|
|
95
|
+
if (msg.includes('EMAIL_NOT_FOUND')) {
|
|
96
|
+
console.log(chalk.yellow(' No account found with this email.'));
|
|
97
|
+
console.log(chalk.gray(' Sign up at https://chartapp-653e1.web.app/auth'));
|
|
98
|
+
} else {
|
|
99
|
+
console.log(chalk.red(` ${err.message}`));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
75
104
|
export async function whoamiCommand() {
|
|
76
105
|
const config = getConfig();
|
|
77
106
|
const uid = config.get('uid');
|
package/src/firebase-client.js
CHANGED
|
@@ -70,4 +70,16 @@ export async function fetchAssistant(uid, assistantId) {
|
|
|
70
70
|
return { id: parts[parts.length - 1], ...parseFirestoreDoc(data) };
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
export async function sendPasswordReset(email) {
|
|
74
|
+
const url = `https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=${API_KEY}`;
|
|
75
|
+
const res = await fetch(url, {
|
|
76
|
+
method: 'POST',
|
|
77
|
+
headers: { 'Content-Type': 'application/json' },
|
|
78
|
+
body: JSON.stringify({ requestType: 'PASSWORD_RESET', email }),
|
|
79
|
+
});
|
|
80
|
+
const data = await res.json();
|
|
81
|
+
if (data.error) throw new Error(data.error.message || 'Failed to send reset email');
|
|
82
|
+
return data;
|
|
83
|
+
}
|
|
84
|
+
|
|
73
85
|
export function setIdToken(token) { cachedIdToken = token; }
|