Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(cli): move opencode plugin hooks under server(), leave setup() empty

Amir Fathie171bd48b5e5
diff --git a/src/cli/client_adapter.c b/src/cli/client_adapter.c
index ed77bd67a..16f2b3ba0 100644
--- a/src/cli/client_adapter.c
+++ b/src/cli/client_adapter.c
@@ -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"
diff --git a/tests/test_agent_clients.c b/tests/test_agent_clients.c
index a1e4c4020..1cf5cab02 100644
--- a/tests/test_agent_clients.c
+++ b/tests/test_agent_clients.c
@@ -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();