#!/usr/bin/env bun import { AtpAgent } from '@atproto/api' // Read credentials from .env file const username = process.env.BSKY_USERNAME const password = process.env.BSKY_PASSWORD if (!username || !password) { console.error('Please provide BSKY_USERNAME and BSKY_PASSWORD in .env file') console.error('Format:') console.error('BSKY_USERNAME=your-handle.bsky.social') console.error('BSKY_PASSWORD=xxxx-xxxx-xxxx-xxxx') process.exit(1) } async function main() { const agent = new AtpAgent({ service: 'https://bsky.social' }) await agent.login({ identifier: username, password: password }) console.log('Connected! Your DID:', agent.session?.did) // Your code here! // Try: // - agent.post({ text: 'Hello world!' }) // - agent.getProfile({ actor: agent.session.did }) // - agent.getTimeline() } main().catch(console.error)