Skip to content

Plugin Development

david edited this page Dec 27, 2025 · 1 revision

Plugin Development Guide

Turbostar is language-agnostic.

"If it can run in a shell, it can be a Turbostar plugin." - said nobody

However, to utilize features like Dependency Graphing, your scripts need to output logs in a specific way.

The "Ready" Protocol

If other services depend on your script, your script must print a specific line to stdout when it is ready to work.

Python Example

import sys

# Do setup work...
setup_database()

# Signal readiness (flush is critical!)
print("SERVICE_READY", flush=True)

# Start main loop...

Node.js Example

const server = app.listen(3000, () => {
  console.log("SERVICE_READY");
});

Lua Example

print("SERVICE_READY")
io.stdout:flush() -- Lua buffers output, so explicit flush is often needed

Handling Shutdowns

Turbostar sends a SIGTERM signal when you press Ctrl+C. Your scripts should handle this gracefully to avoid data corruption.

An example in Python:

import signal
import sys

def handler(signum, frame):
    print("Saving state and exiting...")
    sys.exit(0)

signal.signal(signal.SIGTERM, handler)

Clone this wiki locally