<p align="center">
  <a href="README.ja.md">日本語</a> | <a href="README.zh.md">中文</a> | <a href="README.es.md">Español</a> | <a href="README.fr.md">Français</a> | <a href="README.hi.md">हिन्दी</a> | <a href="README.it.md">Italiano</a> | <a href="README.pt-BR.md">Português (BR)</a>
</p>

<p align="center">
  <img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
</p>

<p align="center">
  <a href="https://github.com/mcp-tool-shop-org/ai-rpg-engine/actions/workflows/ci.yml"><img src="https://github.com/mcp-tool-shop-org/ai-rpg-engine/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
  <a href="https://github.com/mcp-tool-shop-org/ai-rpg-engine/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
  <a href="https://mcp-tool-shop-org.github.io/ai-rpg-engine/"><img src="https://img.shields.io/badge/Landing_Page-live-blue" alt="Landing Page"></a>
</p>

# @ai-rpg-engine/content-schema

Content schemas and validators for AI RPG Engine — define rooms, entities, dialogue, items, and quests as data.

## Install

```bash
npm install @ai-rpg-engine/content-schema
```

## What's Inside

- **Room schemas** — zones with exits, properties, and environmental state
- **Entity schemas** — NPCs, creatures, and player character definitions
- **Dialogue schemas** — graph-based dialogue trees with conditions and effects
- **Item schemas** — equipment, consumables, quest items with stat modifiers
- **Content pack loader** — validate and load JSON/TypeScript content packs
- **Ability schemas** — ability definitions, status definitions, and pack validation with balance advisories
- **Schema validators** — runtime validation with structured error messages
- **JSON Schema** — Draft 2020-12 artifact at `schema/content-pack.schema.json` (`toJsonSchema()`)

## Usage

```typescript
import { loadContent, validateGameContent, toJsonSchema } from '@ai-rpg-engine/content-schema';

const result = loadContent(myContentData);
if (!result.ok) {
  console.error(result.errors);
}

const refs = validateGameContent(myContentData);
if (!refs.ok) {
  console.error(refs.errors);
}

const schema = toJsonSchema();
```

## JSON Schema

The live ContentPack contract for JSON authors is
[`schema/content-pack.schema.json`](./schema/content-pack.schema.json)
(JSON Schema Draft 2020-12). `$ref` it from World Forge, editors, and linters:

```json
{ "$schema": "https://ai-rpg-engine.dev/schemas/content-pack.schema.json" }
```

`loadContent` / `validate.ts` remain the fail-closed runtime gate. Handbook
appendix B is not the source of truth — this artifact is (EntityBlueprint uses
`type` not `kind`; DialogueDefinition uses `entryNodeId` not `startNode`;
StatusDefinition.duration is a DurationSpec object, not a number).

## Documentation

- [Content Files (Ch. 13)](https://mcp-tool-shop-org.github.io/ai-rpg-engine/handbook/13-content-files/) — authoring content packs
- [Handbook](https://mcp-tool-shop-org.github.io/ai-rpg-engine/handbook/)
- [GitHub](https://github.com/mcp-tool-shop-org/ai-rpg-engine)

---

Built by <a href="https://mcp-tool-shop.github.io/">MCP Tool Shop</a>
