// Delete a record by rkey. // Usage: npx tsx scripts/delete-record.ts import { resolve } from "node:path"; import { config } from "dotenv"; import { AtpAgent } from "@atproto/api"; config({ path: resolve(process.cwd(), ".env") }); async function main() { const collection = process.argv[2]; const rkey = process.argv[3]; if (!collection || !rkey) { console.error("Usage: npx tsx scripts/delete-record.ts "); process.exit(1); } const agent = new AtpAgent({ service: process.env.ATP_SERVICE || "https://bsky.social" }); await agent.login({ identifier: process.env.ATP_IDENTIFIER!, password: process.env.ATP_PASSWORD! }); await agent.com.atproto.repo.deleteRecord({ repo: agent.session!.did, collection, rkey, }); console.log(`Deleted ${collection}/${rkey}`); } main().catch((err) => { console.error(err); process.exit(1); });