External plugins ("plugin": [...]) — module code never executes
External plugins ("plugin": [...]) — module code never executes
Description
External plugins listed in mimocode.json under "plugin" array are discovered but their module code is never executed. The server factory function is never called, and no hooks are registered.
Steps to Reproduce
- Create a minimal plugin file:
// ~/.config/opencode/plugins/test-plugin.mjs
console.log("[test] MODULE IMPORTED")
export default async (input) => {
console.log("[test] FACTORY CALLED")
return {}
}
- Add to
~/.config/mimocode/mimocode.json:
{
"plugin": ["/home/user/.config/opencode/plugins/test-plugin.mjs"]
}
-
Restart MiMoCode
-
Check logs —
console.logoutput never appears:
# Expected:
INFO service=plugin path=.../test-plugin.mjs loaded plugin
[test] MODULE IMPORTED
[test] FACTORY CALLED
# Actual:
INFO service=plugin path=.../test-plugin.mjs loading plugin
(nothing else)
Expected Behavior
Module code executes:
- Top-level
console.logappears in logs defaultexport function (factory) is called- Returned hooks are registered
Actual Behavior
Module code never executes:
console.lognever appears- Factory function is never called
- No hooks are registered
- Plugin shows as "loading" but never "loaded"
Environment
- MiMoCode version: 0.38.9
- Node.js: v22.22.2
- OS: Ubuntu 24.04
- File format:
.mjs(ESM)
Comparison with File Hooks
File hooks (~/.config/mimocode/hooks/*.ts) work correctly:
- Module code executes
console.logappears (via writeFileSync)export defaulthooks are registeredtool.execute.before,tool.execute.after,session.userQuery.postall fire
What I've Tried
- Different export formats:
export default fn,export default {server: fn}, named exports - Different file extensions:
.ts,.mjs,.js - Different config paths: absolute path, npm package name
- Adding
console.logat module top level — never appears - Verified with
import()in Node.js — module loads correctly
Theory
The "plugin" config entry is used for file discovery but the runtime loader never calls import() on the resolved path. File hooks (hooks/*.ts) use a different loader that does call import().
Request
Either:
- Fix the external plugin loader to actually import and execute plugin modules
- Or document that external plugins are not supported and remove them from config schema
Impact
Many plugins (oh-my-opencode-slim, opencode-plusplus, ponytail) use the "plugin" config and assume it works. Users waste hours debugging plugins that can never work.