()
| 37 | * @returns Array of plugin IDs (plugin@marketplace format) that are enabled |
| 38 | */ |
| 39 | export async function checkEnabledPlugins(): Promise<string[]> { |
| 40 | const settings = getInitialSettings() |
| 41 | const enabledPlugins: string[] = [] |
| 42 | |
| 43 | // Start with --add-dir plugins (lowest priority) |
| 44 | const addDirPlugins = getAddDirEnabledPlugins() |
| 45 | for (const [pluginId, value] of Object.entries(addDirPlugins)) { |
| 46 | if (pluginId.includes('@') && value) { |
| 47 | enabledPlugins.push(pluginId) |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | // Merged settings (policy > local > project > user) override --add-dir |
| 52 | if (settings.enabledPlugins) { |
| 53 | for (const [pluginId, value] of Object.entries(settings.enabledPlugins)) { |
| 54 | if (!pluginId.includes('@')) { |
| 55 | continue |
| 56 | } |
| 57 | const idx = enabledPlugins.indexOf(pluginId) |
| 58 | if (value) { |
| 59 | if (idx === -1) { |
| 60 | enabledPlugins.push(pluginId) |
| 61 | } |
| 62 | } else { |
| 63 | // Explicitly disabled — remove even if --add-dir enabled it |
| 64 | if (idx !== -1) { |
| 65 | enabledPlugins.splice(idx, 1) |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | return enabledPlugins |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Gets the user-editable scope that "owns" each enabled plugin. |
nothing calls this directly
no test coverage detected