Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
266 changes: 266 additions & 0 deletions .ai/plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
# Implementation Plan: StraightFour Entities and OMI glTF Extensions Analysis

## 1. Files to Create/Modify

### New Files to Create:
```
docs/compatibility/straightfour-gltf-matrix.md
docs/compatibility/straightfour-gltf-report.md
docs/compatibility/straightfour-gltf-mapping.json
docs/compatibility/.gitignore
scripts/analyze_entities.py
scripts/clone_omi_extensions.py
scripts/parse_gltf_extensions.py
scripts/generate_compatibility_matrix.py
scripts/requirements.txt
```

### Directory Structure to Create:
```
docs/
├── compatibility/
│ ├── straightfour-gltf-matrix.md
│ ├── straightfour-gltf-report.md
│ ├── straightfour-gltf-mapping.json
│ └── .gitignore
└── scripts/
├── analyze_entities.py
├── clone_omi_extensions.py
├── parse_gltf_extensions.py
├── generate_compatibility_matrix.py
└── requirements.txt
```

## 2. Key Changes for Each File

### `scripts/analyze_entities.py`
```python
# Purpose: Parse StraightFour entity definitions
# Key functions:
- scan_entity_directories()
- parse_cs_files()
- extract_entity_metadata()
- extract_entity_properties()
- extract_entity_behaviors()
- generate_entity_catalog()
```

### `scripts/clone_omi_extensions.py`
```python
# Purpose: Clone and prepare OMI glTF Extensions repository
# Key functions:
- clone_omi_repository()
- validate_repository_structure()
- list_extension_directories()
- cleanup_temporary_files()
```

### `scripts/parse_gltf_extensions.py`
```python
# Purpose: Parse OMI glTF extension specifications
# Key functions:
- scan_extension_directories()
- parse_schema_files()
- parse_readme_files()
- extract_extension_metadata()
- extract_feature_lists()
- generate_extension_catalog()
```

### `scripts/generate_compatibility_matrix.py`
```python
# Purpose: Map entities to extensions and generate outputs
# Key functions:
- load_entity_catalog()
- load_extension_catalog()
- calculate_semantic_similarity()
- map_entities_to_extensions()
- determine_support_levels()
- generate_markdown_matrix()
- generate_detailed_report()
- generate_json_mapping()
```

### `docs/compatibility/straightfour-gltf-matrix.md`
```markdown
# StraightFour - glTF Extensions Compatibility Matrix

| Extension Name | StraightFour Entity | Support Level | Missing Features | Notes |
|----------------|-------------------|---------------|------------------|-------|
| OMI_audio_emitter | AudioEntity | Partial | spatial_audio, falloff_curve | Basic audio supported |
| OMI_physics_body | BaseEntity | None | rigid_body, collision_shapes | No physics implementation |
...
```

### `docs/compatibility/straightfour-gltf-report.md`
```markdown
# StraightFour glTF Extensions Compatibility Report

## Executive Summary
## StraightFour Entity Model Overview
## OMI glTF Extensions Overview
## Mapping Methodology
## Per-Extension Analysis
## Per-Entity Analysis
## Recommendations
```

### `docs/compatibility/straightfour-gltf-mapping.json`
```json
{
"metadata": {
"generated_at": "timestamp",
"straightfour_version": "detected",
"omi_extensions_commit": "hash"
},
"entities": {...},
"extensions": {...},
"mappings": {...}
}
```

## 3. Dependencies Required

### Python Dependencies (`scripts/requirements.txt`):
```
requests>=2.28.0
gitpython>=3.1.30
pyyaml>=6.0
markdown>=3.4.0
json-schema>=4.17.0
pathlib>=1.0.1
argparse>=1.4.0
logging>=0.4.9.6
```

### System Dependencies:
- Python 3.8+
- Git (for cloning OMI repository)
- Internet connection (for cloning)

## 4. Testing Approach

### Unit Tests (`tests/test_analysis.py`):
```python
def test_entity_parsing():
# Test parsing of known entity files

def test_extension_parsing():
# Test parsing of sample extension files

def test_mapping_logic():
# Test entity-to-extension mapping

def test_output_generation():
# Test markdown and JSON generation
```

### Integration Tests:
- End-to-end pipeline execution
- Output file validation
- JSON schema validation
- Markdown format validation

### Manual Validation:
- Review sample mappings for accuracy
- Verify all entities are captured
- Verify all extensions are captured
- Check output file formatting

