#!/usr/bin/env node /** * PDS Setup Script * * Registers a did:plc, initializes the PDS, and notifies the relay. * Zero dependencies - uses Node.js built-ins only. * * Usage: node scripts/setup.js --handle alice --pds https://your-pds.workers.dev */ import { webcrypto } from 'crypto' // === ARGUMENT PARSING === function parseArgs() { const args = process.argv.slice(2) const opts = { handle: null, pds: null, plcUrl: 'https://plc.directory', relayUrl: 'https://bsky.network' } for (let i = 0; i < args.length; i++) { if (args[i] === '--handle' && args[i + 1]) { opts.handle = args[++i] } else if (args[i] === '--pds' && args[i + 1]) { opts.pds = args[++i] } else if (args[i] === '--plc-url' && args[i + 1]) { opts.plcUrl = args[++i] } else if (args[i] === '--relay-url' && args[i + 1]) { opts.relayUrl = args[++i] } } if (!opts.handle || !opts.pds) { console.error('Usage: node scripts/setup.js --handle --pds ') console.error('') console.error('Options:') console.error(' --handle Handle name (e.g., "alice")') console.error(' --pds PDS URL (e.g., "https://atproto-pds.chad-53c.workers.dev")') console.error(' --plc-url PLC directory URL (default: https://plc.directory)') console.error(' --relay-url Relay URL (default: https://bsky.network)') process.exit(1) } return opts } // === MAIN === async function main() { const opts = parseArgs() console.log('PDS Federation Setup') console.log('====================') console.log(`Handle: ${opts.handle}`) console.log(`PDS: ${opts.pds}`) console.log(`PLC: ${opts.plcUrl}`) console.log(`Relay: ${opts.relayUrl}`) console.log('') // TODO: Implement in subsequent tasks console.log('TODO: Generate keypair') console.log('TODO: Register DID:PLC') console.log('TODO: Initialize PDS') console.log('TODO: Notify relay') } main().catch(err => { console.error('Error:', err.message) process.exit(1) })