()
| 48 | |
| 49 | // Load all plugins from project + user dirs |
| 50 | loadAll() { |
| 51 | const dirs = [ |
| 52 | path.join(this.projectDir, '.smallcode', 'plugins'), |
| 53 | path.join(os.homedir(), '.config', 'smallcode', 'plugins'), |
| 54 | ]; |
| 55 | |
| 56 | for (const dir of dirs) { |
| 57 | if (!fs.existsSync(dir)) continue; |
| 58 | const entries = fs.readdirSync(dir, { withFileTypes: true }); |
| 59 | for (const entry of entries) { |
| 60 | if (entry.isDirectory()) { |
| 61 | this._loadPlugin(path.join(dir, entry.name)); |
| 62 | } else if (entry.name.endsWith('.json') && entry.name !== 'package.json') { |
| 63 | // Single-file plugin (just a manifest with inline content) |
| 64 | this._loadSingleFile(path.join(dir, entry.name)); |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | return this; |
| 70 | } |
| 71 | |
| 72 | _loadPlugin(pluginDir) { |
| 73 | const manifestPath = path.join(pluginDir, 'plugin.json'); |
no test coverage detected