mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-10 09:13:53 +08:00
fix(cli): move opencode plugin hooks under server(), leave setup() empty
DeusData asked (2026-09-19T20:25:34Z on PR #2089) to place the hooks in the server entry rather than returning them from setup(), since the server runtime reads default.server and dispatches the hooks it returns, while the V2 config loader only reads id + setup()/effect() and has no tool domain yet to register against. Moved the existing hook body under server: async (ctx) => {...} and added an empty setup() {}. Updated the emission test to check for both and to assert the old async setup(ctx) { shape is gone. Signed-off-by: Amir Fathi <amirfathi.me@gmail.com>
This commit is contained in:
@@ -303,7 +303,11 @@ char *cbm_client_adapter_opencode(const char *binary_path) {
|
||||
sb_append(
|
||||
&sb, "export default {\n"
|
||||
" id: 'codebase-memory-augment',\n"
|
||||
" async setup(ctx) {\n"
|
||||
" // V2 config loader: requires id + setup|effect; no tool domain yet\n"
|
||||
" // at this point, so there is nothing to register here.\n"
|
||||
" setup() {},\n"
|
||||
" // Server runtime: reads default.server and dispatches the hooks it returns.\n"
|
||||
" server: async (ctx) => {\n"
|
||||
" const dir = ctx?.directory;\n"
|
||||
" const seen = new Set();\n"
|
||||
" const lifecycle = () =>\n"
|
||||
|
||||
@@ -1323,7 +1323,11 @@ TEST(client_adapter_opencode_exports_the_v2_default_definition_issue2077) {
|
||||
ASSERT_NOT_NULL(js);
|
||||
ASSERT_NOT_NULL(strstr(js, "export default {"));
|
||||
ASSERT_NOT_NULL(strstr(js, "id: 'codebase-memory-augment'"));
|
||||
ASSERT_NOT_NULL(strstr(js, "async setup(ctx) {"));
|
||||
/* Hooks live under server(), which the server runtime reads; setup()
|
||||
* stays empty since the V2 config loader has no tool domain yet. */
|
||||
ASSERT_NOT_NULL(strstr(js, "setup() {}"));
|
||||
ASSERT_NOT_NULL(strstr(js, "server: async (ctx) => {"));
|
||||
ASSERT_NULL(strstr(js, "async setup(ctx) {"));
|
||||
ASSERT_NULL(strstr(js, "export const CodebaseMemory"));
|
||||
free(js);
|
||||
PASS();
|
||||
|
||||
Reference in New Issue
Block a user