Skip to content

feat(rpc): support Command Palette actions via commands.execute and manifest contributions - #73

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/48-command-palette-actions
Sep 29, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
issue/48-command-palette-actions

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Summary

Querya Desktop's Command Palette (Ctrl+Shift+P) sends commands.execute for actions declared under contributions.commands in manifest.json. Neither existed: the manifest declared no commands, and commands.execute fell through to -32601 Method not found in router.rs.

  • manifest.json now declares four commands under contributions.commands: clickhouse.optimizeFinal, clickhouse.deduplicate, clickhouse.serverStats, clickhouse.dropPartition.
  • New src/rpc/handlers/commands.rs implements handle_execute(params), dispatching on commandId:
    • clickhouse.serverStats delegates straight to handle_get_server_stats.
    • clickhouse.optimizeFinal / clickhouse.deduplicate / clickhouse.dropPartition build the same SQL as their sdui.contextActions equivalents (OPTIMIZE ... FINAL / DEDUPLICATE, ALTER ... DROP PARTITION) and run it through handle_query, reusing the existing Safe Mode precheck and injection-safe quote_identifier/escape_sql_string_literal.
  • Querya Desktop's Command Palette doesn't yet forward workspace selection (nodeId) to drivers, so database/table/partition are accepted as optional params on commands.execute. A command that needs a target it didn't get returns a clear -32602 error ("requires 'database' and 'table' parameters...") instead of guessing or silently no-oping.
  • Registered "commands.execute" => commands::handle_execute(params).await in router.rs.

Closes #48

Test plan

  • cargo test — 105/105 passing, including new tests for each command (server stats, optimize/deduplicate, drop partition, missing-target errors, unknown commandId, missing params) and a router dispatch test
  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • manifest.json validated as well-formed JSON

…anifest contributions. Closes #48

Querya Desktop's Command Palette invokes commands.execute for actions
declared under contributions.commands in manifest.json, but the driver
neither declared any commands nor implemented the method (returning
-32601 Method not found).

- manifest.json now declares four ClickHouse maintenance commands:
  clickhouse.optimizeFinal, clickhouse.deduplicate, clickhouse.serverStats,
  clickhouse.dropPartition.
- New src/rpc/handlers/commands.rs implements handle_execute, dispatching
  on commandId. clickhouse.serverStats delegates straight to
  handle_get_server_stats. The other three build the same SQL as their
  sdui.contextActions equivalents (OPTIMIZE ... FINAL / DEDUPLICATE,
  ALTER ... DROP PARTITION) and run it through handle_query, reusing
  existing Safe Mode and injection-safe quoting/escaping.
- The Command Palette doesn't yet forward workspace selection (nodeId) to
  drivers, so database/table/partition are accepted as optional params;
  a command that needs a target and doesn't get one returns a clear
  -32602 error instead of guessing or operating on the wrong object.
- Registered "commands.execute" in router.rs.
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 15c8f6b into dev Sep 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant