Files
ObsidianDragon/src/ui/windows/console_command_reference.h
DanS 5c570613c8 feat(console): lite backend command-reference modal
Give the lite console the parity analog of the full-node RPC command
reference: the same searchable two-pane modal (browse/search, detail
pane, examples, Insert / Insert & run, destructive confirm), driven by
the lite backend's own command set instead of daemon RPC.

- ConsoleCommandExecutor::commandReference() returns the category table
  (full node = consoleCommandCategories(); lite = new
  liteConsoleCommandCategories() -- 25 backend verbs in 5 categories).
  The shared renderCommandsPopup reads the table from the executor.
- The Commands button now shows for both variants (gated on
  commandReference()!=nullptr); title/tooltip/arg-quoting branch on
  hasRpcReference() (clarified to mean "speaks JSON-RPC / full node").
- Lite args are bare tokens (the backend takes one unsplit arg string
  and does not strip quotes), so the param-builder's JSON string
  auto-quoting is disabled for lite -- Insert & run emits runnable bare
  commands. send uses the JSON-array form (its positional form is
  unreachable via the single-arg transport); new uses zs/R; import
  takes just the key (the backend hardcodes birthday=0).

Adds 7 i18n keys across all 8 languages (additive). Full-node behavior
is unchanged. Adversarially reviewed (data vs the backend registry,
plumbing/regression, i18n) with all findings fixed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 12:27:51 -05:00

35 lines
1.4 KiB
C++

#pragma once
#include <vector>
namespace dragonx {
namespace ui {
struct ConsoleCommandEntry {
const char* name;
const char* desc; // terse one-line summary (always set)
const char* params; // parameter template, e.g. "\"address\" amount [comment]"
// Optional novice-facing enrichment (C++17 aggregate defaults — entries that omit these keep
// the empty/false fallbacks, and the command explorer falls back to `desc`):
const char* details = ""; // longer plain-language explanation
const char* example = ""; // one concrete, runnable example line
const char* keywords = ""; // space-separated search synonyms ("balance money funds")
bool destructive = false; // consequential/sensitive -> safety badge + run confirmation
};
struct ConsoleCommandCategory {
const char* name;
const ConsoleCommandEntry* commands;
int count;
};
// The full-node daemon's JSON-RPC command reference (browsed by the console's command-reference modal).
const std::vector<ConsoleCommandCategory>& consoleCommandCategories();
// The lite backend's own command set (the ~25 verbs the SDXL backend accepts) — the lite-variant
// analog of the RPC reference, shown by the same modal when the executor is the lite one.
const std::vector<ConsoleCommandCategory>& liteConsoleCommandCategories();
} // namespace ui
} // namespace dragonx