-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource.config.ts
More file actions
138 lines (129 loc) · 4.14 KB
/
Copy pathsource.config.ts
File metadata and controls
138 lines (129 loc) · 4.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import { defineDocs, defineConfig, frontmatterSchema } from 'fumadocs-mdx/config';
import { z } from 'zod';
// Base schema with content source flag
const baseSchema = frontmatterSchema.extend({
source: z.enum(['srd', 'synthesized', 'created']).default('srd'),
});
// Monster schema - extends base with monster-specific fields
const monsterSchema = baseSchema.extend({
size: z.enum(['Tiny', 'Small', 'Medium', 'Large', 'Huge', 'Gargantuan']).optional(),
creatureType: z.string().optional(), // "Aberration", "Dragon (Chromatic)", "Beast", etc.
alignment: z.string().optional(),
ac: z.number().optional(),
hp: z.object({
average: z.number(),
formula: z.string(),
}).optional(),
speed: z.object({
walk: z.number().optional(),
fly: z.number().optional(),
swim: z.number().optional(),
burrow: z.number().optional(),
climb: z.number().optional(),
}).optional(),
abilities: z.object({
str: z.number(),
dex: z.number(),
con: z.number(),
int: z.number(),
wis: z.number(),
cha: z.number(),
}).optional(),
saves: z.object({
str: z.number().optional(),
dex: z.number().optional(),
con: z.number().optional(),
int: z.number().optional(),
wis: z.number().optional(),
cha: z.number().optional(),
}).optional(),
skills: z.array(z.string()).optional(), // ["Perception +10", "Stealth +7"]
immunities: z.array(z.string()).optional(),
resistances: z.array(z.string()).optional(),
vulnerabilities: z.array(z.string()).optional(),
conditionImmunities: z.array(z.string()).optional(),
senses: z.array(z.string()).optional(), // ["darkvision 120 ft.", "Passive Perception 20"]
languages: z.array(z.string()).optional(),
cr: z.string().optional(), // "10", "1/4", "0"
xp: z.number().optional(),
});
// Magic item schema - extends base frontmatter with item-specific fields
const magicItemSchema = baseSchema.extend({
category: z.enum(['Armor', 'Potion', 'Ring', 'Rod', 'Scroll', 'Staff', 'Wand', 'Weapon', 'Wondrous Item']).optional(),
rarity: z.enum(['Common', 'Uncommon', 'Rare', 'Very Rare', 'Legendary', 'Artifact']).optional(),
itemType: z.string().optional(), // Subtype like "Shield", "Any Ammunition", etc.
attunement: z.union([z.boolean(), z.string()]).optional(), // true, false, or "by a spellcaster"
charges: z.object({
max: z.number(),
recharge: z.string().optional(), // "dawn", "1d6+1 at dawn", etc.
}).optional(),
armorType: z.string().optional(), // For armor items
weaponType: z.string().optional(), // For weapon items
});
// Spell schema - extends base frontmatter with spell-specific fields
const spellSchema = baseSchema.extend({
level: z.number().min(0).max(9).optional(), // 0 = cantrip
school: z.enum([
'Abjuration',
'Conjuration',
'Divination',
'Enchantment',
'Evocation',
'Illusion',
'Necromancy',
'Transmutation',
]).optional(),
castingTime: z.string().optional(),
range: z.string().optional(),
components: z.object({
verbal: z.boolean(),
somatic: z.boolean(),
material: z.string().optional(),
}).optional(),
duration: z.string().optional(),
concentration: z.boolean().default(false),
ritual: z.boolean().default(false),
classes: z.array(z.string()).optional(),
higherLevel: z.string().optional(),
});
// Main documentation (rules, classes, origins, etc.)
export const { docs, meta } = defineDocs({
docs: {
dir: 'content',
schema: baseSchema,
},
meta: {
dir: 'content',
},
});
// Bestiary (monster reference with typed frontmatter)
export const { docs: bestiaryDocs, meta: bestiaryMeta } = defineDocs({
docs: {
dir: 'bestiary',
schema: monsterSchema,
},
meta: {
dir: 'bestiary',
},
});
// Spellbook (spell reference with typed frontmatter)
export const { docs: spellDocs, meta: spellMeta } = defineDocs({
docs: {
dir: 'spellbook',
schema: spellSchema,
},
meta: {
dir: 'spellbook',
},
});
// Magic Items (item reference with typed frontmatter)
export const { docs: magicItemDocs, meta: magicItemMeta } = defineDocs({
docs: {
dir: 'magicitems',
schema: magicItemSchema,
},
meta: {
dir: 'magicitems',
},
});
export default defineConfig();