fluxy-bot 0.11.3 → 0.11.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.
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import pc from 'picocolors';
|
|
5
|
+
import Database from 'better-sqlite3';
|
|
6
|
+
|
|
7
|
+
import { DATA_DIR } from '../core/config.js';
|
|
8
|
+
|
|
9
|
+
const DB_PATH = path.join(DATA_DIR, 'memory.db');
|
|
10
|
+
|
|
11
|
+
export function registerPasswordResetCommand(program: Command) {
|
|
12
|
+
program
|
|
13
|
+
.command('password-reset')
|
|
14
|
+
.description('Reset your portal password via the onboard wizard')
|
|
15
|
+
.action(() => {
|
|
16
|
+
if (!fs.existsSync(DB_PATH)) {
|
|
17
|
+
console.log(pc.red('✗ No database found. Run ' + pc.magenta('fluxy init') + ' first.'));
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const db = new Database(DB_PATH);
|
|
22
|
+
|
|
23
|
+
// Clear password and TOTP credentials
|
|
24
|
+
db.prepare("DELETE FROM settings WHERE key IN ('portal_pass', 'totp_enabled', 'totp_secret', 'totp_recovery_codes')").run();
|
|
25
|
+
|
|
26
|
+
// Reset onboard flag so the wizard appears on next visit
|
|
27
|
+
db.prepare("INSERT INTO settings (key, value) VALUES ('onboard_complete', 'false') ON CONFLICT(key) DO UPDATE SET value = 'false', updated_at = CURRENT_TIMESTAMP").run();
|
|
28
|
+
|
|
29
|
+
// Invalidate all active sessions
|
|
30
|
+
db.prepare('DELETE FROM sessions').run();
|
|
31
|
+
db.prepare('DELETE FROM trusted_devices').run();
|
|
32
|
+
|
|
33
|
+
db.close();
|
|
34
|
+
|
|
35
|
+
console.log();
|
|
36
|
+
console.log(pc.green('✓ Password reset successful.'));
|
|
37
|
+
console.log();
|
|
38
|
+
console.log(pc.dim(' The onboard wizard will appear on your next visit'));
|
|
39
|
+
console.log(pc.dim(' so you can create a new password.'));
|
|
40
|
+
console.log();
|
|
41
|
+
console.log(pc.dim(' Restart Fluxy if it\'s running: ') + pc.magenta('fluxy stop && fluxy start'));
|
|
42
|
+
console.log();
|
|
43
|
+
});
|
|
44
|
+
}
|
package/cli/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { registerStartCommand } from './commands/start.js';
|
|
|
9
9
|
import { registerTunnelCommand } from './commands/tunnel.js';
|
|
10
10
|
import { registerUpdateCommand } from './commands/update.js';
|
|
11
11
|
import { registerInitCommand } from './commands/init.js';
|
|
12
|
+
import { registerPasswordResetCommand } from './commands/password-reset.js';
|
|
12
13
|
|
|
13
14
|
const program = new Command();
|
|
14
15
|
|
|
@@ -22,6 +23,7 @@ registerDaemonCommand(program);
|
|
|
22
23
|
registerTunnelCommand(program);
|
|
23
24
|
registerUpdateCommand(program);
|
|
24
25
|
registerInitCommand(program);
|
|
26
|
+
registerPasswordResetCommand(program);
|
|
25
27
|
|
|
26
28
|
// Aliases for convenience matching the old CLI
|
|
27
29
|
program
|
package/package.json
CHANGED
|
@@ -277,11 +277,20 @@ Browser: GET /app/api/tasks → Supervisor strips prefix → Backend receives: G
|
|
|
277
277
|
NEVER run `npm run build`, `vite build`, or any build commands. Vite HMR handles frontend changes automatically. The backend auto-restarts when you edit files. Never look in `dist/` or `dist-fluxy/`.
|
|
278
278
|
|
|
279
279
|
## Installing Packages
|
|
280
|
-
|
|
280
|
+
Your workspace has its own `package.json` and `node_modules/`. You can freely install npm packages — they are fully isolated from the system. Nothing you install can break the supervisor, worker, or chat.
|
|
281
281
|
|
|
282
|
-
|
|
282
|
+
```bash
|
|
283
|
+
npm install <package> # run from your cwd (workspace root)
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
This works for both backend and frontend packages. After installing:
|
|
287
|
+
- Backend picks up new imports on the next auto-restart
|
|
288
|
+
- Vite resolves new frontend imports via HMR
|
|
289
|
+
- No build step needed
|
|
290
|
+
|
|
291
|
+
Before installing, check if a suitable package is already in `node_modules/`. Prefer well-known, maintained packages.
|
|
283
292
|
|
|
284
|
-
|
|
293
|
+
**Never** run `npm install` from the parent directory or modify the parent's `package.json`. Your dependencies are sandboxed to workspace — this boundary is enforced at the runtime level.
|
|
285
294
|
|
|
286
295
|
## Backend Lifecycle (Critical)
|
|
287
296
|
|