/ utils / plugins / pluginPolicy.ts
pluginPolicy.ts
 1  /**
 2   * Plugin policy checks backed by managed settings (policySettings).
 3   *
 4   * Kept as a leaf module (only imports settings) to avoid circular dependencies
 5   * — marketplaceHelpers.ts imports marketplaceManager.ts which transitively
 6   * reaches most of the plugin subsystem.
 7   */
 8  
 9  import { getSettingsForSource } from '../settings/settings.js'
10  
11  /**
12   * Check if a plugin is force-disabled by org policy (managed-settings.json).
13   * Policy-blocked plugins cannot be installed or enabled by the user at any
14   * scope. Used as the single source of truth for policy blocking across the
15   * install chokepoint, enable op, and UI filters.
16   */
17  export function isPluginBlockedByPolicy(pluginId: string): boolean {
18    const policyEnabled = getSettingsForSource('policySettings')?.enabledPlugins
19    return policyEnabled?.[pluginId] === false
20  }