open-index/open-npm huggingface dataset:
npm package: @jondotsoy/pika
Description: A job execution framework with event-driven context management. Register and run named jobs with typed inputs, persistent YAML state, and automatic retries.
Author: Jonathan Delgado
Latest version: 0.1.8

# @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

```bash
npm install @jondotsoy/pika
```

## Usage

Run your script directly with `npx`:

```bash
npx @jondotsoy/pika script.js
```

Or use the loader manually:

```bash
node --import @jondotsoy/pika/loader script.js
```

Define and execute jobs using the `app()` function:

```javascript
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](LICENSE) file for details.