@hiveforge/hivemind-mcp 2.1.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +18 -9
  2. package/dist/cli.js +193 -2
  3. package/dist/cli.js.map +1 -1
  4. package/dist/mcp/index.d.ts +8 -0
  5. package/dist/mcp/index.d.ts.map +1 -0
  6. package/dist/mcp/index.js +8 -0
  7. package/dist/mcp/index.js.map +1 -0
  8. package/dist/mcp/tool-generator.d.ts +108 -0
  9. package/dist/mcp/tool-generator.d.ts.map +1 -0
  10. package/dist/mcp/tool-generator.js +245 -0
  11. package/dist/mcp/tool-generator.js.map +1 -0
  12. package/dist/parser/markdown.d.ts +9 -0
  13. package/dist/parser/markdown.d.ts.map +1 -1
  14. package/dist/parser/markdown.js +13 -2
  15. package/dist/parser/markdown.js.map +1 -1
  16. package/dist/server.d.ts +8 -4
  17. package/dist/server.d.ts.map +1 -1
  18. package/dist/server.js +66 -199
  19. package/dist/server.js.map +1 -1
  20. package/dist/templates/builtin/worldbuilding.d.ts +20 -0
  21. package/dist/templates/builtin/worldbuilding.d.ts.map +1 -0
  22. package/dist/templates/builtin/worldbuilding.js +464 -0
  23. package/dist/templates/builtin/worldbuilding.js.map +1 -0
  24. package/dist/templates/detector.d.ts +51 -0
  25. package/dist/templates/detector.d.ts.map +1 -0
  26. package/dist/templates/detector.js +71 -0
  27. package/dist/templates/detector.js.map +1 -0
  28. package/dist/templates/folder-mapper.d.ts +66 -0
  29. package/dist/templates/folder-mapper.d.ts.map +1 -0
  30. package/dist/templates/folder-mapper.js +148 -0
  31. package/dist/templates/folder-mapper.js.map +1 -0
  32. package/dist/templates/index.d.ts +15 -0
  33. package/dist/templates/index.d.ts.map +1 -0
  34. package/dist/templates/index.js +15 -0
  35. package/dist/templates/index.js.map +1 -0
  36. package/dist/templates/loader.d.ts +115 -0
  37. package/dist/templates/loader.d.ts.map +1 -0
  38. package/dist/templates/loader.js +202 -0
  39. package/dist/templates/loader.js.map +1 -0
  40. package/dist/templates/registry.d.ts +97 -0
  41. package/dist/templates/registry.d.ts.map +1 -0
  42. package/dist/templates/registry.js +141 -0
  43. package/dist/templates/registry.js.map +1 -0
  44. package/dist/templates/schema-factory.d.ts +76 -0
  45. package/dist/templates/schema-factory.d.ts.map +1 -0
  46. package/dist/templates/schema-factory.js +171 -0
  47. package/dist/templates/schema-factory.js.map +1 -0
  48. package/dist/templates/types.d.ts +114 -0
  49. package/dist/templates/types.d.ts.map +1 -0
  50. package/dist/templates/types.js +9 -0
  51. package/dist/templates/types.js.map +1 -0
  52. package/dist/templates/validator.d.ts +200 -0
  53. package/dist/templates/validator.d.ts.map +1 -0
  54. package/dist/templates/validator.js +136 -0
  55. package/dist/templates/validator.js.map +1 -0
  56. package/dist/types/index.d.ts +57 -21
  57. package/dist/types/index.d.ts.map +1 -1
  58. package/dist/types/index.js +39 -15
  59. package/dist/types/index.js.map +1 -1
  60. package/dist/vault/reader.d.ts.map +1 -1
  61. package/dist/vault/reader.js +15 -1
  62. package/dist/vault/reader.js.map +1 -1
  63. package/package.json +7 -4
