Generator Types
There are three types of info generators, each operating at different scopes:IProjectInfoGenerator
Project-level generators analyze the entire project structure.project- The project to analyzecontentIndex- Tracks content usage across the project
- Checking manifest consistency
- Validating pack dependencies
- Analyzing project structure
- Checking for duplicate vanilla content
IProjectItemInfoGenerator
Item-level generators analyze individual ProjectItem objects (entities, blocks, items, etc.).projectItem- The item to analyze (entity, block, item, etc.)contentIndex- Tracks content usageoptions- Optional generator behavior configuration
- Validating JSON schema
- Checking component usage
- Analyzing entity behavior
- Validating scripts
IProjectFileInfoGenerator
File-level generators analyze individual files directly.project- The project contextprojectFile- The file to analyzecontentIndex- Tracks content usage
- Checking file encoding (BOM detection)
- Validating file paths
- Checking file sizes
- Analyzing image files
Base Interface
All generators extendIProjectInfoGeneratorBase:
id- Unique identifier for the generator (e.g., “JSONTAGS”, “STRICT”)title- Human-readable name (e.g., “JSON Tags”, “Strict Mode”)canAlwaysProcess- If true, generator runs even when no applicable items found
getTopicData()- Returns metadata for a specific validation topicsummarize()- Aggregates validation results for reporting
Topic Data
Creating Validation Items
Generators returnProjectInfoItem objects representing validation results:
Info Item Types
Example Generator Implementation
Registering Generators
Add your generator to the registration list inGeneratorRegistrations.ts:
Feature Tracking
Generators can track feature usage statistics using the feature system:Best Practices
- Use specific topic IDs: Define clear enums for topic indexes
- Provide clear messages: Help users understand what’s wrong
- Include context: Add relevant file paths and content snippets
- Handle errors gracefully: Catch exceptions to avoid breaking other generators
- Track features: Use the feature system for analytics
- Add test summaries: Include success/fail items to indicate test completion
- Consider performance: Large projects may have thousands of files
- Use ContentIndex: Track content references for cross-file validation
Related
- ProjectInfoSet - Container for validation results
- Updaters - Automated fixes for validation issues