@jondotsoy/pika
v0.1.8
Published
A job execution framework with event-driven context management. Register and run named jobs with typed inputs, persistent YAML state, and automatic retries.
Readme
@jondotsoy/pika
A job execution framework with event-driven context management. Register and run named jobs with typed inputs, persistent YAML state, and automatic retries.
Install
npm install @jondotsoy/pikaUsage
Run your script directly with npx:
npx @jondotsoy/pika script.jsOr use the loader manually:
node --import @jondotsoy/pika/loader script.jsDefine and execute jobs using the app() function:
import { app } from "@jondotsoy/pika";
const greet = app("greet", {
input: { name: z.string() },
handler: async ({ name }) => {
console.log(`Hello, ${name}!`);
},
});
greet("job-1", { name: "World" });Features
- Persistent state — job state is automatically saved to a YAML manifest and survives process restarts
- Typed inputs — input definitions provide TypeScript inference for job parameters
- Automatic retries — jobs retry on failure up to
maxRetries(default: 3) - Parent-child jobs — async local storage tracks job context across async boundaries
- Event-driven — subscribe to lifecycle events or consume them as an async iterable
License
This project is licensed under the MIT License - see the LICENSE file for details.
