nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] A plugin saved as .js is silently ignored, and nothing shows which plugins loaded

Open addyCooks opened this issue 1 month ago • 1 comments

Description

Only .mjs files in .nanocoder/plugins/ are loaded (source/plugins/host.ts:120). Any other file, such as a plugin named guard.js, is dropped without a message. /doctor has no plugins section and there is no startup line, so a user cannot tell whether a plugin loaded. This is easy to hit: the file looks valid, and a guard plugin that never loads protects nothing.

Environment

  • OS: Windows 11 (10.0.26300)
  • Node version: 22.22.3
  • Nanocoder version: 1.31.0 (main at 9d88dda7)
  • Provider: Ollama
  • Model: qwen2.5:1.5b

Steps to Reproduce

  1. In a trusted project, create .nanocoder/plugins/legacy.js (CommonJS module.exports = {apiVersion: 1, name: 'legacy', hooks: {...}}), legacy-esm.js (ESM export default {...}) and ok.mjs (a valid plugin).
  2. Run NANOCODER_LOG_LEVEL=debug nanocoder --trust-directory run "Reply with the single word OK".
  3. Search stderr, stdout and the log folder for legacy.
  4. Run /doctor.

Expected Behavior

Plugin legacy.js ignored: plugins must use the .mjs extension, and /doctor lists the loaded plugins (name, file, hooks).

Actual Behavior

ok.mjs loads (its marker file is created). legacy.js and legacy-esm.js do not appear anywhere, not even in the debug log. The /doctor report has these sections only: system, nanocoder, providers, lsp, mcp, hooks, formatters, daemon. Two tests for this fail today (a warning about legacy.js, and report.plugins).

Suggested Fix

  • source/plugins/host.ts:120: when a file in the plugins folder is not .mjs (ignore directories and dotfiles), call logWarning with the text above.
  • Add a Plugins section to source/commands/doctor.tsx (name, file, hooks).
  • Optionally show a plugin count in the startup status.

Additional Context

  • Plugins came from #1568. Related: #1652 / open PR #1665 (plugin load errors are hidden in run mode).
  • [x] I have searched existing issues to ensure this is not a duplicate
  • [x] I can reproduce this issue consistently
  • [x] This issue occurs with the latest version of nanocoder

addyCooks avatar Oct 13 '26 12:10 addyCooks

I'd like to work on this. I'll add the warning for unsupported plugin files and list the loaded plugins in /doctor, with tests for both.

PragalvaXFREZ avatar Oct 13 '26 12:10 PragalvaXFREZ