Monorepo for Aesthetic.Computer aesthetic.computer
at main 66 lines 2.6 kB view raw
1#!/usr/bin/env node 2 3/** 4 * Test All Tools 5 * 6 * Quick test of all ATProto tools to verify setup. 7 */ 8 9console.log('\n🧪 Testing ATProto Tools\n') 10console.log('═══════════════════════════════════════\n') 11 12import { AtpAgent } from '@atproto/api' 13 14const testHandle = 'aesthetic.computer' 15const service = 'https://public.api.bsky.app' 16 17console.log('1️⃣ Testing Profile Query...') 18try { 19 const response = await fetch(`${service}/xrpc/app.bsky.actor.getProfile?actor=${testHandle}`) 20 if (!response.ok) throw new Error('Failed') 21 const profile = await response.json() 22 console.log(` ✅ Profile query works`) 23 console.log(` 📝 Found: @${profile.handle} (DID: ${profile.did})`) 24 console.log(` 📊 ${profile.followersCount || 0} followers, ${profile.postsCount || 0} posts\n`) 25} catch (error) { 26 console.log(` ❌ Profile query failed: ${error.message}\n`) 27} 28 29console.log('2️⃣ Testing Feed Query...') 30try { 31 const response = await fetch(`${service}/xrpc/app.bsky.feed.getAuthorFeed?actor=${testHandle}&limit=1`) 32 if (!response.ok) throw new Error('Failed') 33 const feed = await response.json() 34 console.log(` ✅ Feed query works`) 35 console.log(` 📝 Found ${feed.feed.length} post(s)\n`) 36} catch (error) { 37 console.log(` ❌ Feed query failed: ${error.message}\n`) 38} 39 40console.log('3️⃣ Testing Auth (if credentials provided)...') 41try { 42 if (!process.env.BSKY_IDENTIFIER || !process.env.BSKY_APP_PASSWORD) { 43 console.log(' ⏭️ Skipped (no credentials in .env)') 44 console.log(' 💡 To test: Copy .env.example to .env and add credentials\n') 45 } else { 46 const agent = new AtpAgent({ service: 'https://bsky.social' }) 47 await agent.login({ 48 identifier: process.env.BSKY_IDENTIFIER, 49 password: process.env.BSKY_APP_PASSWORD 50 }) 51 console.log(` ✅ Authentication works`) 52 console.log(` 👤 Logged in as @${agent.session.handle}\n`) 53 } 54} catch (error) { 55 console.log(` ❌ Authentication failed: ${error.message}`) 56 console.log(' 💡 Check credentials in .env\n') 57} 58 59console.log('═══════════════════════════════════════') 60console.log('✨ Testing Complete!\n') 61console.log('Available commands:') 62console.log(' node query-profile.mjs aesthetic.computer') 63console.log(' node query-posts.mjs aesthetic.computer') 64console.log(' node explore-lexicons.mjs') 65console.log(' node post-to-bluesky.mjs "Hello!" (requires .env setup)') 66console.log()