diff --git a/src/agent/Agent.zig b/src/agent/Agent.zig index 52d081b9..ab7b3fdf 100644 --- a/src/agent/Agent.zig +++ b/src/agent/Agent.zig @@ -319,7 +319,7 @@ fn runRepl(self: *Self) void { // PandaScript command. if (std.meta.activeTag(cmd) == .natural_language) { if (Command.keywordSyntax(line)) |kc| { - self.terminal.printErrorFmt("Usage: {s} {s}", .{ kc.name, kc.args }); + self.terminal.printErrorFmt("Usage: {s} {s}", .{ kc.name, kc.args.? }); continue; } } diff --git a/src/agent/Command.zig b/src/agent/Command.zig index 6ca26895..5b7a7ac4 100644 --- a/src/agent/Command.zig +++ b/src/agent/Command.zig @@ -219,34 +219,42 @@ pub fn parse(line: []const u8) Command { pub const KeywordSyntax = struct { name: []const u8, - args: []const u8, + /// Null for argless commands (TREE, MARKDOWN, LOGIN, ACCEPT_COOKIES). + args: ?[]const u8, +}; + +/// Single source of truth for PandaScript keyword names — consumed by the +/// parser, the REPL highlighter, and Tab completion. Order is REPL-facing +/// (action verbs first), so completions feel natural. +pub const keywords = [_]KeywordSyntax{ + .{ .name = "GOTO", .args = "" }, + .{ .name = "CLICK", .args = "''" }, + .{ .name = "TYPE", .args = "'' ''" }, + .{ .name = "WAIT", .args = "''" }, + .{ .name = "SCROLL", .args = "[x] [y]" }, + .{ .name = "HOVER", .args = "''" }, + .{ .name = "SELECT", .args = "'' ''" }, + .{ .name = "CHECK", .args = "'' [true|false]" }, + .{ .name = "TREE", .args = null }, + .{ .name = "MARKDOWN", .args = null }, + .{ .name = "EXTRACT", .args = "''" }, + .{ .name = "EVAL", .args = "'