yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
tool_registration.cc
Go to the documentation of this file.
2
11#ifdef YAZE_WITH_GRPC
13#endif
22
23namespace yaze {
24namespace cli {
25namespace agent {
26
27using namespace yaze::cli::handlers;
28using namespace yaze::cli::agent::tools;
29
30// Placeholder classes for meta-tools (they're handled specially in the dispatcher)
31// We need unique classes to avoid REGISTER_AGENT_TOOL macro struct name collisions
33 public:
34 std::string GetName() const override { return "tools-list"; }
35 std::string GetUsage() const override { return "tools-list"; }
36 bool RequiresRom() const override { return false; }
37 protected:
38 absl::Status ValidateArgs(const resources::ArgumentParser&) override { return absl::OkStatus(); }
40 return absl::UnimplementedError("Handled by ToolDispatcher meta-tool handler");
41 }
42};
43
45 public:
46 std::string GetName() const override { return "tools-describe"; }
47 std::string GetUsage() const override { return "tools-describe --name=<tool>"; }
48 bool RequiresRom() const override { return false; }
49 protected:
50 absl::Status ValidateArgs(const resources::ArgumentParser&) override { return absl::OkStatus(); }
52 return absl::UnimplementedError("Handled by ToolDispatcher meta-tool handler");
53 }
54};
55
57 public:
58 std::string GetName() const override { return "tools-search"; }
59 std::string GetUsage() const override { return "tools-search --query=<keyword>"; }
60 bool RequiresRom() const override { return false; }
61 protected:
62 absl::Status ValidateArgs(const resources::ArgumentParser&) override { return absl::OkStatus(); }
64 return absl::UnimplementedError("Handled by ToolDispatcher meta-tool handler");
65 }
66};
67
68// Meta-tools (handled specially but registered for discovery)
69REGISTER_AGENT_TOOL("tools-list", "meta", "List all available tools", "tools-list", {}, false, false, MetaToolsListHandler)
70REGISTER_AGENT_TOOL("tools-describe", "meta", "Get detailed information about a tool", "tools-describe --name=<tool>", {}, false, false, MetaToolsDescribeHandler)
71REGISTER_AGENT_TOOL("tools-search", "meta", "Search tools by keyword", "tools-search --query=<keyword>", {}, false, false, MetaToolsSearchHandler)
72
73// Resource commands
74REGISTER_AGENT_TOOL("resource-list", "resource", "List resource labels", "resource-list --type=<type>", {"resource-list --type=dungeon"}, true, false, ResourceListCommandHandler)
75REGISTER_AGENT_TOOL("resource-search", "resource", "Search resource labels", "resource-search --query=<query>", {"resource-search --query=castle"}, true, false, ResourceSearchCommandHandler)
76
77// Dungeon commands
78REGISTER_AGENT_TOOL("dungeon-list-sprites", "dungeon", "List sprites in a dungeon room", "dungeon-list-sprites --room=<id>", {}, true, false, DungeonListSpritesCommandHandler)
79REGISTER_AGENT_TOOL("dungeon-describe-room", "dungeon", "Describe a room", "dungeon-describe-room --room=<id>", {}, true, false, DungeonDescribeRoomCommandHandler)
80REGISTER_AGENT_TOOL("dungeon-export-room", "dungeon", "Export room data", "dungeon-export-room --room=<id>", {}, true, false, DungeonExportRoomCommandHandler)
81REGISTER_AGENT_TOOL("dungeon-list-objects", "dungeon", "List room objects", "dungeon-list-objects --room=<id>", {}, true, false, DungeonListObjectsCommandHandler)
82REGISTER_AGENT_TOOL("dungeon-get-room-tiles", "dungeon", "Get room tiles", "dungeon-get-room-tiles --room=<id>", {}, true, false, DungeonGetRoomTilesCommandHandler)
83REGISTER_AGENT_TOOL("dungeon-set-room-property", "dungeon", "Set room property", "dungeon-set-room-property --room=<id> --key=<key> --value=<val>", {}, true, false, DungeonSetRoomPropertyCommandHandler)
84
85// Overworld commands
86REGISTER_AGENT_TOOL("overworld-find-tile", "overworld", "Find tile locations", "overworld-find-tile --tile=<id>", {}, true, false, OverworldFindTileCommandHandler)
87REGISTER_AGENT_TOOL("overworld-describe-map", "overworld", "Describe a map", "overworld-describe-map --map=<id>", {}, true, false, OverworldDescribeMapCommandHandler)
88REGISTER_AGENT_TOOL("overworld-list-warps", "overworld", "List warps", "overworld-list-warps --map=<id>", {}, true, false, OverworldListWarpsCommandHandler)
89REGISTER_AGENT_TOOL("overworld-list-sprites", "overworld", "List sprites", "overworld-list-sprites --map=<id>", {}, true, false, OverworldListSpritesCommandHandler)
90REGISTER_AGENT_TOOL("overworld-get-entrance", "overworld", "Get entrance info", "overworld-get-entrance --id=<id>", {}, true, false, OverworldGetEntranceCommandHandler)
91REGISTER_AGENT_TOOL("overworld-tile-stats", "overworld", "Get tile statistics", "overworld-tile-stats", {}, true, false, OverworldTileStatsCommandHandler)
92
93// Message & Dialogue commands
94REGISTER_AGENT_TOOL("message-list", "message", "List messages", "message-list", {}, true, false, MessageListCommandHandler)
95REGISTER_AGENT_TOOL("message-read", "message", "Read message", "message-read --id=<id>", {}, true, false, MessageReadCommandHandler)
96REGISTER_AGENT_TOOL("message-search", "message", "Search messages", "message-search --query=<text>", {}, true, false, MessageSearchCommandHandler)
97REGISTER_AGENT_TOOL("dialogue-list", "dialogue", "List dialogues", "dialogue-list", {}, true, false, DialogueListCommandHandler)
98REGISTER_AGENT_TOOL("dialogue-read", "dialogue", "Read dialogue", "dialogue-read --id=<id>", {}, true, false, DialogueReadCommandHandler)
99REGISTER_AGENT_TOOL("dialogue-search", "dialogue", "Search dialogues", "dialogue-search --query=<text>", {}, true, false, DialogueSearchCommandHandler)
100
101// GUI Automation commands
102REGISTER_AGENT_TOOL("gui-place-tile", "gui", "Place a tile on canvas", "gui-place-tile --x=<x> --y=<y> --tile=<id>", {}, false, false, GuiPlaceTileCommandHandler)
103REGISTER_AGENT_TOOL("gui-click", "gui", "Click GUI element", "gui-click --element=<id>", {}, false, false, GuiClickCommandHandler)
104REGISTER_AGENT_TOOL("gui-discover-tool", "gui", "Discover GUI tools", "gui-discover-tool", {}, false, false, GuiDiscoverToolCommandHandler)
105REGISTER_AGENT_TOOL("gui-screenshot", "gui", "Take screenshot", "gui-screenshot", {}, false, false, GuiScreenshotCommandHandler)
106
107// Music commands
108REGISTER_AGENT_TOOL("music-list", "music", "List music tracks", "music-list", {}, true, false, MusicListCommandHandler)
109REGISTER_AGENT_TOOL("music-info", "music", "Get music info", "music-info --id=<id>", {}, true, false, MusicInfoCommandHandler)
110REGISTER_AGENT_TOOL("music-tracks", "music", "List tracks", "music-tracks", {}, true, false, MusicTracksCommandHandler)
111
112// Sprite commands
113REGISTER_AGENT_TOOL("sprite-list", "sprite", "List sprites", "sprite-list", {}, true, false, SpriteListCommandHandler)
114REGISTER_AGENT_TOOL("sprite-properties", "sprite", "Get sprite properties", "sprite-properties --id=<id>", {}, true, false, SpritePropertiesCommandHandler)
115REGISTER_AGENT_TOOL("sprite-palette", "sprite", "Get sprite palette", "sprite-palette --id=<id>", {}, true, false, SpritePaletteCommandHandler)
116
117// Filesystem commands
118REGISTER_AGENT_TOOL("filesystem-list", "filesystem", "List directory contents", "filesystem-list --path=<path>", {}, false, false, FileSystemListTool)
119REGISTER_AGENT_TOOL("filesystem-read", "filesystem", "Read file contents", "filesystem-read --path=<path>", {}, false, false, FileSystemReadTool)
120REGISTER_AGENT_TOOL("filesystem-exists", "filesystem", "Check file existence", "filesystem-exists --path=<path>", {}, false, false, FileSystemExistsTool)
121REGISTER_AGENT_TOOL("filesystem-info", "filesystem", "Get file info", "filesystem-info --path=<path>", {}, false, false, FileSystemInfoTool)
122
123// Memory inspector commands
124REGISTER_AGENT_TOOL("memory-analyze", "memory", "Analyze memory region", "memory-analyze --address=<addr> --length=<len>", {}, true, false, MemoryAnalyzeTool)
125REGISTER_AGENT_TOOL("memory-search", "memory", "Search for byte pattern", "memory-search --pattern=<hex>", {}, true, false, MemorySearchTool)
126REGISTER_AGENT_TOOL("memory-compare", "memory", "Compare memory regions", "memory-compare", {}, true, false, MemoryCompareTool)
127REGISTER_AGENT_TOOL("memory-check", "memory", "Check memory", "memory-check", {}, true, false, MemoryCheckTool)
128REGISTER_AGENT_TOOL("memory-regions", "memory", "List known memory regions", "memory-regions", {}, false, false, MemoryRegionsTool)
129
130// Test helper tools
131REGISTER_AGENT_TOOL("tools-helper-list", "tools", "List test helper tools", "tools-helper-list", {}, false, false, ToolsListCommandHandler)
132REGISTER_AGENT_TOOL("tools-harness-state", "tools", "Generate WRAM state", "tools-harness-state", {}, false, false, ToolsHarnessStateCommandHandler)
133REGISTER_AGENT_TOOL("tools-extract-values", "tools", "Extract vanilla ROM values", "tools-extract-values", {}, true, false, ToolsExtractValuesCommandHandler)
134REGISTER_AGENT_TOOL("tools-extract-golden", "tools", "Extract golden data", "tools-extract-golden", {}, true, false, ToolsExtractGoldenCommandHandler)
135REGISTER_AGENT_TOOL("tools-patch-v3", "tools", "Create v3 patched ROM", "tools-patch-v3", {}, true, false, ToolsPatchV3CommandHandler)
136
137// Visual analysis tools
138REGISTER_AGENT_TOOL("visual-find-similar-tiles", "visual", "Find tiles with similar patterns", "visual-find-similar-tiles", {}, true, false, TileSimilarityTool)
139REGISTER_AGENT_TOOL("visual-analyze-spritesheet", "visual", "Identify unused regions", "visual-analyze-spritesheet", {}, true, false, SpritesheetAnalysisTool)
140REGISTER_AGENT_TOOL("visual-palette-usage", "visual", "Analyze palette usage", "visual-palette-usage", {}, true, false, PaletteUsageTool)
141REGISTER_AGENT_TOOL("visual-tile-histogram", "visual", "Generate tile usage histogram", "visual-tile-histogram", {}, true, false, TileHistogramTool)
142
143// Code generation tools
144REGISTER_AGENT_TOOL("codegen-asm-hook", "codegen", "Generate ASM hook", "codegen-asm-hook", {}, true, false, CodeGenAsmHookTool)
145REGISTER_AGENT_TOOL("codegen-freespace-patch", "codegen", "Generate patch", "codegen-freespace-patch", {}, true, false, CodeGenFreespacePatchTool)
146REGISTER_AGENT_TOOL("codegen-sprite-template", "codegen", "Generate sprite ASM", "codegen-sprite-template", {}, false, false, CodeGenSpriteTemplateTool)
147REGISTER_AGENT_TOOL("codegen-event-handler", "codegen", "Generate event handler", "codegen-event-handler", {}, false, false, CodeGenEventHandlerTool)
148
149// Project management tools
150REGISTER_AGENT_TOOL("project-status", "project", "Show current project state", "project-status", {}, true, true, ProjectStatusTool)
151REGISTER_AGENT_TOOL("project-snapshot", "project", "Create named checkpoint", "project-snapshot", {}, true, true, ProjectSnapshotTool)
152REGISTER_AGENT_TOOL("project-restore", "project", "Restore ROM to checkpoint", "project-restore", {}, true, true, ProjectRestoreTool)
153REGISTER_AGENT_TOOL("project-export", "project", "Export project", "project-export", {}, true, true, ProjectExportTool)
154REGISTER_AGENT_TOOL("project-import", "project", "Import project", "project-import", {}, false, true, ProjectImportTool)
155REGISTER_AGENT_TOOL("project-diff", "project", "Compare project states", "project-diff", {}, true, true, ProjectDiffTool)
156REGISTER_AGENT_TOOL("project-graph", "project", "Query project graph info (files, symbols, config)", "project-graph --query=<info|files|symbols> [--path=<folder>]", {}, true, true, ProjectGraphTool)
157
158#ifdef YAZE_WITH_GRPC
159REGISTER_AGENT_TOOL("emulator-step", "emulator", "Step emulator", "emulator-step", {}, true, false, EmulatorStepCommandHandler)
160REGISTER_AGENT_TOOL("emulator-run", "emulator", "Run emulator", "emulator-run", {}, true, false, EmulatorRunCommandHandler)
161REGISTER_AGENT_TOOL("emulator-pause", "emulator", "Pause emulator", "emulator-pause", {}, true, false, EmulatorPauseCommandHandler)
162REGISTER_AGENT_TOOL("emulator-reset", "emulator", "Reset emulator", "emulator-reset", {}, true, false, EmulatorResetCommandHandler)
163REGISTER_AGENT_TOOL("emulator-get-state", "emulator", "Get emulator state", "emulator-get-state", {}, true, false, EmulatorGetStateCommandHandler)
164REGISTER_AGENT_TOOL("emulator-set-breakpoint", "emulator", "Set breakpoint", "emulator-set-breakpoint", {}, true, false, EmulatorSetBreakpointCommandHandler)
165REGISTER_AGENT_TOOL("emulator-clear-breakpoint", "emulator", "Clear breakpoint", "emulator-clear-breakpoint", {}, true, false, EmulatorClearBreakpointCommandHandler)
166REGISTER_AGENT_TOOL("emulator-list-breakpoints", "emulator", "List breakpoints", "emulator-list-breakpoints", {}, true, false, EmulatorListBreakpointsCommandHandler)
167REGISTER_AGENT_TOOL("emulator-read-memory", "emulator", "Read memory", "emulator-read-memory", {}, true, false, EmulatorReadMemoryCommandHandler)
168REGISTER_AGENT_TOOL("emulator-write-memory", "emulator", "Write memory", "emulator-write-memory", {}, true, false, EmulatorWriteMemoryCommandHandler)
169REGISTER_AGENT_TOOL("emulator-get-registers", "emulator", "Get registers", "emulator-get-registers", {}, true, false, EmulatorGetRegistersCommandHandler)
170REGISTER_AGENT_TOOL("emulator-get-metrics", "emulator", "Get metrics", "emulator-get-metrics", {}, true, false, EmulatorGetMetricsCommandHandler)
171#endif
172
173} // namespace agent
174} // namespace cli
175} // namespace yaze
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:24
std::string GetUsage() const override
Get the command usage string.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
std::string GetName() const override
Get the command name.
absl::Status ValidateArgs(const resources::ArgumentParser &) override
Validate command arguments.
absl::Status Execute(Rom *, const resources::ArgumentParser &, resources::OutputFormatter &) override
Execute the command business logic.
std::string GetName() const override
Get the command name.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
absl::Status Execute(Rom *, const resources::ArgumentParser &, resources::OutputFormatter &) override
Execute the command business logic.
std::string GetUsage() const override
Get the command usage string.
absl::Status ValidateArgs(const resources::ArgumentParser &) override
Validate command arguments.
std::string GetUsage() const override
Get the command usage string.
absl::Status Execute(Rom *, const resources::ArgumentParser &, resources::OutputFormatter &) override
Execute the command business logic.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
std::string GetName() const override
Get the command name.
absl::Status ValidateArgs(const resources::ArgumentParser &) override
Validate command arguments.
Generate ASM hook at a specific ROM address.
Generate patch using detected freespace regions.
Check if a file or directory exists.
Get detailed information about a file or directory.
List files and directories in a given path.
Analyze a memory region with structure awareness.
Check memory for anomalies and corruption.
Compare memory regions or detect changes.
List known memory regions and their descriptions.
Search for byte patterns in memory.
Analyze palette usage across maps.
Export project as portable archive.
Provides the AI agent with structured information about the project.
Restore ROM to named checkpoint.
Create named checkpoint with edit deltas.
Show current project state and pending edits.
Analyze spritesheets for unused graphics regions.
Command handler for listing dialogue messages.
Command handler for reading dialogue messages.
Command handler for searching dialogue messages.
Command handler for describing a dungeon room.
Command handler for exporting room data.
Command handler for getting room tiles.
Command handler for listing objects in a room.
Command handler for listing sprites in a dungeon room.
Command handler for setting room properties.
Command handler for clicking GUI elements.
Command handler for discovering GUI tools.
Command handler for placing tiles via GUI automation.
Command handler for taking screenshots.
Command handler for listing messages.
Command handler for reading messages.
Command handler for searching messages.
Command handler for getting music track information.
Command handler for listing music tracks.
Command handler for getting detailed music track data.
Command handler for describing overworld maps.
Command handler for finding tiles in overworld.
Command handler for getting entrance information.
Command handler for listing sprites in overworld.
Command handler for listing warps in overworld.
Command handler for getting tile statistics.
Command handler for listing resource labels by type.
Command handler for searching resource labels.
Command handler for listing sprites.
Command handler for getting sprite palette information.
Command handler for getting sprite properties.
Extract comprehensive golden data from ROM.
Create v3 ZSCustomOverworld patched ROM.
Utility for parsing common CLI argument patterns.
Base class for CLI command handlers.
Utility for consistent output formatting across commands.
Code generation tools for AI agents.
Project management tools for AI agents.
CLI command handlers for test helper tools.
#define REGISTER_AGENT_TOOL(Name, Category, Desc, Usage, Examples, ReqRom, ReqProject, HandlerClass)
Visual analysis tools for AI agents.