@qckfx/schema
v0.0.4
Published
This package bundles the **versioned** Zod schema used for **Trigger configuration files** (e.g. `.qckfx/triggers/*.json`). It mirrors the layout & approach used by the agent schema package so maintainers can follow the same workflow.
Downloads
22
Readme
Trigger Schema Package
This package bundles the versioned Zod schema used for Trigger
configuration files (e.g. .qckfx/triggers/*.json). It mirrors the layout &
approach used by the agent schema package so maintainers can follow the same
workflow.
Version folders
src/v1/– schema version 1.0 (current latest).
Each version folder contains:
trigger.ts– Zod schema exported asTriggerSchemaV1plus its TypeScript typeTriggerV1.migrate.ts(optional) – functions that upgrade the parsed object to the latest canonical representation. For v1 it is an identity function.
Registry & helpers
src/index.ts maintains a registry mapping version string → { schema, upgrade
fn }. The helper parseTriggerConfig():
- Extracts the version from the config’s
$schemaURL or string. - Removes
$schema(root schemas are strict). - Validates via the correct Zod schema.
- Applies the upgrade function so callers always receive the latest structure.
Adding a new version
- Create
src/vX.Y/trigger.tswith the updated Zod schema. - Provide
upgradeVXYToLatest()migration. - Register it in
src/index.tsand bumpSCHEMA_VERSION_LATESTplus the exportedTriggertype alias. - Add unit tests.
That’s it – the server code keeps using parseTriggerConfig() or (for backward
compat) TriggerSchema.parse().
