Coding
PromptBeginner5 minmarkdown
Nano Banana Pro
Agent skill for nano-banana-pro
6
Create a performant command system for the database-palace application using Rust for core logic and TypeScript for UI/interactivity. This system will enable users to define and execute commands with optional keyboard shortcuts, similar to VSCode's command palette (Ctrl+P).
Sign in to like and favorite skills
Create a performant command system for the database-palace application using Rust for core logic and TypeScript for UI/interactivity. This system will enable users to define and execute commands with optional keyboard shortcuts, similar to VSCode's command palette (Ctrl+P).
Commands should be defined in a structured format like:
type CommandDefinition = { id: string name: string description: string command_ref: string // Reference to actual execution function shortcut?: ShortcutDefinition } type ShortcutDefinition = { keys: string[] // e.g., ['LCTRL', 'N'] max_delay?: number // milliseconds, default 500 disable_after_executed?: { duration: number // milliseconds count?: number // optional execution count limit } }
const commands = { connections: { NEW_CONNECTION: { id: 'connections.new', name: 'New Connection', description: 'Creates a new database connection tab', command_ref: 'create_new_connection', shortcut: { keys: ['LCTRL', 'N'], max_delay: 500, disable_after_executed: { duration: 2000 } } }, EDIT_CONNECTION: { id: 'connections.edit', name: 'Edit Connection', description: 'Opens the connection editor for the selected connection', command_ref: 'edit_selected_connection', shortcut: { keys: ['LCTRL', 'E'] } } }, queries: { RUN_QUERY: { id: 'queries.run', name: 'Run Query', description: 'Executes the current SQL query', command_ref: 'execute_current_query', shortcut: { keys: ['LCTRL', 'ENTER'] } } } }
commands.rs for command management