npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

botfarm-cli

v0.1.12

Published

Farming but with robots

Downloads

30

Readme

Botfarm CLI

Build Status

Like cron with superpowers. You can write scripts (or "bots") and tell them when to run. Botfarm takes care of setup, scheduling, and capturing logs.

  • ⏲️ Schedule: Configure bots to run at specific times or at intervals.
  • 📺 Console: Observe bots and explore outputs.
  • 📦 Git: Sync your own repos of bots with botfarm to make updates easier.
  • 🏃‍♀️ Easy: No setup required, just add some bots and you're done!

Having trouble? Submit an issue or ask Jason a question on twitter.

Install

  • npm install -g node-gyp
  • npm install -g botfarm-cli

Troubleshooting

Sometimes the install will fail on Linux environments with EACCES permission errors. To remedy this, you can re-install with the --unsafe-perm flag:

npm install -g --unsafe-perm node-gyp botfarm-cli


Get started in 2 steps

Once botfarm-cli is installed, botfarm can be accessed through the bots command.

1) Add a repo

Note: Make sure the repository can be cloned by the current machine. Invalid permissions will cause the add process to stall or fail.

To add a new repository of bots to botfarm, simply run (replace the url and name with your own):
bots repo add http://url-to-repo repo-name

2) Start the service

The background service must be running if you want bots to actually run. Start the service by running:
bots service start

Check if the service is running with:
bots service status

Stop the service by running:
bots service stop


Bot repo configuration

Botfarm isn't opinionated about the structure of repos. The only requirement is to have a botfile.js file in the root of the repo.

The botfile

Every repo should have a botfile in its root. A botfile is a simple JS file that tells botfarm what to run and when to run it. It exports a function that returns an object containing bots.

For example, let's say we have a repo containing two bots. One need's to be run every night at 12am, and the other runs on the hour every hour:

module.exports = () => ({
  'midnight-bot': {
    load: './run-me-at-midnight.js',
    autorun: '12am', // Tell the bot to run every midnight
  },

  'regular-bot': {
    load: './run-every-hour.js',
    autorun: ':00', // Tell the bot to run at every o'clock
  }
});

Autorun strings

Botfarm understands multiple time formats for autorun strings.

| Examples | Meanings | |-----------------------------------------|---------------------------------------------| | 5 hours or 1 minute or 25 seconds | Run the bot at specified intervals. | | :10 or :45 | Run the bot at the same time every hour. | | 3:15pm or 8am | Run the bot at a specific time every day. | | 2:30pm, 9pm | Run the bot at 2:30pm and at 9pm every day. |


The console

The botfarm console is the nerve center for your bots. With the console you can monitor the queue to see when bots are due. Monitor the history to see which bots ran successfully, which ones took a long time, and which ones failed. And see a stream of logs neatly organised by each bot.

Access the console by running:
bots console

The queue

Botfarm keeps an internal queue where it stores the time that each bot is next due to be run. To see the queue:
bots queue show

Sometimes you might want to manually rebuild the queue. To rebuild the queue, run:
bots queue rebuild


Remaning docs coming soon. See bin/cli.js for all commands.

Logs

Manually run a bot

Update bot repos

Delete a repo


Contributions are encouraged 😃