Step 651: plugin manifest model

This commit is contained in:
Bill
2026-02-17 21:54:23 -07:00
parent 96d98fa558
commit ea98c95e5d
4 changed files with 89 additions and 0 deletions

View File

@@ -4738,4 +4738,13 @@ target_link_libraries(step650_test PRIVATE
tree_sitter_javascript tree_sitter_typescript
tree_sitter_java tree_sitter_rust tree_sitter_go)
add_executable(step651_test tests/step651_test.cpp)
target_include_directories(step651_test PRIVATE src)
target_link_libraries(step651_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)

View File

@@ -0,0 +1,30 @@
#pragma once
// Step 651: Language generator plugin manifest
#include <string>
#include <vector>
struct PluginManifest {
std::string pluginName;
std::string sharedObject;
std::string generatorClass;
std::vector<std::string> languages;
};
class LanguageGeneratorPluginManifest {
public:
static bool isValid(const PluginManifest& m) {
return !m.pluginName.empty() && !m.sharedObject.empty() &&
!m.generatorClass.empty() && !m.languages.empty();
}
static bool isPluginFile(const std::string& fileName) {
return fileName.rfind("whetstone-plugin-", 0) == 0 &&
fileName.size() > 3 &&
fileName.substr(fileName.size() - 3) == ".so";
}
static std::string symbolName(const PluginManifest& m) {
return "create_" + m.generatorClass;
}
};

View File

@@ -0,0 +1,26 @@
// Step 651: Language generator plugin manifest (12 tests)
#include "LanguageGeneratorPluginManifest.h"
#include <iostream>
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: "<<m<<"\n"; ++f; }
#define C(c,m) if(!(c)){F(m);return;}
static PluginManifest good(){return {"RustGen","whetstone-plugin-rust.so","RustGenerator",{"rust"}};}
void t1(){T(valid_manifest_passes);C(LanguageGeneratorPluginManifest::isValid(good()),"valid expected");P();}
void t2(){T(invalid_missing_plugin_name);auto m=good();m.pluginName="";C(!LanguageGeneratorPluginManifest::isValid(m),"invalid expected");P();}
void t3(){T(invalid_missing_shared_object);auto m=good();m.sharedObject="";C(!LanguageGeneratorPluginManifest::isValid(m),"invalid expected");P();}
void t4(){T(invalid_missing_generator_class);auto m=good();m.generatorClass="";C(!LanguageGeneratorPluginManifest::isValid(m),"invalid expected");P();}
void t5(){T(invalid_missing_languages);auto m=good();m.languages.clear();C(!LanguageGeneratorPluginManifest::isValid(m),"invalid expected");P();}
void t6(){T(plugin_file_pattern_accepts_valid_name);C(LanguageGeneratorPluginManifest::isPluginFile("whetstone-plugin-rust.so"),"should pass");P();}
void t7(){T(plugin_file_pattern_rejects_wrong_prefix);C(!LanguageGeneratorPluginManifest::isPluginFile("plugin-rust.so"),"should fail");P();}
void t8(){T(plugin_file_pattern_rejects_wrong_suffix);C(!LanguageGeneratorPluginManifest::isPluginFile("whetstone-plugin-rust.dll"),"should fail");P();}
void t9(){T(symbol_name_uses_generator_class);C(LanguageGeneratorPluginManifest::symbolName(good())=="create_RustGenerator","symbol mismatch");P();}
void t10(){T(symbol_name_allows_custom_class);auto m=good();m.generatorClass="GoGenerator";C(LanguageGeneratorPluginManifest::symbolName(m)=="create_GoGenerator","symbol mismatch");P();}
void t11(){T(plugin_file_detection_handles_short_names);C(!LanguageGeneratorPluginManifest::isPluginFile(".so"),"short should fail");P();}
void t12(){T(plugin_file_detection_handles_empty_name);C(!LanguageGeneratorPluginManifest::isPluginFile(""),"empty should fail");P();}
int main(){std::cout<<"Step 651: language generator plugin manifest\n";t1();t2();t3();t4();t5();t6();t7();t8();t9();t10();t11();t12();std::cout<<"\nResults: "<<p<<"/"<<(p+f)<<" passed\n";return f?1:0;}

View File

@@ -13349,3 +13349,27 @@ validation, hash verification, binary replace gating, and restart scheduling.
- `editor/src/HiveMindAutoUpdateModel.h` (`41` <= `600`)
- `editor/tests/step650_test.cpp` within test-file size guidance (`26` lines)
- Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md`
### Step 651: Language generator plugin manifest
**Status:** PASS (12/12 tests)
Adds plugin-manifest validation and discovery helpers for shared-library
language generator extensions (`whetstone-plugin-*.so`) and factory symbol naming.
**Files added:**
- `editor/src/LanguageGeneratorPluginManifest.h` - plugin manifest model
- `editor/tests/step651_test.cpp` - 12 tests for validation/discovery behavior
**Files modified:**
- `editor/CMakeLists.txt` - `step651_test` target
**Verification run:**
- `cmake -S editor -B editor/build-native` - PASS
- `cmake --build editor/build-native --target step651_test step650_test` - PASS
- `./editor/build-native/step651_test` - PASS (12/12)
- `./editor/build-native/step650_test` - PASS (12/12) regression coverage
**Architecture gate check:**
- `editor/src/LanguageGeneratorPluginManifest.h` (`30` <= `600`)
- `editor/tests/step651_test.cpp` within test-file size guidance (`26` lines)
- Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md`