From 319b6734d029b6d4bb5a8c052ccb2cbbdc84b996 Mon Sep 17 00:00:00 2001 From: Bill Date: Tue, 17 Feb 2026 21:51:45 -0700 Subject: [PATCH] Step 648: phase 39a integration --- editor/CMakeLists.txt | 9 ++++++ editor/src/Phase39aIntegration.h | 49 ++++++++++++++++++++++++++++++++ editor/tests/step648_test.cpp | 21 ++++++++++++++ progress.md | 25 ++++++++++++++++ 4 files changed, 104 insertions(+) create mode 100644 editor/src/Phase39aIntegration.h create mode 100644 editor/tests/step648_test.cpp diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt index 4d9bd56..6827006 100644 --- a/editor/CMakeLists.txt +++ b/editor/CMakeLists.txt @@ -4711,4 +4711,13 @@ target_link_libraries(step647_test PRIVATE tree_sitter_javascript tree_sitter_typescript tree_sitter_java tree_sitter_rust tree_sitter_go) +add_executable(step648_test tests/step648_test.cpp) +target_include_directories(step648_test PRIVATE src) +target_link_libraries(step648_test PRIVATE + nlohmann_json::nlohmann_json + unofficial::tree-sitter::tree-sitter + tree_sitter_python tree_sitter_cpp tree_sitter_elisp + tree_sitter_javascript tree_sitter_typescript + tree_sitter_java tree_sitter_rust tree_sitter_go) + # Step 12: Dear ImGui shell scaffolding created (main.cpp exists but not built due to dependencies) diff --git a/editor/src/Phase39aIntegration.h b/editor/src/Phase39aIntegration.h new file mode 100644 index 0000000..978c3b8 --- /dev/null +++ b/editor/src/Phase39aIntegration.h @@ -0,0 +1,49 @@ +#pragma once +// Step 648: Phase 39a integration + +#include "InEditorTestRunnerModel.h" +#include "ProjectAstCMakeGenerator.h" +#include "SelfHostingProjectConfig.h" +#include "SelfModificationSafetyGuard.h" + +struct Phase39aIntegrationResult { + bool configLoaded = false; + bool cmakeGenerated = false; + bool testRunTriggered = false; + bool testRunComplete = false; + bool mutationBlocked = false; + bool safetyReasonPresent = false; + bool selfHostingReady = false; + bool integrationReady = false; +}; + +class Phase39aIntegration { +public: + static Phase39aIntegrationResult run() { + Phase39aIntegrationResult out; + + SelfHostingProjectConfig cfg{"whetstone_DSL", "/workspace", {"editor/src"}, {"step648_test"}, true}; + auto j = SelfHostingProjectConfigModel::toJson(cfg); + SelfHostingProjectConfig parsed; + std::string err; + out.configLoaded = SelfHostingProjectConfigModel::fromJson(j, &parsed, &err); + out.selfHostingReady = SelfHostingProjectConfigModel::canSelfHost(parsed); + + ProjectAstDescription ast{"whetstone_editor", {"src/main.cpp"}, {"step648_test"}, {"nlohmann_json"}, true}; + std::string cmake = ProjectAstCMakeGenerator::generate(ast); + out.cmakeGenerated = cmake.find("add_executable(whetstone_editor") != std::string::npos; + + auto testSummary = InEditorTestRunnerModel::run({"step648_test"}); + out.testRunTriggered = !testSummary.items.empty(); + out.testRunComplete = testSummary.complete; + + std::string reason; + out.mutationBlocked = !SelfModificationSafetyGuard::allowMutation("editor/src/main.cpp", {"editor/src"}, &reason); + out.safetyReasonPresent = !reason.empty(); + + out.integrationReady = out.configLoaded && out.cmakeGenerated && out.testRunTriggered && + out.testRunComplete && out.mutationBlocked && out.safetyReasonPresent && + out.selfHostingReady; + return out; + } +}; diff --git a/editor/tests/step648_test.cpp b/editor/tests/step648_test.cpp new file mode 100644 index 0000000..0b6a023 --- /dev/null +++ b/editor/tests/step648_test.cpp @@ -0,0 +1,21 @@ +// Step 648: Phase 39a integration (8 tests) + +#include "Phase39aIntegration.h" +#include + +static int p=0,f=0; +#define T(n) { std::cout<<" "<<#n<<"... "; } +#define P() { std::cout<<"PASS\n"; ++p; } +#define F(m) { std::cout<<"FAIL: "<