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
13#ifdef YAZE_WITH_GRPC
15#endif
24
25namespace yaze {
26namespace cli {
27namespace agent {
28
29using namespace yaze::cli::handlers;
30using namespace yaze::cli::agent::tools;
31
32// Placeholder classes for meta-tools (they're handled specially in the dispatcher)
33// We need unique classes to avoid REGISTER_AGENT_TOOL macro struct name collisions
35 public:
36 std::string GetName() const override { return "tools-list"; }
37 std::string GetUsage() const override { return "tools-list"; }
38 bool RequiresRom() const override { return false; }
39
40 protected:
41 absl::Status ValidateArgs(const resources::ArgumentParser&) override {
42 return absl::OkStatus();
43 }
44 absl::Status Execute(Rom*, const resources::ArgumentParser&,
46 return absl::UnimplementedError(
47 "Handled by ToolDispatcher meta-tool handler");
48 }
49};
50
52 public:
53 std::string GetName() const override { return "tools-describe"; }
54 std::string GetUsage() const override {
55 return "tools-describe --name=<tool>";
56 }
57 bool RequiresRom() const override { return false; }
58
59 protected:
60 absl::Status ValidateArgs(const resources::ArgumentParser&) override {
61 return absl::OkStatus();
62 }
63 absl::Status Execute(Rom*, const resources::ArgumentParser&,
65 return absl::UnimplementedError(
66 "Handled by ToolDispatcher meta-tool handler");
67 }
68};
69
71 public:
72 std::string GetName() const override { return "tools-search"; }
73 std::string GetUsage() const override {
74 return "tools-search --query=<keyword>";
75 }
76 bool RequiresRom() const override { return false; }
77
78 protected:
79 absl::Status ValidateArgs(const resources::ArgumentParser&) override {
80 return absl::OkStatus();
81 }
82 absl::Status Execute(Rom*, const resources::ArgumentParser&,
84 return absl::UnimplementedError(
85 "Handled by ToolDispatcher meta-tool handler");
86 }
87};
88
89// Meta-tools (handled specially but registered for discovery)
90REGISTER_AGENT_TOOL("tools-list", "meta", "List all available tools",
91 "tools-list", {}, false, false, MetaToolsListHandler)
92REGISTER_AGENT_TOOL("tools-describe", "meta",
93 "Get detailed information about a tool",
94 "tools-describe --name=<tool>", {}, false, false,
96REGISTER_AGENT_TOOL("tools-search", "meta", "Search tools by keyword",
97 "tools-search --query=<keyword>", {}, false, false,
99
100// Resource commands
101REGISTER_AGENT_TOOL("resource-list", "resource", "List resource labels",
102 "resource-list --type=<type>",
103 {"resource-list --type=dungeon"}, true, false,
105REGISTER_AGENT_TOOL("resource-search", "resource", "Search resource labels",
106 "resource-search --query=<query>",
107 {"resource-search --query=castle"}, true, false,
109
110// Dungeon commands
111REGISTER_AGENT_TOOL("dungeon-list-sprites", "dungeon",
112 "List sprites in a dungeon room",
113 "dungeon-list-sprites --room=<id>", {}, true, false,
115REGISTER_AGENT_TOOL("dungeon-describe-room", "dungeon", "Describe a room",
116 "dungeon-describe-room --room=<id>", {}, true, false,
118REGISTER_AGENT_TOOL("dungeon-export-room", "dungeon", "Export room data",
119 "dungeon-export-room --room=<id>", {}, true, false,
121REGISTER_AGENT_TOOL("dungeon-list-objects", "dungeon", "List room objects",
122 "dungeon-list-objects --room=<id>", {}, true, false,
124REGISTER_AGENT_TOOL("dungeon-list-custom-collision", "dungeon",
125 "List custom collision tiles for a room",
126 "dungeon-list-custom-collision --room=<id>", {}, true,
128REGISTER_AGENT_TOOL("dungeon-export-custom-collision-json", "dungeon",
129 "Export custom collision maps to JSON",
130 "dungeon-export-custom-collision-json --out=<path> "
131 "[--room=<id>|--rooms=<ids>|--all] [--report=<path>]",
132 {}, true, true,
134REGISTER_AGENT_TOOL("dungeon-import-custom-collision-json", "dungeon",
135 "Import custom collision maps from JSON",
136 "dungeon-import-custom-collision-json --in=<path> "
137 "[--dry-run] [--replace-all --force] [--report=<path>]",
138 {}, true, true,
140REGISTER_AGENT_TOOL("dungeon-export-water-fill-json", "dungeon",
141 "Export water fill zones to JSON",
142 "dungeon-export-water-fill-json --out=<path> "
143 "[--room=<id>|--rooms=<ids>|--all] [--report=<path>]",
145REGISTER_AGENT_TOOL("dungeon-import-water-fill-json", "dungeon",
146 "Import water fill zones from JSON",
147 "dungeon-import-water-fill-json --in=<path> [--dry-run] "
148 "[--strict-masks] [--report=<path>]",
151 "dungeon-minecart-audit", "dungeon",
152 "Audit minecart-related room data (objects/sprites/collision)",
153 "dungeon-minecart-audit --room=<id>", {}, true, false,
155REGISTER_AGENT_TOOL("dungeon-minecart-map", "dungeon",
156 "Enumerate track tile positions/types with ASCII grid for "
157 "spatial reasoning",
158 "dungeon-minecart-map --room=<id>", {}, true, false,
160REGISTER_AGENT_TOOL("dungeon-get-room-tiles", "dungeon", "Get room tiles",
161 "dungeon-get-room-tiles --room=<id>", {}, true, false,
164 "dungeon-set-room-property", "dungeon", "Set room property",
165 "dungeon-set-room-property --room=<id> --key=<key> --value=<val>", {}, true,
167REGISTER_AGENT_TOOL("dungeon-room-header", "dungeon", "Debug room header bytes",
168 "dungeon-room-header --room=<id>", {}, true, false,
170
171// Overworld commands
172REGISTER_AGENT_TOOL("overworld-find-tile", "overworld", "Find tile locations",
173 "overworld-find-tile --tile=<id>", {}, true, false,
175REGISTER_AGENT_TOOL("overworld-describe-map", "overworld", "Describe a map",
176 "overworld-describe-map --map=<id>", {}, true, false,
178REGISTER_AGENT_TOOL("overworld-list-warps", "overworld", "List warps",
179 "overworld-list-warps --map=<id>", {}, true, false,
181REGISTER_AGENT_TOOL("overworld-list-sprites", "overworld", "List sprites",
182 "overworld-list-sprites --map=<id>", {}, true, false,
184REGISTER_AGENT_TOOL("overworld-get-entrance", "overworld", "Get entrance info",
185 "overworld-get-entrance --id=<id>", {}, true, false,
187REGISTER_AGENT_TOOL("overworld-tile-stats", "overworld", "Get tile statistics",
188 "overworld-tile-stats", {}, true, false,
190
191// Message & Dialogue commands
192REGISTER_AGENT_TOOL("message-list", "message", "List messages", "message-list",
193 {}, true, false, MessageListCommandHandler)
194REGISTER_AGENT_TOOL("message-read", "message", "Read message",
195 "message-read --id=<id>", {}, true, false,
197REGISTER_AGENT_TOOL("message-search", "message", "Search messages",
198 "message-search --query=<text>", {}, true, false,
200REGISTER_AGENT_TOOL("dialogue-list", "dialogue", "List dialogues",
201 "dialogue-list", {}, true, false,
203REGISTER_AGENT_TOOL("dialogue-read", "dialogue", "Read dialogue",
204 "dialogue-read --id=<id>", {}, true, false,
206REGISTER_AGENT_TOOL("dialogue-search", "dialogue", "Search dialogues",
207 "dialogue-search --query=<text>", {}, true, false,
209
210// GUI Automation commands
211REGISTER_AGENT_TOOL("gui-place-tile", "gui", "Place a tile on canvas",
212 "gui-place-tile --x=<x> --y=<y> --tile=<id>", {}, false,
214REGISTER_AGENT_TOOL("gui-click", "gui", "Click GUI element",
215 "gui-click --target=<type:label> [--widget-key=<key>] "
216 "[--click-type=<left|right|middle|double>]",
217 {}, false, false, GuiClickCommandHandler)
218REGISTER_AGENT_TOOL("gui-type", "gui", "Type text into a GUI element",
219 "gui-type --target=<type:label> --text=<text> "
220 "[--widget-key=<key>] [--clear-first]",
221 {}, false, false, GuiTypeCommandHandler)
223 "gui-wait", "gui", "Wait for GUI condition/widget",
224 "gui-wait --condition=<condition> [--widget-key=<key>] [--timeout-ms=<ms>]",
225 {}, false, false, GuiWaitCommandHandler)
226REGISTER_AGENT_TOOL("gui-assert", "gui", "Assert GUI condition/widget",
227 "gui-assert --condition=<condition> [--widget-key=<key>]",
228 {}, false, false, GuiAssertCommandHandler)
229REGISTER_AGENT_TOOL("gui-discover-tool", "gui", "Discover GUI tools",
230 "gui-discover-tool", {}, false, false,
232REGISTER_AGENT_TOOL("gui-screenshot", "gui", "Take screenshot",
233 "gui-screenshot", {}, false, false,
235REGISTER_AGENT_TOOL("gui-summarize-widgets", "gui",
236 "Get a high-level summary of visible GUI widgets",
237 "gui-summarize-widgets", {}, false, false,
239
240// Music commands
241REGISTER_AGENT_TOOL("music-list", "music", "List music tracks", "music-list",
242 {}, true, false, MusicListCommandHandler)
243REGISTER_AGENT_TOOL("music-info", "music", "Get music info",
244 "music-info --id=<id>", {}, true, false,
246REGISTER_AGENT_TOOL("music-tracks", "music", "List tracks", "music-tracks", {},
247 true, false, MusicTracksCommandHandler)
248
249// Sprite commands
250REGISTER_AGENT_TOOL("sprite-list", "sprite", "List sprites", "sprite-list", {},
251 true, false, SpriteListCommandHandler)
252REGISTER_AGENT_TOOL("sprite-properties", "sprite", "Get sprite properties",
253 "sprite-properties --id=<id>", {}, true, false,
255REGISTER_AGENT_TOOL("sprite-palette", "sprite", "Get sprite palette",
256 "sprite-palette --id=<id>", {}, true, false,
258
259// Filesystem commands
260REGISTER_AGENT_TOOL("filesystem-list", "filesystem", "List directory contents",
261 "filesystem-list --path=<path>", {}, false, false,
263REGISTER_AGENT_TOOL("filesystem-read", "filesystem", "Read file contents",
264 "filesystem-read --path=<path>", {}, false, false,
266REGISTER_AGENT_TOOL("filesystem-exists", "filesystem", "Check file existence",
267 "filesystem-exists --path=<path>", {}, false, false,
269REGISTER_AGENT_TOOL("filesystem-info", "filesystem", "Get file info",
270 "filesystem-info --path=<path>", {}, false, false,
272
273// Memory inspector commands
274REGISTER_AGENT_TOOL("memory-analyze", "memory", "Analyze memory region",
275 "memory-analyze --address=<addr> --length=<len>", {}, true,
276 false, MemoryAnalyzeTool)
277REGISTER_AGENT_TOOL("memory-search", "memory", "Search for byte pattern",
278 "memory-search --pattern=<hex>", {}, true, false,
280REGISTER_AGENT_TOOL("memory-compare", "memory", "Compare memory regions",
281 "memory-compare", {}, true, false, MemoryCompareTool)
282REGISTER_AGENT_TOOL("memory-check", "memory", "Check memory", "memory-check",
283 {}, true, false, MemoryCheckTool)
284REGISTER_AGENT_TOOL("memory-regions", "memory", "List known memory regions",
285 "memory-regions", {}, false, false, MemoryRegionsTool)
286
287// Test helper tools
288REGISTER_AGENT_TOOL("tools-helper-list", "tools", "List test helper tools",
289 "tools-helper-list", {}, false, false,
291REGISTER_AGENT_TOOL("tools-harness-state", "tools", "Generate WRAM state",
292 "tools-harness-state", {}, false, false,
294REGISTER_AGENT_TOOL("tools-extract-values", "tools",
295 "Extract vanilla ROM values", "tools-extract-values", {},
297REGISTER_AGENT_TOOL("tools-extract-golden", "tools", "Extract golden data",
298 "tools-extract-golden", {}, true, false,
300REGISTER_AGENT_TOOL("tools-patch-v3", "tools", "Create v3 patched ROM",
301 "tools-patch-v3", {}, true, false,
303
304// Visual analysis tools
305REGISTER_AGENT_TOOL("visual-find-similar-tiles", "visual",
306 "Find tiles with similar patterns",
307 "visual-find-similar-tiles", {}, true, false,
309REGISTER_AGENT_TOOL("visual-analyze-spritesheet", "visual",
310 "Identify unused regions", "visual-analyze-spritesheet", {},
311 true, false, SpritesheetAnalysisTool)
312REGISTER_AGENT_TOOL("visual-palette-usage", "visual", "Analyze palette usage",
313 "visual-palette-usage", {}, true, false, PaletteUsageTool)
314REGISTER_AGENT_TOOL("visual-tile-histogram", "visual",
315 "Generate tile usage histogram", "visual-tile-histogram",
316 {}, true, false, TileHistogramTool)
317
318// Code generation tools
319REGISTER_AGENT_TOOL("codegen-asm-hook", "codegen", "Generate ASM hook",
320 "codegen-asm-hook", {}, true, false, CodeGenAsmHookTool)
321REGISTER_AGENT_TOOL("codegen-freespace-patch", "codegen", "Generate patch",
322 "codegen-freespace-patch", {}, true, false,
324REGISTER_AGENT_TOOL("codegen-sprite-template", "codegen", "Generate sprite ASM",
325 "codegen-sprite-template", {}, false, false,
327REGISTER_AGENT_TOOL("codegen-event-handler", "codegen",
328 "Generate event handler", "codegen-event-handler", {},
329 false, false, CodeGenEventHandlerTool)
330
331// Project management tools
332REGISTER_AGENT_TOOL("project-status", "project", "Show current project state",
333 "project-status", {}, true, true, ProjectStatusTool)
334REGISTER_AGENT_TOOL("project-snapshot", "project", "Create named checkpoint",
335 "project-snapshot", {}, true, true, ProjectSnapshotTool)
336REGISTER_AGENT_TOOL("project-restore", "project", "Restore ROM to checkpoint",
337 "project-restore", {}, true, true, ProjectRestoreTool)
338REGISTER_AGENT_TOOL("project-export", "project", "Export project",
339 "project-export", {}, true, true, ProjectExportTool)
340REGISTER_AGENT_TOOL("project-import", "project", "Import project",
341 "project-import", {}, false, true, ProjectImportTool)
342REGISTER_AGENT_TOOL("project-diff", "project", "Compare project states",
343 "project-diff", {}, true, true, ProjectDiffTool)
345 "project-graph", "project",
346 "Query project graph info (files, symbols, config)",
347 "project-graph --query=<info|files|symbols> [--path=<folder>]", {}, true,
348 true, ProjectGraphTool)
349
350#ifdef YAZE_WITH_GRPC
351REGISTER_AGENT_TOOL("emulator-step", "emulator", "Step emulator",
352 "emulator-step", {}, true, false,
354REGISTER_AGENT_TOOL("emulator-run", "emulator", "Run emulator", "emulator-run",
355 {}, true, false, EmulatorRunCommandHandler)
356REGISTER_AGENT_TOOL("emulator-pause", "emulator", "Pause emulator",
357 "emulator-pause", {}, true, false,
359REGISTER_AGENT_TOOL("emulator-reset", "emulator", "Reset emulator",
360 "emulator-reset", {}, true, false,
362REGISTER_AGENT_TOOL("emulator-get-state", "emulator", "Get emulator state",
363 "emulator-get-state", {}, true, false,
365REGISTER_AGENT_TOOL("emulator-set-breakpoint", "emulator", "Set breakpoint",
366 "emulator-set-breakpoint", {}, true, false,
368REGISTER_AGENT_TOOL("emulator-clear-breakpoint", "emulator", "Clear breakpoint",
369 "emulator-clear-breakpoint", {}, true, false,
371REGISTER_AGENT_TOOL("emulator-list-breakpoints", "emulator", "List breakpoints",
372 "emulator-list-breakpoints", {}, true, false,
374REGISTER_AGENT_TOOL("emulator-read-memory", "emulator", "Read memory",
375 "emulator-read-memory", {}, true, false,
377REGISTER_AGENT_TOOL("emulator-write-memory", "emulator", "Write memory",
378 "emulator-write-memory", {}, true, false,
380REGISTER_AGENT_TOOL("emulator-get-registers", "emulator", "Get registers",
381 "emulator-get-registers", {}, true, false,
383REGISTER_AGENT_TOOL("emulator-get-metrics", "emulator", "Get metrics",
384 "emulator-get-metrics", {}, true, false,
386#endif
387
388} // namespace agent
389} // namespace cli
390} // 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:28
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 listing objects in a room.
Command handler for listing sprites in a dungeon room.
Command handler for reading raw room header bytes (diagnostic)
Command handler for setting room properties.
Command handler for GUI assertions.
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 summarizing GUI widgets.
Command handler for typing into GUI inputs.
Command handler for waiting on GUI conditions.
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.