@hearthforge/shared
v0.1.2
Published
Types and constants shared across HearthForge's panel, agent and plugins
Maintainers
Readme
@hearthforge/shared
The types and constants every part of HearthForge agrees on — the panel, the agent, the web app and every game plugin. It holds the instance status machine (INSTANCE_STATUSES, ALLOWED_TRANSITIONS), the job, backup, node and event vocabularies, the bootstrap step types the agent executes, the API and data-query shapes with their zod schemas, and small pure utilities such as semver comparison. It carries no game nouns and no runtime dependencies beyond zod: anything game-specific belongs to a plugin.
Install
pnpm add @hearthforge/shared zodNode >= 22.
Usage
import { ALLOWED_TRANSITIONS, INSTANCE_STATUSES, compareSemver, type InstanceStatus } from "@hearthforge/shared";
export function canMove(from: InstanceStatus, to: InstanceStatus): boolean {
return ALLOWED_TRANSITIONS[from].includes(to);
}
canMove(INSTANCE_STATUSES.RUNNING, INSTANCE_STATUSES.STOPPING); // true
canMove(INSTANCE_STATUSES.DELETED, INSTANCE_STATUSES.RUNNING); // false
compareSemver("0.4.0-alpha.2", "0.4.0-alpha.13") < 0; // true — semver.org precedencecompareSemver throws on a string that is not semver; validate first with parseSemver.
Peer dependencies
| peer | range |
|---|---|
| zod | ^4.0.0 |
Versioning
Pre-1.0: a minor release may break the contract; a patch never does. Maintenance lines publish from release/X.Y branches under the release-X.Y npm dist-tag and never move latest — see Maintenance releases.
License
Apache-2.0.
Links
- Repository: hearthforge/hearthforge-sdk
- Contributing: CLA.md (required for every contribution)
- HearthForge core: hearthforge/hearthforge