jido-kit
Version:
Helper library for the Jido CLI. Includes types and utilities to write workflows, steps, and plugins with better developer experience.
111 lines (91 loc) ⢠2.38 kB
Markdown
# Jido-Kit
<img src="https://github.com/user-attachments/assets/038ca10c-9524-42de-b980-203ee0dc27b6" alt="jido-logo" height="80" />
**Helper library for building with Jido**
---
## What is Jido-Kit?
`jido-kit` provides essentials - Types and shared utilities (in future) - to improve the developer experience when working with [Jido](https://github.com/aether-flux/jido). It's especially useful when writing configs or plugins, offering IntelliSense and type safety in IDEs like VS Code.
Currently, `jido-kit` focuses on **Types** used across Jido's config and plugin system.
## Installation
```bash
npm install --save-dev jido-kit
```
## Types Provided
You can import individual types or all at once:
```js
import { Hook, Plugin, Step, Flow, Config } from "jido-kit/types";
```
### š¹ Hook
Type for any lifecycle function in a step:
```ts
type Hook = () => void | Promise<void>;
```
### š¹ Plugin
Shape of a plugin object:
```ts
type Plugin = {
onStart?: Hook;
onSuccess?: Hook;
onFailure?: Hook;
};
```
### š¹ Step
Represents a step in a flow:
```ts
type Step = {
run: string;
onStart?: Hook;
onSuccess?: Hook;
onFailure?: Hook;
plugins: Plugin[];
};
```
### š¹ Flow
Structure of a flow definition:
```ts
type Flow = {
name: string;
description?: string;
steps: Step[];
};
```
### š¹ Config
The full structure passed to `jido()`:
```ts
type Config = {
flows: Flow[];
};
```
## Usage Example
In your `jido.config.js`, use JSDoc annotations to enable type hints:
```js
/** @type {import("jido-kit/types").Config} */
import { jido } from "jido";
export default jido({
flows: [
{
name: "build",
steps: [
{
run: "npm run build",
onSuccess: () => console.log("Build complete!")
}
]
}
]
});
```
Or in a plugin file:
```js
/** @type {import("jido-kit/types").Plugin} */
export const myPlugin = () => ({
onStart: () => console.log("Plugin: Flow step is starting...")
});
```
[For complete guide and docs on usage of `jido`, visit the GitHub page for [Jido](https://github.com/aether-flux/jido).]
## Why use Jido-Kit?
ā
Full IntelliSense support
ā
Prevents config mistakes
ā
Helps structure your custom plugins
ā
Zero runtime overhead (just types)
## License
MIT