@@ -0,0 +1,464 @@
1
+ /**
2
+ * Built-in worldbuilding template.
3
+ *
4
+ * Defines entity types for worldbuilding projects:
5
+ * - character: NPCs, player characters, historical figures
6
+ * - location: Places, regions, buildings, rooms
7
+ * - event: Historical events, current events, plot points
8
+ * - faction: Organizations, governments, guilds, houses
9
+ * - lore: Mythology, magic systems, cultural knowledge
10
+ * - asset: Visual and media assets (images, audio, video)
11
+ */
12
+ /**
13
+ * Worldbuilding template definition.
14
+ *
15
+ * Matches the existing hardcoded schemas in src/types/index.ts to ensure
16
+ * backwards compatibility with existing vaults.
17
+ */
18
+ export const worldbuildingTemplate = {
19
+ id: 'worldbuilding',
20
+ name: 'Worldbuilding',
21
+ version: '1.0.0',
22
+ description: 'Template for fictional world creation with characters, locations, events, factions, lore, and assets',
23
+ entityTypes: [
24
+ // Character entity type
25
+ {
26
+ name: 'character',
27
+ displayName: 'Character',
28
+ pluralName: 'Characters',
29
+ description: 'NPCs, player characters, and historical figures',
30
+ icon: 'user',
31
+ fields: [
32
+ {
33
+ name: 'name',
34
+ type: 'string',
35
+ required: true,
36
+ description: 'Character name',
37
+ },
38
+ {
39
+ name: 'age',
40
+ type: 'number',
41
+ description: 'Character age in years',
42
+ },
43
+ {
44
+ name: 'gender',
45
+ type: 'string',
46
+ description: 'Character gender',
47
+ },
48
+ {
49
+ name: 'race',
50
+ type: 'string',
51
+ description: 'Character species or race',
52
+ },
53
+ {
54
+ name: 'appearance',
55
+ type: 'record',
56
+ description: 'Physical appearance details',
57
+ },
58
+ {
59
+ name: 'personality',
60
+ type: 'record',
61
+ description: 'Personality traits and characteristics',
62
+ },
63
+ {
64
+ name: 'relationships',
65
+ type: 'array',
66
+ arrayItemType: 'record',
67
+ description: 'Relationships with other characters',
68
+ },
69
+ {
70
+ name: 'assets',
71
+ type: 'array',
72
+ arrayItemType: 'string',
73
+ description: 'Asset IDs depicting this character',
74
+ },
75
+ ],
76
+ },
77
+ // Location entity type
78
+ {
79
+ name: 'location',
80
+ displayName: 'Location',
81
+ pluralName: 'Locations',
82
+ description: 'Places, regions, buildings, and rooms',
83
+ icon: 'map-pin',
84
+ fields: [
85
+ {
86
+ name: 'name',
87
+ type: 'string',
88
+ required: true,
89
+ description: 'Location name',
90
+ },
91
+ {
92
+ name: 'region',
93
+ type: 'string',
94
+ description: 'Geographic region',
95
+ },
96
+ {
97
+ name: 'category',
98
+ type: 'string',
99
+ description: 'Location category or type',
100
+ },
101
+ {
102
+ name: 'parent',
103
+ type: 'string',
104
+ description: 'Parent location in hierarchy',
105
+ },
106
+ {
107
+ name: 'hierarchy_level',
108
+ type: 'enum',
109
+ enumValues: ['continent', 'region', 'settlement', 'building', 'room'],
110
+ description: 'Level in location hierarchy',
111
+ },
112
+ {
113
+ name: 'children',
114
+ type: 'array',
115
+ arrayItemType: 'string',
116
+ description: 'Child locations in hierarchy',
117
+ },
118
+ {
119
+ name: 'climate',
120
+ type: 'string',
121
+ description: 'Climate type',
122
+ },
123
+ {
124
+ name: 'terrain',
125
+ type: 'array',
126
+ arrayItemType: 'string',
127
+ description: 'Terrain types present',
128
+ },
129
+ {
130
+ name: 'inhabitants',
131
+ type: 'array',
132
+ arrayItemType: 'string',
133
+ description: 'Character IDs of inhabitants',
134
+ },
135
+ {
136
+ name: 'connections',
137
+ type: 'array',
138
+ arrayItemType: 'record',
139
+ description: 'Connections to other locations',
140
+ },
141
+ {
142
+ name: 'assets',
143
+ type: 'array',
144
+ arrayItemType: 'string',
145
+ description: 'Asset IDs depicting this location',
146
+ },
147
+ ],
148
+ },
149
+ // Event entity type
150
+ {
151
+ name: 'event',
152
+ displayName: 'Event',
153
+ pluralName: 'Events',
154
+ description: 'Historical events, current events, and plot points',
155
+ icon: 'calendar',
156
+ fields: [
157
+ {
158
+ name: 'name',
159
+ type: 'string',
160
+ required: true,
161
+ description: 'Event name',
162
+ },
163
+ {
164
+ name: 'date',
165
+ type: 'string',
166
+ description: 'Event date',
167
+ },
168
+ {
169
+ name: 'date_start',
170
+ type: 'string',
171
+ description: 'Event start date (for multi-day events)',
172
+ },
173
+ {
174
+ name: 'date_end',
175
+ type: 'string',
176
+ description: 'Event end date (for multi-day events)',
177
+ },
178
+ {
179
+ name: 'date_display',
180
+ type: 'string',
181
+ description: 'Human-readable date display',
182
+ },
183
+ {
184
+ name: 'event_type',
185
+ type: 'string',
186
+ description: 'Type of event',
187
+ },
188
+ {
189
+ name: 'participants',
190
+ type: 'array',
191
+ arrayItemType: 'string',
192
+ description: 'Character IDs of participants',
193
+ },
194
+ {
195
+ name: 'locations',
196
+ type: 'array',
197
+ arrayItemType: 'string',
198
+ description: 'Location IDs where event occurred',
199
+ },
200
+ {
201
+ name: 'factions',
202
+ type: 'array',
203
+ arrayItemType: 'string',
204
+ description: 'Faction IDs involved in event',
205
+ },
206
+ {
207
+ name: 'outcome',
208
+ type: 'string',
209
+ description: 'Event outcome or result',
210
+ },
211
+ {
212
+ name: 'consequences',
213
+ type: 'array',
214
+ arrayItemType: 'string',
215
+ description: 'Consequences of the event',
216
+ },
217
+ {
218
+ name: 'timeline',
219
+ type: 'string',
220
+ description: 'Timeline this event belongs to',
221
+ },
222
+ {
223
+ name: 'previous_event',
224
+ type: 'string',
225
+ description: 'Previous event in sequence',
226
+ },
227
+ {
228
+ name: 'next_event',
229
+ type: 'string',
230
+ description: 'Next event in sequence',
231
+ },
232
+ ],
233
+ },
234
+ // Faction entity type
235
+ {
236
+ name: 'faction',
237
+ displayName: 'Faction',
238
+ pluralName: 'Factions',
239
+ description: 'Organizations, governments, guilds, and houses',
240
+ icon: 'users',
241
+ fields: [
242
+ {
243
+ name: 'name',
244
+ type: 'string',
245
+ required: true,
246
+ description: 'Faction name',
247
+ },
248
+ {
249
+ name: 'faction_type',
250
+ type: 'enum',
251
+ enumValues: ['house', 'guild', 'organization', 'government', 'military', 'religion', 'other'],
252
+ description: 'Type of faction',
253
+ },
254
+ {
255
+ name: 'leader',
256
+ type: 'string',
257
+ description: 'Character ID of faction leader',
258
+ },
259
+ {
260
+ name: 'members',
261
+ type: 'array',
262
+ arrayItemType: 'string',
263
+ description: 'Character IDs of faction members',
264
+ },
265
+ {
266
+ name: 'headquarters',
267
+ type: 'string',
268
+ description: 'Location ID of faction headquarters',
269
+ },
270
+ {
271
+ name: 'founded',
272
+ type: 'string',
273
+ description: 'When the faction was founded',
274
+ },
275
+ {
276
+ name: 'goals',
277
+ type: 'array',
278
+ arrayItemType: 'string',
279
+ description: 'Faction goals and objectives',
280
+ },
281
+ {
282
+ name: 'resources',
283
+ type: 'array',
284
+ arrayItemType: 'string',
285
+ description: 'Resources controlled by faction',
286
+ },
287
+ {
288
+ name: 'allies',
289
+ type: 'array',
290
+ arrayItemType: 'string',
291
+ description: 'Faction IDs of allies',
292
+ },
293
+ {
294
+ name: 'rivals',
295
+ type: 'array',
296
+ arrayItemType: 'string',
297
+ description: 'Faction IDs of rivals',
298
+ },
299
+ ],
300
+ },
301
+ // Lore entity type
302
+ {
303
+ name: 'lore',
304
+ displayName: 'Lore',
305
+ pluralName: 'Lore',
306
+ description: 'Mythology, magic systems, and cultural knowledge',
307
+ icon: 'book',
308
+ fields: [
309
+ {
310
+ name: 'name',
311
+ type: 'string',
312
+ required: true,
313
+ description: 'Lore entry name',
314
+ },
315
+ {
316
+ name: 'category',
317
+ type: 'enum',
318
+ enumValues: ['mythology', 'history', 'magic', 'technology', 'culture', 'religion', 'other'],
319
+ description: 'Lore category',
320
+ },
321
+ {
322
+ name: 'related_entities',
323
+ type: 'array',
324
+ arrayItemType: 'string',
325
+ description: 'IDs of related entities',
326
+ },
327
+ {
328
+ name: 'source',
329
+ type: 'enum',
330
+ enumValues: ['in-world', 'meta', 'player-knowledge'],
331
+ description: 'Knowledge source type',
332
+ },
333
+ ],
334
+ },
335
+ // Asset entity type
336
+ {
337
+ name: 'asset',
338
+ displayName: 'Asset',
339
+ pluralName: 'Assets',
340
+ description: 'Visual and media assets (images, audio, video)',
341
+ icon: 'image',
342
+ fields: [
343
+ {
344
+ name: 'asset_type',
345
+ type: 'enum',
346
+ enumValues: ['image', 'audio', 'video', 'document'],
347
+ default: 'image',
348
+ description: 'Type of asset',
349
+ },
350
+ {
351
+ name: 'file_path',
352
+ type: 'string',
353
+ required: true,
354
+ description: 'Path to asset file in vault',
355
+ },
356
+ {
357
+ name: 'file_format',
358
+ type: 'string',
359
+ description: 'File format (e.g., png, jpg, mp3)',
360
+ },
361
+ {
362
+ name: 'depicts',
363
+ type: 'array',
364
+ arrayItemType: 'string',
365
+ description: 'Entity IDs depicted in this asset',
366
+ },
367
+ {
368
+ name: 'generation_date',
369
+ type: 'string',
370
+ description: 'When asset was generated',
371
+ },
372
+ {
373
+ name: 'generator',
374
+ type: 'string',
375
+ description: 'Tool or system that generated the asset',
376
+ },
377
+ {
378
+ name: 'workflow_id',
379
+ type: 'string',
380
+ description: 'ComfyUI workflow ID used to generate',
381
+ },
382
+ {
383
+ name: 'prompt',
384
+ type: 'string',
385
+ description: 'Generation prompt used',
386
+ },
387
+ {
388
+ name: 'negative_prompt',
389
+ type: 'string',
390
+ description: 'Negative prompt for generation',
391
+ },
392
+ {
393
+ name: 'model',
394
+ type: 'string',
395
+ description: 'AI model used for generation',
396
+ },
397
+ {
398
+ name: 'seed',
399
+ type: 'number',
400
+ description: 'Random seed for reproducible generation',
401
+ },
402
+ {
403
+ name: 'parameters',
404
+ type: 'record',
405
+ description: 'Generation parameters (seed, steps, cfg, etc.)',
406
+ },
407
+ {
408
+ name: 'approved_by',
409
+ type: 'string',
410
+ description: 'Who approved this asset',
411
+ },
412
+ {
413
+ name: 'approval_date',
414
+ type: 'string',
415
+ description: 'When this asset was approved',
416
+ },
417
+ ],
418
+ },
419
+ // Reference entity type
420
+ {
421
+ name: 'reference',
422
+ displayName: 'Reference',
423
+ pluralName: 'References',
424
+ description: 'Out-of-world reference material (sources, inspiration, rules, notes)',
425
+ icon: 'bookmark',
426
+ fields: [
427
+ {
428
+ name: 'name',
429
+ type: 'string',
430
+ required: true,
431
+ description: 'Reference name or title',
432
+ },
433
+ {
434
+ name: 'category',
435
+ type: 'enum',
436
+ enumValues: ['source', 'inspiration', 'rules', 'notes', 'other'],
437
+ description: 'Type of reference material',
438
+ },
439
+ {
440
+ name: 'source_url',
441
+ type: 'string',
442
+ description: 'URL to external source material',
443
+ },
444
+ {
445
+ name: 'related_entities',
446
+ type: 'array',
447
+ arrayItemType: 'string',
448
+ description: 'IDs of entities related to this reference',
449
+ },
450
+ {
451
+ name: 'author',
452
+ type: 'string',
453
+ description: 'Author or creator of the reference material',
454
+ },
455
+ {
456
+ name: 'date_accessed',
457
+ type: 'string',
458
+ description: 'When this reference was accessed or added',
459
+ },
460
+ ],
461
+ },
462
+ ],
463
+ };
464
+ //# sourceMappingURL=worldbuilding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worldbuilding.js","sourceRoot":"","sources":["../../../src/templates/builtin/world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AI,EAAE,QAAQ;oBACd,WAAW,EAAE,2CAA2C;iBACzD;aACF;SACF;KACF;CACF,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Template auto-detection from vault folder structure.
3
+ *
4
+ * This module enables backwards compatibility by automatically identifying
5
+ * templates based on vault organization patterns.
6
+ */
7
+ /**
8
+ * Result of template detection with confidence level.
9
+ */
10
+ export interface DetectionResult {
11
+ /** Detected template identifier */
12
+ templateId: string;
13
+ /** Confidence level based on pattern matches */
14
+ confidence: 'high' | 'medium' | 'low';
15
+ /** Folder names that matched detection patterns */
16
+ matchedPatterns: string[];
17
+ /** User-friendly notification message */
18
+ message: string;
19
+ }
20
+ /**
21
+ * Detects template type from vault folder structure.
22
+ *
23
+ * Provides automatic template identification for backwards compatibility
24
+ * with existing vaults.
25
+ */
26
+ export declare class TemplateDetector {
27
+ /**
28
+ * Worldbuilding folder patterns (case-insensitive).
29
+ *
30
+ * Vaults with 2+ matching folders are detected as worldbuilding templates.
31
+ */
32
+ private static readonly WORLDBUILDING_PATTERNS;
33
+ /**
34
+ * Detect template from vault folder structure.
35
+ *
36
+ * Scans top-level folders and matches against known template patterns.
37
+ * Returns null if no template can be confidently detected.
38
+ *
39
+ * @param vaultPath - Absolute path to vault directory
40
+ * @returns Detection result with confidence level, or null if no match
41
+ */
42
+ detectTemplate(vaultPath: string): Promise<DetectionResult | null>;
43
+ /**
44
+ * List top-level folders in vault, excluding hidden directories.
45
+ *
46
+ * @param vaultPath - Absolute path to vault directory
47
+ * @returns Array of folder names
48
+ */
49
+ private listTopLevelFolders;
50
+ }
51
+ //# sourceMappingURL=detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detector.d.ts","sourceRoot":"","sources":["../../src/templates/detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IAEnB,gDAAgD;IAChD,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IAEtC,mDAAmD;IACnD,eAAe,EAAE,MAAM,EAAE,CAAC;IAE1B,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,qBAAa,gBAAgB;IAC3B;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAY5C;IAEF;;;;;;;;OAQG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAyBxE;;;;;OAKG;YACW,mBAAmB;CAOlC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Template auto-detection from vault folder structure.
3
+ *
4
+ * This module enables backwards compatibility by automatically identifying
5
+ * templates based on vault organization patterns.
6
+ */
7
+ import { promises as fs } from 'fs';
8
+ /**
9
+ * Detects template type from vault folder structure.
10
+ *
11
+ * Provides automatic template identification for backwards compatibility
12
+ * with existing vaults.
13
+ */
14
+ export class TemplateDetector {
15
+ /**
16
+ * Worldbuilding folder patterns (case-insensitive).
17
+ *
18
+ * Vaults with 2+ matching folders are detected as worldbuilding templates.
19
+ */
20
+ static WORLDBUILDING_PATTERNS = [
21
+ 'characters',
22
+ 'character',
23
+ 'locations',
24
+ 'location',
25
+ 'events',
26
+ 'event',
27
+ 'factions',
28
+ 'faction',
29
+ 'lore',
30
+ 'assets',
31
+ 'asset',
32
+ ];
33
+ /**
34
+ * Detect template from vault folder structure.
35
+ *
36
+ * Scans top-level folders and matches against known template patterns.
37
+ * Returns null if no template can be confidently detected.
38
+ *
39
+ * @param vaultPath - Absolute path to vault directory
40
+ * @returns Detection result with confidence level, or null if no match
41
+ */
42
+ async detectTemplate(vaultPath) {
43
+ const folders = await this.listTopLevelFolders(vaultPath);
44
+ // Check for worldbuilding patterns
45
+ const matched = folders.filter((f) => TemplateDetector.WORLDBUILDING_PATTERNS.some((p) => f.toLowerCase().includes(p.toLowerCase())));
46
+ if (matched.length >= 2) {
47
+ const confidence = matched.length >= 4 ? 'high' : matched.length >= 3 ? 'medium' : 'low';
48
+ return {
49
+ templateId: 'worldbuilding',
50
+ confidence,
51
+ matchedPatterns: matched,
52
+ message: `Detected worldbuilding vault (${confidence} confidence). Matched folders: ${matched.join(', ')}`,
53
+ };
54
+ }
55
+ return null;
56
+ }
57
+ /**
58
+ * List top-level folders in vault, excluding hidden directories.
59
+ *
60
+ * @param vaultPath - Absolute path to vault directory
61
+ * @returns Array of folder names
62
+ */
63
+ async listTopLevelFolders(vaultPath) {
64
+ const entries = await fs.readdir(vaultPath, { withFileTypes: true });
65
+ return entries
66
+ .filter((e) => e.isDirectory())
67
+ .filter((e) => !e.name.startsWith('.'))
68
+ .map((e) => e.name);
69
+ }
70
+ }
71
+ //# sourceMappingURL=detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detector.js","sourceRoot":"","sources":["../../src/templates/detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AAmBpC;;;;;GAKG;AACH,MAAM,OAAO,gBAAgB;IAC3B;;;;OAIG;IACK,MAAM,CAAU,sBAAsB,GAAG;QAC/C,YAAY;QACZ,WAAW;QACX,WAAW;QACX,UAAU;QACV,QAAQ;QACR,OAAO;QACP,UAAU;QACV,SAAS;QACT,MAAM;QACN,QAAQ;QACR,OAAO;KACR,CAAC;IAEF;;;;;;;;OAQG;IACH,KAAK,CAAC,cAAc,CAAC,SAAiB;QACpC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAE1D,mCAAmC;QACnC,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACnC,gBAAgB,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CACjD,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAC1C,CACF,CAAC;QAEF,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YACxB,MAAM,UAAU,GACd,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;YAExE,OAAO;gBACL,UAAU,EAAE,eAAe;gBAC3B,UAAU;gBACV,eAAe,EAAE,OAAO;gBACxB,OAAO,EAAE,iCAAiC,UAAU,kCAAkC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;aAC3G,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,mBAAmB,CAAC,SAAiB;QACjD,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QACrE,OAAO,OAAO;aACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;aAC9B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;aACtC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Folder-to-type mapping utility.
3
+ *
4
+ * Infers entity types from file paths based on folder names.
5
+ * Used by the CLI 'fix' command and Obsidian plugin to auto-suggest
6
+ * entity types for files without frontmatter.
7
+ */
8
+ import type { FolderMapping } from './types.js';
9
+ /**
10
+ * Default folder-to-type mappings for common worldbuilding folder structures.
11
+ *
12
+ * Supports multiple naming conventions (e.g., 'characters', 'people', 'npcs')
13
+ * mapping to the same entity type.
14
+ */
15
+ export declare const DEFAULT_FOLDER_MAPPINGS: FolderMapping[];
16
+ /**
17
+ * FolderMapper infers entity types from file paths.
18
+ *
19
+ * Checks each path segment against folder mappings to determine
20
+ * the most likely entity type for a file.
21
+ */
22
+ export declare class FolderMapper {
23
+ private mappings;
24
+ /**
25
+ * Create a FolderMapper with optional custom mappings.
26
+ *
27
+ * @param customMappings - Additional or override mappings.
28
+ * Custom mappings take precedence over defaults.
29
+ */
30
+ constructor(customMappings?: FolderMapping[]);
31
+ /**
32
+ * Infer entity type from a file path.
33
+ *
34
+ * Checks each folder in the path against mappings.
35
+ * Returns the first match found, or null if no match.
36
+ *
37
+ * @param filePath - Relative or absolute file path
38
+ * @returns Inferred entity type name, or null if no match
39
+ */
40
+ inferType(filePath: string): string | null;
41
+ /**
42
+ * Infer types for multiple file paths.
43
+ *
44
+ * @param filePaths - Array of file paths
45
+ * @returns Map of file path to inferred type (or null)
46
+ */
47
+ inferTypes(filePaths: string[]): Map<string, string | null>;
48
+ /**
49
+ * Get all registered mappings.
50
+ *
51
+ * @returns Array of folder mappings
52
+ */
53
+ getMappings(): FolderMapping[];
54
+ /**
55
+ * Add a new mapping.
56
+ *
57
+ * @param pattern - Folder name pattern
58
+ * @param entityType - Entity type to assign
59
+ */
60
+ addMapping(pattern: string, entityType: string): void;
61
+ }
62
+ /**
63
+ * Singleton instance for convenience.
64
+ */
65
+ export declare const folderMapper: FolderMapper;
66
+ //# sourceMappingURL=folder-mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"folder-mapper.d.ts","sourceRoot":"","sources":["../../src/templates/folder-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,aAAa,EAgDlD,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAsB;IAEtC;;;;;OAKG;gBACS,cAAc,GAAE,aAAa,EAAO;IAchD;;;;;;;;OAQG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAuB1C;;;;;OAKG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ3D;;;;OAIG;IACH,WAAW,IAAI,aAAa,EAAE;IAO9B;;;;;OAKG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;CAGtD;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,cAAqB,CAAC"}