#!/usr/bin/env node import bcrypt from 'bcryptjs'; import { readFileSync, writeFileSync } from 'fs'; import { resolve, dirname } from 'path'; import { fileURLToPath } from 'url'; const __dirname = dirname(fileURLToPath(import.meta.url)); const configPath = resolve(__dirname, '../data/config.json'); const password = process.argv[2]; if (!password) { console.error('Usage: node scripts/set-password.js '); process.exit(1); } const hash = await bcrypt.hash(password, 12); const config = JSON.parse(readFileSync(configPath, 'utf8')); config.passwordHash = hash; writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n'); console.log('Password set successfully.');