forked from ultraworkers/claw-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanagedPlugins.ts
More file actions
27 lines (26 loc) · 877 Bytes
/
Copy pathmanagedPlugins.ts
File metadata and controls
27 lines (26 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { getSettingsForSource } from '../settings/settings.js'
/**
* Plugin names locked by org policy (policySettings.enabledPlugins).
*
* Returns null when managed settings declare no plugin entries (common
* case — no policy in effect).
*/
export function getManagedPluginNames(): Set<string> | null {
const enabledPlugins = getSettingsForSource('policySettings')?.enabledPlugins
if (!enabledPlugins) {
return null
}
const names = new Set<string>()
for (const [pluginId, value] of Object.entries(enabledPlugins)) {
// Only plugin@marketplace boolean entries (true OR false) are
// protected. Legacy owner/repo array form is not.
if (typeof value !== 'boolean' || !pluginId.includes('@')) {
continue
}
const name = pluginId.split('@')[0]
if (name) {
names.add(name)
}
}
return names.size > 0 ? names : null
}