fix: Refactor test command handling with modular structure and common utilities

- Added new `test_common` module with helper functions for prompting and input handling.
- Introduced `test_common.cc` and `test_common.h` for shared functionality across test commands.
- Updated `z3ed.cmake` to include `test_common` in the build process.
- Refactored `test_commands.cc` to utilize new common utilities for improved readability and maintainability.
- Adjusted paths for source files in the build configuration to ensure proper linking.

This commit lays the groundwork for a more organized and modular approach to handling test commands, facilitating future enhancements and maintenance.
This commit is contained in:
scawful
2025-10-03 02:10:18 -04:00
parent ba12075ca9
commit 758b0c0a35
5 changed files with 206 additions and 2327 deletions

View File

@@ -44,6 +44,7 @@ add_executable(
cli/handlers/agent.cc
cli/handlers/agent/common.cc
cli/handlers/agent/general_commands.cc
cli/handlers/agent/test_common.cc
cli/handlers/agent/test_commands.cc
cli/handlers/agent/gui_commands.cc
cli/service/ai_service.cc
@@ -75,10 +76,11 @@ add_executable(
option(YAZE_WITH_JSON "Build with JSON support" OFF)
if(YAZE_WITH_JSON)
add_subdirectory(../../third_party/json)
add_subdirectory(${CMAKE_SOURCE_DIR}/third_party/json ${CMAKE_BINARY_DIR}/third_party/json)
target_compile_definitions(z3ed PRIVATE YAZE_WITH_JSON)
target_link_libraries(z3ed PRIVATE nlohmann_json::nlohmann_json)
list(APPEND Z3ED_SRC_FILES cli/gemini_ai_service.cc)
list(APPEND Z3ED_SRC_FILES cli/service/gemini_ai_service.cc)
list(APPEND Z3ED_SRC_FILES cli/service/prompt_builder.cc)
endif()
target_include_directories(
@@ -91,6 +93,7 @@ target_include_directories(
${CMAKE_SOURCE_DIR}/incl/
${CMAKE_SOURCE_DIR}/src/
${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine
${CMAKE_SOURCE_DIR}/third_party/httplib
${PNG_INCLUDE_DIRS}
${SDL2_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}