refactor: Revamp CLI Structure and Command Handling

- Introduced a new CLI structure by creating cli.cc and cli.h files, enhancing command organization and modularity.
- Updated command handling to improve the setup and execution of various CLI commands, including AI agent interactions and ROM operations.
- Replaced the deprecated modern_cli.h with a more streamlined approach, ensuring better maintainability and clarity in command definitions.
- Adjusted CMake configuration to reflect the new file structure and included additional proto files for gRPC services, supporting enhanced functionality.
- Enhanced the TUI components for improved user experience, including better navigation and command execution flow.
This commit is contained in:
scawful
2025-10-05 23:44:14 -04:00
parent 13af75e924
commit ffddb208c6
10 changed files with 314 additions and 199 deletions

1130
src/cli/tui/tui.cc Normal file

File diff suppressed because it is too large Load Diff

80
src/cli/tui/tui.h Normal file
View File

@@ -0,0 +1,80 @@
#ifndef YAZE_CLI_TUI_H
#define YAZE_CLI_TUI_H
#include <ftxui/component/component.hpp>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <string>
#include <vector>
#include "app/rom.h"
namespace yaze {
/**
* @namespace yaze::cli
* @brief Namespace for the command line interface.
*/
namespace cli {
const std::vector<std::string> kMainMenuEntries = {
"🎮 Load ROM / Quick Start",
"🤖 AI Agent Chat",
"📝 TODO Manager",
"🔧 ROM Tools",
"🎨 Graphics & Palettes",
"🧪 Testing & Validation",
"⚙️ Settings",
"❓ Help & Documentation",
"🚪 Exit",
};
enum class MainMenuEntry {
kLoadRom,
kAIAgentChat,
kTodoManager,
kRomTools,
kGraphicsTools,
kTestingTools,
kSettings,
kHelp,
kExit,
};
enum class LayoutID {
kLoadRom,
kAIAgentChat,
kTodoManager,
kRomTools,
kGraphicsTools,
kTestingTools,
kSettings,
kApplyAsarPatch,
kApplyBpsPatch,
kExtractSymbols,
kValidateAssembly,
kGenerateSaveFile,
kPaletteEditor,
kHexViewer,
kCommandPalette,
kHelp,
kExit,
kMainMenu,
kDashboard,
kError,
};
struct Context {
Rom rom;
LayoutID current_layout = LayoutID::kMainMenu;
std::string error_message;
bool use_autocomplete = true;
bool show_suggestions = true;
};
static Context app_context;
void ShowMain();
} // namespace cli
} // namespace yaze
#endif // YAZE_CLI_TUI_H