uwonbot 1.0.3 → 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 +39 -2
- package/package.json +1 -1
- package/src/auth.js +30 -1
- package/src/banner.js +15 -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')
|
|
@@ -61,6 +66,35 @@ program
|
|
|
61
66
|
await startAgent(parseInt(opts.port));
|
|
62
67
|
});
|
|
63
68
|
|
|
69
|
+
program
|
|
70
|
+
.command('upgrade')
|
|
71
|
+
.description('Upgrade uwonbot to the latest version')
|
|
72
|
+
.action(async () => {
|
|
73
|
+
const { execSync } = await import('child_process');
|
|
74
|
+
const chalk = (await import('chalk')).default;
|
|
75
|
+
console.log(chalk.cyan(' Checking for updates...'));
|
|
76
|
+
try {
|
|
77
|
+
const latest = execSync('npm view uwonbot version', { encoding: 'utf8' }).trim();
|
|
78
|
+
const { readFileSync } = await import('fs');
|
|
79
|
+
const { fileURLToPath } = await import('url');
|
|
80
|
+
const { dirname, join } = await import('path');
|
|
81
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
82
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
|
|
83
|
+
const current = pkg.version;
|
|
84
|
+
if (current === latest) {
|
|
85
|
+
console.log(chalk.green(` ✓ Already on latest version (v${current})`));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
console.log(chalk.yellow(` Current: v${current} → Latest: v${latest}`));
|
|
89
|
+
console.log(chalk.cyan(' Upgrading...'));
|
|
90
|
+
execSync(`npm install -g uwonbot@${latest}`, { stdio: 'inherit' });
|
|
91
|
+
console.log(chalk.green(`\n ✓ Upgraded to v${latest}!`));
|
|
92
|
+
} catch (e) {
|
|
93
|
+
console.error(chalk.red(` ✗ Upgrade failed: ${e.message}`));
|
|
94
|
+
console.log(chalk.gray(' Try manually: npm install -g uwonbot@latest'));
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
64
98
|
program
|
|
65
99
|
.command('run <command>')
|
|
66
100
|
.description('Ask your assistant to run a task')
|
|
@@ -88,11 +122,14 @@ if (process.argv.length <= 2) {
|
|
|
88
122
|
console.log(' uwonbot assistants List your AI assistants');
|
|
89
123
|
console.log(' uwonbot run "..." Ask AI to run a task');
|
|
90
124
|
console.log(' uwonbot agent Start local agent (OS control)');
|
|
125
|
+
console.log(' uwonbot upgrade Upgrade to latest version');
|
|
126
|
+
console.log(' uwonbot reset-password Reset password via email');
|
|
91
127
|
console.log(' uwonbot logout Log out');
|
|
92
128
|
console.log('');
|
|
93
129
|
} else {
|
|
94
130
|
console.log(' Get started:');
|
|
95
131
|
console.log(' uwonbot login Log in to your account');
|
|
132
|
+
console.log(' uwonbot reset-password Reset your password');
|
|
96
133
|
console.log(' uwonbot chat Start chatting after login');
|
|
97
134
|
console.log('');
|
|
98
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/banner.js
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { dirname, join } from 'path';
|
|
5
|
+
|
|
6
|
+
function getVersion() {
|
|
7
|
+
try {
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
|
|
10
|
+
return pkg.version || '0.0.0';
|
|
11
|
+
} catch { return '0.0.0'; }
|
|
12
|
+
}
|
|
2
13
|
|
|
3
14
|
export function showBanner() {
|
|
15
|
+
const ver = getVersion();
|
|
4
16
|
const blue = chalk.hex('#2563eb');
|
|
5
17
|
const cyan = chalk.hex('#06b6d4');
|
|
6
18
|
const gray = chalk.hex('#6b7280');
|
|
7
19
|
const white = chalk.white.bold;
|
|
8
20
|
|
|
21
|
+
const verStr = `v${ver}`.padEnd(25);
|
|
22
|
+
|
|
9
23
|
console.log('');
|
|
10
24
|
console.log(blue(' ╔══════════════════════════════════════════════════════════════╗'));
|
|
11
25
|
console.log(blue(' ║ ║'));
|
|
@@ -17,7 +31,7 @@ export function showBanner() {
|
|
|
17
31
|
console.log(blue(' ║') + cyan(' ╚═════╝ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚═╝ ') + blue(' ║'));
|
|
18
32
|
console.log(blue(' ║ ║'));
|
|
19
33
|
console.log(blue(' ║') + gray(' AI Assistant — Your AI controls your computer ') + blue(' ║'));
|
|
20
|
-
console.log(blue(' ║') + gray(
|
|
34
|
+
console.log(blue(' ║') + gray(` ${verStr}https://uwonbot.com `) + blue(' ║'));
|
|
21
35
|
console.log(blue(' ║ ║'));
|
|
22
36
|
console.log(blue(' ╚══════════════════════════════════════════════════════════════╝'));
|
|
23
37
|
console.log('');
|
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; }
|