## 5. Potential Challenges and Solutions

### Challenge 1: Entity Definition Parsing
**Problem**: StraightFour entities are defined in C# files with varying structures
**Solution**:
- Use regex patterns to extract class definitions
- Parse Unity serialized field attributes
- Handle inheritance hierarchies
- Fallback to filename-based categorization

### Challenge 2: glTF Extension Diversity
**Problem**: OMI extensions have inconsistent documentation formats
**Solution**:
- Support multiple documentation formats (README.md, schema.json)
- Handle missing or incomplete specifications
- Use flexible parsing with error recovery
- Manual overrides for special cases

### Challenge 3: Semantic Mapping Complexity
**Problem**: Determining which entities map to which extensions
**Solution**:
- Implement keyword matching algorithms
- Use field name similarity scoring
- Create manual mapping overrides file
- Implement confidence scoring system

### Challenge 4: Large Repository Sizes
**Problem**: OMI repository may be large or slow to clone
**Solution**:
- Implement shallow clone with specific depth
- Cache cloned repository locally
- Add timeout handling
- Provide progress indicators

### Challenge 5: Output Quality and Accuracy
**Problem**: Generated reports may contain inaccuracies
**Solution**:
- Implement confidence scoring for mappings
- Add manual review flags for uncertain mappings
- Include raw data in JSON for verification
- Provide clear methodology documentation

## 6. Implementation Phases

### Phase 1: Setup and Infrastructure
1. Create directory structure
2. Set up Python environment and dependencies
3. Implement basic file I/O utilities

### Phase 2: StraightFour Analysis
1. Implement entity directory scanning
2. Parse C# entity files
3. Extract metadata and properties
4. Generate entity catalog

### Phase 3: OMI Extensions Analysis
1. Clone OMI repository
2. Parse extension specifications
3. Extract features and schemas
4. Generate extension catalog

### Phase 4: Mapping and Analysis
1. Implement mapping algorithms
2. Calculate support levels
3. Identify missing features
4. Generate compatibility scores

### Phase 5: Output Generation
1. Generate markdown matrix
2. Generate detailed report
3. Generate JSON mapping
4. Validate output formats

### Phase 6: Testing and Validation
1. Run comprehensive tests
2. Manual review of outputs
3. Fix identified issues
4. Final validation

## 7. Risk Mitigation

### Risk: OMI Repository Changes
**Mitigation**: Pin to specific commit, handle repository structure changes gracefully

### Risk: Incomplete Entity Discovery
**Mitigation**: Log all discovered entities, provide manual override capability

### Risk: Poor Mapping Quality
**Mitigation**: Implement confidence scoring, flag uncertain mappings for review

### Risk: Large Output Files
**Mitigation**: Implement pagination for large matrices, compress JSON output

### Risk: Missing Documentation
**Mitigation**: Handle missing files gracefully, provide fallback descriptions

This implementation plan provides a comprehensive approach to analyzing StraightFour entities and mapping them to OMI glTF extensions while maintaining code quality and handling potential challenges systematically.
11 changes: 11 additions & 0 deletions docs/compatibility/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Temporary files during analysis
temp/
*.tmp
*.log

# Downloaded repositories (if any)
omi-gltf-extensions/

# Cache files
*.cache
__pycache__/
32 changes: 32 additions & 0 deletions docs/compatibility/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# StraightFour glTF Extension Compatibility Documentation

This directory contains comprehensive documentation about StraightFour's compatibility with OMI glTF extensions.

## Files Overview

- **`straightfour-gltf-matrix.md`** - Quick reference compatibility matrix showing support levels for all analyzed extensions
- **`straightfour-gltf-report.md`** - Detailed analysis report with implementation recommendations
- **`straightfour-gltf-mapping.json`** - Machine-readable mapping data for integration and tooling

## Quick Reference

### Current Support Summary
- **Full Support**: 8 extensions (23.5%)
- **Partial Support**: 16 extensions (47.1%)
- **No Support**: 10 extensions (29.4%)

### Strongest Areas
- UI System (Canvas, Button, Text, Input)
- Basic Rendering (Lights, Materials, Meshes)
- Audio System (3D spatial audio)

### Major Gaps
- Physics simulation and constraints
- Networking and multiplayer
- User interaction systems
- Advanced vehicle physics

## Usage

### For Developers
Use the JSON mapping file to programmatically check extension support:
Loading
Loading