Skip to content

Repository files navigation

Trotsky

A type-safe library to build automation at the top of ATProto/Bluesky API.

Status
CI checksGithub Actions
Latest versionLatest version
Release dateRelease date
Code ClimateMaintainability
Open issuesOpen issues
DocumentationGuideAPI

Features

  • Builder Pattern: Easily create our automation with an intuitive DSL.
  • Reduce Complexity: Design advanced scenarios with a single expression in minutes.
  • Type-safety: Benefit from type-safety and autocompletion for a robut development experience.
  • Lifecycle Hooks: Extend scenarios with beforeStep and afterStep hooks for logging, monitoring, validation, and more.
  • Discover: Find inspirations with a curated list of Trotsky implementations.

Quickstart

Install Trotsky from NPM with your favorite package manager:

yarn add trotsky

Then write your script using Trotsky:

import{AtpAgent}from"@atproto/api"import{Trotsky}from"trotsky"asyncfunctionmain(){constagent=newAtpAgent({service: "https://bsky.social"})// Ensure you logged in with your agent, for instance using the login methodawaitagent.login({identifier: 'trotsky.pirhoo.com',password: 'h0rs3!'})awaitTrotsky.init(agent).searchPost({q: 'trotsky'}).take(5).each().like().run()}main()

Lifecycle Hooks

Extend your scenarios with beforeStep and afterStep hooks for logging, monitoring, validation, and more:

import{Trotsky}from"trotsky"consttrotsky=newTrotsky(agent)// Log when steps starttrotsky.beforeStep((step,context)=>{console.log(`Starting: ${step.constructor.name}`)})// Track performance after each steptrotsky.afterStep((step,context,result)=>{console.log(`Completed: ${step.constructor.name} (${result.executionTime}ms)`)if(result.executionTime>1000){console.warn('Slow step detected!')}})awaittrotsky.actor('alice.bsky.social').createPost('Hello world!').run()

See the Hooks Documentation for comprehensive guides and examples.

Next Steps

Find out more about how to use Trotsky with advanced scenario on the official documentation.

About

🔨 A type-safe Javascript library to build automation at the top of ATProto/Bluesky API.

Topics

Resources

Stars

15 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages