@ironbird/core
v0.1.0
Published
Commands, targets, fakes, clocks, effect tracking, and event recording for ironbird
Readme
@ironbird/core
Commands, targets, fakes, clocks, effect tracking, and event recording for ironbird, which lets coding agents drive a React Native app's logic through typed commands, headlessly in Node or in a running development build.
npm install @ironbird/core zod@^4.2It runs unmodified in Node and Hermes and depends on nothing but zod 4.2 or later, a peer dependency. Apps on Zod 3: migrating from Zod 3.
import { z } from 'zod';
import { createTarget, defineCommands } from '@ironbird/core';
export const commands = defineCommands({
'counter.add': z.object({ by: z.number().int() }).describe('Add to the counter'),
});
let count = 0;
const listeners = new Set<() => void>();
export const target = createTarget({
commands,
dispatch: ({ payload }) => {
count += payload.by;
for (const listener of listeners) listener();
},
getState: () => ({ count }),
subscribe: (listener) => {
listeners.add(listener);
return () => {
listeners.delete(listener);
};
},
});For a Redux store or an XState actor, @ironbird/redux and @ironbird/xstate build the target for you.
MIT licensed.
