Builds contextual information from ROM resources for AI prompts. More...
#include <resource_context_builder.h>
Public Member Functions | |
ResourceContextBuilder (Rom *rom) | |
absl::StatusOr< std::string > | BuildResourceContext () |
Build a complete resource context string for AI prompts. | |
absl::StatusOr< std::map< std::string, std::string > > | GetLabels (const std::string &category) |
Get labels for a specific resource category. | |
absl::StatusOr< std::string > | ExportToJson () |
Export all labels to JSON format. | |
Private Member Functions | |
std::string | ExtractOverworldLabels () |
Extract overworld map labels. | |
std::string | ExtractDungeonLabels () |
Extract dungeon labels. | |
std::string | ExtractEntranceLabels () |
Extract entrance labels. | |
std::string | ExtractRoomLabels () |
Extract room labels. | |
std::string | ExtractSpriteLabels () |
Extract sprite labels. | |
std::string | GetCommonTile16Reference () |
Add common tile16 reference for AI. | |
Private Attributes | |
Rom * | rom_ |
Builds contextual information from ROM resources for AI prompts.
This class extracts user-defined labels from the ROM's ResourceLabelManager and formats them into human-readable context that can be injected into AI prompts. This enables AI to use meaningful names like "eastern_palace" instead of opaque IDs like "0x02".
Example usage: ResourceContextBuilder builder(rom); std::string context = builder.BuildResourceContext().value(); // Context contains formatted labels for all resource types
Definition at line 26 of file resource_context_builder.h.
|
inlineexplicit |
Definition at line 28 of file resource_context_builder.h.
absl::StatusOr< std::string > yaze::cli::ResourceContextBuilder::BuildResourceContext | ( | ) |
Build a complete resource context string for AI prompts.
Extracts all ResourceLabels from the ROM and formats them into a structured text format suitable for AI consumption.
Example output:
Definition at line 165 of file resource_context_builder.cc.
References ExtractDungeonLabels(), ExtractEntranceLabels(), ExtractOverworldLabels(), ExtractRoomLabels(), ExtractSpriteLabels(), GetCommonTile16Reference(), and rom_.
absl::StatusOr< std::map< std::string, std::string > > yaze::cli::ResourceContextBuilder::GetLabels | ( | const std::string & | category | ) |
Get labels for a specific resource category.
category | Resource type ("overworld", "dungeon", "entrance", etc.) |
Definition at line 202 of file resource_context_builder.cc.
References yaze::Rom::is_loaded(), yaze::Rom::resource_label(), and rom_.
Referenced by yaze::cli::handlers::ResourceListCommandHandler::Execute(), and yaze::cli::handlers::ResourceSearchCommandHandler::Execute().
absl::StatusOr< std::string > yaze::cli::ResourceContextBuilder::ExportToJson | ( | ) |
Export all labels to JSON format.
Creates a structured JSON representation of all resources for potential use by AI services.
Definition at line 228 of file resource_context_builder.cc.
References yaze::Rom::is_loaded(), yaze::Rom::resource_label(), and rom_.
|
private |
Extract overworld map labels.
Returns formatted string like:
Definition at line 24 of file resource_context_builder.cc.
References yaze::Rom::is_loaded(), yaze::core::ResourceLabelManager::labels_, yaze::Rom::resource_label(), and rom_.
Referenced by BuildResourceContext().
|
private |
Extract dungeon labels.
Returns formatted string like:
Definition at line 53 of file resource_context_builder.cc.
References yaze::Rom::is_loaded(), yaze::core::ResourceLabelManager::labels_, yaze::Rom::resource_label(), and rom_.
Referenced by BuildResourceContext().
|
private |
Extract entrance labels.
Returns formatted string like:
Definition at line 83 of file resource_context_builder.cc.
References yaze::Rom::is_loaded(), yaze::core::ResourceLabelManager::labels_, yaze::Rom::resource_label(), and rom_.
Referenced by BuildResourceContext().
|
private |
Extract room labels.
Returns formatted string like:
Definition at line 111 of file resource_context_builder.cc.
References yaze::Rom::is_loaded(), yaze::core::ResourceLabelManager::labels_, yaze::Rom::resource_label(), and rom_.
Referenced by BuildResourceContext().
|
private |
Extract sprite labels.
Returns formatted string like:
Definition at line 137 of file resource_context_builder.cc.
References yaze::Rom::is_loaded(), yaze::core::ResourceLabelManager::labels_, yaze::Rom::resource_label(), and rom_.
Referenced by BuildResourceContext().
|
private |
Add common tile16 reference for AI.
Provides a quick reference of common tile16 IDs that AI can use without needing to search through the entire tileset.
Returns formatted string like:
Definition at line 8 of file resource_context_builder.cc.
Referenced by BuildResourceContext().
|
private |
Definition at line 78 of file resource_context_builder.h.
Referenced by BuildResourceContext(), ExportToJson(), ExtractDungeonLabels(), ExtractEntranceLabels(), ExtractOverworldLabels(), ExtractRoomLabels(), ExtractSpriteLabels(), and GetLabels().